Skip to content

Commit b5992fe

Browse files
signal11davem330
authored andcommitted
mac802154: Use netif flow control
Use netif_stop_queue() and netif_wake_queue() to control the flow of packets to mac802154 devices. Since many IEEE 802.15.4 devices have no output buffer, and since the mac802154 xmit() function is designed to block, netif_stop_queue() is called after each packet. Signed-off-by: Alan Ott <alan@signal11.us> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7dd43d3 commit b5992fe

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎net/mac802154/tx.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/if_arp.h>
2626
#include <linux/crc-ccitt.h>
2727

28+
#include <net/ieee802154_netdev.h>
2829
#include <net/mac802154.h>
2930
#include <net/wpan-phy.h>
3031

@@ -44,6 +45,7 @@ struct xmit_work {
4445
static void mac802154_xmit_worker(struct work_struct *work)
4546
{
4647
struct xmit_work *xw = container_of(work, struct xmit_work, work);
48+
struct mac802154_sub_if_data *sdata;
4749
int res;
4850

4951
mutex_lock(&xw->priv->phy->pib_lock);
@@ -65,6 +67,11 @@ static void mac802154_xmit_worker(struct work_struct *work)
6567
out:
6668
mutex_unlock(&xw->priv->phy->pib_lock);
6769

70+
/* Restart the netif queue on each sub_if_data object. */
71+
rcu_read_lock();
72+
list_for_each_entry_rcu(sdata, &xw->priv->slaves, list)
73+
netif_wake_queue(sdata->dev);
74+
rcu_read_unlock();
6875

6976
dev_kfree_skb(xw->skb);
7077

@@ -75,6 +82,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
7582
u8 page, u8 chan)
7683
{
7784
struct xmit_work *work;
85+
struct mac802154_sub_if_data *sdata;
7886

7987
if (!(priv->phy->channels_supported[page] & (1 << chan))) {
8088
WARN_ON(1);
@@ -102,6 +110,12 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
102110
return NETDEV_TX_BUSY;
103111
}
104112

113+
/* Stop the netif queue on each sub_if_data object. */
114+
rcu_read_lock();
115+
list_for_each_entry_rcu(sdata, &priv->slaves, list)
116+
netif_stop_queue(sdata->dev);
117+
rcu_read_unlock();
118+
105119
INIT_WORK(&work->work, mac802154_xmit_worker);
106120
work->skb = skb;
107121
work->priv = priv;

0 commit comments

Comments
 (0)