bcm43xxx: Remove bcmf_txavail_work and resue bcmf_tx_poll_work
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
b343a42e8c
commit
f75f100954
@ -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 */
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
/* If so, then poll the network for new XMIT data */
|
||||
/* Ignore the notification if the interface is not yet up */
|
||||
|
||||
priv->bc_dev.d_buf = priv->cur_tx_frame->data;
|
||||
priv->bc_dev.d_len = 0;
|
||||
devif_poll(&priv->bc_dev, bcmf_txpoll);
|
||||
if (priv->bc_bifup)
|
||||
{
|
||||
/* Check if there is room in the hardware to hold another packet. */
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user