diff --git a/arch/arm/src/kinetis/Kconfig b/arch/arm/src/kinetis/Kconfig index 17923818b5..cf781ade5e 100644 --- a/arch/arm/src/kinetis/Kconfig +++ b/arch/arm/src/kinetis/Kconfig @@ -629,6 +629,25 @@ config KINETIS_ENET_NORXER If selected, then the MII/RMII RXER output will be configured as a GPIO and pulled low. +choice + prompt "Work queue" + default KINETIS_EMAC_LPWORK if SCHED_LPWORK + default KINETIS_EMAC_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config KINETIS_EMAC_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config KINETIS_EMAC_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue endmenu # Kinetis Ethernet Configuration menu "Kinetis SDHC Configuration" diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index dc0be25e16..a546103d36 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -80,12 +80,24 @@ * Pre-processor Definitions ****************************************************************************/ -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_KINETIS_EMAC_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_KINETIS_EMAC_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_KINETIS_EMAC_HPWORK nor CONFIG_KINETIS_EMAC_LPWORK defined +# endif #endif /* CONFIG_KINETIS_ENETNETHIFS determines the number of physical interfaces @@ -974,11 +986,11 @@ static int kinetis_interrupt(int irq, FAR void *context) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, kinetis_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, kinetis_interrupt_work, priv, 0); #else /* Process the interrupt now */ @@ -1093,11 +1105,11 @@ static void kinetis_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, kinetis_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, kinetis_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -1206,7 +1218,7 @@ static void kinetis_polltimer_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, kinetis_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, kinetis_poll_work, priv, 0); } else { @@ -1513,7 +1525,7 @@ static int kinetis_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, kinetis_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, kinetis_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/lpc17xx/Kconfig b/arch/arm/src/lpc17xx/Kconfig index 5038000d86..7691b48a0e 100644 --- a/arch/arm/src/lpc17xx/Kconfig +++ b/arch/arm/src/lpc17xx/Kconfig @@ -724,6 +724,26 @@ config LPC17_MULTICAST ---help--- Enable receipt of multicast (and unicast) frames. Automatically set if NET_IGMP is selected. + +choice + prompt "Work queue" + default LPC17_ETHERNET_LPWORK if SCHED_LPWORK + default LPC17_ETHERNET_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config LPC17_ETHERNET_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config LPC17_ETHERNET_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue endmenu menu "LCD device driver options" diff --git a/arch/arm/src/lpc17xx/lpc17_ethernet.c b/arch/arm/src/lpc17xx/lpc17_ethernet.c index 1373050682..d5ff009fd6 100644 --- a/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -83,12 +83,24 @@ * Pre-processor Definitions ****************************************************************************/ /* Configuration ************************************************************/ -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_LPC17_ETHERNET_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_LPC17_ETHERNET_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_LPC17_ETHERNET_HPWORK nor CONFIG_LPC17_ETHERNET_LPWORK defined +# endif #endif /* CONFIG_LPC17_NINTERFACES determines the number of physical interfaces @@ -1259,11 +1271,11 @@ static int lpc17_interrupt(int irq, void *context) /* Cancel any pending RX done work */ - work_cancel(HPWORK, &priv->lp_rxwork); + work_cancel(ETHWORK, &priv->lp_rxwork); /* Schedule RX-related work to be performed on the work thread */ - work_queue(HPWORK, &priv->lp_rxwork, (worker_t)lpc17_rxdone_work, + work_queue(ETHWORK, &priv->lp_rxwork, (worker_t)lpc17_rxdone_work, priv, 0); #else /* CONFIG_NET_NOINTS */ @@ -1323,7 +1335,7 @@ static int lpc17_interrupt(int irq, void *context) * to avoid race conditions with the TX timeout work) */ - work_cancel(HPWORK, &priv->lp_txwork); + work_cancel(ETHWORK, &priv->lp_txwork); /* Then make sure that the TX poll timer is running (if it is * already running, the following would restart it). This is @@ -1336,7 +1348,7 @@ static int lpc17_interrupt(int irq, void *context) /* Schedule TX-related work to be performed on the work thread */ - work_queue(HPWORK, &priv->lp_txwork, (worker_t)lpc17_txdone_work, + work_queue(ETHWORK, &priv->lp_txwork, (worker_t)lpc17_txdone_work, priv, 0); #else /* CONFIG_NET_NOINTS */ @@ -1468,7 +1480,7 @@ static void lpc17_txtimeout_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->lp_txwork, lpc17_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->lp_txwork, lpc17_txtimeout_work, priv, 0); } #else @@ -1526,7 +1538,7 @@ static void lpc17_poll_process(FAR struct lpc17_driver_s *priv) if (considx != prodidx) { #ifdef CONFIG_NET_NOINTS - work_queue(HPWORK, &priv->lp_rxwork, (worker_t)lpc17_rxdone_work, + work_queue(ETHWORK, &priv->lp_rxwork, (worker_t)lpc17_rxdone_work, priv, 0); #else /* CONFIG_NET_NOINTS */ @@ -1606,7 +1618,7 @@ static void lpc17_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->lp_pollwork, lpc17_poll_work, priv, 0); + work_queue(ETHWORK, &priv->lp_pollwork, lpc17_poll_work, priv, 0); } else { @@ -2013,7 +2025,7 @@ static int lpc17_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->lp_pollwork, lpc17_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->lp_pollwork, lpc17_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/lpc43xx/Kconfig b/arch/arm/src/lpc43xx/Kconfig index 7c9a89c49d..c063fd86c7 100644 --- a/arch/arm/src/lpc43xx/Kconfig +++ b/arch/arm/src/lpc43xx/Kconfig @@ -485,8 +485,8 @@ endif # LCP43_EXTSDRAM3 endmenu # External Memory Configuration -if LPC43_ETHERNET menu "Ethernet MAC configuration" + depends on LPC43_ETHERNET config LPC43_PHYADDR int "PHY address" @@ -619,6 +619,26 @@ config LPC43_RMII bool default y if !LPC43_MII +choice + prompt "Work queue" + default LPC43_ETHERNET_LPWORK if SCHED_LPWORK + default LPC43_ETHERNET_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config LPC43_ETHERNET_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config LPC43_ETHERNET_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue + config LPC43_ETHERNET_REGDEBUG bool "Register-Level Debug" default n @@ -627,7 +647,6 @@ config LPC43_ETHERNET_REGDEBUG Enable very low-level register access debug. Depends on CONFIG_DEBUG_NET_INFO. endmenu # Ethernet MAC configuration -endif # LPC43_ETHERNET menu "RS-485 Configuration" if LPC43_USART0 diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c index 086dd0b8f3..c96f1a7551 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.c +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c @@ -83,12 +83,24 @@ ****************************************************************************/ /* Configuration ************************************************************/ -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_LPC43_ETHERNET_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_LPC43_ETHERNET_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_LPC43_ETHERNET_HPWORK nor CONFIG_LPC43_ETHERNET_LPWORK defined +# endif #endif #ifndef CONFIG_LPC43_PHYADDR @@ -2075,11 +2087,11 @@ static int lpc43_interrupt(int irq, FAR void *context) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, lpc43_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, lpc43_interrupt_work, priv, 0); } #else @@ -2195,11 +2207,11 @@ static void lpc43_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, lpc43_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, lpc43_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -2339,7 +2351,7 @@ static void lpc43_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, lpc43_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, lpc43_poll_work, priv, 0); } else { @@ -2556,7 +2568,7 @@ static int lpc43_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, lpc43_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, lpc43_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/sam34/Kconfig b/arch/arm/src/sam34/Kconfig index 1f1f423e85..df13714792 100644 --- a/arch/arm/src/sam34/Kconfig +++ b/arch/arm/src/sam34/Kconfig @@ -1136,9 +1136,8 @@ config SAM34_SPI_REGDEBUG endmenu # AT91SAM3/4 SPI device driver options endif # SAM34_SPI0 || SAM34_SPI1 -if SAM34_EMAC - menu "AT91SAM3/4 EMAC device driver options" + depends on SAM34_EMAC config SAM34_EMAC_NRXBUFFERS int "Number of RX buffers" @@ -1332,6 +1331,30 @@ config SAM34_EMAC_PHYSR_100FD This must be provided if SAM34_EMAC_AUTONEG is defined. This is the value under the bit mask that represents the 100Mbps, full duplex setting. +config SAM34_EMAC_ISETH0 + bool + default y + +choice + prompt "Work queue" + default SAM34_EMAC_LPWORK if SCHED_LPWORK + default SAM34_EMAC_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config SAM34_EMAC_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config SAM34_EMAC_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue + config SAM34_EMAC_REGDEBUG bool "Register-Level Debug" default n @@ -1339,13 +1362,7 @@ config SAM34_EMAC_REGDEBUG ---help--- Enable very low-level register access debug. Depends on CONFIG_DEBUG_NET_INFO. -config SAM34_EMAC_ISETH0 - bool - default y if !SAM34_EMAC || !SAM34_GMAC_ISETH0 - default n if SAM34_EMAC && SAM34_GMAC_ISETH0 - endmenu # EMAC device driver options -endif # SAM34_EMAC if SAM34_HSMCI menu "AT91SAM3/4 HSMCI device driver options" diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index a7a9bc2141..15e7b1b4ba 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -97,12 +97,24 @@ ****************************************************************************/ /* Configuration ************************************************************/ -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_SAM34_EMAC_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_SAM34_EMAC_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_SAM34_EMAC_HPWORK nor CONFIG_SAM34_EMAC_LPWORK defined +# endif #endif /* Number of buffer for RX */ @@ -1690,11 +1702,11 @@ static int sam_emac_interrupt(int irq, void *context) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_interrupt_work, priv, 0); #else /* Process the interrupt now */ @@ -1807,11 +1819,11 @@ static void sam_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -1918,7 +1930,7 @@ static void sam_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_poll_work, priv, 0); } else { @@ -2155,7 +2167,7 @@ static int sam_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/sama5/Kconfig b/arch/arm/src/sama5/Kconfig index 121ee991ec..1400aea5c9 100644 --- a/arch/arm/src/sama5/Kconfig +++ b/arch/arm/src/sama5/Kconfig @@ -1685,13 +1685,11 @@ config SAMA5_EMACA_REGDEBUG endmenu # EMAC device driver options endif # SAMA5_EMACA -if SAMA5_EMACB - menu "EMAC device driver options" - -if SAMA5_EMAC0 + depends on SAMA5_EMACB menu "EMAC0 device driver options" + depends on SAMA5_EMAC0 config SAMA5_EMAC0_NRXBUFFERS int "Number of RX buffers" @@ -1871,11 +1869,9 @@ config SAMA5_EMAC0_PHYSR_FULLDUPLEX endif # !SAMA5_EMAC0_PHYSR_ALTCONFIG endif # SAMA5_EMAC0_AUTONEG endmenu # EMAC0 device driver options -endif # SAMA5_EMAC0 - -if SAMA5_EMAC1 menu "EMAC1 device driver options" + depends on SAMA5_EMAC1 config SAMA5_EMAC1_NRXBUFFERS int "Number of RX buffers" @@ -2055,7 +2051,6 @@ config SAMA5_EMAC1_PHYSR_FULLDUPLEX endif # !SAMA5_EMAC1_PHYSR_ALTCONFIG endif # SAMA5_EMAC1_AUTONEG endmenu # EMAC1 device driver options -endif # SAMA5_EMAC1 # These apply to both EMAC0 and EMAC1 @@ -2073,6 +2068,26 @@ config SAMA5_EMACB_NBC ---help--- Select to disable receipt of broadcast packets. +choice + prompt "Work queue" + default SAMA5_EMACB_LPWORK if SCHED_LPWORK + default SAMA5_EMACB_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config SAMA5_EMACB_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config SAMA5_EMACB_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue + config SAMA5_EMACB_DEBUG bool "Force EMAC0/1 DEBUG" default n @@ -2092,7 +2107,6 @@ config SAMA5_EMACB_REGDEBUG Enable very low-level register access debug. Depends on CONFIG_DEBUG_NET_INFO. endmenu # EMAC device driver options -endif # SAMA5_EMACB if SAMA5_EMACA || SAMA5_EMAC0 || SAMA5_EMAC1 || SAMA5_GMAC choice diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index ba118484e1..3d9f282ce9 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -113,12 +113,24 @@ ****************************************************************************/ /* Configuration ************************************************************/ -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_SAMA5_EMACB_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_SAMA5_EMACB_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_SAMA5_EMACB_HPWORK nor CONFIG_SAMA5_EMACB_LPWORK defined +# endif #endif /* EMAC0 Configuration ******************************************************/ @@ -2098,11 +2110,11 @@ static int sam_emac_interrupt(struct sam_emac_s *priv) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_interrupt_work, priv, 0); #else /* Process the interrupt now */ @@ -2244,11 +2256,11 @@ static void sam_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -2355,7 +2367,7 @@ static void sam_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_poll_work, priv, 0); } else { @@ -2600,7 +2612,7 @@ static int sam_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/samv7/Kconfig b/arch/arm/src/samv7/Kconfig index fc4f513507..9a79ec5428 100644 --- a/arch/arm/src/samv7/Kconfig +++ b/arch/arm/src/samv7/Kconfig @@ -1998,6 +1998,26 @@ config SAMV7_EMAC_NBC ---help--- Select to disable receipt of broadcast packets. +choice + prompt "Work queue" + default SAMV7_EMAC_LPWORK if SCHED_LPWORK + default SAMV7_EMAC_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config SAMV7_EMAC_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config SAMV7_EMAC_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue + config SAMV7_EMAC_DEBUG bool "Force EMAC0/1 DEBUG" default n diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index c246140138..2eefdcefa7 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -103,12 +103,24 @@ ****************************************************************************/ /* Configuration ************************************************************/ -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_SAMV7_EMAC_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_SAMV7_EMAC_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_SAMV7_EMAC_HPWORK nor CONFIG_SAMV7_EMAC_LPWORK defined +# endif #endif /* EMAC0 Configuration ******************************************************/ @@ -2544,11 +2556,11 @@ static int sam_emac_interrupt(struct sam_emac_s *priv) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_interrupt_work, priv, 0); #else /* Process the interrupt now */ @@ -2691,11 +2703,11 @@ static void sam_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -2802,7 +2814,7 @@ static void sam_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_poll_work, priv, 0); } else { @@ -3050,7 +3062,7 @@ static int sam_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, sam_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, sam_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/samv7/sam_ethernet.c b/arch/arm/src/samv7/sam_ethernet.c index 0137b16115..847099fb92 100644 --- a/arch/arm/src/samv7/sam_ethernet.c +++ b/arch/arm/src/samv7/sam_ethernet.c @@ -44,26 +44,6 @@ #ifdef CONFIG_NET -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index c0dc163d30..57165d8ab0 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -6146,8 +6146,8 @@ config RTC_HSECLOCK endchoice -if STM32_ETHMAC menu "Ethernet MAC configuration" + depends on STM32_ETHMAC config STM32_PHYADDR int "PHY address" @@ -6351,6 +6351,26 @@ config STM32_RMII_EXTCLK endchoice +choice + prompt "Work queue" + default STM32_ETHMAC_LPWORK if SCHED_LPWORK + default STM32_ETHMAC_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config STM32_ETHMAC_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config STM32_ETHMAC_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue + config STM32_ETHMAC_REGDEBUG bool "Register-Level Debug" default n @@ -6358,8 +6378,7 @@ config STM32_ETHMAC_REGDEBUG ---help--- Enable very low-level register access debug. Depends on CONFIG_DEBUG_FEATURES. -endmenu -endif +endmenu # Ethernet MAC configuration menu "USB FS Host Configuration" diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index abf911f7ac..635940ac95 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -93,12 +93,24 @@ # error "Logic to support multiple Ethernet interfaces is incomplete" #endif -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_STM32_ETHMAC_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_STM32_ETHMAC_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_STM32_ETHMAC_HPWORK nor CONFIG_STM32_ETHMAC_LPWORK defined +# endif #endif #if !defined(CONFIG_STM32_SYSCFG) && !defined(CONFIG_STM32_CONNECTIVITYLINE) @@ -2139,11 +2151,11 @@ static int stm32_interrupt(int irq, FAR void *context) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_interrupt_work, priv, 0); } #else @@ -2259,11 +2271,11 @@ static void stm32_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -2403,7 +2415,7 @@ static void stm32_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_poll_work, priv, 0); } else { @@ -2618,7 +2630,7 @@ static int stm32_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/stm32f7/Kconfig b/arch/arm/src/stm32f7/Kconfig index ced8f62ca3..1723b9dad0 100644 --- a/arch/arm/src/stm32f7/Kconfig +++ b/arch/arm/src/stm32f7/Kconfig @@ -4436,8 +4436,8 @@ config STM32F7_ADC3_DMA endmenu # "ADC Configuration" -if STM32F7_ETHMAC menu "Ethernet MAC configuration" + depends on STM32F7_ETHMAC config STM32F7_PHYADDR int "PHY address" @@ -4619,7 +4619,27 @@ config STM32F7_RMII_EXTCLK ---help--- Clocking is provided by external logic. -endchoice +endchoice # RMII clock configuration + +choice + prompt "Work queue" + default STM32F7_ETHMAC_LPWORK if SCHED_LPWORK + default STM32F7_ETHMAC_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config STM32F7_ETHMAC_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config STM32F7_ETHMAC_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue config STM32F7_ETHMAC_REGDEBUG bool "Register-Level Debug" @@ -4628,6 +4648,5 @@ config STM32F7_ETHMAC_REGDEBUG ---help--- Enable very low-level register access debug. Depends on CONFIG_DEBUG_FEATURES. -endmenu -endif # STM32F7_ETHMAC +endmenu # Ethernet MAC configuration endif # ARCH_CHIP_STM32F7 diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c b/arch/arm/src/stm32f7/stm32_ethernet.c index 0d4485ac26..eccf15b348 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.c +++ b/arch/arm/src/stm32f7/stm32_ethernet.c @@ -94,12 +94,24 @@ # error "Logic to support multiple Ethernet interfaces is incomplete" #endif -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_STM32F7_ETHMAC_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_STM32F7_ETHMAC_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_STM32F7_ETHMAC_HPWORK nor CONFIG_STM32F7_ETHMAC_LPWORK defined +# endif #endif #ifndef CONFIG_STM32F7_PHYADDR @@ -2252,11 +2264,11 @@ static int stm32_interrupt(int irq, void *context) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_interrupt_work, priv, 0); } #else @@ -2372,11 +2384,11 @@ static void stm32_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -2516,7 +2528,7 @@ static void stm32_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_poll_work, priv, 0); } else { @@ -2732,7 +2744,7 @@ static int stm32_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, stm32_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, stm32_txavail_work, priv, 0); } #else diff --git a/arch/arm/src/tiva/Kconfig b/arch/arm/src/tiva/Kconfig index 174252528b..78a7ae07f1 100644 --- a/arch/arm/src/tiva/Kconfig +++ b/arch/arm/src/tiva/Kconfig @@ -1100,6 +1100,25 @@ config TIVA_EMAC_HWCHECKSUM ---help--- Use the hardware checksum capabilities of the Tiva chip +choice + prompt "Work queue" + default TIVA_ETHERNET_LPWORK if SCHED_LPWORK + default TIVA_ETHERNET_HPWORK if !SCHED_LPWORK && SCHED_HPWORK + depends on SCHED_WORKQUEUE + ---help--- + Work queue support is required to use the Ethernet driver. If the + low priority work queue is available, then it should be used by the + driver. + +config TIVA_ETHERNET_HPWORK + bool "High priority" + depends on SCHED_HPWORK + +config TIVA_ETHERNET_LPWORK + bool "Low priority" + depends on SCHED_LPWORK + +endchoice # Work queue config TIVA_ETHERNET_REGDEBUG bool "Register-Level Debug" default n diff --git a/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index e7d7d0a67b..3882a95db3 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c_ethernet.c @@ -98,12 +98,24 @@ # error Logic to support multiple Ethernet interfaces is incomplete #endif -/* If processing is not done at the interrupt level, then high priority - * work queue support is required. +/* If processing is not done at the interrupt level, then work queue support + * is required. */ -#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_HPWORK) -# error High priority work queue support is required +#if defined(CONFIG_NET_NOINTS) && !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required +#endif + +/* Select work queue */ + +#if defined(CONFIG_SCHED_WORKQUEUE) +# if defined(CONFIG_TIVA_ETHERNET_HPWORK) +# define ETHWORK HPWORK +# elif defined(CONFIG_TIVA_ETHERNET_LPWORK) +# define ETHWORK LPWORK +# else +# error Neither CONFIG_TIVA_ETHERNET_HPWORK nor CONFIG_TIVA_ETHERNET_LPWORK defined +# endif #endif /* Are we using the internal PHY or an external PHY? */ @@ -2167,11 +2179,11 @@ static int tiva_interrupt(int irq, FAR void *context) /* Cancel any pending poll work */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, tiva_interrupt_work, priv, 0); + work_queue(ETHWORK, &priv->work, tiva_interrupt_work, priv, 0); } #else @@ -2303,11 +2315,11 @@ static void tiva_txtimeout_expiry(int argc, uint32_t arg, ...) * on work that has already been started. */ - work_cancel(HPWORK, &priv->work); + work_cancel(ETHWORK, &priv->work); /* Schedule to perform the TX timeout processing on the worker thread. */ - work_queue(HPWORK, &priv->work, tiva_txtimeout_work, priv, 0); + work_queue(ETHWORK, &priv->work, tiva_txtimeout_work, priv, 0); #else /* Process the timeout now */ @@ -2447,7 +2459,7 @@ static void tiva_poll_expiry(int argc, uint32_t arg, ...) { /* Schedule to perform the interrupt processing on the worker thread. */ - work_queue(HPWORK, &priv->work, tiva_poll_work, priv, 0); + work_queue(ETHWORK, &priv->work, tiva_poll_work, priv, 0); } else { @@ -2662,7 +2674,7 @@ static int tiva_txavail(struct net_driver_s *dev) { /* Schedule to serialize the poll on the worker thread. */ - work_queue(HPWORK, &priv->work, tiva_txavail_work, priv, 0); + work_queue(ETHWORK, &priv->work, tiva_txavail_work, priv, 0); } #else diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9bb451ab3a..5bcb225dd0 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -24,7 +24,9 @@ choice default 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. + 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 LOOPBACK_HPWORK bool "High priority" @@ -245,7 +247,9 @@ choice default ENC28J60_HPWORK if !SCHED_LPWORK && SCHED_HPWORK depends on SCHED_WORKQUEUE ---help--- - Work queue support is required to use the ENC28J60 driver. If the low priority work queue is available, then it should be used by the ENC28J60. + Work queue support is required to use the ENC28J60 driver. If the + low priority work queue is available, then it should be used by the + ENC28J60 driver. config ENC28J60_HPWORK bool "High priority" @@ -332,7 +336,9 @@ choice default ENCX24J600_HPWORK if !SCHED_LPWORK && SCHED_HPWORK depends on SCHED_WORKQUEUE ---help--- - Work queue support is required to use the ENCX24J600 driver. If the low priority work queue is available, then it should be used by the ENCX24J600. + Work queue support is required to use the ENCX24J600 driver. If the + low priority work queue is available, then it should be used by the + ENCX24J600 driver. config ENCX24J600_HPWORK bool "High priority" @@ -444,7 +450,9 @@ choice default FTMAC100_HPWORK if !SCHED_LPWORK && SCHED_HPWORK depends on SCHED_WORKQUEUE ---help--- - Work queue support is required to use the FTMAC100 driver. If the low priority work queue is available, then it should be used by the FTMAC100. + Work queue support is required to use the FTMAC100 driver. If the + low priority work queue is available, then it should be used by the + FTMAC100 driver. config FTMAC100_HPWORK bool "High priority" diff --git a/net/Kconfig b/net/Kconfig index 2c1aecd291..a216650c76 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -247,7 +247,9 @@ choice default TUN_HPWORK if !SCHED_LPWORK && SCHED_HPWORK depends on SCHED_WORKQUEUE ---help--- - Work queue support is required to use the TUN driver. If the low priority work queue is available, then it should be used by the TUN. + Work queue support is required to use the TUN driver. If the + low priority work queue is available, then it should be used by the + TUN driver. config TUN_HPWORK bool "High priority"