Networking: The network device list was protected by a re-entrant semaphore. With the recent change to support network device callback, the network stack needs to access the network device list too. Some drivers, however, run the network stack from the interrupt level -- this is bad but a fact in the current state. Of course,those drivers are unable to take the semaphore and will assert.

The solution here is to eliminate the device devices semaphore altogether.  This eliminates netdev_semtake() and netdev_semgive() and replaces them with net_lock() and net_unlock() which have larger scope as needed for this purpose.
This commit is contained in:
Gregory Nutt
2015-05-31 08:34:03 -06:00
parent 6687e156e6
commit 33085cb309
16 changed files with 74 additions and 265 deletions
+5 -39
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* net/netdev/netdev.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -69,8 +69,10 @@ extern "C"
#endif
#if CONFIG_NSOCKET_DESCRIPTORS > 0
/* List of registered Ethernet device drivers. This duplicates a declaration
* in net/netdev/netdev.h
/* List of registered Ethernet device drivers. You must have the network
* locked in order to access this list.
*
* NOTE that this duplicates a declaration in net/tcp/tcp.h
*/
EXTERN struct net_driver_s *g_netdevices;
@@ -80,42 +82,6 @@ EXTERN struct net_driver_s *g_netdevices;
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Function: netdev_seminit
*
* Description:
* Initialize the network device semaphore.
*
****************************************************************************/
#if CONFIG_NSOCKET_DESCRIPTORS > 0
void netdev_seminit(void);
#endif
/****************************************************************************
* Function: netdev_semtake
*
* Description:
* Get exclusive access to the network device list.
*
****************************************************************************/
#if CONFIG_NSOCKET_DESCRIPTORS > 0
void netdev_semtake(void);
#endif
/****************************************************************************
* Function: netdev_semgive
*
* Description:
* Release exclusive access to the network device list
*
****************************************************************************/
#if CONFIG_NSOCKET_DESCRIPTORS > 0
void netdev_semgive(void);
#endif
/****************************************************************************
* Name: netdev_ifup / netdev_ifdown
*