DK-TM4C129X: The network monitor is no enabled by default in NSH configuration

This commit is contained in:
Gregory Nutt 2015-01-05 12:09:33 -06:00
parent 5752f301de
commit 67bcdf5514
4 changed files with 121 additions and 56 deletions

19
TODO
View File

@ -15,7 +15,7 @@ nuttx/
(8) Kernel/Protected Builds (8) Kernel/Protected Builds
(4) C++ Support (4) C++ Support
(6) Binary loaders (binfmt/) (6) Binary loaders (binfmt/)
(13) Network (net/, drivers/net) (14) Network (net/, drivers/net)
(4) USB (drivers/usbdev, drivers/usbhost) (4) USB (drivers/usbdev, drivers/usbhost)
(11) Libraries (libc/, libm/) (11) Libraries (libc/, libm/)
(11) File system/Generic drivers (fs/, drivers/) (11) File system/Generic drivers (fs/, drivers/)
@ -893,9 +893,10 @@ o Network (net/, drivers/net)
the network stack. The network stack supports either interrupt the network stack. The network stack supports either interrupt
level processing or normal task level processing (depending on level processing or normal task level processing (depending on
CONFIG_NET_NOINTS). This is really a very bad use of CPU CONFIG_NET_NOINTS). This is really a very bad use of CPU
resources; All of the network stack processing should be more resources; All of the network stack processing should be
to a work queue (and, all use of CONFIG_NET_NOINTS=n should modified to use a work queue (and, all use of CONFIG_NET_NOINTS=n
be eliminated). This applies to almost all Ethernet drivers: should be eliminated). This applies to almost all Ethernet
drivers:
ARCHITECTURE CONFIG_NET_NOINTS ARCHITECTURE CONFIG_NET_NOINTS
C5471 NO C5471 NO
@ -932,6 +933,16 @@ o Network (net/, drivers/net)
Status: Open Status: Open
Priority: Low, unless your logic depends on that behavior. Priority: Low, unless your logic depends on that behavior.
Title: NETWORK WON'T STAY DOWN
Description: If you enable the NSH network monitor (CONFIG_NSH_NETINIT_MONITOR)
then the NSH 'ifdown' command is broken. Doing 'nsh> ifconfig eth0'
will, indeed, bring the network down. However, the network monitor
notices the change in the link status and will bring the network
back up. There needs to be some kind of interlock between
cmd_ifdown() and the network monitor thread to prevent this.
Status: Open
Priority: Low, this is just a nuisance in most cases.
o USB (drivers/usbdev, drivers/usbhost) o USB (drivers/usbdev, drivers/usbhost)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -411,29 +411,7 @@ Networking Support
Networking support via the can be added to NSH by selecting the following Networking support via the can be added to NSH by selecting the following
configuration options. configuration options.
==================================================
file1: CONFIG_ARCH_HAVE_NET=y
file1: CONFIG_ARP_SEND_DELAYMSEC=20
file1: CONFIG_ARP_SEND_MAXTRIES=5
file1: CONFIG_IOB_BUFSIZE=196
file1: CONFIG_IOB_NBUFFERS=36
file1: CONFIG_IOB_NCHAINS=8
file1: CONFIG_IOB_THROTTLE=8
file1: CONFIG_NSOCKET_DESCRIPTORS=8
file1: CONFIG_SCHED_HPWORK=y
file1: CONFIG_SCHED_HPWORKPERIOD=50000
file1: CONFIG_SCHED_HPWORKPRIORITY=224
file1: CONFIG_SCHED_HPWORKSTACKSIZE=2048
file1: CONFIG_SCHED_WORKQUEUE=y
file1: CONFIG_SIG_SIGWORK=17
file1: =y
file1:
file1:
file1:
file1: =y
file1: =y
file1: CONFIG_WEBCLIENT_TIMEOUT=10
==================================================
Selecting the EMAC peripheral Selecting the EMAC peripheral
----------------------------- -----------------------------
@ -573,20 +551,23 @@ f Application Configuration -> Network Utilities
Builtin Apps: Builtin Apps:
nsh> nsh>
NOTE: If you enable this feature, you experience a delay on booting. NOTE: If you enable this networking as described above, you will
That is because the start-up logic waits for the network connection experience a delay on booting NSH. That is because the start-up logic
to be established before starting NuttX. In a real application, you waits for the network connection to be established before starting
would probably want to do the network bringup on a separate thread NuttX. In a real application, you would probably want to do the
so that access to the NSH prompt is not delayed. network bringup on a separate thread so that access to the NSH prompt
is not delayed.
This delay will be especially long if the board is not connected to This delay will be especially long if the board is not connected to
a network because additional time will be required to fail with timeout a network. On the order of minutes! You will probably think that
errors. NuttX has crashed! And then, when it finally does come up after
numerous timeouts and retries, the network will not be available --
even if the network cable is plugged in later.
This delay will be especially long if the board is not connected to The long delays can be eliminated by using a separate the network
a network. On the order of a minute! You will probably think that initialization thread discussed below. Recovering after the network
NuttX has crashed! And then, when it finally does come up, the becomes available requires the network monitor feature, also discussed
network will not be available. below.
Network Initialization Thread Network Initialization Thread
----------------------------- -----------------------------
@ -606,8 +587,66 @@ f Application Configuration -> Network Utilities
thread could poll periodically for network status, but does not). thread could poll periodically for network status, but does not).
Both of these shortcomings could be eliminated by enabling the network Both of these shortcomings could be eliminated by enabling the network
monitor. See the SAMA5 configurations for a description of what it would monitor:
take to incorporate the network monitor feature.
Network Monitor
---------------
By default the network initialization thread will bring-up the network
then exit, freeing all of the resources that it required. This is a
good behavior for systems with limited memory.
If the CONFIG_NSH_NETINIT_MONITOR option is selected, however, then the
network initialization thread will persist forever; it will monitor the
network status. In the event that the network goes down (for example, if
a cable is removed), then the thread will monitor the link status and
attempt to bring the network back up. In this case the resources
required for network initialization are never released.
Pre-requisites:
- CONFIG_NSH_NETINIT_THREAD as described above.
- CONFIG_TIVA_PHY_INTERRUPTS=y. The TM4C129X EMAC block supports PHY
interrupts. This is true whether the TM4C internal PHY is used or
if an external PHY is used. If this option is selected, then support
for the PHY interrupt will be built in and the following additional
settings will be automatically selected:
CONFIG_NETDEV_PHY_IOCTL. Enable PHY IOCTL commands in the Ethernet
device driver. Special IOCTL commands must be provided by the Ethernet
driver to support certain PHY operations that will be needed for link
management. There operations are not complex and are implemented for
the Atmel SAMA5 family.
CONFIG_ARCH_PHY_INTERRUPT. This is not a user selectable option.
Rather, it is set when you select a board that supports PHY
interrupts. In most architectures, the PHY interrupt is not
associated with the Ethernet driver at all; the Tiva architecture is
an exception. For most other architectures, the PHY interrupt is
provided via some board-specific GPIO. In any event, the board-
specific logic must provide support for the PHY interrupt. To do
this, the board logic must do two things: (1) It must provide the
function arch_phy_irq() as described and prototyped in the
nuttx/include/nuttx/arch.h, and (2) it must select
CONFIG_ARCH_PHY_INTERRUPT in the board configuration file to
advertise that it supports arch_phy_irq().
And a few other things: UDP support is required (CONFIG_NET_UDP) and
signals must not be disabled (CONFIG_DISABLE_SIGNALS).
Given those prerequisites, the network monitor can be selected with these
additional settings.
System Type -> Tiva Ethernet Configuration
CONFIG_TIVA_PHY_INTERRUPTS=y : Enable PHY interrupt support
CONFIG_ARCH_PHY_INTERRUPT=y : (auto-selected)
CONFIG_NETDEV_PHY_IOCTL=y : (auto-selected)
Application Configuration -> NSH Library -> Networking Configuration
CONFIG_NSH_NETINIT_THREAD : Enable the network initialization thread
CONFIG_NSH_NETINIT_MONITOR=y : Enable the network monitor
CONFIG_NSH_NETINIT_RETRYMSEC=2000 : Configure the network monitor as you like
CONFIG_NSH_NETINIT_SIGNO=18
DK-TM4129X Configuration Options DK-TM4129X Configuration Options
================================ ================================
@ -776,16 +815,24 @@ Where <subdir> is one of the following:
easily disabled or reconfigured (See see the network related easily disabled or reconfigured (See see the network related
configuration settings above in the section entitled "Networking"). configuration settings above in the section entitled "Networking").
NOTE: In boot-up sequence is very simple in this example; all By default, this configuration assumes a 10.0.0.xx network. It
initialization is done sequentially (vs. in parallel) and so you will uses a fixed IP address of 10.0.0.2 and assumes that the host is
not see the NSH prompt until all initialization is complete. The at 10.0.0.1 and that the host provides the default router. The
network bring-up in particular will add some delay before the NSH network mask is 255.255.255.0. These address can be changed by
prompt appears. In a real application, you would probably want to modifying the settings in the configuration. DHCPC can be enabled
do the network bringup on a separate thread so that access to the be modifying this default configuration (See the "Networking"
NSH prompt is not delayed. section above).
This delay will be especially long if the board is not connected to The network initialization thread is enabled in this example. NSH
a network because additional time will be required to fail with will create a separate thread when it starts to initialize the
timeout errors. This delay can be eliminated, however, if you enable network. This eliminates start-up delays to bring the network. This
an NSH initialization option as described above in a paragraph feature may be disabled by reverting the configuration described above
entitled, "Network Initialization Thread." under "Network Initialization Thread"
The persistent network monitor thread is also available in this
configuration. The network monitor will monitor changes in the
link status and gracefully take the network down when the link is
lost (for example, if the cable is disconnected) and bring the
network back up when the link becomes available again (for example,
if the cable is reconnected. The paragraph "Network Monitor" above
for additional information.

View File

@ -214,7 +214,7 @@ CONFIG_TIVA_GPIOP_IRQS=y
# #
CONFIG_TIVA_PHY_INTERNAL=y CONFIG_TIVA_PHY_INTERNAL=y
CONFIG_TIVA_AUTONEG=y CONFIG_TIVA_AUTONEG=y
# CONFIG_TIVA_PHY_INTERRUPTS is not set CONFIG_TIVA_PHY_INTERRUPTS=y
CONFIG_TIVA_EMAC_NRXDESC=8 CONFIG_TIVA_EMAC_NRXDESC=8
CONFIG_TIVA_EMAC_NTXDESC=4 CONFIG_TIVA_EMAC_NTXDESC=4
# CONFIG_TIVA_EMAC_ENHANCEDDESC is not set # CONFIG_TIVA_EMAC_ENHANCEDDESC is not set
@ -451,6 +451,7 @@ CONFIG_NETDEVICES=y
# CONFIG_NET_E1000 is not set # CONFIG_NET_E1000 is not set
# CONFIG_NET_SLIP is not set # CONFIG_NET_SLIP is not set
# CONFIG_NET_VNET is not set # CONFIG_NET_VNET is not set
CONFIG_ARCH_PHY_INTERRUPT=y
# CONFIG_PIPES is not set # CONFIG_PIPES is not set
# CONFIG_PM is not set # CONFIG_PM is not set
# CONFIG_POWER is not set # CONFIG_POWER is not set
@ -552,7 +553,7 @@ CONFIG_NET_SOLINGER=y
# #
# Network Device Operations # Network Device Operations
# #
# CONFIG_NETDEV_PHY_IOCTL is not set CONFIG_NETDEV_PHY_IOCTL=y
# #
# Raw Socket Support # Raw Socket Support
@ -928,7 +929,12 @@ CONFIG_NSH_CONSOLE=y
# #
# Networking Configuration # Networking Configuration
# #
# CONFIG_NSH_NETINIT_THREAD is not set CONFIG_NSH_NETINIT_THREAD=y
CONFIG_NSH_NETINIT_MONITOR=y
CONFIG_NSH_NETINIT_SIGNO=18
CONFIG_NSH_NETINIT_RETRYMSEC=2000
CONFIG_NSH_NETINIT_THREAD_STACKSIZE=1568
CONFIG_NSH_NETINIT_THREAD_PRIORITY=100
CONFIG_NSH_IPADDR=0x0a000002 CONFIG_NSH_IPADDR=0x0a000002
CONFIG_NSH_DRIPADDR=0x0a000001 CONFIG_NSH_DRIPADDR=0x0a000001
CONFIG_NSH_NETMASK=0xffffff00 CONFIG_NSH_NETMASK=0xffffff00
@ -1021,6 +1027,7 @@ CONFIG_READLINE_ECHO=y
# #
# PHY Tool # PHY Tool
# #
# CONFIG_SYSTEM_MDIO is not set
# #
# Power Off # Power Off

View File

@ -1509,7 +1509,7 @@ Networking
- And a few other things: UDP support is required (CONFIG_NET_UDP) and - And a few other things: UDP support is required (CONFIG_NET_UDP) and
signals must not be disabled (CONFIG_DISABLE_SIGNALS). signals must not be disabled (CONFIG_DISABLE_SIGNALS).
Given those prerequisites, the newtork monitor can be selected with these additional settings. Given those prerequisites, the network monitor can be selected with these additional settings.
Networking Support -> Networking Device Support Networking Support -> Networking Device Support
CONFIG_NETDEV_PHY_IOCTL=y : Enable PHY ioctl support CONFIG_NETDEV_PHY_IOCTL=y : Enable PHY ioctl support