Add CONFIG_NETDEV_LATEINIT that can be used to suppress calls to up_netinitialize() from early initialization

This commit is contained in:
Gregory Nutt
2015-07-17 07:20:16 -06:00
parent 50897b7a64
commit 652371c919
17 changed files with 102 additions and 31 deletions
+7 -3
View File
@@ -10717,7 +10717,7 @@
* libc/netdb: Add a default value for DNS server IP address. Make * libc/netdb: Add a default value for DNS server IP address. Make
sure that the IP address has been initialized before permitting DNS sure that the IP address has been initialized before permitting DNS
queries (2015-07-13). queries (2015-07-13).
* libc/netdb: Add support for a DNS host name resulution cache. This * libc/netdb: Add support for a DNS host name resolution cache. This
can save a lot of DNS name server lookups (but might also have the can save a lot of DNS name server lookups (but might also have the
negative consequence of using stale IP address mappings (2015-07-13). negative consequence of using stale IP address mappings (2015-07-13).
* graphics/, libnx/, and include/nuttx/nx: Implement anti-aliasing in * graphics/, libnx/, and include/nuttx/nx: Implement anti-aliasing in
@@ -10725,9 +10725,13 @@
* drivers/lcd/ and include/nuttx/lcd: Modify the SSD1306 LCD driver to * drivers/lcd/ and include/nuttx/lcd: Modify the SSD1306 LCD driver to
support either the SPI or I2C interface. From Alan Carvalho de Assis support either the SPI or I2C interface. From Alan Carvalho de Assis
(2015-07-15). (2015-07-15).
* drivers/can.c: Fix an issue in the CAN driver hwere the rx_sem * arch/src/stm32f7 and arch/include/stm32f7: Add architecture support
for the STMicro STM32 F7 (2015-07-15).
* drivers/can.c: Fix an issue in the CAN driver where the rx_sem
count can grow beyond bounds (2015-07-15). count can grow beyond bounds (2015-07-15).
* configs/stm32f762g-disco/: Add initialize support for the STMicor * configs/stm32f762g-disco/: Add initialize support for the STMicor
STM32 F7 Discovery board. This is a work in progress and will be a STM32 F7 Discovery board. This is a work in progress and will be a
while before it is fully functional (2015-07-16). while before it is fully functional (2015-07-16).
* arch/../up_etherstub.c, arch/../up_initialize, and other files: Add
CONFIG_NETDEV_LATEINIT that can be used to suppress calls to
up_netinitialize() from early in initialization (2015-07-17).
+9 -9
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/common/up_etherstub.c * arch/arm/src/common/up_etherstub.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -66,18 +66,18 @@
* *
* Description: * Description:
* This is a stub version os up_netinitialize. Normally, up_netinitialize * This is a stub version os up_netinitialize. Normally, up_netinitialize
* is defined in board/up_network.c for board-specific ethernet * is defined in board/xyz_network.c for board-specific Ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific ethernet * implementations, or chip/xyx_ethernet.c for chip-specific Ethernet
* implementations. The stub version here is used in the cornercase where * implementations. The stub version here is used in the corner case where
* the network is enable yet there is no ethernet driver to be initialized. * the network is enable yet there is no Ethernet driver to be initialized.
* In this case, up_initialize will still try to call up_netinitialize() * In this case, up_initialize will still try to call up_netinitialize()
* when one does not exist. This cornercase would occur if, for example, * when one does not exist. This corner case would occur if, for example,
* only a USB network interface is being used or perhaps if a SLIP is * only a USB network interface is being used or perhaps if a SLIP is
* being used). * being used).
* *
* In the long run, it might be better to have some kind of CONFIG_NO_ETHERNET * Use of this stub is deprecated. The preferred mechanism is to use
* to suppress the call to up_netinitialize() in up_initialize(). Then * CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* this stub would not be needed. * up_initialize(). Then this stub would not be needed.
* *
****************************************************************************/ ****************************************************************************/
+2
View File
@@ -248,9 +248,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB -- device and/or host */ /* Initialize USB -- device and/or host */
+6 -2
View File
@@ -478,10 +478,14 @@ void up_wdtinit(void);
/* Networking ***************************************************************/ /* Networking ***************************************************************/
/* Defined in board/up_network.c for board-specific Ethernet implementations, /* Defined in board/xyz_network.c for board-specific Ethernet implementations,
* or chip/xyx_ethernet.c for chip-specific Ethernet implementations, or * or chip/xyx_ethernet.c for chip-specific Ethernet implementations, or
* common/up_etherstub.c for a cornercase where the network is enabled yet * common/up_etherstub.c for a corner case where the network is enabled yet
* there is no Ethernet driver to be initialized. * there is no Ethernet driver to be initialized.
*
* Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
* use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* up_initialize(). Then this stub would not be needed.
*/ */
#ifdef CONFIG_NET #ifdef CONFIG_NET
+5 -1
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# arch/arm/src/kinetis/Make.defs # arch/arm/src/kinetis/Make.defs
# #
# Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. # Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -67,6 +67,10 @@ CMN_UASRCS += up_signal_handler.S
endif endif
endif endif
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
ifneq ($(CONFIG_KINETIS_ENET),y) ifneq ($(CONFIG_KINETIS_ENET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+5 -1
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# arch/arm/src/lpc17xx/Make.defs # arch/arm/src/lpc17xx/Make.defs
# #
# Copyright (C) 2010-2011, 2013-2014 Gregory Nutt. All rights reserved. # Copyright (C) 2010-2011, 2013-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -82,6 +82,10 @@ CMN_UASRCS += up_signal_handler.S
endif endif
endif endif
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
ifneq ($(CONFIG_LPC17_ETHERNET),y) ifneq ($(CONFIG_LPC17_ETHERNET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+3 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/avr/src/common/up_initialize.c * arch/avr/src/common/up_initialize.c
* *
* Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2010, 2012-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -262,9 +262,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB */ /* Initialize USB */
+2
View File
@@ -186,9 +186,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB */ /* Initialize USB */
+10 -10
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/mips/src/common/up_etherstub.c * arch/mips/src/common/up_etherstub.c
* *
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -66,18 +66,18 @@
* *
* Description: * Description:
* This is a stub version os up_netinitialize. Normally, up_netinitialize * This is a stub version os up_netinitialize. Normally, up_netinitialize
* is defined in board/up_network.c for board-specific ethernet * is defined in board/xyz_network.c for board-specific Ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific ethernet * implementations, or chip/xyx_ethernet.c for chip-specific Ethernet
* implementations. The stub version here is used in the cornercase where * implementations. The stub version here is used in the corner case where
* the network is enable yet there is no ethernet driver to be initialized. * the network is enable yet there is no Ethernet driver to be initialized.
* In this case, up_initialize will still try to call up_netinitialize() * In this case, up_initialize will still try to call up_netinitialize()
* when one does not exist. This cornercase would occur if, for example, * when one does not exist. This corner case would occur if, for example,
* only a USB network interface is being used or perhaps if a SLIP is * only a USB network interface is being used or perhaps if a SLIP is
* being used). In those cases, the initialization path is very different. * being used).
* *
* In the long run, it might be better to have some kind of CONFIG_NO_ETHERNET * Use of this stub is deprecated. The preferred mechanism is to use
* to suppress the call to up_netinitialize() in up_initialize(). Then * CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* this stub would not be needed. * up_initialize(). Then this stub would not be needed.
* *
****************************************************************************/ ****************************************************************************/
+2
View File
@@ -188,9 +188,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB -- device and/or host */ /* Initialize USB -- device and/or host */
+5 -1
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# arch/mips/src/pic32mx/Make.defs # arch/mips/src/pic32mx/Make.defs
# #
# Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved. # Copyright (C) 2011-2012, 2014-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,10 @@ CMN_CSRCS += up_usestack.c up_vfork.c
# Configuration dependent common files # Configuration dependent common files
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifneq ($(CONFIG_PIC32MX_ETHERNET),y) ifneq ($(CONFIG_PIC32MX_ETHERNET),y)
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+4
View File
@@ -51,6 +51,10 @@ CMN_CSRCS += up_usestack.c up_vfork.c
# Configuration dependent common files # Configuration dependent common files
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifneq ($(CONFIG_PIC32MZ_ETHERNET),y) ifneq ($(CONFIG_PIC32MZ_ETHERNET),y)
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+3 -1
View File
@@ -176,9 +176,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
/* Initialize the netwok */ #ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB */ /* Initialize USB */
+2
View File
@@ -188,9 +188,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB -- device and/or host */ /* Initialize USB -- device and/or host */
+3
View File
@@ -192,8 +192,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
board_led_on(LED_IRQSENABLED); board_led_on(LED_IRQSENABLED);
} }
+4 -1
View File
@@ -175,8 +175,11 @@ void up_initialize(void)
ramlog_consoleinit(); ramlog_consoleinit();
#endif #endif
/* Initialize the netwok */ #ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
board_led_on(LED_IRQSENABLED); board_led_on(LED_IRQSENABLED);
} }
+30 -1
View File
@@ -6,12 +6,41 @@
comment "General Ethernet MAC Driver Options" comment "General Ethernet MAC Driver Options"
config NETDEV_MULTINIC config NETDEV_MULTINIC
bool "Multiple NIC support" bool "Multiple network interface support"
default n default n
---help--- ---help---
Select this option if you board and/or MCU are capable of supporting Select this option if you board and/or MCU are capable of supporting
multiple Ethernet MAC drivers. multiple Ethernet MAC drivers.
config NETDEV_LATEINIT
bool "Late driver initialization"
default n
---help---
Normally, networking initialization occur in the later phase of the
boot process in the function up_initialize() when it calls the
driver initialization function, up_netintialize(). This
initialization occurs after a sufficient about of the OS has been
initialized so that driver registration can be performed, but
before the completion of OS initialization and before the first
application is started.
In a few situations, however, you may want to suppress this early
network driver initialization. As examples:
- If you are using SLIP or PPPD, then there will be no network
driver to be initialized,
- Certain multi-network configurations where a simple call to
up_netinitialize() may be insufficient, and
- Situations where there are other board-level hardware
dependencies so that the hardware is not in an appropriate
state for up_netinitialize() to be called.
Examples of this latter situation includes such things as network
drivers that required some setup via an I2C I/O expander, or network
drivers that depend on USB, SPI, I2C, PCI, serial, or other
interfaces that may not be ready when up_netiniailize() is normally
called.
config NET_DUMPPACKET config NET_DUMPPACKET
bool "Enable packet dumping" bool "Enable packet dumping"
depends on DEBUG depends on DEBUG