summaryrefslogtreecommitdiff
path: root/net/mac802154/tx.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2022-05-19 18:05:10 +0300
committerStefan Schmidt <stefan@datenfreihafen.org>2022-06-10 10:48:40 +0300
commit20a19d1df3e4079cbaa045ec89bbefb831d4705d (patch)
tree2542608e79053b30cc50308909a5cabd5a433adc /net/mac802154/tx.c
parentbde000ae459f2829ed88e967f7fa7665b4e3afaf (diff)
downloadlinux-20a19d1df3e4079cbaa045ec89bbefb831d4705d.tar.xz
net: mac802154: Bring the ability to hold the transmit queue
Create a hold_txs atomic variable and increment/decrement it when relevant, ie. when we want to hold the queue or release it: currently all the "stopped" situations are suitable, but very soon we will more extensively use this feature for MLME purposes. Upon release, the atomic counter is decremented and checked. If it is back to 0, then the netif queue gets woken up. This makes the whole process fully transparent, provided that all the users of ieee802154_wake/stop_queue() now call ieee802154_hold/release_queue() instead. In no situation individual drivers should call any of these helpers manually in order to avoid messing with the counters. There are other functions more suited for this purpose which have been introduced, such as the _xmit_complete() and _xmit_error() helpers which will handle all that for them. One advantage is that, as no more drivers call the stop/wake helpers directly, we can safely stop exporting them and only declare the hold/release ones in a header only accessible to the core. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Alexander Aring <aahringo@redhat.com> Link: https://lore.kernel.org/r/20220519150516.443078-6-miquel.raynal@bootlin.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Diffstat (limited to 'net/mac802154/tx.c')
-rw-r--r--net/mac802154/tx.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 33f64ecd96c7..6a53c83cf039 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -43,7 +43,7 @@ void ieee802154_xmit_sync_worker(struct work_struct *work)
err_tx:
/* Restart the netif queue on each sub_if_data object. */
- ieee802154_wake_queue(&local->hw);
+ ieee802154_release_queue(local);
atomic_dec(&local->phy->ongoing_txs);
kfree_skb(skb);
netdev_dbg(dev, "transmission failed\n");
@@ -75,7 +75,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
}
/* Stop the netif queue on each sub_if_data object. */
- ieee802154_stop_queue(&local->hw);
+ ieee802154_hold_queue(local);
atomic_inc(&local->phy->ongoing_txs);
/* Drivers should preferably implement the async callback. In some rare
@@ -99,7 +99,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
return NETDEV_TX_OK;
err_wake_netif_queue:
- ieee802154_wake_queue(&local->hw);
+ ieee802154_release_queue(local);
atomic_dec(&local->phy->ongoing_txs);
err_free_skb:
kfree_skb(skb);