diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index 39beed00e03..ce49f0c840b 100644 --- a/arch/arm/src/c5471/c5471_ethernet.c +++ b/arch/arm/src/c5471/c5471_ethernet.c @@ -111,10 +111,6 @@ /* Timing values ************************************************************/ -/* TX poll deley = 1 seconds. CLK_TCK=number of clock ticks per second */ - -#define C5471_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define C5471_TXTIMEOUT (60*CLK_TCK) @@ -297,7 +293,6 @@ static uint8_t g_pktbuf[MAX_NETDEV_PKTSIZE + CONFIG_NET_GUARDSIZE]; struct c5471_driver_s { bool c_bifup; /* true:ifup false:ifdown */ - struct wdog_s c_txpoll; /* TX poll timer */ struct wdog_s c_txtimeout; /* TX timeout timer */ struct work_s c_irqwork; /* For deferring interrupt work to the work queue */ struct work_s c_pollwork; /* For deferring poll work to the work queue */ @@ -397,9 +392,6 @@ static int c5471_interrupt(int irq, void *context, void *arg); static void c5471_txtimeout_work(void *arg); static void c5471_txtimeout_expiry(wdparm_t arg); -static void c5471_poll_work(void *arg); -static void c5471_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int c5471_ifup(struct net_driver_s *dev); @@ -1771,74 +1763,6 @@ static void c5471_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->c_irqwork, c5471_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: c5471_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void c5471_poll_work(void *arg) -{ - struct c5471_driver_s *priv = (struct c5471_driver_s *)arg; - - /* Check if the ESM has let go of the RX descriptor giving us access rights - * to submit another Ethernet frame. - */ - - net_lock(); - if ((EIM_TXDESC_OWN_HOST & getreg32(priv->c_rxcpudesc)) == 0) - { - /* If so, update TCP timing states and - * poll the network for new XMIT data - */ - - devif_timer(&priv->c_dev, C5471_WDDELAY, c5471_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->c_txpoll, C5471_WDDELAY, - c5471_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: c5471_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void c5471_poll_expiry(wdparm_t arg) -{ - struct c5471_driver_s *priv = (struct c5471_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->c_pollwork, c5471_poll_work, priv, 0); -} - /**************************************************************************** * Function: c5471_ifup * @@ -1894,11 +1818,6 @@ static int c5471_ifup(struct net_driver_s *dev) putreg32((getreg32(ENET0_MODE) | ENET_MODE_ENABLE), ENET0_MODE); /* enable ENET */ up_mdelay(100); - /* Set and activate a timer process */ - - wd_start(&priv->c_txpoll, C5471_WDDELAY, - c5471_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->c_bifup = true; @@ -1947,9 +1866,8 @@ static int c5471_ifdown(struct net_driver_s *dev) putreg32((getreg32(EIM_CTRL) & ~EIM_CTRL_ESM_EN), EIM_CTRL); /* disable ESM */ - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->c_txpoll); wd_cancel(&priv->c_txtimeout); /* Reset the device */ @@ -1995,7 +1913,7 @@ static void c5471_txavail_work(void *arg) { /* If so, then poll the network for new XMIT data */ - devif_timer(&priv->c_dev, 0, c5471_txpoll); + devif_poll(&priv->c_dev, c5471_txpoll); } } diff --git a/arch/arm/src/imx6/imx_enet.c b/arch/arm/src/imx6/imx_enet.c index 67a82323376..9d89f135523 100644 --- a/arch/arm/src/imx6/imx_enet.c +++ b/arch/arm/src/imx6/imx_enet.c @@ -136,12 +136,6 @@ #endif #endif -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per - * second. - */ - -#define IMX_WDDELAY (1 * CLK_TCK) - /* Align assuming that the D-Cache is enabled (probably 32-bytes). * * REVISIT: The size of descriptors and buffers must also be in even units @@ -282,7 +276,6 @@ struct imx_driver_s uint8_t txhead; /* The next TX descriptor to use */ uint8_t rxtail; /* The next RX descriptor to use */ uint8_t phyaddr; /* Selected PHY address */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -355,9 +348,6 @@ static int imx_enet_interrupt(int irq, void *context, void *arg); static void imx_txtimeout_work(void *arg); static void imx_txtimeout_expiry(wdparm_t arg); -static void imx_poll_work(void *arg); -static void imx_polltimer_expiry(wdparm_t arg); - /* NuttX callback functions */ static int imx_ifup(struct net_driver_s *dev); @@ -1244,76 +1234,6 @@ static void imx_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, imx_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: imx_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void imx_poll_work(void *arg) -{ - struct imx_driver_s *priv = (struct imx_driver_s *)arg; - - /* Check if there is there is a transmission in progress. - * We cannot perform the TX poll if he are unable to accept - * another packet for transmission. - */ - - net_lock(); - if (!imx_txringfull(priv)) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. Hmmm.. might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->dev, IMX_WDDELAY, imx_txpoll); - } - - /* Setup the watchdog poll timer again in any case */ - - wd_start(&priv->txpoll, IMX_WDDELAY, - imx_polltimer_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: imx_polltimer_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void imx_polltimer_expiry(wdparm_t arg) -{ - struct imx_driver_s *priv = (struct imx_driver_s *)arg; - - /* Schedule to perform the poll processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, imx_poll_work, priv, 0); -} - /**************************************************************************** * Function: imx_ifup_action * @@ -1414,11 +1334,6 @@ static int imx_ifup_action(struct net_driver_s *dev, bool resetphy) putreg32(ENET_RDAR, IMX_ENET_RDAR); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, IMX_WDDELAY, - imx_polltimer_expiry, (wdparm_t)priv); - /* Clear all pending ENET interrupt */ putreg32(RX_INTERRUPTS | ERROR_INTERRUPTS | TX_INTERRUPTS, IMX_ENET_EIR); @@ -1500,9 +1415,8 @@ static int imx_ifdown(struct net_driver_s *dev) up_disable_irq(IMX_IRQ_ENET0); putreg32(0, IMX_ENET_EIMR); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be @@ -1555,7 +1469,7 @@ static void imx_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, imx_txpoll); + devif_poll(&priv->dev, imx_txpoll); } } diff --git a/arch/arm/src/imxrt/imxrt_enet.c b/arch/arm/src/imxrt/imxrt_enet.c index df4bf4d820c..1bf3a0989fc 100644 --- a/arch/arm/src/imxrt/imxrt_enet.c +++ b/arch/arm/src/imxrt/imxrt_enet.c @@ -125,12 +125,6 @@ # error Write back D-Cache not yet supported #endif -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per - * second. - */ - -#define IMXRT_WDDELAY (1 * CLK_TCK) - /* Align assuming that the D-Cache is enabled (probably 32-bytes). * * REVISIT: The size of descriptors and buffers must also be in even units @@ -264,7 +258,6 @@ struct imxrt_driver_s uint8_t txhead; /* The next TX descriptor to use */ uint8_t rxtail; /* The next RX descriptor to use */ uint8_t phyaddr; /* Selected PHY address */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -337,9 +330,6 @@ static int imxrt_enet_interrupt(int irq, void *context, void *arg); static void imxrt_txtimeout_work(void *arg); static void imxrt_txtimeout_expiry(wdparm_t arg); -static void imxrt_poll_work(void *arg); -static void imxrt_polltimer_expiry(wdparm_t arg); - /* NuttX callback functions */ static int imxrt_ifup(struct net_driver_s *dev); @@ -1198,76 +1188,6 @@ static void imxrt_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, imxrt_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: imxrt_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void imxrt_poll_work(void *arg) -{ - struct imxrt_driver_s *priv = (struct imxrt_driver_s *)arg; - - /* Check if there is there is a transmission in progress. - * We cannot perform the TX poll if he are unable to accept - * another packet for transmission. - */ - - net_lock(); - if (!imxrt_txringfull(priv)) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. Hmmm.. might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->dev, IMXRT_WDDELAY, imxrt_txpoll); - } - - /* Setup the watchdog poll timer again in any case */ - - wd_start(&priv->txpoll, IMXRT_WDDELAY, - imxrt_polltimer_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: imxrt_polltimer_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void imxrt_polltimer_expiry(wdparm_t arg) -{ - struct imxrt_driver_s *priv = (struct imxrt_driver_s *)arg; - - /* Schedule to perform the poll processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, imxrt_poll_work, priv, 0); -} - /**************************************************************************** * Function: imxrt_ifup_action * @@ -1368,11 +1288,6 @@ static int imxrt_ifup_action(struct net_driver_s *dev, bool resetphy) putreg32(ENET_RDAR, IMXRT_ENET_RDAR); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, IMXRT_WDDELAY, - imxrt_polltimer_expiry, (wdparm_t)priv); - /* Clear all pending ENET interrupt */ putreg32(RX_INTERRUPTS | ERROR_INTERRUPTS | TX_INTERRUPTS, IMXRT_ENET_EIR); @@ -1455,9 +1370,8 @@ static int imxrt_ifdown(struct net_driver_s *dev) up_disable_irq(IMXRT_IRQ_ENET); putreg32(0, IMXRT_ENET_EIMR); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be @@ -1510,7 +1424,7 @@ static void imxrt_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, imxrt_txpoll); + devif_poll(&priv->dev, imxrt_txpoll); } } diff --git a/arch/arm/src/imxrt/imxrt_flexcan.c b/arch/arm/src/imxrt/imxrt_flexcan.c index 29fd5dd83d0..22a394daa2e 100644 --- a/arch/arm/src/imxrt/imxrt_flexcan.c +++ b/arch/arm/src/imxrt/imxrt_flexcan.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -1045,7 +1044,7 @@ static void imxrt_txdone_work(void *arg) */ net_lock(); - devif_timer(&priv->dev, 0, imxrt_txpoll); + devif_poll(&priv->dev, imxrt_txpoll); net_unlock(); } @@ -1383,7 +1382,7 @@ static void imxrt_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, imxrt_txpoll); + devif_poll(&priv->dev, imxrt_txpoll); } } diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index a782ddc6926..779a15fabe3 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -103,12 +103,6 @@ #define NENET_NBUFFERS \ (CONFIG_KINETIS_ENETNTXBUFFERS+CONFIG_KINETIS_ENETNRXBUFFERS) -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per - * second. - */ - -#define KINETIS_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define KINETIS_TXTIMEOUT (60*CLK_TCK) @@ -223,7 +217,6 @@ struct kinetis_driver_s uint8_t txhead; /* The next TX descriptor to use */ uint8_t rxtail; /* The next RX descriptor to use */ uint8_t phyaddr; /* Selected PHY address */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ uint32_t ints; /* Enabled interrupts */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ @@ -294,9 +287,6 @@ static int kinetis_interrupt(int irq, void *context, void *arg); static void kinetis_txtimeout_work(void *arg); static void kinetis_txtimeout_expiry(wdparm_t arg); -static void kinetis_poll_work(void *arg); -static void kinetis_polltimer_expiry(wdparm_t arg); - /* NuttX callback functions */ static int kinetis_ifup(struct net_driver_s *dev); @@ -1046,76 +1036,6 @@ static void kinetis_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, kinetis_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: kinetis_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void kinetis_poll_work(void *arg) -{ - struct kinetis_driver_s *priv = (struct kinetis_driver_s *)arg; - - /* Check if there is there is a transmission in progress. We cannot - * perform the TX poll if he are unable to accept another packet for - * transmission. - */ - - net_lock(); - if (!kinetis_txringfull(priv)) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. Hmmm..might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->dev, KINETIS_WDDELAY, kinetis_txpoll); - } - - /* Setup the watchdog poll timer again in any case */ - - wd_start(&priv->txpoll, KINETIS_WDDELAY, - kinetis_polltimer_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: kinetis_polltimer_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void kinetis_polltimer_expiry(wdparm_t arg) -{ - struct kinetis_driver_s *priv = (struct kinetis_driver_s *)arg; - - /* Schedule to perform the poll processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, kinetis_poll_work, priv, 0); -} - /**************************************************************************** * Function: kinetis_ifup * @@ -1227,11 +1147,6 @@ static int kinetis_ifup(struct net_driver_s *dev) putreg32(ENET_RDAR, KINETIS_ENET_RDAR); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, KINETIS_WDDELAY, - kinetis_polltimer_expiry, (wdparm_t)priv); - putreg32(0, KINETIS_ENET_EIMR); /* Clear all pending ENET interrupt */ @@ -1293,9 +1208,8 @@ static int kinetis_ifdown(struct net_driver_s *dev) up_disable_irq(KINETIS_IRQ_EMACRX); up_disable_irq(KINETIS_IRQ_EMACMISC); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be @@ -1352,7 +1266,7 @@ static void kinetis_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, kinetis_txpoll); + devif_poll(&priv->dev, kinetis_txpoll); } } diff --git a/arch/arm/src/kinetis/kinetis_flexcan.c b/arch/arm/src/kinetis/kinetis_flexcan.c index 64d2c215c6e..e3895048f60 100644 --- a/arch/arm/src/kinetis/kinetis_flexcan.c +++ b/arch/arm/src/kinetis/kinetis_flexcan.c @@ -1048,7 +1048,7 @@ static void kinetis_txdone_work(void *arg) */ net_lock(); - devif_timer(&priv->dev, 0, kinetis_txpoll); + devif_poll(&priv->dev, kinetis_txpoll); net_unlock(); } @@ -1404,7 +1404,7 @@ static void kinetis_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, kinetis_txpoll); + devif_poll(&priv->dev, kinetis_txpoll); } } diff --git a/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c index a09663fe9f5..77fc01e4ebb 100644 --- a/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c +++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c @@ -144,12 +144,6 @@ /* Timing *******************************************************************/ -/* TX poll deley = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define LPC17_40_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define LPC17_40_TXTIMEOUT (60*CLK_TCK) @@ -296,7 +290,6 @@ struct lpc17_40_driver_s uint8_t lp_phyaddr; /* PHY device address */ #endif uint32_t lp_inten; /* Shadow copy of INTEN register */ - struct wdog_s lp_txpoll; /* TX poll timer */ struct wdog_s lp_txtimeout; /* TX timeout timer */ struct work_s lp_txwork; /* TX work continuation */ @@ -371,9 +364,6 @@ static int lpc17_40_interrupt(int irq, void *context, void *arg); static void lpc17_40_txtimeout_work(void *arg); static void lpc17_40_txtimeout_expiry(wdparm_t arg); -static void lpc17_40_poll_work(void *arg); -static void lpc17_40_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ #ifdef CONFIG_NET_ICMPv6 @@ -1440,94 +1430,6 @@ static void lpc17_40_txtimeout_expiry(wdparm_t arg) } } -/**************************************************************************** - * Function: lpc17_40_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void lpc17_40_poll_work(void *arg) -{ - struct lpc17_40_driver_s *priv = (struct lpc17_40_driver_s *)arg; - unsigned int prodidx; - unsigned int considx; - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - net_lock(); - if (lpc17_40_txdesc(priv) == OK) - { - /* If so, update TCP timing states and poll the network layer for new - * XMIT data. Hmmm.. might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->lp_dev, LPC17_40_WDDELAY, lpc17_40_txpoll); - } - - /* Simulate a fake receive to relaunch the data exchanges when a receive - * interrupt has been lost and all the receive buffers are used. - */ - - /* Get the current producer and consumer indices */ - - considx = lpc17_40_getreg(LPC17_40_ETH_RXCONSIDX) & ETH_RXCONSIDX_MASK; - prodidx = lpc17_40_getreg(LPC17_40_ETH_RXPRODIDX) & ETH_RXPRODIDX_MASK; - - if (considx != prodidx) - { - work_queue(ETHWORK, &priv->lp_rxwork, lpc17_40_rxdone_work, - priv, 0); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->lp_txpoll, LPC17_40_WDDELAY, - lpc17_40_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: lpc17_40_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void lpc17_40_poll_expiry(wdparm_t arg) -{ - struct lpc17_40_driver_s *priv = (struct lpc17_40_driver_s *)arg; - - DEBUGASSERT(arg); - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->lp_pollwork, lpc17_40_poll_work, priv, 0); -} - /**************************************************************************** * Function: lpc17_40_ipv6multicast * @@ -1749,11 +1651,6 @@ static int lpc17_40_ifup(struct net_driver_s *dev) regval |= ETH_CMD_TXEN; lpc17_40_putreg(regval, LPC17_40_ETH_CMD); - /* Set and activate a timer process */ - - wd_start(&priv->lp_txpoll, LPC17_40_WDDELAY, - lpc17_40_poll_expiry, (wdparm_t)priv); - /* Finally, make the interface up and enable the Ethernet interrupt at * the interrupt controller */ @@ -1794,9 +1691,8 @@ static int lpc17_40_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(LPC17_40_IRQ_ETH); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->lp_txpoll); wd_cancel(&priv->lp_txtimeout); /* Reset the device and mark it as down. */ @@ -1839,7 +1735,7 @@ static void lpc17_40_txavail_work(void *arg) { /* If so, then poll the network layer for new XMIT data */ - devif_timer(&priv->lp_dev, 0, lpc17_40_txpoll); + devif_poll(&priv->lp_dev, lpc17_40_txpoll); } } diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c index 410d55a6249..412884a7a8d 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.c +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c @@ -210,12 +210,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define LPC43_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define LPC43_TXTIMEOUT (60*CLK_TCK) @@ -512,7 +506,6 @@ struct lpc43_ethmac_s uint8_t ifup : 1; /* true:ifup false:ifdown */ uint8_t mbps100 : 1; /* 100MBps operation (vs 10 MBps) */ uint8_t fduplex : 1; /* Full (vs. half) duplex */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring work to the work queue */ struct work_s pollwork; /* For deferring work to the work queue */ @@ -601,9 +594,6 @@ static int lpc43_interrupt(int irq, void *context, void *arg); static void lpc43_txtimeout_work(void *arg); static void lpc43_txtimeout_expiry(wdparm_t arg); -static void lpc43_poll_work(void *arg); -static void lpc43_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int lpc43_ifup(struct net_driver_s *dev); @@ -1270,7 +1260,7 @@ static void lpc43_dopoll(struct lpc43_ethmac_s *priv) if (dev->d_buf) { - devif_timer(dev, 0, lpc43_txpoll); + devif_poll(dev, lpc43_txpoll); /* We will, most likely end up with a buffer to be freed. But it * might not be the same one that we allocated above. @@ -2129,104 +2119,6 @@ static void lpc43_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, lpc43_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: lpc43_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void lpc43_poll_work(void *arg) -{ - struct lpc43_ethmac_s *priv = (struct lpc43_ethmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if the next TX descriptor is owned by the Ethernet DMA or - * CPU. We cannot perform the TX poll if we are unable to accept - * another packet for transmission. - * - * In a race condition, ETH_TDES0_OWN may be cleared BUT still - * not available because lpc43_freeframe() has not yet run. If - * lpc43_freeframe() has run, the buffer1 pointer (tdes2) will be - * nullified (and inflight should be < CONFIG_LPC43_ETH_NTXDESC). - */ - - net_lock(); - if ((priv->txhead->tdes0 & ETH_TDES0_OWN) == 0 && - priv->txhead->tdes2 == 0) - { - /* If we have the descriptor, then perform the timer poll. Allocate a - * buffer for the poll. - */ - - DEBUGASSERT(dev->d_len == 0 && dev->d_buf == NULL); - dev->d_buf = lpc43_allocbuffer(priv); - - /* We can't poll if we have no buffers */ - - if (dev->d_buf) - { - /* Update TCP timing states and poll for new XMIT data. - */ - - devif_timer(dev, LPC43_WDDELAY, lpc43_txpoll); - - /* We will, most likely end up with a buffer to be freed. But it - * might not be the same one that we allocated above. - */ - - if (dev->d_buf) - { - DEBUGASSERT(dev->d_len == 0); - lpc43_freebuffer(priv, dev->d_buf); - dev->d_buf = NULL; - } - } - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, LPC43_WDDELAY, - lpc43_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: lpc43_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void lpc43_poll_expiry(wdparm_t arg) -{ - struct lpc43_ethmac_s *priv = (struct lpc43_ethmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, lpc43_poll_work, priv, 0); -} - /**************************************************************************** * Function: lpc43_ifup * @@ -2272,11 +2164,6 @@ static int lpc43_ifup(struct net_driver_s *dev) return ret; } - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, LPC43_WDDELAY, - lpc43_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->ifup = true; @@ -2315,9 +2202,8 @@ static int lpc43_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(LPC43M4_IRQ_ETHERNET); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/lpc54xx/lpc54_ethernet.c b/arch/arm/src/lpc54xx/lpc54_ethernet.c index d67881735b1..37ddb9c868b 100644 --- a/arch/arm/src/lpc54xx/lpc54_ethernet.c +++ b/arch/arm/src/lpc54xx/lpc54_ethernet.c @@ -132,12 +132,6 @@ #define ETHWORK LPWORK -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define LPC54_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define LPC54_TXTIMEOUT (60*CLK_TCK) @@ -296,7 +290,6 @@ struct lpc54_ethdriver_s uint8_t eth_fullduplex : 1; /* 1:Full duplex 0:Half duplex mode */ uint8_t eth_100mbps : 1; /* 1:100mbps 0:10mbps */ uint8_t eth_rxdiscard : 1; /* 1:Discarding Rx data */ - struct wdog_s eth_txpoll; /* TX poll timer */ struct wdog_s eth_txtimeout; /* TX timeout timer */ struct work_s eth_irqwork; /* For deferring interrupt work to the work queue */ struct work_s eth_pollwork; /* For deferring poll work to the work queue */ @@ -404,15 +397,11 @@ static int lpc54_mac_interrupt(int irq, void *context, void *arg); /* Watchdog timer expirations */ -static void lpc54_eth_dotimer(struct lpc54_ethdriver_s *priv); static void lpc54_eth_dopoll(struct lpc54_ethdriver_s *priv); static void lpc54_eth_txtimeout_work(void *arg); static void lpc54_eth_txtimeout_expiry(wdparm_t arg); -static void lpc54_eth_poll_work(void *arg); -static void lpc54_eth_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int lpc54_eth_ifup(struct net_driver_s *dev); @@ -1688,73 +1677,6 @@ static void lpc54_eth_txtimeout_expiry(wdparm_t arg) priv, 0); } -/**************************************************************************** - * Name: lpc54_eth_dotimer - * - * Description: - * Check if there are Tx descriptors available and, if so, allocate a Tx - * then perform the normal Tx poll - * - * Input Parameters: - * priv - Reference to the driver state structure - * - * Returned Value: - * None - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void lpc54_eth_dotimer(struct lpc54_ethdriver_s *priv) -{ - struct lpc54_txring_s *txring0; -#ifdef CONFIG_LPC54_ETH_MULTIQUEUE - struct lpc54_txring_s *txring1; -#endif - - DEBUGASSERT(priv->eth_dev.d_buf == NULL); - - txring0 = &priv->eth_txring[0]; -#ifdef CONFIG_LPC54_ETH_MULTIQUEUE - txring1 = &priv->eth_txring[1]; - - /* We cannot perform the Tx poll now if all of the Tx descriptors for both - * channels are in-use. - */ - - if (txring0->tr_inuse < txring0->tr_ndesc && - txring1->tr_inuse < txring1->tr_ndesc) -#else - /* We cannot perform the Tx poll now if all of the Tx descriptors for this - * channel 0 are in-use. - */ - - if (txring0->tr_inuse < txring0->tr_ndesc) -#endif - { - /* There is a free descriptor in the ring, allocate a new Tx buffer - * to perform the poll. - */ - - priv->eth_dev.d_buf = (uint8_t *)lpc54_pktbuf_alloc(priv); - if (priv->eth_dev.d_buf != NULL) - { - devif_timer(&priv->eth_dev, LPC54_WDDELAY, lpc54_eth_txpoll); - - /* Make sure that the Tx buffer remaining after the poll is - * freed. - */ - - if (priv->eth_dev.d_buf != NULL) - { - lpc54_pktbuf_free(priv, (uint32_t *)priv->eth_dev.d_buf); - priv->eth_dev.d_buf = NULL; - } - } - } -} - /**************************************************************************** * Name: lpc54_eth_dopoll * @@ -1807,7 +1729,7 @@ static void lpc54_eth_dopoll(struct lpc54_ethdriver_s *priv) priv->eth_dev.d_buf = (uint8_t *)lpc54_pktbuf_alloc(priv); if (priv->eth_dev.d_buf != NULL) { - devif_timer(&priv->eth_dev, 0, lpc54_eth_txpoll); + devif_poll(&priv->eth_dev, lpc54_eth_txpoll); /* Make sure that the Tx buffer remaining after the poll is * freed. @@ -1822,73 +1744,6 @@ static void lpc54_eth_dopoll(struct lpc54_ethdriver_s *priv) } } -/**************************************************************************** - * Name: lpc54_eth_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Run on a work queue thread. - * - ****************************************************************************/ - -static void lpc54_eth_poll_work(void *arg) -{ - struct lpc54_ethdriver_s *priv = (struct lpc54_ethdriver_s *)arg; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - /* Perform the timer poll */ - - lpc54_eth_dotimer(priv); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->eth_txpoll, LPC54_WDDELAY, - lpc54_eth_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: lpc54_eth_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Runs in the context of a the timer interrupt handler. Local - * interrupts are disabled by the interrupt logic. - * - ****************************************************************************/ - -static void lpc54_eth_poll_expiry(wdparm_t arg) -{ - struct lpc54_ethdriver_s *priv = (struct lpc54_ethdriver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->eth_pollwork, lpc54_eth_poll_work, priv, 0); -} - /**************************************************************************** * Name: lpc54_eth_ifup * @@ -2167,11 +2022,6 @@ static int lpc54_eth_ifup(struct net_driver_s *dev) regval |= ETH_MAC_CONFIG_TE; lpc54_putreg(regval, LPC54_ETH_MAC_CONFIG); - /* Set and activate a timer process */ - - wd_start(&priv->eth_txpoll, LPC54_WDDELAY, - lpc54_eth_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->eth_bifup = 1; @@ -2209,9 +2059,8 @@ static int lpc54_eth_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(LPC54_IRQ_ETHERNET); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->eth_txpoll); wd_cancel(&priv->eth_txtimeout); /* Put the EMAC in its post-reset, non-operational state. This should be diff --git a/arch/arm/src/rtl8720c/amebaz_netdev.c b/arch/arm/src/rtl8720c/amebaz_netdev.c index fb3a8d1cd4e..80812c0a98f 100644 --- a/arch/arm/src/rtl8720c/amebaz_netdev.c +++ b/arch/arm/src/rtl8720c/amebaz_netdev.c @@ -30,20 +30,13 @@ #include #include "amebaz_netdev.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define WDDELAY (1 * CLK_TCK / 2) - /**************************************************************************** * Public Functions ****************************************************************************/ -static void amebaz_poll_work(void *arg); static void amebaz_netdev_notify_tx_done(struct amebaz_dev_s *priv) { - work_queue(LPWORK, &priv->pollwork, amebaz_poll_work, priv, 0); + work_queue(LPWORK, &priv->pollwork, amebaz_txavail_work, priv, 0); } static int amebaz_txpoll(struct net_driver_s *dev) @@ -222,12 +215,6 @@ void amebaz_netdev_notify_receive(struct amebaz_dev_s *priv, net_unlock(); } -static void amebaz_poll_expiry(wdparm_t arg) -{ - struct amebaz_dev_s *priv = (struct amebaz_dev_s *)arg; - work_queue(LPWORK, &priv->pollwork, amebaz_poll_work, priv, 0); -} - static void amebaz_txavail_work(void *arg) { struct amebaz_dev_s *priv = (struct amebaz_dev_s *)arg; @@ -247,40 +234,13 @@ static void amebaz_txavail_work(void *arg) if (priv->dev.d_buf) { - devif_timer(&priv->dev, 0, amebaz_txpoll); + devif_poll(&priv->dev, amebaz_txpoll); } } net_unlock(); } -static void amebaz_poll_work(void *arg) -{ - struct amebaz_dev_s *priv = (struct amebaz_dev_s *)arg; - struct net_driver_s *dev = &priv->dev; - net_lock(); - if (IFF_IS_UP(dev->d_flags)) - { - if (!priv->curr && rltk_wlan_check_isup(priv->devnum)) - { - priv->curr = rltk_wlan_alloc_skb(MAX_NETDEV_PKTSIZE); - if (priv->curr) - { - priv->dev.d_buf = priv->curr->tail; - priv->dev.d_len = 0; - } - } - - if (priv->dev.d_buf) - { - devif_timer(&priv->dev, WDDELAY, amebaz_txpoll); - } - } - - wd_start(&priv->txpoll, WDDELAY, amebaz_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - static int amebaz_txavail(struct net_driver_s *dev) { struct amebaz_dev_s *priv = (struct amebaz_dev_s *)dev->d_private; @@ -365,7 +325,6 @@ static int amebaz_ifup(struct net_driver_s *dev) { priv->mode = RTW_MODE_NONE; priv->conn.status = AMEBAZ_STATUS_DISABLED; - wd_start(&priv->txpoll, WDDELAY, amebaz_poll_expiry, (wdparm_t)dev); } return OK; @@ -393,7 +352,6 @@ static int amebaz_ifdown(struct net_driver_s *dev) priv->curr = NULL; } - wd_cancel(&priv->txpoll); if (priv->devnum == 0) { rltk_wlan_deinit(); diff --git a/arch/arm/src/s32k1xx/s32k1xx_enet.c b/arch/arm/src/s32k1xx/s32k1xx_enet.c index 28cae558c71..01ccde7e005 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_enet.c +++ b/arch/arm/src/s32k1xx/s32k1xx_enet.c @@ -123,12 +123,6 @@ # error Write back D-Cache not yet supported #endif -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per - * second. - */ - -#define S32K1XX_WDDELAY (1*CLK_TCK) - /* Align assuming that the D-Cache is enabled (probably 32-bytes). * * REVISIT: The size of descriptors and buffers must also be in even units @@ -258,7 +252,6 @@ struct s32k1xx_driver_s uint8_t txhead; /* The next TX descriptor to use */ uint8_t rxtail; /* The next RX descriptor to use */ uint8_t phyaddr; /* Selected PHY address */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -332,9 +325,6 @@ static int s32k1xx_enet_interrupt(int irq, void *context, static void s32k1xx_txtimeout_work(void *arg); static void s32k1xx_txtimeout_expiry(wdparm_t arg); -static void s32k1xx_poll_work(void *arg); -static void s32k1xx_polltimer_expiry(wdparm_t arg); - /* NuttX callback functions */ static int s32k1xx_ifup(struct net_driver_s *dev); @@ -1196,76 +1186,6 @@ static void s32k1xx_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, s32k1xx_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: s32k1xx_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void s32k1xx_poll_work(void *arg) -{ - struct s32k1xx_driver_s *priv = (struct s32k1xx_driver_s *)arg; - - /* Check if there is there is a transmission in progress. We cannot - * perform the TX poll if he are unable to accept another packet for - * transmission. - */ - - net_lock(); - if (!s32k1xx_txringfull(priv)) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. Hmmm.. might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->dev, S32K1XX_WDDELAY, s32k1xx_txpoll); - } - - /* Setup the watchdog poll timer again in any case */ - - wd_start(&priv->txpoll, S32K1XX_WDDELAY, - s32k1xx_polltimer_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: s32k1xx_polltimer_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void s32k1xx_polltimer_expiry(wdparm_t arg) -{ - struct s32k1xx_driver_s *priv = (struct s32k1xx_driver_s *)arg; - - /* Schedule to perform the poll processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, s32k1xx_poll_work, priv, 0); -} - /**************************************************************************** * Function: s32k1xx_ifup_action * @@ -1364,11 +1284,6 @@ static int s32k1xx_ifup_action(struct net_driver_s *dev, bool resetphy) putreg32(ENET_RDAR, S32K1XX_ENET_RDAR); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, S32K1XX_WDDELAY, - s32k1xx_polltimer_expiry, (wdparm_t)priv); - /* Clear all pending ENET interrupt */ putreg32(RX_INTERRUPTS | ERROR_INTERRUPTS | TX_INTERRUPTS, @@ -1452,9 +1367,8 @@ static int s32k1xx_ifdown(struct net_driver_s *dev) up_disable_irq(S32K1XX_IRQ_ENET_RXDONE); putreg32(0, S32K1XX_ENET_EIMR); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be @@ -1507,7 +1421,7 @@ static void s32k1xx_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, s32k1xx_txpoll); + devif_poll(&priv->dev, s32k1xx_txpoll); } } diff --git a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c index 535f6fdd099..5b6d2f9b5e6 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c +++ b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c @@ -1049,7 +1049,7 @@ static void s32k1xx_txdone_work(void *arg) */ net_lock(); - devif_timer(&priv->dev, 0, s32k1xx_txpoll); + devif_poll(&priv->dev, s32k1xx_txpoll); net_unlock(); } @@ -1406,7 +1406,7 @@ static void s32k1xx_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, s32k1xx_txpoll); + devif_poll(&priv->dev, s32k1xx_txpoll); } } diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index 18d1275f3d5..7bae2ab8b09 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -214,12 +214,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SAM_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define SAM_TXTIMEOUT (60*CLK_TCK) @@ -245,7 +239,6 @@ struct sam_emac_s { uint8_t ifup : 1; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -369,9 +362,6 @@ static int sam_emac_interrupt(int irq, void *context, void *arg); static void sam_txtimeout_work(void *arg); static void sam_txtimeout_expiry(wdparm_t arg); -static void sam_poll_work(void *arg); -static void sam_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int sam_ifup(struct net_driver_s *dev); @@ -935,7 +925,7 @@ static void sam_dopoll(struct sam_emac_s *priv) * then poll the network for new XMIT data. */ - devif_timer(dev, 0, sam_txpoll); + devif_poll(dev, sam_txpoll); } } @@ -1731,72 +1721,6 @@ static void sam_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, sam_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: sam_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void sam_poll_work(void *arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if there are any free TX descriptors. We cannot perform the - * TX poll if we do not have buffering for another packet. - */ - - net_lock(); - if (sam_txfree(priv) > 0) - { - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(dev, SAM_WDDELAY, sam_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: sam_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void sam_poll_expiry(wdparm_t arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, sam_poll_work, priv, 0); -} - /**************************************************************************** * Function: sam_ifup * @@ -1865,10 +1789,6 @@ static int sam_ifup(struct net_driver_s *dev) ninfo("Enable normal operation\n"); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - /* Enable the EMAC interrupt */ priv->ifup = true; @@ -1904,9 +1824,8 @@ static int sam_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(SAM_IRQ_EMAC); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c index da1d228e230..413d3ee4e75 100644 --- a/arch/arm/src/sama5/sam_emaca.c +++ b/arch/arm/src/sama5/sam_emaca.c @@ -245,12 +245,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SAM_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define SAM_TXTIMEOUT (60*CLK_TCK) @@ -276,7 +270,6 @@ struct sam_emac_s { uint8_t ifup : 1; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -400,9 +393,6 @@ static int sam_emac_interrupt(int irq, void *context, void *arg); static void sam_txtimeout_work(void *arg); static void sam_txtimeout_expiry(wdparm_t arg); -static void sam_poll_work(void *arg); -static void sam_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int sam_ifup(struct net_driver_s *dev); @@ -970,7 +960,7 @@ static void sam_dopoll(struct sam_emac_s *priv) * then poll the network for new XMIT data. */ - devif_timer(dev, 0, sam_txpoll); + devif_poll(dev, sam_txpoll); } } @@ -1792,72 +1782,6 @@ static void sam_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, sam_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: sam_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void sam_poll_work(void *arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if there are any free TX descriptors. We cannot perform the - * TX poll if we do not have buffering for another packet. - */ - - net_lock(); - if (sam_txfree(priv) > 0) - { - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(dev, SAM_WDDELAY, sam_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: sam_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void sam_poll_expiry(wdparm_t arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, sam_poll_work, priv, 0); -} - /**************************************************************************** * Function: sam_ifup * @@ -1926,10 +1850,6 @@ static int sam_ifup(struct net_driver_s *dev) ninfo("Enable normal operation\n"); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - /* Enable the EMAC interrupt */ priv->ifup = true; @@ -1965,9 +1885,8 @@ static int sam_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(SAM_IRQ_EMAC); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index 1b4f75c3daa..d473e5fe26b 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -292,12 +292,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SAM_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define SAM_TXTIMEOUT (60*CLK_TCK) @@ -386,7 +380,6 @@ struct sam_emacattr_s struct sam_emac_s { uint8_t ifup : 1; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -466,9 +459,6 @@ static int sam_emac_interrupt(int irq, void *context, void *arg); static void sam_txtimeout_work(void *arg); static void sam_txtimeout_expiry(wdparm_t arg); -static void sam_poll_work(void *arg); -static void sam_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int sam_ifup(struct net_driver_s *dev); @@ -1283,7 +1273,7 @@ static void sam_dopoll(struct sam_emac_s *priv) * then poll the network for new XMIT data. */ - devif_timer(dev, 0, sam_txpoll); + devif_poll(dev, sam_txpoll); } } @@ -2129,72 +2119,6 @@ static void sam_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, sam_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: sam_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void sam_poll_work(void *arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if there are any free TX descriptors. We cannot perform the - * TX poll if we do not have buffering for another packet. - */ - - net_lock(); - if (sam_txfree(priv) > 0) - { - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(dev, SAM_WDDELAY, sam_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: sam_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void sam_poll_expiry(wdparm_t arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, sam_poll_work, priv, 0); -} - /**************************************************************************** * Function: sam_ifup * @@ -2271,10 +2195,6 @@ static int sam_ifup(struct net_driver_s *dev) ninfo("Enable normal operation\n"); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - /* Enable the EMAC interrupt */ priv->ifup = true; @@ -2310,9 +2230,8 @@ static int sam_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(priv->attr->irq); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c index e52347e5c1f..0e056bc6172 100644 --- a/arch/arm/src/sama5/sam_gmac.c +++ b/arch/arm/src/sama5/sam_gmac.c @@ -171,12 +171,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SAM_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define SAM_TXTIMEOUT (60*CLK_TCK) @@ -202,7 +196,6 @@ struct sam_gmac_s { uint8_t ifup : 1; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -325,9 +318,6 @@ static int sam_gmac_interrupt(int irq, void *context, void *arg); static void sam_txtimeout_work(void *arg); static void sam_txtimeout_expiry(wdparm_t arg); -static void sam_poll_work(void *arg); -static void sam_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int sam_ifup(struct net_driver_s *dev); @@ -912,7 +902,7 @@ static void sam_dopoll(struct sam_gmac_s *priv) * then poll the network for new XMIT data. */ - devif_timer(dev, 0, sam_txpoll); + devif_poll(dev, sam_txpoll); } } @@ -1776,72 +1766,6 @@ static void sam_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, sam_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: sam_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void sam_poll_work(void *arg) -{ - struct sam_gmac_s *priv = (struct sam_gmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if there are any free TX descriptors. We cannot perform the - * TX poll if we do not have buffering for another packet. - */ - - net_lock(); - if (sam_txfree(priv) > 0) - { - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(dev, SAM_WDDELAY, sam_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: sam_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void sam_poll_expiry(wdparm_t arg) -{ - struct sam_gmac_s *priv = (struct sam_gmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, sam_poll_work, priv, 0); -} - /**************************************************************************** * Function: sam_ifup * @@ -1913,10 +1837,6 @@ static int sam_ifup(struct net_driver_s *dev) ninfo("Enable normal operation\n"); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - /* Enable the GMAC interrupt */ priv->ifup = true; @@ -1952,9 +1872,8 @@ static int sam_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(SAM_IRQ_GMAC); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the GMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/samd5e5/sam_gmac.c b/arch/arm/src/samd5e5/sam_gmac.c index f39d5fbf721..e05adcf4da0 100644 --- a/arch/arm/src/samd5e5/sam_gmac.c +++ b/arch/arm/src/samd5e5/sam_gmac.c @@ -168,12 +168,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SAM_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define SAM_TXTIMEOUT (60*CLK_TCK) @@ -199,7 +193,6 @@ struct sam_gmac_s { uint8_t ifup : 1; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -322,9 +315,6 @@ static int sam_gmac_interrupt(int irq, void *context, void *arg); static void sam_txtimeout_work(void *arg); static void sam_txtimeout_expiry(wdparm_t arg); -static void sam_poll_work(void *arg); -static void sam_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int sam_ifup(struct net_driver_s *dev); @@ -900,7 +890,7 @@ static void sam_dopoll(struct sam_gmac_s *priv) * then poll the network for new XMIT data. */ - devif_timer(dev, 0, sam_txpoll); + devif_poll(dev, sam_txpoll); } } @@ -1741,72 +1731,6 @@ static void sam_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, sam_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: sam_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void sam_poll_work(void *arg) -{ - struct sam_gmac_s *priv = (struct sam_gmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if there are any free TX descriptors. We cannot perform the - * TX poll if we do not have buffering for another packet. - */ - - net_lock(); - if (sam_txfree(priv) > 0) - { - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(dev, sam_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: sam_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void sam_poll_expiry(wdparm_t arg) -{ - struct sam_gmac_s *priv = (struct sam_gmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, sam_poll_work, priv, 0); -} - /**************************************************************************** * Function: sam_ifup * @@ -1876,10 +1800,6 @@ static int sam_ifup(struct net_driver_s *dev) ninfo("Enable normal operation\n"); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - /* Enable the GMAC interrupt */ priv->ifup = true; @@ -1915,9 +1835,8 @@ static int sam_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(SAM_IRQ_GMAL); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the GMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index 59b7518d0cc..b34eb080ef3 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -388,12 +388,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SAM_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define SAM_TXTIMEOUT (60*CLK_TCK) @@ -505,7 +499,6 @@ struct sam_queue_s struct sam_emac_s { uint8_t ifup : 1; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring work to the work queue */ struct work_s pollwork; /* For deferring work to the work queue */ @@ -582,9 +575,6 @@ static int sam_emac_interrupt(int irq, void *context, void *arg); static void sam_txtimeout_work(void *arg); static void sam_txtimeout_expiry(wdparm_t arg); -static void sam_poll_work(void *arg); -static void sam_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int sam_ifup(struct net_driver_s *dev); @@ -1593,7 +1583,7 @@ static void sam_dopoll(struct sam_emac_s *priv, int qid) * then poll the network for new XMIT data. */ - devif_timer(dev, 0, sam_txpoll); + devif_poll(dev, sam_txpoll); } } @@ -2594,72 +2584,6 @@ static void sam_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, sam_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: sam_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void sam_poll_work(void *arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if there are any free TX descriptors. We cannot perform the - * TX poll if we do not have buffering for another packet. - */ - - net_lock(); - if (sam_txfree(priv, EMAC_QUEUE_0) > 0) - { - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(dev, SAM_WDDELAY, sam_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: sam_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void sam_poll_expiry(wdparm_t arg) -{ - struct sam_emac_s *priv = (struct sam_emac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, sam_poll_work, priv, 0); -} - /**************************************************************************** * Function: sam_ifup * @@ -2747,10 +2671,6 @@ static int sam_ifup(struct net_driver_s *dev) ninfo("Enable normal operation\n"); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, SAM_WDDELAY, sam_poll_expiry, (wdparm_t)priv); - /* Enable the EMAC interrupt */ priv->ifup = true; @@ -2786,9 +2706,8 @@ static int sam_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(priv->attr->irq); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/stm32/stm32_can_sock.c b/arch/arm/src/stm32/stm32_can_sock.c index 6125f64a021..7dc688aeeb1 100644 --- a/arch/arm/src/stm32/stm32_can_sock.c +++ b/arch/arm/src/stm32/stm32_can_sock.c @@ -1083,7 +1083,7 @@ static void stm32can_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, stm32can_txpoll); + devif_poll(&priv->dev, stm32can_txpoll); } } @@ -1511,7 +1511,7 @@ static void stm32can_txdone_work(void *arg) */ net_lock(); - devif_timer(&priv->dev, 0, stm32can_txpoll); + devif_poll(&priv->dev, stm32can_txpoll); net_unlock(); } diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index 7064e70f5c9..72eb3097345 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -292,12 +292,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define STM32_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define STM32_TXTIMEOUT (60*CLK_TCK) @@ -623,7 +617,6 @@ struct stm32_ethmac_s uint8_t ifup : 1; /* true:ifup false:ifdown */ uint8_t mbps100 : 1; /* 100MBps operation (vs 10 MBps) */ uint8_t fduplex : 1; /* Full (vs. half) duplex */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -712,9 +705,6 @@ static int stm32_interrupt(int irq, void *context, void *arg); static void stm32_txtimeout_work(void *arg); static void stm32_txtimeout_expiry(wdparm_t arg); -static void stm32_poll_work(void *arg); -static void stm32_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int stm32_ifup(struct net_driver_s *dev); @@ -1386,7 +1376,7 @@ static void stm32_dopoll(struct stm32_ethmac_s *priv) if (dev->d_buf) { - devif_timer(dev, 0, stm32_txpoll); + devif_poll(dev, stm32_txpoll); /* We will, most likely end up with a buffer to be freed. But it * might not be the same one that we allocated above. @@ -2255,104 +2245,6 @@ static void stm32_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, stm32_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: stm32_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void stm32_poll_work(void *arg) -{ - struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if the next TX descriptor is owned by the Ethernet DMA or - * CPU. We cannot perform the TX poll if we are unable to accept - * another packet for transmission. - * - * In a race condition, ETH_TDES0_OWN may be cleared BUT still - * not available because stm32_freeframe() has not yet run. If - * stm32_freeframe() has run, the buffer1 pointer (tdes2) will be - * nullified (and inflight should be < CONFIG_STM32_ETH_NTXDESC). - */ - - net_lock(); - if ((priv->txhead->tdes0 & ETH_TDES0_OWN) == 0 && - priv->txhead->tdes2 == 0) - { - /* If we have the descriptor, then perform the timer poll. Allocate a - * buffer for the poll. - */ - - DEBUGASSERT(dev->d_len == 0 && dev->d_buf == NULL); - dev->d_buf = stm32_allocbuffer(priv); - - /* We can't poll if we have no buffers */ - - if (dev->d_buf) - { - /* Update TCP timing states and poll the network for new XMIT data. - */ - - devif_timer(dev, STM32_WDDELAY, stm32_txpoll); - - /* We will, most likely end up with a buffer to be freed. But it - * might not be the same one that we allocated above. - */ - - if (dev->d_buf) - { - DEBUGASSERT(dev->d_len == 0); - stm32_freebuffer(priv, dev->d_buf); - dev->d_buf = NULL; - } - } - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: stm32_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void stm32_poll_expiry(wdparm_t arg) -{ - struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, stm32_poll_work, priv, 0); -} - /**************************************************************************** * Function: stm32_ifup * @@ -2399,11 +2291,6 @@ static int stm32_ifup(struct net_driver_s *dev) return ret; } - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->ifup = true; @@ -2444,9 +2331,8 @@ static int stm32_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(STM32_IRQ_ETH); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/stm32/stm32_fdcan_sock.c b/arch/arm/src/stm32/stm32_fdcan_sock.c index a2c2ee6551b..4f1c417d889 100644 --- a/arch/arm/src/stm32/stm32_fdcan_sock.c +++ b/arch/arm/src/stm32/stm32_fdcan_sock.c @@ -1981,7 +1981,7 @@ static void fdcan_txdone_work(void *arg) */ net_lock(); - devif_timer(&priv->dev, 0, fdcan_txpoll); + devif_poll(&priv->dev, fdcan_txpoll); net_unlock(); } @@ -3105,7 +3105,7 @@ static void fdcan_txavail_work(void *arg) * new XMIT data. */ - devif_timer(&priv->dev, 0, fdcan_txpoll); + devif_poll(&priv->dev, fdcan_txpoll); } } diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c b/arch/arm/src/stm32f7/stm32_ethernet.c index 04744dbaec6..ceca359a997 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.c +++ b/arch/arm/src/stm32f7/stm32_ethernet.c @@ -289,12 +289,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define STM32_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define STM32_TXTIMEOUT (60*CLK_TCK) @@ -626,7 +620,6 @@ struct stm32_ethmac_s uint8_t mbps100 : 1; /* 100MBps operation (vs 10 MBps) */ uint8_t fduplex : 1; /* Full (vs. half) duplex */ uint8_t intf; /* Ethernet interface number */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -732,9 +725,6 @@ static int stm32_interrupt(int irq, void *context, void *arg); static void stm32_txtimeout_work(void *arg); static void stm32_txtimeout_expiry(wdparm_t arg); -static void stm32_poll_work(void *arg); -static void stm32_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int stm32_ifup(struct net_driver_s *dev); @@ -1428,7 +1418,7 @@ static void stm32_dopoll(struct stm32_ethmac_s *priv) if (dev->d_buf) { - devif_timer(dev, 0, stm32_txpoll); + devif_poll(dev, stm32_txpoll); /* We will, most likely end up with a buffer to be freed. But it * might not be the same one that we allocated above. @@ -2352,112 +2342,6 @@ static void stm32_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, stm32_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: stm32_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void stm32_poll_work(void *arg) -{ - struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if the next TX descriptor is owned by the Ethernet DMA or - * CPU. We cannot perform the TX poll if we are unable to accept - * another packet for transmission. - * - * In a race condition, ETH_TDES0_OWN may be cleared BUT still - * not available because stm32_freeframe() has not yet run. If - * stm32_freeframe() has run, the buffer1 pointer (tdes2) will be - * nullified (and inflight should be < CONFIG_STM32F7_ETH_NTXDESC). - */ - - net_lock(); - if ((priv->txhead->tdes0 & ETH_TDES0_OWN) == 0 && - priv->txhead->tdes2 == 0) - { - /* If we have the descriptor, then perform the timer poll. Allocate a - * buffer for the poll. - */ - - DEBUGASSERT(dev->d_len == 0 && dev->d_buf == NULL); - dev->d_buf = stm32_allocbuffer(priv); - - /* We can't poll if we have no buffers */ - - if (dev->d_buf) - { - /* Update TCP timing states and poll the network for new XMIT data. - */ - - devif_timer(dev, STM32_WDDELAY, stm32_txpoll); - - /* We will, most likely end up with a buffer to be freed. But it - * might not be the same one that we allocated above. - */ - - if (dev->d_buf) - { - DEBUGASSERT(dev->d_len == 0); - stm32_freebuffer(priv, dev->d_buf); - dev->d_buf = NULL; - } - } - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: stm32_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void stm32_poll_expiry(wdparm_t arg) -{ - struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - if (work_available(&priv->pollwork)) - { - work_queue(ETHWORK, &priv->pollwork, stm32_poll_work, priv, 0); - } - else - { - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - } -} - /**************************************************************************** * Function: stm32_ifup * @@ -2502,11 +2386,6 @@ static int stm32_ifup(struct net_driver_s *dev) return ret; } - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->ifup = true; @@ -2544,9 +2423,8 @@ static int stm32_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(STM32_IRQ_ETH); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/stm32h7/stm32_ethernet.c b/arch/arm/src/stm32h7/stm32_ethernet.c index c7206ea2e95..4c131f5a624 100644 --- a/arch/arm/src/stm32h7/stm32_ethernet.c +++ b/arch/arm/src/stm32h7/stm32_ethernet.c @@ -277,12 +277,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define STM32_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define STM32_TXTIMEOUT (60*CLK_TCK) @@ -625,7 +619,6 @@ struct stm32_ethmac_s uint8_t mbps100 : 1; /* 100MBps operation (vs 10 MBps) */ uint8_t fduplex : 1; /* Full (vs. half) duplex */ uint8_t intf; /* Ethernet interface number */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -734,9 +727,6 @@ static int stm32_interrupt(int irq, void *context, void *arg); static void stm32_txtimeout_work(void *arg); static void stm32_txtimeout_expiry(wdparm_t arg); -static void stm32_poll_work(void *arg); -static void stm32_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int stm32_ifup(struct net_driver_s *dev); @@ -1464,7 +1454,7 @@ static void stm32_dopoll(struct stm32_ethmac_s *priv) if (dev->d_buf) { - devif_timer(dev, 0, stm32_txpoll); + devif_poll(dev, stm32_txpoll); /* We will, most likely end up with a buffer to be freed. But it * might not be the same one that we allocated above. @@ -2462,115 +2452,6 @@ static void stm32_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, stm32_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: stm32_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void stm32_poll_work(void *arg) -{ - struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if the next TX descriptor is owned by the Ethernet DMA or - * CPU. We cannot perform the timer poll if we are unable to accept - * another packet for transmission. Hmmm.. might be bug here. - * Does this mean if there is a transmit in progress, we will miss - * TCP time state updates? - * - * In a race condition, ETH_TDES3_OWN may be cleared BUT still - * not available because stm32_freeframe() has not yet run. If - * stm32_freeframe() has run, the buffer1 pointer (des2) will be - * nullified (and inflight should be < CONFIG_STM32H7_ETH_NTXDESC). - */ - - net_lock(); - if ((priv->txhead->des3 & ETH_TDES3_RD_OWN) == 0 && - priv->txhead->des0 == 0) - { - /* If we have the descriptor, then perform the timer poll. Allocate a - * buffer for the poll. - */ - - DEBUGASSERT(dev->d_len == 0 && dev->d_buf == NULL); - dev->d_buf = stm32_allocbuffer(priv); - - /* We can't poll if we have no buffers */ - - if (dev->d_buf) - { - /* Update TCP timing states and poll the network for new XMIT - * data. - */ - - devif_timer(dev, STM32_WDDELAY, stm32_txpoll); - - /* We will, most likely end up with a buffer to be freed. But it - * might not be the same one that we allocated above. - */ - - if (dev->d_buf) - { - DEBUGASSERT(dev->d_len == 0); - stm32_freebuffer(priv, dev->d_buf); - dev->d_buf = NULL; - } - } - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: stm32_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void stm32_poll_expiry(wdparm_t arg) -{ - struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - if (work_available(&priv->pollwork)) - { - work_queue(ETHWORK, &priv->pollwork, stm32_poll_work, priv, 0); - } - else - { - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - } -} - /**************************************************************************** * Function: stm32_ifup * @@ -2613,11 +2494,6 @@ static int stm32_ifup(struct net_driver_s *dev) return ret; } - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, STM32_WDDELAY, - stm32_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->ifup = true; @@ -2655,9 +2531,8 @@ static int stm32_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(STM32_IRQ_ETH); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/arm/src/tiva/lm/lm3s_ethernet.c b/arch/arm/src/tiva/lm/lm3s_ethernet.c index fc8a4474580..0933e1944e4 100644 --- a/arch/arm/src/tiva/lm/lm3s_ethernet.c +++ b/arch/arm/src/tiva/lm/lm3s_ethernet.c @@ -154,12 +154,6 @@ # define tiva_dumppacket(m,a,n) #endif -/* TX poll deley = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define TIVA_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define TIVA_TXTIMEOUT (60*CLK_TCK) @@ -190,7 +184,6 @@ struct tiva_driver_s #endif bool ld_bifup; /* true:ifup false:ifdown */ - struct wdog_s ld_txpoll; /* TX poll timer */ struct wdog_s ld_txtimeout; /* TX timeout timer */ struct work_s ld_irqwork; /* For deferring interrupt work to the work queue */ struct work_s ld_pollwork; /* For deferring poll work to the work queue */ @@ -254,9 +247,6 @@ static int tiva_interrupt(int irq, void *context, void *arg); static void tiva_txtimeout_work(void *arg); static void tiva_txtimeout_expiry(wdparm_t arg); -static void tiva_poll_work(void *arg); -static void tiva_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int tiva_ifup(struct net_driver_s *dev); @@ -1187,79 +1177,6 @@ static void tiva_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->ld_irqwork, tiva_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: tiva_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void tiva_poll_work(void *arg) -{ - struct tiva_driver_s *priv = (struct tiva_driver_s *)arg; - - /* Check if we can send another Tx packet now. The NEWTX bit initiates an - * Ethernet transmission once the packet has been placed in the TX FIFO. - * This bit is cleared once the transmission has been completed. - * - * NOTE: This can cause missing poll cycles and, hence, some timing - * inaccuracies. - */ - - net_lock(); - if ((tiva_ethin(priv, TIVA_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. - */ - - devif_timer(&priv->ld_dev, TIVA_WDDELAY, tiva_txpoll); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->ld_txpoll, TIVA_WDDELAY, - tiva_poll_expiry, (wdparm_t)priv); - } - - net_unlock(); -} - -/**************************************************************************** - * Function: tiva_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void tiva_poll_expiry(wdparm_t arg) -{ - struct tiva_driver_s *priv = (struct tiva_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->ld_pollwork, tiva_poll_work, priv, 0); -} - /**************************************************************************** * Function: tiva_ifup * @@ -1413,11 +1330,6 @@ static int tiva_ifup(struct net_driver_s *dev) (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[4]; tiva_ethout(priv, TIVA_MAC_IA1_OFFSET, regval); - /* Set and activate a timer process */ - - wd_start(&priv->ld_txpoll, TIVA_WDDELAY, - tiva_poll_expiry, (wdparm_t)priv); - priv->ld_bifup = true; leave_critical_section(flags); return OK; @@ -1452,10 +1364,9 @@ static int tiva_ifdown(struct net_driver_s *dev) (int)((dev->d_ipaddr >> 16) & 0xff), (int)(dev->d_ipaddr >> 24)); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ flags = enter_critical_section(); - wd_cancel(&priv->ld_txpoll); wd_cancel(&priv->ld_txtimeout); /* Disable the Ethernet interrupt */ @@ -1545,7 +1456,7 @@ static void tiva_txavail_work(void *arg) * network for new Tx data */ - devif_timer(&priv->ld_dev, 0, tiva_txpoll); + devif_poll(&priv->ld_dev, tiva_txpoll); } net_unlock(); diff --git a/arch/arm/src/tiva/tm4c/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c/tm4c_ethernet.c index 6f0df4a5bc1..6f55d1256a7 100644 --- a/arch/arm/src/tiva/tm4c/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c/tm4c_ethernet.c @@ -261,12 +261,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define TIVA_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define TIVA_TXTIMEOUT (60*CLK_TCK) @@ -629,7 +623,6 @@ struct tiva_ethmac_s uint8_t ifup : 1; /* true:ifup false:ifdown */ uint8_t mbps100 : 1; /* 100MBps operation (vs 10 MBps) */ uint8_t fduplex : 1; /* Full (vs. half) duplex */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -722,9 +715,6 @@ static int tiva_interrupt(int irq, void *context, void *arg); static void tiva_txtimeout_work(void *arg); static void tiva_txtimeout_expiry(wdparm_t arg); -static void tiva_poll_work(void *arg); -static void tiva_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int tiva_ifup(struct net_driver_s *dev); @@ -1386,7 +1376,7 @@ static void tiva_dopoll(struct tiva_ethmac_s *priv) if (dev->d_buf) { - devif_timer(dev, 0, tiva_txpoll); + devif_poll(dev, tiva_txpoll); /* We will, most likely end up with a buffer to be freed. But it * might not be the same one that we allocated above. @@ -2248,104 +2238,6 @@ static void tiva_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, tiva_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: tiva_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void tiva_poll_work(void *arg) -{ - struct tiva_ethmac_s *priv = (struct tiva_ethmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if the next TX descriptor is owned by the Ethernet DMA or - * CPU. We cannot perform the TX poll if we are unable to accept - * another packet for transmission. - * - * In a race condition, EMAC_TDES0_OWN may be cleared BUT still - * not available because tiva_freeframe() has not yet run. If - * tiva_freeframe() has run, the buffer1 pointer (tdes2) will be - * nullified (and inflight should be < CONFIG_TIVA_EMAC_NTXDESC). - */ - - net_lock(); - if ((priv->txhead->tdes0 & EMAC_TDES0_OWN) == 0 && - priv->txhead->tdes2 == 0) - { - /* If we have the descriptor, then perform the timer poll. Allocate a - * buffer for the poll. - */ - - DEBUGASSERT(dev->d_len == 0 && dev->d_buf == NULL); - dev->d_buf = tiva_allocbuffer(priv); - - /* We can't poll if we have no buffers */ - - if (dev->d_buf) - { - /* Update TCP timing states and poll the network for new XMIT data. - */ - - devif_timer(dev, TIVA_WDDELAY, tiva_txpoll); - - /* We will, most likely end up with a buffer to be freed. But it - * might not be the same one that we allocated above. - */ - - if (dev->d_buf) - { - DEBUGASSERT(dev->d_len == 0); - tiva_freebuffer(priv, dev->d_buf); - dev->d_buf = NULL; - } - } - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, TIVA_WDDELAY, - tiva_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: tiva_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void tiva_poll_expiry(wdparm_t arg) -{ - struct tiva_ethmac_s *priv = (struct tiva_ethmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, tiva_poll_work, priv, 0); -} - /**************************************************************************** * Function: tiva_ifup * @@ -2391,11 +2283,6 @@ static int tiva_ifup(struct net_driver_s *dev) return ret; } - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, TIVA_WDDELAY, - tiva_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->ifup = true; @@ -2434,9 +2321,8 @@ static int tiva_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(TIVA_IRQ_ETHCON); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the EMAC in its reset, non-operational state. This should be diff --git a/arch/hc/src/m9s12/m9s12_ethernet.c b/arch/hc/src/m9s12/m9s12_ethernet.c index a9d17e6b21e..6d4362deed3 100644 --- a/arch/hc/src/m9s12/m9s12_ethernet.c +++ b/arch/hc/src/m9s12/m9s12_ethernet.c @@ -57,12 +57,6 @@ # define CONFIG_HCS12_NINTERFACES 1 #endif -/* TX poll deley = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define HCS12_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define HCS12_TXTIMEOUT (60*CLK_TCK) @@ -82,7 +76,6 @@ struct emac_driver_s { bool d_bifup; /* true:ifup false:ifdown */ - struct wdog_s d_txpoll; /* TX poll timer */ struct wdog_s d_txtimeout; /* TX timeout timer */ /* This holds the information visible to the NuttX network */ @@ -119,7 +112,6 @@ static int emac_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ -static void emac_polltimer(wdparm_t arg); static void emac_txtimeout(wdparm_t arg); /* NuttX callback functions */ @@ -490,43 +482,6 @@ static void emac_txtimeout(wdparm_t arg) devif_poll(&priv->d_dev, emac_txpoll); } -/**************************************************************************** - * Function: emac_polltimer - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void emac_polltimer(wdparm_t arg) -{ - FAR struct emac_driver_s *priv = (FAR struct emac_driver_s *)arg; - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - /* If so, update TCP timing states and poll the network for new XMIT data. - * Hmmm.. might be bug here. Does this mean if there is a transmit in - * progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->d_dev, HCS12_WDDELAY, emac_txpoll); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->d_txpoll, HCS12_WDDELAY, emac_polltimer, (wdparm_t)arg); -} - /**************************************************************************** * Function: emac_ifup * @@ -555,11 +510,6 @@ static int emac_ifup(struct net_driver_s *dev) /* Initialize PHYs, Ethernet interface, and setup up Ethernet interrupts */ - /* Set and activate a timer process */ - - wd_start(&priv->d_txpoll, HCS12_WDDELAY, - emac_polltimer, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->d_bifup = true; @@ -594,9 +544,8 @@ static int emac_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(CONFIG_HCS12_IRQ); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->d_txpoll); wd_cancel(&priv->d_txtimeout); /* Put the EMAC is its reset, non-operational state. This should be @@ -650,7 +599,7 @@ static int emac_txavail(struct net_driver_s *dev) /* If so, then poll the network for new XMIT data */ - devif_timer(&priv->d_dev, 0, emac_txpoll); + devif_poll(&priv->d_dev, emac_txpoll); } leave_critical_section(flags); diff --git a/arch/mips/src/pic32mx/pic32mx_ethernet.c b/arch/mips/src/pic32mx/pic32mx_ethernet.c index 938141b8cc9..5544b5fb1c1 100644 --- a/arch/mips/src/pic32mx/pic32mx_ethernet.c +++ b/arch/mips/src/pic32mx/pic32mx_ethernet.c @@ -161,12 +161,6 @@ /* Timing *******************************************************************/ -/* TX poll deley = 1 seconds. CLK_TCK is the number of clock ticks per - * second - */ - -#define PIC32MX_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define PIC32MX_TXTIMEOUT (60*CLK_TCK) @@ -314,7 +308,6 @@ struct pic32mx_driver_s #endif uint8_t pd_txnext; /* Index to the next Tx descriptor */ uint32_t pd_inten; /* Shadow copy of INTEN register */ - struct wdog_s pd_txpoll; /* TX poll timer */ struct wdog_s pd_txtimeout; /* TX timeout timer */ struct work_s pd_irqwork; /* For deferring interrupt work to the work queue */ struct work_s pd_pollwork; /* For deferring poll work to the work queue */ @@ -387,7 +380,6 @@ pic32mx_rxdesc(struct pic32mx_driver_s *priv); static int pic32mx_transmit(struct pic32mx_driver_s *priv); static int pic32mx_txpoll(struct net_driver_s *dev); static void pic32mx_poll(struct pic32mx_driver_s *priv); -static void pic32mx_timerpoll(struct pic32mx_driver_s *priv); /* Interrupt handling */ @@ -403,9 +395,6 @@ static int pic32mx_interrupt(int irq, void *context, void *arg); static void pic32mx_txtimeout_work(void *arg); static void pic32mx_txtimeout_expiry(wdparm_t arg); -static void pic32mx_poll_work(void *arg); -static void pic32mx_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int pic32mx_ifup(struct net_driver_s *dev); @@ -1235,53 +1224,7 @@ static void pic32mx_poll(struct pic32mx_driver_s *priv) /* And perform the poll */ priv->pd_polling = true; - devif_timer(&priv->pd_dev, 0, pic32mx_txpoll); - - /* Free any buffer left attached after the poll */ - - if (priv->pd_dev.d_buf != NULL) - { - pic32mx_freebuffer(priv, priv->pd_dev.d_buf); - priv->pd_dev.d_buf = NULL; - } - - priv->pd_polling = false; - } - } -} - -/**************************************************************************** - * Function: pic32mx_timerpoll - * - * Description: - * Perform the network timer poll. - * - * Input Parameters: - * priv - Reference to the driver state structure - * - * Returned Value: - * None - * - ****************************************************************************/ - -static void pic32mx_timerpoll(struct pic32mx_driver_s *priv) -{ - /* Is there already a poll in progress. This happens, for example, when - * debugging output is enabled. Interrupts may be re-enabled while debug - * output is performed and a timer expiration could attempt a concurrent - * poll. - */ - - if (!priv->pd_polling) - { - DEBUGASSERT(priv->pd_dev.d_buf == NULL); - priv->pd_dev.d_buf = pic32mx_allocbuffer(priv); - if (priv->pd_dev.d_buf != NULL) - { - /* And perform the poll */ - - priv->pd_polling = true; - devif_timer(&priv->pd_dev, PIC32MX_WDDELAY, pic32mx_txpoll); + devif_poll(&priv->pd_dev, pic32mx_txpoll); /* Free any buffer left attached after the poll */ @@ -2014,76 +1957,6 @@ static void pic32mx_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->pd_irqwork, pic32mx_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: pic32mx_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void pic32mx_poll_work(void *arg) -{ - struct pic32mx_driver_s *priv = (struct pic32mx_driver_s *)arg; - - /* Check if the next Tx descriptor is available. We cannot perform the Tx - * poll if we are unable to accept another packet for transmission. - */ - - net_lock(); - if (pic32mx_txdesc(priv) != NULL) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. - * Hmmm... might be bug here. Does this mean if there is a transmit - * in progress we will missing TCP time state updates? - */ - - pic32mx_timerpoll(priv); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->pd_txpoll, PIC32MX_WDDELAY, - pic32mx_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: pic32mx_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void pic32mx_poll_expiry(wdparm_t arg) -{ - struct pic32mx_driver_s *priv = (struct pic32mx_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pd_pollwork, pic32mx_poll_work, priv, 0); -} - /**************************************************************************** * Function: pic32mx_ifup * @@ -2384,11 +2257,6 @@ static int pic32mx_ifup(struct net_driver_s *dev) priv->pd_inten = ETH_RXINTS; pic32mx_putreg(ETH_RXINTS, PIC32MX_ETH_IENSET); - /* Set and activate a timer process */ - - wd_start(&priv->pd_txpoll, PIC32MX_WDDELAY, - pic32mx_poll_expiry, (wdparm_t)priv); - /* Finally, enable the Ethernet interrupt at the interrupt controller */ priv->pd_ifup = true; @@ -2431,9 +2299,8 @@ static int pic32mx_ifdown(struct net_driver_s *dev) up_disable_irq(PIC32MX_IRQSRC_ETH); #endif - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->pd_txpoll); wd_cancel(&priv->pd_txtimeout); /* Reset the device and mark it as down. */ diff --git a/arch/mips/src/pic32mz/pic32mz_ethernet.c b/arch/mips/src/pic32mz/pic32mz_ethernet.c index 8cb709de3ad..0c5ee759dd0 100644 --- a/arch/mips/src/pic32mz/pic32mz_ethernet.c +++ b/arch/mips/src/pic32mz/pic32mz_ethernet.c @@ -189,12 +189,6 @@ /* Timing *******************************************************************/ -/* TX poll deley = 1 seconds. CLK_TCK is the number of clock ticks per - * second - */ - -#define PIC32MZ_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define PIC32MZ_TXTIMEOUT (60*CLK_TCK) @@ -367,7 +361,6 @@ struct pic32mz_driver_s #endif uint8_t pd_txnext; /* Index to the next Tx descriptor */ uint32_t pd_inten; /* Shadow copy of INTEN register */ - struct wdog_s pd_txpoll; /* TX poll timer */ struct wdog_s pd_txtimeout; /* TX timeout timer */ struct work_s pd_irqwork; /* For deferring interrupt work to the work queue */ struct work_s pd_pollwork; /* For deferring poll work to the work queue */ @@ -445,7 +438,6 @@ static struct pic32mz_rxdesc_s *pic32mz_rxdesc( static int pic32mz_transmit(struct pic32mz_driver_s *priv); static int pic32mz_txpoll(struct net_driver_s *dev); static void pic32mz_poll(struct pic32mz_driver_s *priv); -static void pic32mz_timerpoll(struct pic32mz_driver_s *priv); /* Interrupt handling */ @@ -461,9 +453,6 @@ static int pic32mz_interrupt(int irq, void *context, void *arg); static void pic32mz_txtimeout_work(void *arg); static void pic32mz_txtimeout_expiry(wdparm_t arg); -static void pic32mz_poll_work(void *arg); -static void pic32mz_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int pic32mz_ifup(struct net_driver_s *dev); @@ -1337,53 +1326,7 @@ static void pic32mz_poll(struct pic32mz_driver_s *priv) /* And perform the poll */ priv->pd_polling = true; - devif_timer(&priv->pd_dev, 0, pic32mz_txpoll); - - /* Free any buffer left attached after the poll */ - - if (priv->pd_dev.d_buf != NULL) - { - pic32mz_freebuffer(priv, priv->pd_dev.d_buf); - priv->pd_dev.d_buf = NULL; - } - - priv->pd_polling = false; - } - } -} - -/**************************************************************************** - * Function: pic32mz_timerpoll - * - * Description: - * Perform the network timer poll. - * - * Input Parameters: - * priv - Reference to the driver state structure - * - * Returned Value: - * None - * - ****************************************************************************/ - -static void pic32mz_timerpoll(struct pic32mz_driver_s *priv) -{ - /* Is there already a poll in progress. This happens, for example, when - * debugging output is enabled. Interrupts may be re-enabled while debug - * output is performed and a timer expiration could attempt a concurrent - * poll. - */ - - if (!priv->pd_polling) - { - DEBUGASSERT(priv->pd_dev.d_buf == NULL); - priv->pd_dev.d_buf = pic32mz_allocbuffer(priv); - if (priv->pd_dev.d_buf != NULL) - { - /* And perform the poll */ - - priv->pd_polling = true; - devif_timer(&priv->pd_dev, PIC32MZ_WDDELAY, pic32mz_txpoll); + devif_poll(&priv->pd_dev, pic32mz_txpoll); /* Free any buffer left attached after the poll */ @@ -2144,75 +2087,6 @@ static void pic32mz_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->pd_irqwork, pic32mz_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: pic32mz_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void pic32mz_poll_work(void *arg) -{ - struct pic32mz_driver_s *priv = (struct pic32mz_driver_s *)arg; - - /* Check if the next Tx descriptor is available. We cannot perform the Tx - * poll if we are unable to accept another packet for transmission. - */ - - net_lock(); - if (pic32mz_txdesc(priv) != NULL) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. Hmmm.. might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - pic32mz_timerpoll(priv); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->pd_txpoll, PIC32MZ_WDDELAY, - pic32mz_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: pic32mz_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void pic32mz_poll_expiry(wdparm_t arg) -{ - struct pic32mz_driver_s *priv = (struct pic32mz_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pd_pollwork, pic32mz_poll_work, priv, 0); -} - /**************************************************************************** * Function: pic32mz_ifup * @@ -2522,11 +2396,6 @@ static int pic32mz_ifup(struct net_driver_s *dev) priv->pd_inten = ETH_RXINTS; pic32mz_putreg(ETH_RXINTS, PIC32MZ_ETH_IENSET); - /* Set and activate a timer process */ - - wd_start(&priv->pd_txpoll, PIC32MZ_WDDELAY, - pic32mz_poll_expiry, (wdparm_t)priv); - /* Finally, enable the Ethernet interrupt at the interrupt controller */ priv->pd_ifup = true; @@ -2570,9 +2439,8 @@ static int pic32mz_ifdown(struct net_driver_s *dev) up_disable_irq(PIC32MZ_IRQ_ETH); #endif - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->pd_txpoll); wd_cancel(&priv->pd_txtimeout); /* Reset the device and mark it as down. */ diff --git a/arch/misoc/src/common/misoc_net.c b/arch/misoc/src/common/misoc_net.c index 832b98c9bc6..505f897dc04 100644 --- a/arch/misoc/src/common/misoc_net.c +++ b/arch/misoc/src/common/misoc_net.c @@ -76,12 +76,6 @@ # define CONFIG_MISOC_NET_NINTERFACES 1 #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define MISOC_NET_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define MISOC_NET_TXTIMEOUT (60*CLK_TCK) @@ -101,7 +95,6 @@ struct misoc_net_driver_s { bool misoc_net_bifup; /* true:ifup false:ifdown */ - struct wdog_s misoc_net_txpoll; /* TX poll timer */ struct wdog_s misoc_net_txtimeout; /* TX timeout timer */ struct work_s misoc_net_irqwork; /* For deferring interrupt work to the work queue */ struct work_s misoc_net_pollwork; /* For deferring poll work to the work queue */ @@ -151,9 +144,6 @@ static int misoc_net_interrupt(int irq, void *context, void *arg); static void misoc_net_txtimeout_work(void *arg); static void misoc_net_txtimeout_expiry(wdparm_t arg); -static void misoc_net_poll_work(void *arg); -static void misoc_net_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int misoc_net_ifup(struct net_driver_s *dev); @@ -726,77 +716,6 @@ static void misoc_net_txtimeout_expiry(wdparm_t arg) misoc_net_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: misoc_net_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void misoc_net_poll_work(void *arg) -{ - struct misoc_net_driver_s *priv = (struct misoc_net_driver_s *)arg; - - /* Perform the poll */ - - net_lock(); - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - /* If so, update TCP timing states and poll the network for new XMIT data. - * Hmmm.. might be bug here. Does this mean if there is a transmit in - * progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->misoc_net_dev, MISOC_NET_WDDELAY, misoc_net_txpoll); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->misoc_net_txpoll, MISOC_NET_WDDELAY, - misoc_net_poll_expiry, (wdparm_t)priv); - - net_unlock(); -} - -/**************************************************************************** - * Function: misoc_net_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void misoc_net_poll_expiry(wdparm_t arg) -{ - struct misoc_net_driver_s *priv = (struct misoc_net_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(HPWORK, &priv->misoc_net_pollwork, - misoc_net_poll_work, priv, 0); -} - /**************************************************************************** * Function: misoc_net_ifup * @@ -846,11 +765,6 @@ static int misoc_net_ifup(struct net_driver_s *dev) flags = enter_critical_section(); - /* Set and activate a timer process */ - - wd_start(&priv->misoc_net_txpoll, MISOC_NET_WDDELAY, - misoc_net_poll_expiry, (wdparm_t)priv); - priv->misoc_net_bifup = true; up_enable_irq(ETHMAC_INTERRUPT); @@ -891,9 +805,8 @@ static int misoc_net_ifdown(struct net_driver_s *dev) ethmac_sram_reader_ev_enable_write(0); ethmac_sram_writer_ev_enable_write(0); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->misoc_net_txpoll); wd_cancel(&priv->misoc_net_txtimeout); /* Put the EMAC in its reset, non-operational state. This should be @@ -941,7 +854,7 @@ static void misoc_net_txavail_work(void *arg) { /* If so, then poll the network for new XMIT data */ - devif_timer(&priv->misoc_net_dev, 0, misoc_net_txpoll); + devif_poll(&priv->misoc_net_dev, misoc_net_txpoll); } } diff --git a/arch/renesas/src/rx65n/rx65n_cmtw0.c b/arch/renesas/src/rx65n/rx65n_cmtw0.c index 730f37627e4..93d0252a104 100644 --- a/arch/renesas/src/rx65n/rx65n_cmtw0.c +++ b/arch/renesas/src/rx65n/rx65n_cmtw0.c @@ -124,10 +124,6 @@ void rx65n_cmtw0_create(uint32_t txpoll_time, uint32_t txtimeout_time) MPC.PE7PFS.BYTE = 0x1du; PORTE.PMR.BYTE |= 0x80u; - /* Attach the IRQ for poll expiry */ - - irq_attach(RX65N_INTB170_IRQ, (xcpt_t)rx65n_poll_expiry, NULL); - /* Attach the IRQ for tx timeout */ irq_attach(RX65N_INTB171_IRQ, (xcpt_t)rx65n_txtimeout_expiry, NULL); diff --git a/arch/renesas/src/rx65n/rx65n_eth.c b/arch/renesas/src/rx65n/rx65n_eth.c index 43ed70c7334..cf0c826e1eb 100644 --- a/arch/renesas/src/rx65n/rx65n_eth.c +++ b/arch/renesas/src/rx65n/rx65n_eth.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -484,8 +483,6 @@ static int rx65n_interrupt(int irq, FAR void *context, FAR void *arg); static void rx65n_txtimeout_work(FAR void *arg); -static void rx65n_poll_work(FAR void *arg); - /* NuttX callback functions */ static int rx65n_ifup(struct net_driver_s *dev); @@ -1180,7 +1177,7 @@ static void rx65n_dopoll(FAR struct rx65n_ethmac_s *priv) if (dev->d_buf) { - devif_timer(dev, 0, rx65n_txpoll); + devif_poll(dev, rx65n_txpoll); /* We will, most likely end up with a buffer to be freed. But it * might not be the same one that we allocated above. @@ -2087,114 +2084,6 @@ void rx65n_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->irqwork, rx65n_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: rx65n_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void rx65n_poll_work(FAR void *arg) -{ - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)arg; - FAR struct net_driver_s *dev = &priv->dev; - - /* Check if the next TX descriptor is owned by the Ethernet DMA or - * CPU. We cannot perform the TX poll if we are unable to accept - * another packet for transmission. - * - * In a race condition, TACT may be cleared BUT still not available - * because rx65n_freeframe() has not yet run. If rx65n_freeframe() - * has run, the buffer1 pointer (tdes2) will be nullified (and - * inflight should be < CONFIG_RX65N_ETH_NTXDESC). - */ - - net_lock(); - if ((priv->txhead->tdes0 & TACT) == 0 && - priv->txhead->tdes2 == 0) - { - /* If we have the descriptor, then perform the timer poll. Allocate a - * buffer for the poll. - */ - - DEBUGASSERT(dev->d_len == 0 && dev->d_buf == NULL); - dev->d_buf = rx65n_allocbuffer(priv); - - /* We can't poll if we have no buffers */ - - if (dev->d_buf) - { - /* Update TCP timing states and poll the network for new XMIT data. - */ - - devif_timer(dev, CLK_TCK, rx65n_txpoll); - - /* We will, most likely end up with a buffer to be freed. But it - * might not be the same one that we allocated above. - */ - - if (dev->d_buf) - { - DEBUGASSERT(dev->d_len == 0); - rx65n_freebuffer(priv, dev->d_buf); - dev->d_buf = NULL; - } - } - } - - /* Setup the poll timer again */ - - rx65n_cmtw0_start(rx65n_cmtw0_txpoll, RX65N_CMTW0_COUNT_VALUE_FOR_TXPOLL); - - net_unlock(); -} - -/**************************************************************************** - * Function: rx65n_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -void rx65n_poll_expiry(wdparm_t arg) -{ - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)arg; - rx65n_cmtw0_stop(rx65n_cmtw0_txpoll); - if (work_available(&priv->pollwork)) - { - /* Schedule to perform the interrupt processing - * on the worker thread. - */ - - work_queue(ETHWORK, &priv->pollwork, rx65n_poll_work, priv, 0); - } - else - { - rx65n_cmtw0_start(rx65n_cmtw0_txpoll, - RX65N_CMTW0_COUNT_VALUE_FOR_TXPOLL); - } -} - /**************************************************************************** * Function: rx65n_ifup * @@ -2241,9 +2130,6 @@ static int rx65n_ifup(struct net_driver_s *dev) return ret; } - /* Set and activate a timer process */ - - rx65n_cmtw0_start(rx65n_cmtw0_txpoll, RX65N_CMTW0_COUNT_VALUE_FOR_TXPOLL); priv->ifup = true; /* Enable the Ethernet interrupt */ @@ -2285,9 +2171,8 @@ static int rx65n_ifdown(struct net_driver_s *dev) up_disable_irq(RX65N_ETH_IRQ); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - rx65n_cmtw0_stop(rx65n_cmtw0_txpoll); rx65n_cmtw0_stop(rx65n_cmtw0_timeout); /* Put the EMAC in its reset, non-operational state. diff --git a/arch/renesas/src/rx65n/rx65n_eth.h b/arch/renesas/src/rx65n/rx65n_eth.h index 416bcd365c3..914dd6bc9cc 100644 --- a/arch/renesas/src/rx65n/rx65n_eth.h +++ b/arch/renesas/src/rx65n/rx65n_eth.h @@ -73,22 +73,6 @@ extern "C" #ifdef CONFIG_RX65N_EMAC0 int rx65n_ethinitialize(int intf); -/**************************************************************************** - * Function: rx65n_poll_expiry - * - * Description: - * Poll Expiry timer - * - * Input Parameters: - * arg - Input argument - * - * Returned Value: - * None - * - ****************************************************************************/ - -void rx65n_poll_expiry(wdparm_t arg); - /**************************************************************************** * Function: rx65n_txtimeout_expiry * diff --git a/arch/risc-v/src/bl602/bl602_netdev.c b/arch/risc-v/src/bl602/bl602_netdev.c index 70babd3cdb5..a831de0de9d 100644 --- a/arch/risc-v/src/bl602/bl602_netdev.c +++ b/arch/risc-v/src/bl602/bl602_netdev.c @@ -44,7 +44,6 @@ #include #include -#include #include #include #include @@ -101,12 +100,6 @@ #define BL602_NET_NINTERFACES 2 #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define BL602_NET_WDDELAY (1 * CLOCKS_PER_SEC) - #define WIFI_MTU_SIZE 1516 #define BL602_NET_TXBUFF_NUM 12 @@ -140,8 +133,6 @@ struct bl602_net_driver_s { - struct wdog_s txpoll; /* TX poll timer */ - struct work_s pollwork; /* For deferring poll work to the work queue */ struct work_s availwork; /* wifi manager */ @@ -261,11 +252,6 @@ static int bl602_net_txpoll(struct net_driver_s *dev); static void bl602_net_reply(struct bl602_net_driver_s *priv); static void bl602_net_receive(struct bl602_net_driver_s *priv); -/* Watchdog timer expirations */ - -static void bl602_net_poll_work(void *arg); -static void bl602_net_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int bl602_net_ifup(struct net_driver_s *dev); @@ -834,95 +820,6 @@ int bl602_net_notify(uint32_t event, uint8_t *data, int len, void *opaque) return OK; } -/**************************************************************************** - * Name: bl602_net_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Run on a work queue thread. - * - ****************************************************************************/ - -static void bl602_net_poll_work(void *arg) -{ - struct bl602_net_driver_s *priv = (struct bl602_net_driver_s *)arg; - - net_lock(); - DEBUGASSERT(priv->net_dev.d_buf == NULL); - DEBUGASSERT(priv->push_cnt == 0); - - priv->net_dev.d_buf = bl602_netdev_alloc_txbuf(); - if (priv->net_dev.d_buf) - { - priv->net_dev.d_buf += PRESERVE_80211_HEADER_LEN; - priv->net_dev.d_len = 0; - } - - if (priv->net_dev.d_buf) - { - devif_timer(&priv->net_dev, BL602_NET_WDDELAY, bl602_net_txpoll); - - if (priv->push_cnt != 0) - { - /* notify to tx now */ - - bl_irq_handler(); - priv->push_cnt = 0; - } - - if (priv->net_dev.d_buf != NULL) - { - bl602_netdev_free_txbuf(priv->net_dev.d_buf - - PRESERVE_80211_HEADER_LEN); - priv->net_dev.d_buf = NULL; - } - } - - wd_start( - &priv->txpoll, BL602_NET_WDDELAY, bl602_net_poll_expiry, (wdparm_t)priv); - - DEBUGASSERT(priv->net_dev.d_buf == NULL); - net_unlock(); -} - -/**************************************************************************** - * Name: bl602_net_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Runs in the context of a the timer interrupt handler. Local - * interrupts are disabled by the interrupt logic. - * - ****************************************************************************/ - -static void bl602_net_poll_expiry(wdparm_t arg) -{ - struct bl602_net_driver_s *priv = (struct bl602_net_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - if (work_available(&priv->pollwork)) - { - work_queue(ETHWORK, &priv->pollwork, bl602_net_poll_work, priv, 0); - } -} - /**************************************************************************** * Name: bl602_net_ifup * @@ -943,8 +840,10 @@ static void bl602_net_poll_expiry(wdparm_t arg) static int bl602_net_ifup(struct net_driver_s *dev) { +#ifdef CONFIG_NET_ICMPv6 struct bl602_net_driver_s *priv = (struct bl602_net_driver_s *)dev->d_private; +#endif #ifdef CONFIG_NET_IPv4 ninfo("Bringing up: %ld.%ld.%ld.%ld\n", @@ -971,11 +870,6 @@ static int bl602_net_ifup(struct net_driver_s *dev) bl602_net_ipv6multicast(priv); #endif - /* Set and activate a timer process */ - - wd_start( - &priv->txpoll, BL602_NET_WDDELAY, bl602_net_poll_expiry, (wdparm_t)priv); - return OK; } @@ -1025,8 +919,6 @@ static int bl602_net_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); - wd_cancel(&priv->txpoll); - leave_critical_section(flags); if (priv == &g_bl602_net[0]) @@ -1082,7 +974,7 @@ static void bl602_net_txavail_work(void *arg) if (priv->net_dev.d_buf) { - devif_timer(&priv->net_dev, 0, bl602_net_txpoll); + devif_poll(&priv->net_dev, bl602_net_txpoll); if (priv->push_cnt != 0) { diff --git a/arch/risc-v/src/esp32c3/esp32c3_wlan.c b/arch/risc-v/src/esp32c3/esp32c3_wlan.c index ff25fd65fa4..c70ec77872b 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_wlan.c +++ b/arch/risc-v/src/esp32c3/esp32c3_wlan.c @@ -54,12 +54,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define WLAN_WDDELAY (1 * CLK_TCK) - /* TX timeout = 1 minute */ #define WLAN_TXTOUT (60 * CLK_TCK) @@ -146,7 +140,6 @@ struct wlan_priv_s bool ifup; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s rxwork; /* Send packet work */ @@ -249,9 +242,6 @@ static void wlan_dopoll(struct wlan_priv_s *priv); static void wlan_txtimeout_work(void *arg); static void wlan_txtimeout_expiry(wdparm_t arg); -static void wlan_poll_work(void *arg); -static void wlan_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int wlan_ifup(struct net_driver_s *dev); @@ -1060,108 +1050,6 @@ static void wlan_txtimeout_expiry(wdparm_t arg) } } -/**************************************************************************** - * Name: wlan_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void wlan_poll_work(void *arg) -{ - int32_t delay_tick = WLAN_WDDELAY; - struct wlan_priv_s *priv = (struct wlan_priv_s *)arg; - struct net_driver_s *dev = &priv->dev; - struct wlan_pktbuf_s *pktbuf; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - pktbuf = wlan_alloc_buffer(priv); - if (pktbuf == NULL) - { - /* Delay 10ms */ - - delay_tick = MSEC2TICK(10); - if (delay_tick == 0) - { - delay_tick = 1; - } - - goto exit; - } - - dev->d_buf = pktbuf->buffer; - dev->d_len = WLAN_BUF_SIZE; - - /* Check if there is room in the send another TX packets. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - * - * If there is no room, we should reset the timeout value to be 1 to - * trigger the timer as soon as possible. - */ - - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(&priv->dev, delay_tick, wlan_txpoll); - - if (dev->d_buf != NULL) - { - wlan_free_buffer(priv, dev->d_buf); - - dev->d_buf = NULL; - dev->d_len = 0; - } - - /* Try to send all cached TX packets */ - - wlan_transmit(priv); - -exit: - wd_start(&priv->txpoll, delay_tick, wlan_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: wlan_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer callback handler. - * - * Input Parameters: - * argc - The number of available arguments - * arg - The first argument - * - * Returned Value: - * None - * - ****************************************************************************/ - -static void wlan_poll_expiry(wdparm_t arg) -{ - struct wlan_priv_s *priv = (struct wlan_priv_s *)arg; - - if (priv->ifup) - { - work_queue(WLAN_WORK, &priv->pollwork, wlan_poll_work, priv, 0); - } -} - /**************************************************************************** * Name: wlan_txavail_work * @@ -1264,10 +1152,6 @@ static int wlan_ifup(struct net_driver_s *dev) wlan_init_buffer(priv); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, WLAN_WDDELAY, wlan_poll_expiry, (wdparm_t)priv); - priv->ifup = true; if (g_callback_register_ref == 0) { @@ -1311,9 +1195,8 @@ static int wlan_ifdown(struct net_driver_s *dev) return OK; } - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Mark the device "down" */ diff --git a/arch/risc-v/src/mpfs/mpfs_ethernet.c b/arch/risc-v/src/mpfs/mpfs_ethernet.c index 1c687a6bd09..0bcee6e2f04 100644 --- a/arch/risc-v/src/mpfs/mpfs_ethernet.c +++ b/arch/risc-v/src/mpfs/mpfs_ethernet.c @@ -156,12 +156,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define MPFS_WDDELAY (1 * CLK_TCK) - /* TX timeout = 1 minute */ #define MPFS_TXTIMEOUT (60 * CLK_TCK) @@ -259,7 +253,6 @@ struct mpfs_ethmac_s uint8_t ifup : 1; /* true:ifup false:ifdown */ uint8_t intf; /* Ethernet interface number */ uint8_t phyaddr; /* PHY address */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ @@ -312,9 +305,6 @@ static int mpfs_buffer_initialize(struct mpfs_ethmac_s *priv, unsigned int queue); static void mpfs_buffer_free(struct mpfs_ethmac_s *priv, unsigned int queue); -static void mpfs_poll_expiry(wdparm_t arg); -static void mpfs_poll_work(void *arg); - static int mpfs_transmit(struct mpfs_ethmac_s *priv, unsigned int queue); static int mpfs_txpoll(struct net_driver_s *dev); static void mpfs_dopoll(struct mpfs_ethmac_s *priv); @@ -1514,84 +1504,10 @@ static void mpfs_dopoll(struct mpfs_ethmac_s *priv) * then poll the network for new XMIT data. */ - devif_timer(dev, 0, mpfs_txpoll); + devif_poll(dev, mpfs_txpoll); } } -/**************************************************************************** - * Function: mpfs_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void mpfs_poll_expiry(wdparm_t arg) -{ - struct mpfs_ethmac_s *priv = (struct mpfs_ethmac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - if (work_available(&priv->pollwork)) - { - work_queue(ETHWORK, &priv->pollwork, mpfs_poll_work, priv, 0); - } - else - { - wd_start(&priv->txpoll, MPFS_WDDELAY, - mpfs_poll_expiry, (wdparm_t)priv); - } -} - -/**************************************************************************** - * Function: mpfs_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void mpfs_poll_work(void *arg) -{ - struct mpfs_ethmac_s *priv = (struct mpfs_ethmac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - /* Check if there are any free TX descriptors. We cannot perform the - * TX poll if we do not have buffering for another packet. - */ - - net_lock(); - if (mpfs_txfree(priv, 0) > 0) - { - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(dev, MPFS_WDDELAY, mpfs_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, MPFS_WDDELAY, mpfs_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - /**************************************************************************** * Function: mpfs_ifup * @@ -1671,11 +1587,6 @@ static int mpfs_ifup(struct net_driver_s *dev) ninfo("Enable normal operation\n"); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, MPFS_WDDELAY, - mpfs_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupts */ priv->ifup = true; @@ -1723,9 +1634,8 @@ static int mpfs_ifdown(struct net_driver_s *dev) *priv->queue[2].int_disable = 0xffffffff; *priv->queue[3].int_disable = 0xffffffff; - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Put the MAC in its reset, non-operational state. This should be diff --git a/arch/sim/src/sim/up_netdriver.c b/arch/sim/src/sim/up_netdriver.c index 728bd6a4792..773a718607f 100644 --- a/arch/sim/src/sim/up_netdriver.c +++ b/arch/sim/src/sim/up_netdriver.c @@ -77,7 +77,6 @@ /* Net driver worker */ -static struct work_s g_timer_work; static struct work_s g_avail_work; static struct work_s g_recv_work; @@ -287,24 +286,9 @@ static int netdriver_txpoll(struct net_driver_s *dev) return 0; } -static void netdriver_timer_work(void *arg) -{ - struct net_driver_s *dev = arg; - - net_lock(); - if (IFF_IS_UP(dev->d_flags)) - { - work_queue(LPWORK, &g_timer_work, netdriver_timer_work, dev, CLK_TCK); - devif_timer(dev, CLK_TCK, netdriver_txpoll); - } - - net_unlock(); -} - static int netdriver_ifup(struct net_driver_s *dev) { netdev_ifup(dev->d_ipaddr); - work_queue(LPWORK, &g_timer_work, netdriver_timer_work, dev, CLK_TCK); netdev_carrier_on(dev); return OK; } @@ -312,7 +296,6 @@ static int netdriver_ifup(struct net_driver_s *dev) static int netdriver_ifdown(struct net_driver_s *dev) { netdev_carrier_off(dev); - work_cancel(LPWORK, &g_timer_work); netdev_ifdown(); return OK; } @@ -324,7 +307,7 @@ static void netdriver_txavail_work(void *arg) net_lock(); if (IFF_IS_UP(dev->d_flags)) { - devif_timer(dev, 0, netdriver_txpoll); + devif_poll(dev, netdriver_txpoll); } net_unlock(); diff --git a/arch/xtensa/src/esp32/esp32_emac.c b/arch/xtensa/src/esp32/esp32_emac.c index b038aa5397e..b20905bcd43 100644 --- a/arch/xtensa/src/esp32/esp32_emac.c +++ b/arch/xtensa/src/esp32/esp32_emac.c @@ -113,10 +113,6 @@ #define EMAC_TX_TO (60 * CLK_TCK) -/* TCP/IP periodic poll process = 1 seconds */ - -#define EMAC_WDDELAY (1 * CLK_TCK) - /* Ethernet control frame pause timeout */ #define EMAC_PAUSE_TIME (0x1648) @@ -201,7 +197,6 @@ struct esp32_emac_s uint8_t mbps100 : 1; /* 100MBps operation (vs 10 MBps) */ uint8_t fduplex : 1; /* Full (vs. half) duplex */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s txwork; /* For deferring TX work to the work queue */ @@ -252,7 +247,6 @@ static int emac_ifdown(struct net_driver_s *dev); static int emac_ifup(struct net_driver_s *dev); static void emac_dopoll(struct esp32_emac_s *priv); static void emac_txtimeout_expiry(wdparm_t arg); -static void emac_poll_expiry(wdparm_t arg); /**************************************************************************** * External Function Prototypes @@ -1698,7 +1692,7 @@ static void emac_dopoll(struct esp32_emac_s *priv) dev->d_len = EMAC_BUF_LEN; - devif_timer(dev, 0, emac_txpoll); + devif_poll(dev, emac_txpoll); if (dev->d_buf) { @@ -1746,102 +1740,6 @@ static void emac_txavail_work(void *arg) net_unlock(); } -/**************************************************************************** - * Function: emac_txavail_work - * - * Description: - * Perform an out-of-cycle poll on the worker thread. - * - * Input Parameters: - * arg - Reference to the NuttX driver state structure (cast to void*) - * - * Returned Value: - * None - * - * Assumptions: - * Called on the higher priority worker thread. - * - ****************************************************************************/ - -static void emac_poll_work(void *arg) -{ - int ret; - struct esp32_emac_s *priv = (struct esp32_emac_s *)arg; - struct net_driver_s *dev = &priv->dev; - - ninfo("ifup: %d\n", priv->ifup); - - /* Ignore the notification if the interface is not yet up */ - - net_lock(); - - /* Poll the network for new XMIT data */ - - if (!TX_IS_BUSY(priv)) - { - DEBUGASSERT(dev->d_len == 0 && dev->d_buf == NULL); - - dev->d_buf = (uint8_t *)emac_alloc_buffer(priv); - if (!dev->d_buf) - { - /* never reach */ - - net_unlock(); - return ; - } - - dev->d_len = EMAC_BUF_LEN; - - devif_timer(dev, EMAC_WDDELAY , emac_txpoll); - - if (dev->d_buf) - { - emac_free_buffer(priv, dev->d_buf); - - dev->d_buf = NULL; - dev->d_len = 0; - } - } - - ret = wd_start(&priv->txpoll, EMAC_WDDELAY, - emac_poll_expiry, (wdparm_t)priv); - if (ret) - { - nerr("ERROR: Failed to start TX poll timer"); - } - - net_unlock(); -} - -/**************************************************************************** - * Function: emac_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void emac_poll_expiry(wdparm_t arg) -{ - struct esp32_emac_s *priv = (struct esp32_emac_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - if (priv->ifup) - { - work_queue(ETHWORK, &priv->pollwork, emac_poll_work, priv, 0); - } -} - /**************************************************************************** * Function: emac_ifup * @@ -1903,11 +1801,6 @@ static int emac_ifup(struct net_driver_s *dev) emac_start(); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, EMAC_WDDELAY, - emac_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ up_enable_irq(ESP32_IRQ_EMAC); @@ -1951,9 +1844,8 @@ static int emac_ifdown(struct net_driver_s *dev) up_disable_irq(priv->cpuint); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Reset ethernet MAC and disable clock */ diff --git a/arch/xtensa/src/esp32/esp32_wlan.c b/arch/xtensa/src/esp32/esp32_wlan.c index 37368df2a75..f111fe3509a 100644 --- a/arch/xtensa/src/esp32/esp32_wlan.c +++ b/arch/xtensa/src/esp32/esp32_wlan.c @@ -54,12 +54,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define WLAN_WDDELAY (1 * CLK_TCK) - /* TX timeout = 1 minute */ #define WLAN_TXTOUT (60 * CLK_TCK) @@ -144,7 +138,6 @@ struct wlan_priv_s bool ifup; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s rxwork; /* Send packet work */ @@ -251,9 +244,6 @@ static void wlan_dopoll(struct wlan_priv_s *priv); static void wlan_txtimeout_work(void *arg); static void wlan_txtimeout_expiry(wdparm_t arg); -static void wlan_poll_work(void *arg); -static void wlan_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int wlan_ifup(struct net_driver_s *dev); @@ -1057,108 +1047,6 @@ static void wlan_txtimeout_expiry(wdparm_t arg) } } -/**************************************************************************** - * Name: wlan_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void wlan_poll_work(void *arg) -{ - int32_t delay_tick = WLAN_WDDELAY; - struct wlan_priv_s *priv = (struct wlan_priv_s *)arg; - struct net_driver_s *dev = &priv->dev; - struct wlan_pktbuf *pktbuf; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - pktbuf = wlan_alloc_buffer(priv); - if (!pktbuf) - { - /* Delay 10ms */ - - delay_tick = MSEC2TICK(10); - if (delay_tick == 0) - { - delay_tick = 1; - } - - goto exit; - } - - dev->d_buf = pktbuf->buffer; - dev->d_len = WLAN_BUF_SIZE; - - /* Check if there is room in the send another TX packets. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - * - * If there is no room, we should reset the timeout value to be 1 to - * trigger the timer as soon as possible. - */ - - /* Update TCP timing states and poll the network for new XMIT data. */ - - devif_timer(&priv->dev, delay_tick, wlan_txpoll); - - if (dev->d_buf) - { - wlan_free_buffer(priv, dev->d_buf); - - dev->d_buf = NULL; - dev->d_len = 0; - } - - /* Try to send all cached TX packets */ - - wlan_transmit(priv); - -exit: - wd_start(&priv->txpoll, delay_tick, wlan_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: wlan_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer callback handler. - * - * Input Parameters: - * argc - The number of available arguments - * arg - The first argument - * - * Returned Value: - * None - * - ****************************************************************************/ - -static void wlan_poll_expiry(wdparm_t arg) -{ - struct wlan_priv_s *priv = (struct wlan_priv_s *)arg; - - if (priv->ifup) - { - work_queue(WLAN_WORK, &priv->pollwork, wlan_poll_work, priv, 0); - } -} - /**************************************************************************** * Name: wlan_txavail_work * @@ -1261,10 +1149,6 @@ static int wlan_ifup(struct net_driver_s *dev) wlan_init_buffer(priv); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, WLAN_WDDELAY, wlan_poll_expiry, (wdparm_t)priv); - priv->ifup = true; if (g_callback_register_ref == 0) { @@ -1310,7 +1194,6 @@ static int wlan_ifdown(struct net_driver_s *dev) /* Cancel the TX poll timer and TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Mark the device "down" */ diff --git a/arch/z80/src/ez80/ez80_emac.c b/arch/z80/src/ez80/ez80_emac.c index 74c381dffa8..ab6212e6715 100644 --- a/arch/z80/src/ez80/ez80_emac.c +++ b/arch/z80/src/ez80/ez80_emac.c @@ -243,12 +243,6 @@ extern uintptr_t _RAM_ADDR_U_INIT_PARAM; #define EMAC_EIN_HANDLED \ (EMAC_ISTAT_RXEVENTS | EMAC_ISTAT_TXEVENTS | EMAC_ISTAT_SYSEVENTS) -/* TX poll deley = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define EMAC_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define EMAC_TXTIMEOUT (60*CLK_TCK) @@ -337,7 +331,6 @@ struct ez80emac_driver_s bool bfullduplex; /* true:full duplex */ bool b100mbs; /* true:100Mbp */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ struct work_s txwork; /* For deferring Tx-related work to the work queue */ @@ -416,9 +409,6 @@ static int ez80emac_sysinterrupt(int irq, FAR void *context, static void ez80emac_txtimeout_work(FAR void *arg); static void ez80emac_txtimeout_expiry(wdparm_t arg); -static void ez80emac_poll_work(FAR void *arg); -static void ez80emac_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int ez80emac_ifup(struct net_driver_s *dev); @@ -1979,81 +1969,6 @@ static void ez80emac_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->txwork, ez80emac_txtimeout_work, priv, 0); } -/**************************************************************************** - * Function: ez80emac_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void ez80emac_poll_work(FAR void *arg) -{ - FAR struct ez80emac_driver_s *priv = (FAR struct ez80emac_driver_s *)arg; - - /* Poll the network for new XMIT data */ - - net_lock(); - devif_timer(&priv->dev, EMAC_WDDELAY, ez80emac_txpoll); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, EMAC_WDDELAY, - ez80emac_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Function: ez80emac_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void ez80emac_poll_expiry(wdparm_t arg) -{ - FAR struct ez80emac_driver_s *priv = (FAR struct ez80emac_driver_s *)arg; - - /* Is our single work structure available? It may not be if there are - * pending interrupt actions. - */ - - if (work_available(&priv->syswork)) - { - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->syswork, ez80emac_poll_work, priv, 0); - } - else - { - /* No.. Just re-start the watchdog poll timer, missing one polling - * cycle. - */ - - wd_start(&priv->txpoll, EMAC_WDDELAY, - ez80emac_poll_expiry, (wdparm_t)arg); - } -} - /**************************************************************************** * Function: ez80emac_ifup * @@ -2139,11 +2054,6 @@ static int ez80emac_ifup(FAR struct net_driver_s *dev) outp(EZ80_EMAC_ISTAT, 0xff); /* Clear all pending interrupts */ outp(EZ80_EMAC_IEN, EMAC_EIN_HANDLED); /* Enable all interrupts */ - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, EMAC_WDDELAY, - ez80emac_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupts */ priv->bifup = true; @@ -2184,7 +2094,6 @@ static int ez80emac_ifdown(struct net_driver_s *dev) /* Cancel the TX poll timer and TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Disable Rx */ @@ -2232,7 +2141,7 @@ static void ez80emac_txavail_work(FAR void *arg) /* If so, then poll the network for new XMIT data */ - devif_timer(&priv->dev, 0, ez80emac_txpoll); + devif_poll(&priv->dev, ez80emac_txpoll); } net_unlock(); diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index f567d0662df..dc8221e5bdb 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -269,12 +269,6 @@ # define CONFIG_DM9X_MODE_AUTO 1 #endif -/* TX poll deley = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define DM9X_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define DM6X_TXTIMEOUT (60*CLK_TCK) @@ -308,7 +302,6 @@ struct dm9x_driver_s bool dm_b100m; /* true:speed == 100M; false:speed == 10M */ uint8_t dm_ntxpending; /* Count of packets pending transmission */ uint8_t ncrxpackets; /* Number of continuous rx packets */ - struct wdog_s dm_txpoll; /* TX poll timer */ struct wdog_s dm_txtimeout; /* TX timeout timer */ struct work_s dm_irqwork; /* For deferring interrupt work to the work queue */ struct work_s dm_pollwork; /* For deferring poll work to the work queue */ @@ -385,9 +378,6 @@ static int dm9x_interrupt(int irq, FAR void *context, FAR void *arg); static void dm9x_txtimeout_work(FAR void *arg); static void dm9x_txtimeout_expiry(wdparm_t arg); -static void dm9x_poll_work(FAR void *arg); -static void dm9x_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int dm9x_ifup(FAR struct net_driver_s *dev); @@ -1363,85 +1353,6 @@ static void dm9x_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->dm_irqwork, dm9x_txtimeout_work, priv, 0); } -/**************************************************************************** - * Name: dm9x_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void dm9x_poll_work(FAR void *arg) -{ - FAR struct dm9x_driver_s *priv = (FAR struct dm9x_driver_s *)arg; - - /* Perform the poll */ - - net_lock(); - - /* If the number of contiguous RX packets exceeds a threshold, reset the - * counter and re-enable RX interrupts - */ - - if (priv->ncrxpackets >= DM9X_CRXTHRES) - { - priv->ncrxpackets = 0; - putreg(DM9X_IMR, DM9X_IMRENABLE); - } - - /* Check if there is room in the DM90x0 to hold another packet. In 100M - * mode, that can be 2 packets, otherwise it is a single packet. - */ - - if (priv->dm_ntxpending < 1 || (priv->dm_b100m && priv->dm_ntxpending < 2)) - { - /* Update TCP timing states and poll the network for new XMIT data */ - - devif_timer(&priv->dm_dev, DM9X_WDDELAY, dm9x_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->dm_txpoll, DM9X_WDDELAY, - dm9x_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: dm9x_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void dm9x_poll_expiry(wdparm_t arg) -{ - FAR struct dm9x_driver_s *priv = (FAR struct dm9x_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->dm_pollwork, dm9x_poll_work, priv, 0); -} - /**************************************************************************** * Name: dm9x_phymode * @@ -1546,11 +1457,6 @@ static int dm9x_ifup(FAR struct net_driver_s *dev) ninfo("delay: %dmS speed: %s\n", i, priv->dm_b100m ? "100M" : "10M"); - /* Set and activate a timer process */ - - wd_start(&priv->dm_txpoll, DM9X_WDDELAY, - dm9x_poll_expiry, (wdparm_t)priv); - /* Enable the DM9X interrupt */ priv->dm_bifup = true; @@ -1587,9 +1493,8 @@ static int dm9x_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(CONFIG_DM9X_IRQ); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->dm_txpoll); wd_cancel(&priv->dm_txtimeout); /* Reset the device */ @@ -1643,7 +1548,7 @@ static void dm9x_txavail_work(FAR void *arg) { /* If so, then poll the network for new XMIT data */ - devif_timer(&priv->dm_dev, 0, dm9x_txpoll); + devif_poll(&priv->dm_dev, dm9x_txpoll); } } @@ -1870,9 +1775,8 @@ static void dm9x_reset(FAR struct dm9x_driver_s *priv) uint8_t save; int i; - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->dm_txpoll); wd_cancel(&priv->dm_txtimeout); /* Save previous register address */ diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 8824c0e1e4e..2c4a776388a 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -133,10 +133,6 @@ /* Timing *******************************************************************/ -/* TX poll deley = 1 seconds. CLK_TCK is the number of ticks per second */ - -#define ENC_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define ENC_TXTIMEOUT (60*CLK_TCK) @@ -229,7 +225,6 @@ struct enc_driver_s /* Timing */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ /* If we don't own the SPI bus, then we cannot do SPI accesses from the @@ -323,8 +318,6 @@ static int enc_interrupt(int irq, FAR void *context, FAR void *arg); static void enc_toworker(FAR void *arg); static void enc_txtimeout(wdparm_t arg); -static void enc_pollworker(FAR void *arg); -static void enc_polltimer(wdparm_t arg); /* NuttX callback functions */ @@ -1951,100 +1944,6 @@ static void enc_txtimeout(wdparm_t arg) UNUSED(ret); } -/**************************************************************************** - * Name: enc_pollworker - * - * Description: - * Periodic timer handler continuation. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void enc_pollworker(FAR void *arg) -{ - FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)arg; - - DEBUGASSERT(priv); - - /* Get exclusive access to both the network and the SPI bus. */ - - net_lock(); - enc_lock(priv); - - /* Verify that the hardware is ready to send another packet. The driver - * start a transmission process by setting ECON1.TXRTS. When the packet is - * finished transmitting or is aborted due to an error/cancellation, the - * ECON1.TXRTS bit will be cleared. - */ - - if ((enc_rdgreg(priv, ENC_ECON1) & ECON1_TXRTS) == 0) - { - /* Yes.. update TCP timing states and poll the network for new XMIT - * data. Hmmm.. looks like a bug here to me. Does this mean if there - * is a transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->dev, ENC_WDDELAY, enc_txpoll); - } - - /* Release lock on the SPI bus and the network */ - - enc_unlock(priv); - net_unlock(); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, ENC_WDDELAY, - enc_polltimer, (wdparm_t)arg); -} - -/**************************************************************************** - * Name: enc_polltimer - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void enc_polltimer(wdparm_t arg) -{ - FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)arg; - int ret; - - /* In complex environments, we cannot do SPI transfers from the timeout - * handler because semaphores are probably used to lock the SPI bus. In - * this case, we will defer processing to the worker thread. This is also - * much kinder in the use of system resources and is, therefore, probably - * a good thing to do in any event. - */ - - DEBUGASSERT(priv && work_available(&priv->pollwork)); - - /* Notice that poll watchdog is not active so further poll timeouts can - * occur until we restart the poll timeout watchdog. - */ - - ret = work_queue(ENCWORK, &priv->pollwork, enc_pollworker, - (FAR void *)priv, 0); - DEBUGASSERT(ret == OK); - UNUSED(ret); -} - /**************************************************************************** * Name: enc_ifup * @@ -2100,11 +1999,6 @@ static int enc_ifup(struct net_driver_s *dev) enc_bfsgreg(priv, ENC_ECON1, ECON1_RXEN); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, ENC_WDDELAY, - enc_polltimer, (wdparm_t)priv); - /* Mark the interface up and enable the Ethernet interrupt at the * controller */ @@ -2156,9 +2050,8 @@ static int enc_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); priv->lower->disable(priv->lower); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Reset the device and leave in the power save state */ @@ -2220,7 +2113,7 @@ static int enc_txavail(struct net_driver_s *dev) * poll the network for new XMIT data */ - devif_timer(&priv->dev, 0, enc_txpoll); + devif_poll(&priv->dev, enc_txpoll); } } diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c index ff500b19ecd..fcd6a687588 100644 --- a/drivers/net/encx24j600.c +++ b/drivers/net/encx24j600.c @@ -133,10 +133,6 @@ /* Timing *******************************************************************/ -/* TX poll delay = 1 seconds. CLK_TCK is the number of ticks per second */ - -#define ENC_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define ENC_TXTIMEOUT (60*CLK_TCK) @@ -226,7 +222,6 @@ struct enc_driver_s /* Timing */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ /* Avoid SPI accesses from the interrupt handler by using the work queue */ @@ -335,8 +330,6 @@ static int enc_interrupt(int irq, FAR void *context, FAR void *arg); static void enc_toworker(FAR void *arg); static void enc_txtimeout(wdparm_t arg); -static void enc_pollworker(FAR void *arg); -static void enc_polltimer(wdparm_t arg); /* NuttX callback functions */ @@ -2099,99 +2092,6 @@ static void enc_txtimeout(wdparm_t arg) DEBUGASSERT(ret == OK); } -/**************************************************************************** - * Name: enc_pollworker - * - * Description: - * Periodic timer handler continuation. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void enc_pollworker(FAR void *arg) -{ - FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)arg; - - DEBUGASSERT(priv); - - /* Get exclusive access to both the network and the SPI bus. */ - - net_lock(); - enc_lock(priv); - - /* Verify that the hardware is ready to send another packet. The driver - * start a transmission process by setting ECON1.TXRTS. When the packet is - * finished transmitting or is aborted due to an error/cancellation, the - * ECON1.TXRTS bit will be cleared. - */ - - if ((enc_rdreg(priv, ENC_ECON1) & ECON1_TXRTS) == 0) - { - /* Yes.. update TCP timing states and poll the network for new XMIT - * data. Hmmm.. looks like a bug here to me. Does this mean if there - * is a transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->dev, ENC_WDDELAY, enc_txpoll); - } - - /* Release lock on the SPI bus and the network */ - - enc_unlock(priv); - net_unlock(); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, ENC_WDDELAY, enc_polltimer, (wdparm_t)arg); -} - -/**************************************************************************** - * Name: enc_polltimer - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void enc_polltimer(wdparm_t arg) -{ - FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)arg; - int ret; - - /* In complex environments, we cannot do SPI transfers from the timeout - * handler because semaphores are probably used to lock the SPI bus. In - * this case, we will defer processing to the worker thread. This is also - * much kinder in the use of system resources and is, therefore, probably - * a good thing to do in any event. - */ - - DEBUGASSERT(priv && work_available(&priv->pollwork)); - - /* Notice that poll watchdog is not active so further poll timeouts can - * occur until we restart the poll timeout watchdog. - */ - - ret = work_queue(ENCWORK, &priv->pollwork, enc_pollworker, - (FAR void *)priv, 0); - DEBUGASSERT(ret == OK); - UNUSED(ret); -} - /**************************************************************************** * Name: enc_ifup * @@ -2248,11 +2148,6 @@ static int enc_ifup(struct net_driver_s *dev) enc_bfs(priv, ENC_ECON1, ECON1_RXEN); - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, ENC_WDDELAY, - enc_polltimer, (wdparm_t)priv); - /* Enable the Ethernet interrupt at the controller */ priv->lower->enable(priv->lower); @@ -2300,9 +2195,8 @@ static int enc_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); priv->lower->disable(priv->lower); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); /* Reset the device and leave in the power save state */ @@ -2365,7 +2259,7 @@ static int enc_txavail(struct net_driver_s *dev) * poll the network for new XMIT data */ - devif_timer(&priv->dev, 0, enc_txpoll); + devif_poll(&priv->dev, enc_txpoll); } } diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index b972d2fd99e..f6607b9464a 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -81,12 +81,6 @@ # define CONFIG_FTMAC100_NINTERFACES 1 #endif -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per - * second. - */ - -#define FTMAC100_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define FTMAC100_TXTIMEOUT (60*CLK_TCK) @@ -161,7 +155,6 @@ struct ftmac100_driver_s /* NuttX net data */ bool ft_bifup; /* true:ifup false:ifdown */ - struct wdog_s ft_txpoll; /* TX poll timer */ struct wdog_s ft_txtimeout; /* TX timeout timer */ unsigned int status; /* Last ISR status */ struct work_s ft_irqwork; /* For deferring work to the work queue */ @@ -208,9 +201,6 @@ static int ftmac100_interrupt(int irq, FAR void *context, FAR void *arg); static void ftmac100_txtimeout_work(FAR void *arg); static void ftmac100_txtimeout_expiry(wdparm_t arg); -static void ftmac100_poll_work(FAR void *arg); -static void ftmac100_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int ftmac100_ifup(FAR struct net_driver_s *dev); @@ -1089,75 +1079,6 @@ static void ftmac100_txtimeout_expiry(wdparm_t arg) work_queue(FTMAWORK, &priv->ft_irqwork, ftmac100_txtimeout_work, priv, 0); } -/**************************************************************************** - * Name: ftmac100_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void ftmac100_poll_work(FAR void *arg) -{ - FAR struct ftmac100_driver_s *priv = (FAR struct ftmac100_driver_s *)arg; - - /* Perform the poll */ - - net_lock(); - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - /* If so, update TCP timing states and poll the network for new XMIT data. - * Hmmm.. might be bug here. Does this mean if there is a transmit in - * progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->ft_dev, FTMAC100_WDDELAY, ftmac100_txpoll); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->ft_txpoll, FTMAC100_WDDELAY, - ftmac100_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: ftmac100_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void ftmac100_poll_expiry(wdparm_t arg) -{ - FAR struct ftmac100_driver_s *priv = (FAR struct ftmac100_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(FTMAWORK, &priv->ft_pollwork, ftmac100_poll_work, priv, 0); -} - /**************************************************************************** * Name: ftmac100_ifup * @@ -1210,11 +1131,6 @@ static int ftmac100_ifup(struct net_driver_s *dev) ftmac100_ipv6multicast(priv); #endif - /* Set and activate a timer process */ - - wd_start(&priv->ft_txpoll, FTMAC100_WDDELAY, - ftmac100_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->ft_bifup = true; @@ -1251,9 +1167,8 @@ static int ftmac100_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(CONFIG_FTMAC100_IRQ); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->ft_txpoll); wd_cancel(&priv->ft_txtimeout); /* Put the EMAC in its reset, non-operational state. This should be @@ -1305,7 +1220,7 @@ static void ftmac100_txavail_work(FAR void *arg) /* If so, then poll the network for new XMIT data */ - devif_timer(&priv->ft_dev, 0, ftmac100_txpoll); + devif_poll(&priv->ft_dev, ftmac100_txpoll); } net_unlock(); diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c index 066e7088b68..6753bb5b510 100644 --- a/drivers/net/lan91c111.c +++ b/drivers/net/lan91c111.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -68,12 +67,6 @@ # define lan91c111_dumppacket(m, b, l) #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define LAN91C111_WDDELAY (1*CLK_TCK) - /* MII busy delay = 1 microsecond */ #define LAN91C111_MIIDELAY 1 @@ -91,7 +84,6 @@ struct lan91c111_driver_s uintptr_t base; /* Base address */ int irq; /* IRQ number */ uint16_t bank; /* Current bank */ - struct wdog_s txpoll; /* TX poll timer */ struct work_s irqwork; /* For deferring interrupt work to the work queue */ struct work_s pollwork; /* For deferring poll work to the work queue */ uint8_t pktbuf[MAX_NETDEV_PKTSIZE + 4]; /* +4 due to getregs32/putregs32 */ @@ -119,11 +111,6 @@ static void lan91c111_txdone(FAR struct net_driver_s *dev); static void lan91c111_interrupt_work(FAR void *arg); static int lan91c111_interrupt(int irq, FAR void *context, FAR void *arg); -/* Watchdog timer expirations */ - -static void lan91c111_poll_work(FAR void *arg); -static void lan91c111_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int lan91c111_ifup(FAR struct net_driver_s *dev); @@ -978,87 +965,6 @@ static int lan91c111_interrupt(int irq, FAR void *context, FAR void *arg) return OK; } -/**************************************************************************** - * Name: lan91c111_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Run on a work queue thread. - * - ****************************************************************************/ - -static void lan91c111_poll_work(FAR void *arg) -{ - FAR struct net_driver_s *dev = arg; - FAR struct lan91c111_driver_s *priv = dev->d_private; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - /* Perform the poll */ - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - if (getreg16(priv, MIR_REG) & MIR_FREE_MASK) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. Hmmm.. might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(dev, LAN91C111_WDDELAY, lan91c111_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, LAN91C111_WDDELAY, - lan91c111_poll_expiry, (wdparm_t)dev); - net_unlock(); -} - -/**************************************************************************** - * Name: lan91c111_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Runs in the context of a the timer interrupt handler. Local - * interrupts are disabled by the interrupt logic. - * - ****************************************************************************/ - -static void lan91c111_poll_expiry(wdparm_t arg) -{ - FAR struct net_driver_s *dev = (FAR struct net_driver_s *)arg; - FAR struct lan91c111_driver_s *priv = dev->d_private; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(LAN91C111_WORK, &priv->pollwork, lan91c111_poll_work, dev, 0); -} - /**************************************************************************** * Name: lan91c111_ifup * @@ -1124,10 +1030,6 @@ static int lan91c111_ifup(FAR struct net_driver_s *dev) lan91c111_ipv6multicast(dev); #endif - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, LAN91C111_WDDELAY, - lan91c111_poll_expiry, (wdparm_t)dev); net_unlock(); /* Enable the Ethernet interrupt */ @@ -1163,10 +1065,6 @@ static int lan91c111_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(priv->irq); - /* Cancel the TX poll timer and work */ - - wd_cancel(&priv->txpoll); - work_cancel(LAN91C111_WORK, &priv->irqwork); work_cancel(LAN91C111_WORK, &priv->pollwork); @@ -1228,7 +1126,7 @@ static void lan91c111_txavail_work(FAR void *arg) { /* If so, then poll the network for new XMIT data */ - devif_timer(dev, 0, lan91c111_txpoll); + devif_poll(dev, lan91c111_txpoll); } } diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 0db33f30796..ea29c9ba86b 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -37,7 +37,6 @@ #include #include -#include #include #include #include @@ -60,12 +59,6 @@ # error Worker thread support is required (CONFIG_SCHED_WORKQUEUE) #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define LO_WDDELAY (1*CLK_TCK) - /* This is a helper pointer for accessing the contents of the IP header */ #define IPv4BUF ((FAR struct ipv4_hdr_s *)priv->lo_dev.d_buf) @@ -83,7 +76,6 @@ struct lo_driver_s { bool lo_bifup; /* true:ifup false:ifdown */ bool lo_txdone; /* One RX packet was looped back */ - struct wdog_s lo_polldog; /* TX poll timer */ struct work_s lo_work; /* For deferring poll work to the work queue */ /* This holds the information visible to the NuttX network */ @@ -105,8 +97,6 @@ static uint8_t g_iobuffer[NET_LO_PKTSIZE + CONFIG_NET_GUARDSIZE]; /* Polling logic */ static int lo_txpoll(FAR struct net_driver_s *dev); -static void lo_poll_work(FAR void *arg); -static void lo_poll_expiry(wdparm_t arg); /* NuttX callback functions */ @@ -128,8 +118,8 @@ static int lo_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); * * Description: * Check if the network has any outgoing packets ready to send. This is - * a callback from devif_poll() or devif_timer(). devif_poll() will be - * called only during normal TX polling. + * a callback from devif_poll(). devif_poll() will be called only during + * normal TX polling. * * Input Parameters: * dev - Reference to the NuttX driver state structure @@ -197,75 +187,6 @@ static int lo_txpoll(FAR struct net_driver_s *dev) return 0; } -/**************************************************************************** - * Name: lo_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked - * - ****************************************************************************/ - -static void lo_poll_work(FAR void *arg) -{ - FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg; - - /* Perform the poll */ - - net_lock(); - priv->lo_txdone = false; - devif_timer(&priv->lo_dev, LO_WDDELAY, lo_txpoll); - - /* Was something received and looped back? */ - - while (priv->lo_txdone) - { - /* Yes, poll again for more TX data */ - - priv->lo_txdone = false; - devif_poll(&priv->lo_dev, lo_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->lo_polldog, LO_WDDELAY, lo_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: lo_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void lo_poll_expiry(wdparm_t arg) -{ - FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(LPWORK, &priv->lo_work, lo_poll_work, priv, 0); -} - /**************************************************************************** * Name: lo_ifup * @@ -300,11 +221,6 @@ static int lo_ifup(FAR struct net_driver_s *dev) NTOHS(dev->d_ipv6addr[6]), NTOHS(dev->d_ipv6addr[7])); #endif - /* Set and activate a timer process */ - - wd_start(&priv->lo_polldog, LO_WDDELAY, - lo_poll_expiry, (wdparm_t)priv); - priv->lo_bifup = true; netdev_carrier_on(dev); return OK; @@ -332,10 +248,6 @@ static int lo_ifdown(FAR struct net_driver_s *dev) netdev_carrier_off(dev); - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(&priv->lo_polldog); - /* Mark the device "down" */ priv->lo_bifup = false; @@ -373,7 +285,7 @@ static void lo_txavail_work(FAR void *arg) /* If so, then poll the network for new XMIT data */ priv->lo_txdone = false; - devif_timer(&priv->lo_dev, 0, lo_txpoll); + devif_poll(&priv->lo_dev, lo_txpoll); } while (priv->lo_txdone); } diff --git a/drivers/net/rpmsgdrv.c b/drivers/net/rpmsgdrv.c index 6c102fb37f2..77b4273af9c 100644 --- a/drivers/net/rpmsgdrv.c +++ b/drivers/net/rpmsgdrv.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -58,12 +57,6 @@ # define net_rpmsg_drv_dumppacket(m, b, l) #endif -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per - * second. - */ - -#define NET_RPMSG_DRV_WDDELAY (1*CLK_TCK) - /**************************************************************************** * Private Types ****************************************************************************/ @@ -83,7 +76,6 @@ struct net_rpmsg_drv_s FAR const char *cpuname; FAR const char *devname; struct rpmsg_endpoint ept; - struct wdog_s txpoll; /* TX poll timer */ struct work_s pollwork; /* For deferring poll work to the work queue */ /* This holds the information visible to the NuttX network */ @@ -124,11 +116,6 @@ static int net_rpmsg_drv_ept_cb(FAR struct rpmsg_endpoint *ept, void *data, static int net_rpmsg_drv_send_recv(struct net_driver_s *dev, void *header_, uint32_t command, int len); -/* Watchdog timer expirations */ - -static void net_rpmsg_drv_poll_work(FAR void *arg); -static void net_rpmsg_drv_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev); @@ -699,100 +686,6 @@ out: return ret; } -/**************************************************************************** - * Name: net_rpmsg_drv_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Run on a work queue thread. - * - ****************************************************************************/ - -static void net_rpmsg_drv_poll_work(FAR void *arg) -{ - FAR struct net_driver_s *dev = arg; - FAR struct net_rpmsg_drv_s *priv = dev->d_private; - uint32_t size; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - /* Perform the poll */ - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - if (dev->d_buf == NULL) - { - /* Try to get the payload buffer if not yet */ - - dev->d_buf = rpmsg_get_tx_payload_buffer(&priv->ept, &size, false); - if (dev->d_buf) - { - dev->d_buf += sizeof(struct net_rpmsg_transfer_s); - dev->d_pktsize = size - sizeof(struct net_rpmsg_transfer_s); - } - } - - if (dev->d_buf) - { - /* If so, update TCP timing states and poll the network for new XMIT - * data. Hmmm.. might be bug here. Does this mean if there is a - * transmit in progress, we will missing TCP time state updates? - */ - - devif_timer(dev, NET_RPMSG_DRV_WDDELAY, net_rpmsg_drv_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, NET_RPMSG_DRV_WDDELAY, - net_rpmsg_drv_poll_expiry, (wdparm_t)dev); - net_unlock(); -} - -/**************************************************************************** - * Name: net_rpmsg_drv_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Runs in the context of a the timer interrupt handler. Local - * interrupts are disabled by the interrupt logic. - * - ****************************************************************************/ - -static void net_rpmsg_drv_poll_expiry(wdparm_t arg) -{ - FAR struct net_driver_s *dev = (FAR struct net_driver_s *)arg; - FAR struct net_rpmsg_drv_s *priv = dev->d_private; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(LPWORK, &priv->pollwork, net_rpmsg_drv_poll_work, dev, 0); -} - /**************************************************************************** * Name: net_rpmsg_drv_ifup * @@ -813,7 +706,6 @@ static void net_rpmsg_drv_poll_expiry(wdparm_t arg) static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev) { - FAR struct net_rpmsg_drv_s *priv = dev->d_private; struct net_rpmsg_ifup_s msg = { }; @@ -882,11 +774,6 @@ static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev) net_rpmsg_drv_ipv6multicast(dev); #endif - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, NET_RPMSG_DRV_WDDELAY, - net_rpmsg_drv_poll_expiry, (wdparm_t)dev); - net_unlock(); #ifdef CONFIG_NETDB_DNSCLIENT @@ -953,9 +840,6 @@ static int net_rpmsg_drv_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); - /* Cancel the TX poll timer and work */ - - wd_cancel(&priv->txpoll); work_cancel(LPWORK, &priv->pollwork); leave_critical_section(flags); @@ -1023,7 +907,7 @@ static void net_rpmsg_drv_txavail_work(FAR void *arg) { /* If so, then poll the network for new XMIT data */ - devif_timer(dev, 0, net_rpmsg_drv_txpoll); + devif_poll(dev, net_rpmsg_drv_txpoll); } } diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index 792ae6ca52b..11a0e08c9a1 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -76,12 +76,6 @@ # define CONFIG_SKELETON_NINTERFACES 1 #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SKELETON_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define SKELETON_TXTIMEOUT (60*CLK_TCK) @@ -101,7 +95,6 @@ struct skel_driver_s { bool sk_bifup; /* true:ifup false:ifdown */ - struct wdog_s sk_txpoll; /* TX poll timer */ struct wdog_s sk_txtimeout; /* TX timeout timer */ struct work_s sk_irqwork; /* For deferring interrupt work to the work queue */ struct work_s sk_pollwork; /* For deferring poll work to the work queue */ @@ -160,9 +153,6 @@ static int skel_interrupt(int irq, FAR void *context, FAR void *arg); static void skel_txtimeout_work(FAR void *arg); static void skel_txtimeout_expiry(wdparm_t arg); -static void skel_poll_work(FAR void *arg); -static void skel_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int skel_ifup(FAR struct net_driver_s *dev); @@ -687,82 +677,6 @@ static void skel_txtimeout_expiry(wdparm_t arg) work_queue(ETHWORK, &priv->sk_irqwork, skel_txtimeout_work, priv, 0); } -/**************************************************************************** - * Name: skel_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Run on a work queue thread. - * - ****************************************************************************/ - -static void skel_poll_work(FAR void *arg) -{ - FAR struct skel_driver_s *priv = (FAR struct skel_driver_s *)arg; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - /* Perform the poll */ - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - /* If so, update TCP timing states and poll the network for new XMIT data. - * Hmmm.. might be bug here. Does this mean if there is a transmit in - * progress, we will missing TCP time state updates? - */ - - devif_timer(&priv->sk_dev, SKELETON_WDDELAY, skel_txpoll); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->sk_txpoll, SKELETON_WDDELAY, - skel_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: skel_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Runs in the context of a the timer interrupt handler. Local - * interrupts are disabled by the interrupt logic. - * - ****************************************************************************/ - -static void skel_poll_expiry(wdparm_t arg) -{ - FAR struct skel_driver_s *priv = (FAR struct skel_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->sk_pollwork, skel_poll_work, priv, 0); -} - /**************************************************************************** * Name: skel_ifup * @@ -808,11 +722,6 @@ static int skel_ifup(FAR struct net_driver_s *dev) skel_ipv6multicast(priv); #endif - /* Set and activate a timer process */ - - wd_start(&priv->sk_txpoll, SKELETON_WDDELAY, - skel_poll_expiry, (wdparm_t)priv); - /* Enable the Ethernet interrupt */ priv->sk_bifup = true; @@ -848,9 +757,8 @@ static int skel_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); up_disable_irq(CONFIG_SKELETON_IRQ); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->sk_txpoll); wd_cancel(&priv->sk_txtimeout); /* Put the EMAC in its reset, non-operational state. This should be @@ -902,7 +810,7 @@ static void skel_txavail_work(FAR void *arg) /* If so, then poll the network for new XMIT data */ - devif_timer(&priv->sk_dev, 0, skel_txpoll); + devif_poll(&priv->sk_dev, skel_txpoll); } net_unlock(); diff --git a/drivers/net/slip.c b/drivers/net/slip.c index f1b492d4e6a..160f1cca014 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -439,9 +439,6 @@ static int slip_txtask(int argc, FAR char *argv[]) { FAR struct slip_driver_s *priv; unsigned int index = *(argv[1]) - '0'; - clock_t start_ticks; - clock_t now_ticks; - unsigned int hsec; int ret; nerr("index: %d\n", index); @@ -456,7 +453,6 @@ static int slip_txtask(int argc, FAR char *argv[]) /* Loop forever */ - start_ticks = clock_systime_ticks(); for (; ; ) { /* Wait for the timeout to expire (or until we are signaled by */ @@ -488,23 +484,9 @@ static int slip_txtask(int argc, FAR char *argv[]) net_lock(); priv->dev.d_buf = priv->txbuf; - /* Has a half second elapsed since the last timer poll? */ + /* perform the normal TX poll */ - now_ticks = clock_systime_ticks(); - hsec = (unsigned int)((now_ticks - start_ticks) / TICK_PER_HSEC); - if (hsec > 0) - { - /* Yes, perform the timer poll */ - - devif_timer(&priv->dev, hsec * TICK_PER_HSEC, slip_txpoll); - start_ticks += hsec * TICK_PER_HSEC; - } - else - { - /* No, perform the normal TX poll */ - - devif_timer(&priv->dev, 0, slip_txpoll); - } + devif_poll(&priv->dev, slip_txpoll); net_unlock(); } diff --git a/drivers/net/tun.c b/drivers/net/tun.c index f9c9150111a..195e2e826d4 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -59,7 +59,6 @@ #include #include -#include #include #include #include @@ -105,12 +104,6 @@ #define NET_TUN_PKTSIZE ((CONFIG_NET_TUN_PKTSIZE + CONFIG_NET_GUARDSIZE + 1) & ~1) -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define TUN_WDDELAY (1 * CLK_TCK) - /* This is a helper pointer for accessing the contents of the Ethernet * header. */ @@ -137,7 +130,6 @@ struct tun_device_s bool bifup; /* true:ifup false:ifdown */ bool read_wait; bool write_wait; - struct wdog_s txpoll; /* TX poll timer */ struct work_s work; /* For deferring poll work to the work queue */ FAR struct pollfd *poll_fds; sem_t waitsem; @@ -190,11 +182,6 @@ static void tun_net_receive_tun(FAR struct tun_device_s *priv); static void tun_txdone(FAR struct tun_device_s *priv); -/* Watchdog timer expirations */ - -static void tun_poll_work(FAR void *arg); -static void tun_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int tun_ifup(FAR struct net_driver_s *dev); @@ -759,89 +746,6 @@ static void tun_txdone(FAR struct tun_device_s *priv) devif_poll(&priv->dev, tun_txpoll); } -/**************************************************************************** - * Name: tun_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Ethernet interrupts are disabled - * - ****************************************************************************/ - -static void tun_poll_work(FAR void *arg) -{ - FAR struct tun_device_s *priv = (FAR struct tun_device_s *)arg; - int ret; - - /* Perform the poll */ - - ret = tun_lock(priv); - if (ret < 0) - { - /* This would indicate that the worker thread was canceled.. not a - * likely event. - */ - - DEBUGASSERT(ret == -ECANCELED); - return; - } - - net_lock(); - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - if (priv->read_d_len == 0) - { - /* If so, poll the network for new XMIT data. */ - - priv->dev.d_buf = priv->read_buf; - devif_timer(&priv->dev, TUN_WDDELAY, tun_txpoll); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, TUN_WDDELAY, tun_poll_expiry, (wdparm_t)priv); - - net_unlock(); - tun_unlock(priv); -} - -/**************************************************************************** - * Name: tun_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void tun_poll_expiry(wdparm_t arg) -{ - FAR struct tun_device_s *priv = (FAR struct tun_device_s *)arg; - - /* Schedule to perform the timer expiration on the worker thread. */ - - work_queue(TUNWORK, &priv->work, tun_poll_work, priv, 0); -} - /**************************************************************************** * Name: tun_ifup * @@ -877,10 +781,6 @@ static int tun_ifup(FAR struct net_driver_s *dev) dev->d_ipv6addr[6], dev->d_ipv6addr[7]); #endif - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, TUN_WDDELAY, tun_poll_expiry, (wdparm_t)priv); - priv->bifup = true; netdev_carrier_on(dev); return OK; @@ -911,10 +811,6 @@ static int tun_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); - /* Cancel the TX poll timer */ - - wd_cancel(&priv->txpoll); - /* Mark the device "down" */ priv->bifup = false; @@ -969,7 +865,7 @@ static void tun_txavail_work(FAR void *arg) /* Poll the network for new XMIT data */ priv->dev.d_buf = priv->read_buf; - devif_timer(&priv->dev, 0, tun_txpoll); + devif_poll(&priv->dev, tun_txpoll); } net_unlock(); diff --git a/drivers/usbdev/cdcecm.c b/drivers/usbdev/cdcecm.c index d67201c3d9d..4563498f244 100644 --- a/drivers/usbdev/cdcecm.c +++ b/drivers/usbdev/cdcecm.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -90,12 +89,6 @@ # define CONFIG_CDCECM_NINTERFACES 1 #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define CDCECM_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define CDCECM_TXTIMEOUT (60*CLK_TCK) @@ -137,7 +130,6 @@ struct cdcecm_driver_s /* Network device */ bool bifup; /* true:ifup false:ifdown */ - struct wdog_s txpoll; /* TX poll timer */ struct work_s irqwork; /* For deferring interrupt work * to the work queue */ struct work_s pollwork; /* For deferring poll work to @@ -169,11 +161,6 @@ static void cdcecm_txdone(FAR struct cdcecm_driver_s *priv); static void cdcecm_interrupt_work(FAR void *arg); -/* Watchdog timer expirations */ - -static void cdcecm_poll_work(FAR void *arg); -static void cdcecm_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int cdcecm_ifup(FAR struct net_driver_s *dev); @@ -646,79 +633,6 @@ static void cdcecm_interrupt_work(FAR void *arg) net_unlock(); } -/**************************************************************************** - * Name: cdcecm_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * Run on a work queue thread. - * - ****************************************************************************/ - -static void cdcecm_poll_work(FAR void *arg) -{ - FAR struct cdcecm_driver_s *self = (FAR struct cdcecm_driver_s *)arg; - - ninfo("rxpending: %d, txdone: %d\n", self->rxpending, self->txdone); - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - /* Perform the poll. We are always able to accept another packet, since - * cdcecm_transmit will just wait until the USB device write request will - * become available. - */ - - devif_timer(&self->dev, CDCECM_WDDELAY, cdcecm_txpoll); - - /* Setup the watchdog poll timer again */ - - wd_start(&self->txpoll, CDCECM_WDDELAY, - cdcecm_poll_expiry, (wdparm_t)self); - - net_unlock(); -} - -/**************************************************************************** - * Name: cdcecm_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Runs in the context of a the timer interrupt handler. Local - * interrupts are disabled by the interrupt logic. - * - ****************************************************************************/ - -static void cdcecm_poll_expiry(wdparm_t arg) -{ - FAR struct cdcecm_driver_s *priv = (FAR struct cdcecm_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(ETHWORK, &priv->pollwork, cdcecm_poll_work, priv, 0); -} - /**************************************************************************** * Name: cdcecm_ifup * @@ -766,11 +680,6 @@ static int cdcecm_ifup(FAR struct net_driver_s *dev) cdcecm_ipv6multicast(priv); #endif - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, CDCECM_WDDELAY, - cdcecm_poll_expiry, (wdparm_t)priv); - priv->bifup = true; return OK; } @@ -802,10 +711,6 @@ static int cdcecm_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(&priv->txpoll); - /* Put the EMAC in its reset, non-operational state. This should be * a known configuration that will guarantee the cdcecm_ifup() always * successfully brings the interface back up. @@ -851,7 +756,7 @@ static void cdcecm_txavail_work(FAR void *arg) if (self->bifup) { - devif_timer(&self->dev, 0, cdcecm_txpoll); + devif_poll(&self->dev, cdcecm_txpoll); } net_unlock(); diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index 234fb649e15..9ae1e7e5d61 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #ifdef CONFIG_RNDIS_BOARD_SERIALSTR @@ -94,12 +93,6 @@ #define RNDIS_BUFFER_SIZE CONFIG_NET_ETH_PKTSIZE #define RNDIS_BUFFER_COUNT 4 -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define RNDIS_WDDELAY (1*CLK_TCK) - /* Work queue to use for network operations. LPWORK should be used here */ #define ETHWORK LPWORK @@ -145,7 +138,6 @@ struct rndis_dev_s struct rndis_req_s wrreqs[CONFIG_RNDIS_NWRREQS]; struct work_s rxwork; /* Worker for dispatching RX packets */ - struct wdog_s txpoll; /* TX poll watchdog */ struct work_s pollwork; /* TX poll worker */ bool registered; /* Has netdev_register() been called */ @@ -221,7 +213,6 @@ static int rndis_ifdown(FAR struct net_driver_s *dev); static int rndis_txavail(FAR struct net_driver_s *dev); static int rndis_transmit(FAR struct rndis_dev_s *priv); static int rndis_txpoll(FAR struct net_driver_s *dev); -static void rndis_polltimer(wdparm_t arg); /* usbclass callbacks */ @@ -1066,62 +1057,6 @@ static int rndis_transmit(FAR struct rndis_dev_s *priv) return ret; } -/**************************************************************************** - * Name: rndis_pollworker - * - * Description: - * Worker function called by txpoll worker. - * - ****************************************************************************/ - -static void rndis_pollworker(FAR void *arg) -{ - FAR struct rndis_dev_s *priv = (struct rndis_dev_s *)arg; - - DEBUGASSERT(priv != NULL); - - net_lock(); - - if (rndis_allocnetreq(priv)) - { - devif_timer(&priv->netdev, RNDIS_WDDELAY, rndis_txpoll); - - if (priv->net_req != NULL) - { - rndis_freenetreq(priv); - } - } - - net_unlock(); -} - -/**************************************************************************** - * Name: rndis_polltimer - * - * Description: - * Network poll watchdog timer callback - * - ****************************************************************************/ - -static void rndis_polltimer(wdparm_t arg) -{ - FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)arg; - int ret; - - if (work_available(&priv->pollwork)) - { - ret = work_queue(ETHWORK, &priv->pollwork, rndis_pollworker, - (FAR void *)priv, 0); - DEBUGASSERT(ret == OK); - UNUSED(ret); - } - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, RNDIS_WDDELAY, - rndis_polltimer, (wdparm_t)arg); -} - /**************************************************************************** * Name: rndis_ifup * @@ -1132,10 +1067,6 @@ static void rndis_polltimer(wdparm_t arg) static int rndis_ifup(FAR struct net_driver_s *dev) { - FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)dev->d_private; - - wd_start(&priv->txpoll, RNDIS_WDDELAY, - rndis_polltimer, (wdparm_t)priv); return OK; } @@ -1149,9 +1080,6 @@ static int rndis_ifup(FAR struct net_driver_s *dev) static int rndis_ifdown(FAR struct net_driver_s *dev) { - FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)dev->d_private; - - wd_cancel(&priv->txpoll); return OK; } @@ -1171,7 +1099,7 @@ static void rndis_txavail_work(FAR void *arg) if (rndis_allocnetreq(priv)) { - devif_timer(&priv->netdev, 0, rndis_txpoll); + devif_poll(&priv->netdev, rndis_txpoll); if (priv->net_req != NULL) { rndis_freenetreq(priv); diff --git a/drivers/usbhost/usbhost_cdcmbim.c b/drivers/usbhost/usbhost_cdcmbim.c index 7429dda266e..2aeeb9b39b4 100644 --- a/drivers/usbhost/usbhost_cdcmbim.c +++ b/drivers/usbhost/usbhost_cdcmbim.c @@ -50,7 +50,6 @@ #include #define CDCMBIM_NETBUF_SIZE 8192 -#define CDCMBIM_WDDELAY (1*CLK_TCK) /**************************************************************************** * Pre-processor Definitions @@ -228,7 +227,6 @@ struct usbhost_cdcmbim_s /* Network device members */ - struct wdog_s txpoll; /* TX poll timer */ bool bifup; /* true:ifup false:ifdown */ struct net_driver_s netdev; /* Interface understood by the network */ uint8_t txpktbuf[MAX_NETDEV_PKTSIZE]; @@ -319,7 +317,6 @@ static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv, uint8_t *buf, size_t len); static int cdcmbim_txpoll(struct net_driver_s *dev); -static void cdcmbim_txpoll_work(void *arg); /**************************************************************************** * Private Data @@ -2302,29 +2299,6 @@ static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv, net_unlock(); } -static void cdcmbim_txpoll_expiry(wdparm_t arg) -{ - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)arg; - - work_queue(LPWORK, &priv->txpollwork, cdcmbim_txpoll_work, priv, 0); -} - -static void cdcmbim_txpoll_work(void *arg) -{ - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)arg; - - net_lock(); - priv->netdev.d_buf = priv->txpktbuf; - - devif_timer(&priv->netdev, CDCMBIM_WDDELAY, cdcmbim_txpoll); - - /* setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, (1 * CLK_TCK), - cdcmbim_txpoll_expiry, (wdparm_t)priv); - net_unlock(); -} - /**************************************************************************** * Name: cdcmbim_txpoll * @@ -2425,10 +2399,6 @@ static int cdcmbim_ifup(struct net_driver_s *dev) } } - /* Start network TX poll */ - - wd_start(&priv->txpoll, (1 * CLK_TCK), - cdcmbim_txpoll_expiry, (wdparm_t)priv); priv->bifup = true; return OK; } @@ -2457,8 +2427,6 @@ static int cdcmbim_ifdown(struct net_driver_s *dev) flags = enter_critical_section(); - wd_cancel(&priv->txpoll); - /* Mark the device "down" */ priv->bifup = false; @@ -2496,7 +2464,7 @@ static void cdcmbim_txavail_work(void *arg) if (priv->bifup) { - devif_timer(&priv->netdev, 0, cdcmbim_txpoll); + devif_poll(&priv->netdev, cdcmbim_txpoll); } net_unlock(); diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c index f793f1ec06c..630e3579090 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c @@ -37,7 +37,6 @@ #include #include -#include #include #include #include @@ -83,12 +82,6 @@ # define CONFIG_IEEE80211_BROADCOM_NINTERFACES 1 #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define BCMF_WDDELAY (1*CLK_TCK) - /* TX timeout = 1 minute */ #define BCMF_TXTIMEOUT (60*CLK_TCK) @@ -109,11 +102,6 @@ static void bcmf_receive(FAR struct bcmf_dev_s *priv); static int bcmf_txpoll(FAR struct net_driver_s *dev); static void bcmf_rxpoll_work(FAR void *arg); -/* Watchdog timer expirations */ - -static void bcmf_poll_work(FAR void *arg); -static void bcmf_poll_expiry(wdparm_t arg); - /* NuttX callback functions */ static int bcmf_ifup(FAR struct net_driver_s *dev); @@ -517,7 +505,7 @@ static void bcmf_txdone_poll_work(FAR void *arg) priv->bc_dev.d_buf = priv->cur_tx_frame->data; priv->bc_dev.d_len = 0; - devif_timer(&priv->bc_dev, 0, bcmf_txpoll); + devif_poll(&priv->bc_dev, bcmf_txpoll); } net_unlock(); @@ -602,97 +590,6 @@ void bcmf_netdev_notify_rx(FAR struct bcmf_dev_s *priv) work_queue(BCMFWORK, &priv->bc_rxwork, bcmf_rxpoll_work, priv, 0); } -/**************************************************************************** - * Name: bcmf_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() was called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * - ****************************************************************************/ - -static void bcmf_poll_work(FAR void *arg) -{ - FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - - /* Perform the poll */ - - /* Check if there is room in the send another TX packet. We cannot perform - * the TX poll if he are unable to accept another packet for transmission. - */ - - if (bcmf_netdev_alloc_tx_frame(priv)) - { - goto exit_unlock; - } - - /* If so, update TCP timing states and poll the network for new XMIT data. - * Hmmm.. might be bug here. Does this mean if there is a transmit in - * progress, we will missing TCP time state updates? - */ - - priv->bc_dev.d_buf = priv->cur_tx_frame->data; - priv->bc_dev.d_len = 0; - devif_timer(&priv->bc_dev, BCMF_WDDELAY, bcmf_txpoll); - - /* Setup the watchdog poll timer again */ - -exit_unlock: - wd_start(&priv->bc_txpoll, BCMF_WDDELAY, - bcmf_poll_expiry, (wdparm_t)priv); - - net_unlock(); -} - -/**************************************************************************** - * Name: bcmf_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void bcmf_poll_expiry(wdparm_t arg) -{ - FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - if (work_available(&priv->bc_pollwork)) - { - work_queue(BCMFWORK, &priv->bc_pollwork, bcmf_poll_work, priv, 0); - } - else - { - wd_start(&priv->bc_txpoll, BCMF_WDDELAY, - bcmf_poll_expiry, (wdparm_t)priv); - } -} - /**************************************************************************** * Name: bcmf_ifup * @@ -736,11 +633,6 @@ static int bcmf_ifup(FAR struct net_driver_s *dev) bcmf_ipv6multicast(priv); #endif - /* Set and activate a timer process */ - - wd_start(&priv->bc_txpoll, BCMF_WDDELAY, - bcmf_poll_expiry, (wdparm_t)priv); - /* Enable the hardware interrupt */ priv->bc_bifup = true; @@ -773,10 +665,6 @@ static int bcmf_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); #warning Missing logic - /* Cancel the TX poll timer */ - - wd_cancel(&priv->bc_txpoll); - /* Put the EMAC in its reset, non-operational state. This should be * a known configuration that will guarantee the bcmf_ifup() always * successfully brings the interface back up. @@ -833,7 +721,7 @@ static void bcmf_txavail_work(FAR void *arg) priv->bc_dev.d_buf = priv->cur_tx_frame->data; priv->bc_dev.d_len = 0; - devif_timer(&priv->bc_dev, 0, bcmf_txpoll); + devif_poll(&priv->bc_dev, bcmf_txpoll); } exit_unlock: diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index 0e087e77cb4..be6206ed6d2 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -92,12 +91,6 @@ # define XBEENET_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE #endif -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per - * second. - */ - -#define TXPOLL_WDDELAY (1*CLK_TCK) - /**************************************************************************** * Private Types ****************************************************************************/ @@ -130,7 +123,6 @@ struct xbeenet_driver_s struct xbeenet_callback_s xd_cb; /* Callback information */ XBEEHANDLE xd_mac; /* Contained XBee MAC interface */ bool xd_bifup; /* true:ifup false:ifdown */ - struct wdog_s xd_txpoll; /* TX poll timer */ struct work_s xd_pollwork; /* Defer poll work to the work queue */ /* Hold a list of events */ @@ -169,8 +161,6 @@ static int xbeenet_rxframe(FAR struct xbeenet_driver_s *maccb, /* Common TX logic */ static int xbeenet_txpoll_callback(FAR struct net_driver_s *dev); -static void xbeenet_txpoll_work(FAR void *arg); -static void xbeenet_txpoll_expiry(wdparm_t arg); /* IOCTL support */ @@ -566,78 +556,6 @@ static int xbeenet_txpoll_callback(FAR struct net_driver_s *dev) return 0; } -/**************************************************************************** - * Name: xbeenet_txpoll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void xbeenet_txpoll_work(FAR void *arg) -{ - FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)arg; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - -#ifdef CONFIG_NET_6LOWPAN - /* Make sure the our single packet buffer is attached */ - - priv->xd_dev.r_dev.d_buf = g_iobuffer.rb_buf; -#endif - - /* Then perform the poll */ - - devif_timer(&priv->xd_dev.r_dev, TXPOLL_WDDELAY, xbeenet_txpoll_callback); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->xd_txpoll, TXPOLL_WDDELAY, - xbeenet_txpoll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: xbeenet_txpoll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void xbeenet_txpoll_expiry(wdparm_t arg) -{ - FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(XBEENET_WORK, &priv->xd_pollwork, xbeenet_txpoll_work, priv, 0); -} - /**************************************************************************** * Name: xbeenet_coord_eaddr * @@ -755,10 +673,6 @@ static int xbeenet_ifup(FAR struct net_driver_s *dev) wlinfo(" Node: %02x:%02x\n", dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1]); #endif - /* Set and activate a timer process */ - - wd_start(&priv->xd_txpoll, TXPOLL_WDDELAY, - xbeenet_txpoll_expiry, (wdparm_t)priv); /* The interface is now up */ @@ -795,10 +709,6 @@ static int xbeenet_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(&priv->xd_txpoll); - /* TODO: Put the xbee driver in its reset, non-operational state. This * should be a known configuration that will guarantee the xbeenet_ifup() * always successfully brings the interface back up. @@ -854,7 +764,7 @@ static void xbeenet_txavail_work(FAR void *arg) /* Then poll the network for new XMIT data */ - devif_timer(&priv->xd_dev.r_dev, 0, xbeenet_txpoll_callback); + devif_poll(&priv->xd_dev.r_dev, xbeenet_txpoll_callback); } net_unlock(); diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index 4dafdae4b37..656ec1934a6 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -215,12 +215,6 @@ #define SPIRIT_RXFIFO_ALMOSTFULL (3 * SPIRIT_MAX_FIFO_LEN / 4) #define SPIRIT_TXFIFO_ALMOSTEMPTY (1 * SPIRIT_MAX_FIFO_LEN / 4) -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define SPIRIT_WDDELAY (1*CLK_TCK) - /* Maximum number of retries (10) */ #define SPIRIT_MAX_RETX PKT_N_RETX_10 @@ -268,12 +262,10 @@ struct spirit_driver_s struct work_s txwork; /* TX work queue support (HP) */ struct work_s rxwork; /* RX work queue support (LP) */ struct work_s pollwork; /* TX network poll work (LP) */ - struct wdog_s txpoll; /* TX poll timer */ struct wdog_s txtimeout; /* TX timeout timer */ sem_t rxsem; /* Exclusive access to the RX queue */ sem_t txsem; /* Exclusive access to the TX queue */ bool ifup; /* Spirit is on and interface is up */ - bool needpoll; /* Timer poll needed */ uint8_t state; /* See enum spirit_driver_state_e */ uint8_t counter; /* Count used with TX timeout */ uint8_t prescaler; /* Prescaler used with TX timeout */ @@ -316,7 +308,6 @@ static void spirit_txtimeout_work(FAR void *arg); static void spirit_txtimeout_expiry(wdparm_t arg); static void spirit_txpoll_work(FAR void *arg); -static void spirit_txpoll_expiry(wdparm_t arg); /* NuttX callback functions */ @@ -1788,63 +1779,16 @@ static void spirit_txpoll_work(FAR void *arg) /* Do nothing if the network is not yet UP */ - if (!priv->ifup) - { - priv->needpoll = false; - } - - /* Is a periodic poll needed? */ - - else if (priv->needpoll) - { - /* Perform the periodic poll */ - - priv->needpoll = false; - devif_timer(&priv->radio.r_dev, SPIRIT_WDDELAY, - spirit_txpoll_callback); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->txpoll, SPIRIT_WDDELAY, - spirit_txpoll_expiry, (wdparm_t)priv); - } - else + if (priv->ifup) { /* Perform a normal, asynchronous poll for new TX data */ - devif_timer(&priv->radio.r_dev, 0, spirit_txpoll_callback); + devif_poll(&priv->radio.r_dev, spirit_txpoll_callback); } net_unlock(); } -/**************************************************************************** - * Name: spirit_txpoll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void spirit_txpoll_expiry(wdparm_t arg) -{ - FAR struct spirit_driver_s *priv = (FAR struct spirit_driver_s *)arg; - - /* Schedule to perform the poll work on the LP worker thread. */ - - priv->needpoll = true; - work_queue(LPWORK, &priv->pollwork, spirit_txpoll_work, priv, 0); -} - /**************************************************************************** * Name: spirit_ifup * @@ -1941,11 +1885,6 @@ static int spirit_ifup(FAR struct net_driver_s *dev) goto error_with_ifalmostup; } - /* Set and activate a timer process */ - - wd_start(&priv->txpoll, SPIRIT_WDDELAY, - spirit_txpoll_expiry, (wdparm_t)priv); - /* Enables the interrupts from the SPIRIT1 */ DEBUGASSERT(priv->lower->enable != NULL); @@ -2005,9 +1944,8 @@ static int spirit_ifdown(FAR struct net_driver_s *dev) DEBUGASSERT(priv->lower->enable != NULL); priv->lower->enable(priv->lower, false); - /* Cancel the TX poll timer and TX timeout timers */ + /* Cancel the TX timeout timers */ - wd_cancel(&priv->txpoll); wd_cancel(&priv->txtimeout); leave_critical_section(flags); diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h index 6db2237352d..be811e31e85 100644 --- a/include/nuttx/net/netdev.h +++ b/include/nuttx/net/netdev.h @@ -546,8 +546,6 @@ int sixlowpan_input(FAR struct radio_driver_s *ieee, ****************************************************************************/ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback); -int devif_timer(FAR struct net_driver_s *dev, int delay, - devif_poll_callback_t callback); /**************************************************************************** * Name: neighbor_out diff --git a/net/devif/devif_poll.c b/net/devif/devif_poll.c index b3a0395ac02..c928be2defb 100644 --- a/net/devif/devif_poll.c +++ b/net/devif/devif_poll.c @@ -771,34 +771,4 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback) return bstop; } -/**************************************************************************** - * Name: devif_timer - * - * Description: - * This function will traverse each active network connection structure and - * perform network timer operations. The Ethernet driver MUST implement - * logic to periodically call devif_timer(). - * - * This function will call the provided callback function for every active - * connection. Polling will continue until all connections have been polled - * or until the user-supplied function returns a non-zero value (which it - * should do only if it cannot accept further write data). - * - * When the callback function is called, there may be an outbound packet - * waiting for service in the device packet buffer, and if so the d_len - * field is set to a value larger than zero. The device driver should then - * send out the packet. - * - * Assumptions: - * This function is called from the MAC device driver with the network - * locked. - * - ****************************************************************************/ - -int devif_timer(FAR struct net_driver_s *dev, int delay, - devif_poll_callback_t callback) -{ - return devif_poll(dev, callback); -} - #endif /* CONFIG_NET */ diff --git a/wireless/bluetooth/bt_netdev.c b/wireless/bluetooth/bt_netdev.c index 684e686e3b6..e4996b6b519 100644 --- a/wireless/bluetooth/bt_netdev.c +++ b/wireless/bluetooth/bt_netdev.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -78,12 +77,6 @@ # error CONFIG_IOB_BUFSIZE to small for max Bluetooth frame #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define TXPOLL_WDDELAY (1*CLK_TCK) - /**************************************************************************** * Private Types ****************************************************************************/ @@ -112,7 +105,6 @@ struct btnet_driver_s sem_t bd_exclsem; /* Exclusive access to struct */ bool bd_bifup; /* true:ifup false:ifdown */ - struct wdog_s bd_txpoll; /* TX poll timer */ struct work_s bd_pollwork; /* Defer poll work to the work queue */ #ifdef CONFIG_WIRELESS_BLUETOOTH_HOST @@ -161,8 +153,6 @@ static void btnet_hci_received(FAR struct bt_buf_s *buf, FAR void *context); /* Common TX logic */ static int btnet_txpoll_callback(FAR struct net_driver_s *netdev); -static void btnet_txpoll_work(FAR void *arg); -static void btnet_txpoll_expiry(wdparm_t arg); /* NuttX callback functions */ @@ -636,78 +626,6 @@ static int btnet_txpoll_callback(FAR struct net_driver_s *netdev) return 0; } -/**************************************************************************** - * Name: btnet_txpoll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void btnet_txpoll_work(FAR void *arg) -{ - FAR struct btnet_driver_s *priv = (FAR struct btnet_driver_s *)arg; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - -#ifdef CONFIG_NET_6LOWPAN - /* Make sure the our single packet buffer is attached */ - - priv->bd_dev.r_dev.d_buf = g_iobuffer.rb_buf; -#endif - - /* Then perform the poll */ - - devif_timer(&priv->bd_dev.r_dev, TXPOLL_WDDELAY, btnet_txpoll_callback); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->bd_txpoll, TXPOLL_WDDELAY, - btnet_txpoll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: btnet_txpoll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void btnet_txpoll_expiry(wdparm_t arg) -{ - FAR struct btnet_driver_s *priv = (FAR struct btnet_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(LPWORK, &priv->bd_pollwork, btnet_txpoll_work, priv, 0); -} - /**************************************************************************** * Name: btnet_ifup * @@ -754,11 +672,6 @@ static int btnet_ifup(FAR struct net_driver_s *netdev) netdev->d_mac.radio.nv_addr[4], netdev->d_mac.radio.nv_addr[5]); #endif - /* Set and activate a timer process */ - - wd_start(&priv->bd_txpoll, TXPOLL_WDDELAY, - btnet_txpoll_expiry, (wdparm_t)priv); - /* The interface is now up */ priv->bd_bifup = true; @@ -794,10 +707,6 @@ static int btnet_ifdown(FAR struct net_driver_s *netdev) flags = spin_lock_irqsave(NULL); - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(&priv->bd_txpoll); - /* Put the EMAC in its reset, non-operational state. This should be * a known configuration that will guarantee the btnet_ifup() always * successfully brings the interface back up. diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c index ccabf970bba..72894415cb6 100644 --- a/wireless/ieee802154/mac802154_loopback.c +++ b/wireless/ieee802154/mac802154_loopback.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -85,12 +84,6 @@ # define LO_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define LO_WDDELAY (1*CLK_TCK) - /* Fake value for MAC header length */ #define MAC_HDRLEN 9 @@ -108,7 +101,6 @@ struct lo_driver_s bool lo_bifup; /* true:ifup false:ifdown */ bool lo_pending; /* True: TX poll pending */ uint8_t lo_panid[2]; /* Fake PAN ID for testing */ - struct wdog_s lo_polldog; /* TX poll timer */ struct work_s lo_work; /* For deferring poll work to the work queue */ FAR struct iob_s *lo_head; /* Head of IOBs queued for loopback */ FAR struct iob_s *lo_tail; /* Tail of IOBs queued for loopback */ @@ -155,8 +147,6 @@ static inline void lo_netmask(FAR struct net_driver_s *dev); static int lo_loopback(FAR struct net_driver_s *dev); static void lo_loopback_work(FAR void *arg); -static void lo_poll_work(FAR void *arg); -static void lo_poll_expiry(wdparm_t arg); /* NuttX callback functions */ @@ -439,82 +429,6 @@ static void lo_loopback_work(FAR void *arg) net_unlock(); } -/**************************************************************************** - * Name: lo_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked - * - ****************************************************************************/ - -static void lo_poll_work(FAR void *arg) -{ - FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg; - - /* Perform the poll */ - - net_lock(); - -#ifdef CONFIG_NET_6LOWPAN - /* Make sure the our single packet buffer is attached */ - - priv->lo_radio.r_dev.d_buf = g_iobuffer.rb_buf; -#endif - - /* Then perform the poll */ - - devif_timer(&priv->lo_radio.r_dev, LO_WDDELAY, lo_loopback); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->lo_polldog, LO_WDDELAY, lo_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: lo_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void lo_poll_expiry(wdparm_t arg) -{ - FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg; - - if (!work_available(&priv->lo_work) || priv->lo_head != NULL) - { - nwarn("WARNING: lo_work NOT available\n"); - priv->lo_pending = true; - } - else - { - /* Schedule to perform the interrupt processing on the worker thread. */ - - priv->lo_pending = false; - work_queue(LPBKWORK, &priv->lo_work, lo_poll_work, priv, 0); - } -} - /**************************************************************************** * Name: lo_ifup * @@ -576,11 +490,6 @@ static int lo_ifup(FAR struct net_driver_s *dev) } #endif - /* Set and activate a timer process */ - - wd_start(&priv->lo_polldog, LO_WDDELAY, - lo_poll_expiry, (wdparm_t)priv); - priv->lo_bifup = true; return OK; } @@ -607,10 +516,6 @@ static int lo_ifdown(FAR struct net_driver_s *dev) ninfo("IP up: %u\n", priv->lo_bifup); - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(&priv->lo_polldog); - /* Mark the device "down" */ priv->lo_bifup = false; diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index 086d07b877c..74f8e15c7c7 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -104,12 +103,6 @@ "CONFIG_IOB_NBUFFERS to avoid waiting on req_data" #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define TXPOLL_WDDELAY (1*CLK_TCK) - /**************************************************************************** * Private Types ****************************************************************************/ @@ -141,7 +134,6 @@ struct macnet_driver_s struct macnet_callback_s md_cb; /* Callback information */ MACHANDLE md_mac; /* Contained MAC interface */ bool md_bifup; /* true:ifup false:ifdown */ - struct wdog_s md_txpoll; /* TX poll timer */ struct work_s md_pollwork; /* Defer poll work to the work queue */ /* Hold a list of events */ @@ -184,8 +176,6 @@ static int macnet_rxframe(FAR struct macnet_driver_s *maccb, /* Common TX logic */ static int macnet_txpoll_callback(FAR struct net_driver_s *dev); -static void macnet_txpoll_work(FAR void *arg); -static void macnet_txpoll_expiry(wdparm_t arg); /* IOCTL support */ @@ -534,78 +524,6 @@ static int macnet_txpoll_callback(FAR struct net_driver_s *dev) return 0; } -/**************************************************************************** - * Name: macnet_txpoll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void macnet_txpoll_work(FAR void *arg) -{ - FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)arg; - - /* Lock the network and serialize driver operations if necessary. - * NOTE: Serialization is only required in the case where the driver work - * is performed on an LP worker thread and where more than one LP worker - * thread has been configured. - */ - - net_lock(); - -#ifdef CONFIG_NET_6LOWPAN - /* Make sure the our single packet buffer is attached */ - - priv->md_dev.r_dev.d_buf = priv->md_iobuffer.rb_buf; -#endif - - /* Then perform the poll */ - - devif_timer(&priv->md_dev.r_dev, TXPOLL_WDDELAY, macnet_txpoll_callback); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->md_txpoll, TXPOLL_WDDELAY, - macnet_txpoll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: macnet_txpoll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * Global interrupts are disabled by the watchdog logic. - * - ****************************************************************************/ - -static void macnet_txpoll_expiry(wdparm_t arg) -{ - FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)arg; - - /* Schedule to perform the interrupt processing on the worker thread. */ - - work_queue(WPANWORK, &priv->md_pollwork, macnet_txpoll_work, priv, 0); -} - /**************************************************************************** * Name: macnet_coord_eaddr * @@ -760,11 +678,6 @@ static int macnet_ifup(FAR struct net_driver_s *dev) dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1]); #endif - /* Set and activate a timer process */ - - wd_start(&priv->md_txpoll, TXPOLL_WDDELAY, - macnet_txpoll_expiry, (wdparm_t)priv); - ret = OK; } @@ -800,10 +713,6 @@ static int macnet_ifdown(FAR struct net_driver_s *dev) flags = enter_critical_section(); - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(&priv->md_txpoll); - /* Put the EMAC in its reset, non-operational state. This should be * a known configuration that will guarantee the macnet_ifup() always * successfully brings the interface back up. diff --git a/wireless/pktradio/pktradio_loopback.c b/wireless/pktradio/pktradio_loopback.c index f598780624b..cd9d14f67c7 100644 --- a/wireless/pktradio/pktradio_loopback.c +++ b/wireless/pktradio/pktradio_loopback.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -76,12 +75,6 @@ # error No support for CONFIG_PKTRADIO_ADDRLEN other than {1,2,8} #endif -/* TX poll delay = 1 seconds. - * CLK_TCK is the number of clock ticks per second - */ - -#define LO_WDDELAY (1*CLK_TCK) - /* Fake value for MAC header length */ #if CONFIG_IOB_BUFSIZE > 40 @@ -103,7 +96,6 @@ struct lo_driver_s bool lo_bifup; /* true:ifup false:ifdown */ bool lo_pending; /* True: TX poll pending */ uint8_t lo_panid[2]; /* Fake PAN ID for testing */ - struct wdog_s lo_polldog; /* TX poll timer */ struct work_s lo_work; /* For deferring poll work to the work queue */ FAR struct iob_s *lo_head; /* Head of IOBs queued for loopback */ FAR struct iob_s *lo_tail; /* Tail of IOBs queued for loopback */ @@ -146,8 +138,6 @@ static inline void lo_netmask(FAR struct net_driver_s *dev); static int lo_loopback(FAR struct net_driver_s *dev); static void lo_loopback_work(FAR void *arg); -static void lo_poll_work(FAR void *arg); -static void lo_poll_expiry(wdparm_t arg); /* NuttX callback functions */ @@ -397,82 +387,6 @@ static void lo_loopback_work(FAR void *arg) net_unlock(); } -/**************************************************************************** - * Name: lo_poll_work - * - * Description: - * Perform periodic polling from the worker thread - * - * Input Parameters: - * arg - The argument passed when work_queue() as called. - * - * Returned Value: - * OK on success - * - * Assumptions: - * The network is locked - * - ****************************************************************************/ - -static void lo_poll_work(FAR void *arg) -{ - FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg; - - /* Perform the poll */ - - net_lock(); - -#ifdef CONFIG_NET_6LOWPAN - /* Make sure the our single packet buffer is attached */ - - priv->lo_radio.r_dev.d_buf = g_iobuffer.rb_buf; -#endif - - /* And perform the poll */ - - devif_timer(&priv->lo_radio.r_dev, LO_WDDELAY, lo_loopback); - - /* Setup the watchdog poll timer again */ - - wd_start(&priv->lo_polldog, LO_WDDELAY, lo_poll_expiry, (wdparm_t)priv); - net_unlock(); -} - -/**************************************************************************** - * Name: lo_poll_expiry - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Input Parameters: - * arg - The argument - * - * Returned Value: - * None - * - * Assumptions: - * The network is locked. - * - ****************************************************************************/ - -static void lo_poll_expiry(wdparm_t arg) -{ - FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg; - - if (!work_available(&priv->lo_work) || priv->lo_head != NULL) - { - nwarn("WARNING: lo_work NOT available\n"); - priv->lo_pending = true; - } - else - { - /* Schedule to perform the interrupt processing on the worker thread. */ - - priv->lo_pending = false; - work_queue(LPBKWORK, &priv->lo_work, lo_poll_work, priv, 0); - } -} - /**************************************************************************** * Name: lo_ifup * @@ -515,11 +429,6 @@ static int lo_ifup(FAR struct net_driver_s *dev) dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7]); #endif - /* Set and activate a timer process */ - - wd_start(&priv->lo_polldog, LO_WDDELAY, - lo_poll_expiry, (wdparm_t)priv); - priv->lo_bifup = true; return OK; } @@ -546,10 +455,6 @@ static int lo_ifdown(FAR struct net_driver_s *dev) ninfo("IP up: %u\n", priv->lo_bifup); - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(&priv->lo_polldog); - /* Mark the device "down" */ priv->lo_bifup = false;