You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/06/16 06:13:21 UTC

[incubator-nuttx] branch master updated: bcm43xxx: Remove bcmf_txavail_work and resue bcmf_tx_poll_work

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new f75f100954 bcm43xxx: Remove bcmf_txavail_work and resue bcmf_tx_poll_work
f75f100954 is described below

commit f75f100954e2d8bf0000a637fe0273cd635f5837
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jun 16 02:15:50 2022 +0800

    bcm43xxx: Remove bcmf_txavail_work and resue bcmf_tx_poll_work
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h |   2 -
 drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c | 102 +++++-----------------
 drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h |   2 +-
 drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c  |   2 +-
 4 files changed, 22 insertions(+), 86 deletions(-)

diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h
index e3f5dea4ce..4386e4624e 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h
@@ -64,8 +64,6 @@ struct bcmf_dev_s
   FAR struct bcmf_bus_dev_s *bus; /* Bus interface structure */
 
   bool bc_bifup;             /* true:ifup false:ifdown */
-  struct wdog_s bc_txpoll;   /* TX poll timer */
-  struct work_s bc_irqwork;  /* For deferring interrupt work to the work queue */
   struct work_s bc_rxwork;   /* For deferring rx work to the work queue */
   struct work_s bc_pollwork; /* For deferring poll work to the work queue */
 
diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c
index 630e357909..1eba0f8d95 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c
@@ -82,10 +82,6 @@
 # define CONFIG_IEEE80211_BROADCOM_NINTERFACES 1
 #endif
 
-/* TX timeout = 1 minute */
-
-#define BCMF_TXTIMEOUT (60*CLK_TCK)
-
 /* This is a helper pointer for accessing the contents of Ethernet header */
 
 #define BUF ((FAR struct eth_hdr_s *)priv->bc_dev.d_buf)
@@ -107,7 +103,6 @@ static void bcmf_rxpoll_work(FAR void *arg);
 static int  bcmf_ifup(FAR struct net_driver_s *dev);
 static int  bcmf_ifdown(FAR struct net_driver_s *dev);
 
-static void bcmf_txavail_work(FAR void *arg);
 static int  bcmf_txavail(FAR struct net_driver_s *dev);
 
 #if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
@@ -472,13 +467,13 @@ static int bcmf_txpoll(FAR struct net_driver_s *dev)
 }
 
 /****************************************************************************
- * Function: bcmf_txdone_poll_work
+ * Function: bcmf_tx_poll_work
  *
  * Description:
  *   The function is called in order to perform an out-of-sequence TX poll.
  *   This is done:
  *
- *   1. After completion of a transmission (bcmf_netdev_notify_tx_done), and
+ *   1. After completion of a transmission (bcmf_netdev_notify_tx), and
  *   2. When new TX data is available (bcmf_txavail).
  *
  * Input Parameters:
@@ -491,21 +486,26 @@ static int bcmf_txpoll(FAR struct net_driver_s *dev)
  *
  ****************************************************************************/
 
-static void bcmf_txdone_poll_work(FAR void *arg)
+static void bcmf_tx_poll_work(FAR void *arg)
 {
   FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg;
 
-  /* Check if there is room in the hardware to hold another packet. */
-
   net_lock();
 
-  if (bcmf_netdev_alloc_tx_frame(priv) == OK)
+  /* Ignore the notification if the interface is not yet up */
+
+  if (priv->bc_bifup)
     {
-      /* If so, then poll the network for new XMIT data */
+      /* Check if there is room in the hardware to hold another packet. */
 
-      priv->bc_dev.d_buf = priv->cur_tx_frame->data;
-      priv->bc_dev.d_len = 0;
-      devif_poll(&priv->bc_dev, bcmf_txpoll);
+      if (bcmf_netdev_alloc_tx_frame(priv) == OK)
+        {
+          /* If so, then poll the network for new XMIT data */
+
+          priv->bc_dev.d_buf = priv->cur_tx_frame->data;
+          priv->bc_dev.d_len = 0;
+          devif_poll(&priv->bc_dev, bcmf_txpoll);
+        }
     }
 
   net_unlock();
@@ -553,23 +553,23 @@ static void bcmf_rxpoll_work(FAR void *arg)
 }
 
 /****************************************************************************
- * Name: bcmf_netdev_notify_tx_done
+ * Name: bcmf_netdev_notify_tx
  *
  * Description:
- *   Notify callback called when TX frame is sent and freed.
+ *   Notify callback called when TX frame is avail or sent.
  *
  * Assumptions:
  *
  ****************************************************************************/
 
-void bcmf_netdev_notify_tx_done(FAR struct bcmf_dev_s *priv)
+void bcmf_netdev_notify_tx(FAR struct bcmf_dev_s *priv)
 {
   /* Schedule to perform a poll for new Tx data the worker thread. */
 
   if (work_available(&priv->bc_pollwork))
     {
       work_queue(BCMFWORK, &priv->bc_pollwork,
-                 bcmf_txdone_poll_work, priv, 0);
+                 bcmf_tx_poll_work, priv, 0);
     }
 }
 
@@ -677,57 +677,6 @@ static int bcmf_ifdown(FAR struct net_driver_s *dev)
   return OK;
 }
 
-/****************************************************************************
- * Name: bcmf_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 bcmf_txavail_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();
-
-  /* Ignore the notification if the interface is not yet up */
-
-  if (priv->bc_bifup)
-    {
-      /* Check if there is room in the hardware to hold another packet. */
-
-      if (bcmf_netdev_alloc_tx_frame(priv))
-        {
-          goto exit_unlock;
-        }
-
-      /* If so, then poll the network for new XMIT data */
-
-      priv->bc_dev.d_buf = priv->cur_tx_frame->data;
-      priv->bc_dev.d_len = 0;
-      devif_poll(&priv->bc_dev, bcmf_txpoll);
-    }
-
-exit_unlock:
-  net_unlock();
-}
-
 /****************************************************************************
  * Name: bcmf_txavail
  *
@@ -751,18 +700,7 @@ static int bcmf_txavail(FAR struct net_driver_s *dev)
 {
   FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)dev->d_private;
 
-  /* Is our single work structure available?  It may not be if there are
-   * pending interrupt actions and we will have to ignore the Tx
-   * availability action.
-   */
-
-  if (work_available(&priv->bc_pollwork))
-    {
-      /* Schedule to serialize the poll on the worker thread. */
-
-      work_queue(BCMFWORK, &priv->bc_pollwork, bcmf_txavail_work, priv, 0);
-    }
-
+  bcmf_netdev_notify_tx(priv);
   return OK;
 }
 
diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h
index 07d851d9ce..33ce35c9a0 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h
@@ -35,6 +35,6 @@ int bcmf_netdev_register(FAR struct bcmf_dev_s *priv);
 
 void bcmf_netdev_notify_rx(FAR struct bcmf_dev_s *priv);
 
-void bcmf_netdev_notify_tx_done(FAR struct bcmf_dev_s *priv);
+void bcmf_netdev_notify_tx(FAR struct bcmf_dev_s *priv);
 
 #endif /* __DRIVERS_WIRELESS_IEEE80211_BCM43XXX_BCMF_NETDEV_H */
diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c
index 6def925d3e..33f04281aa 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c
@@ -433,7 +433,7 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv)
     {
       /* Notify upper layer at least one TX buffer is available */
 
-      bcmf_netdev_notify_tx_done(priv);
+      bcmf_netdev_notify_tx(priv);
     }
 
   return OK;