All network drivers! Change pre-processor logic that selects the high priority work queue or gives preferential treatment to the high priority work. All network logic must run on the low priority work queue! Or suffer the consequences.

This commit is contained in:
Gregory Nutt
2018-11-21 07:57:26 -06:00
parent b69957ef5f
commit 09f4dee6bc
46 changed files with 310 additions and 826 deletions
-49
View File
@@ -164,36 +164,7 @@ config IEEE802154_NETDEV_RECVRPRIO
the MAC character driver (which should always be lowest priority since
it is a "catch-all" type receiver).
choice
prompt "Work queue"
default IEEE802154_NETDEV_LPWORK if SCHED_LPWORK
default IEEE802154_NETDEV_HPWORK if !SCHED_LPWORK && SCHED_HPWORK
depends on SCHED_WORKQUEUE
---help---
Work queue support is required to use the IEEE802.15.4 network
driver. If the low priority work queue is available, then it should
be used by the loopback driver.
WARNING!! The IEEE802.15.4 network device must never run on the same
work queue as does the IEEE 802.15.4 MAC. That configuration will
cause deadlocks: The network logic may be blocked on the work queue
waiting on resources that can only be freed by the MAC logic but the
MAC is unable to run because the work queue is blocked. The
recommended configuration is: Network on the LP work queue; MAC on HP
work queue. Blocking on the HP work queue is a very bad thing in
any case.
config IEEE802154_NETDEV_HPWORK
bool "High priority"
depends on SCHED_HPWORK
config IEEE802154_NETDEV_LPWORK
bool "Low priority"
depends on SCHED_LPWORK
endchoice # Work queue
endif # IEEE802154_NETDEV
endif # IEEE802154_MACDEV
config IEEE802154_LOOPBACK
@@ -205,26 +176,6 @@ config IEEE802154_LOOPBACK
Add support for the IEEE802.15.4 6LoWPAN Loopback test device.
if IEEE802154_LOOPBACK
choice
prompt "Work queue"
default IEEE802154_LOOPBACK_LPWORK if SCHED_LPWORK
default IEEE802154_LOOPBACK_HPWORK if !SCHED_LPWORK && SCHED_HPWORK
depends on SCHED_WORKQUEUE
---help---
Work queue support is required to use the loopback driver. If the
low priority work queue is available, then it should be used by the
loopback driver.
config IEEE802154_LOOPBACK_HPWORK
bool "High priority"
depends on SCHED_HPWORK
config IEEE802154_LOOPBACK_LPWORK
bool "Low priority"
depends on SCHED_LPWORK
endchoice # Work queue
endif # IEEE802154_LOOPBACK
endif # WIRELESS_IEEE802154
+12 -9
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* wireless/iee802154/mac802154_loopback.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -71,16 +71,19 @@
#if !defined(CONFIG_SCHED_WORKQUEUE)
# error Worker thread support is required (CONFIG_SCHED_WORKQUEUE)
#else
# if defined(CONFIG_IEEE802154_LOOPBACK_HPWORK)
# define LPBKWORK HPWORK
# elif defined(CONFIG_IEEE802154_LOOPBACK_LPWORK)
# define LPBKWORK LPWORK
# else
# error Neither CONFIG_IEEE802154_LOOPBACK_HPWORK nor CONFIG_IEEE802154_LOOPBACK_LPWORK defined
# endif
#endif
/* The low priority work queue is preferred. If it is not enabled, LPWORK
* will be the same as HPWORK.
*
* NOTE: However, the network should NEVER run on the high priority work
* queue! That queue is intended only to service short back end interrupt
* processing that never suspends. Suspending the high priority work queue
* may bring the system to its knees!
*/
#define LPBKWORK LPWORK
/* Preferred address size */
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
+12 -12
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* wireless/ieee802154/mac802154_netdev.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -77,19 +77,19 @@
#if !defined(CONFIG_SCHED_WORKQUEUE)
# error Work queue support is required in this configuration (CONFIG_SCHED_WORKQUEUE)
#else
/* Use the selected work queue */
# if defined(CONFIG_IEEE802154_NETDEV_HPWORK)
# define WPANWORK HPWORK
# elif defined(CONFIG_IEEE802154_NETDEV_LPWORK)
# define WPANWORK LPWORK
# else
# error Neither CONFIG_IEEE802154_NETDEV_HPWORK nor CONFIG_IEEE802154_NETDEV_LPWORK defined
# endif
#endif
/* The low priority work queue is preferred. If it is not enabled, LPWORK
* will be the same as HPWORK.
*
* NOTE: However, the network should NEVER run on the high priority work
* queue! That queue is intended only to service short back end interrupt
* processing that never suspends. Suspending the high priority work queue
* may bring the system to its knees!
*/
#define WPANWORK LPWORK
/* CONFIG_IEEE802154_NETDEV_NINTERFACES determines the number of physical interfaces
* that will be supported.
*/