diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-05-19 17:05:13 +0200 |
---|---|---|
committer | Stefan Schmidt <stefan@datenfreihafen.org> | 2022-06-10 09:48:40 +0200 |
commit | f0feb34904735ffa21fe7b0c50f9f9527ec74b7a (patch) | |
tree | 27ef02d071d235a3a95005b4b17d439efa6329ce /net/mac802154/util.c | |
parent | a40612f399eabe23424acf5985643a35d4f2832e (diff) | |
download | lwn-f0feb34904735ffa21fe7b0c50f9f9527ec74b7a.tar.gz lwn-f0feb34904735ffa21fe7b0c50f9f9527ec74b7a.zip |
net: mac802154: Introduce a tx queue flushing mechanism
Right now we are able to stop a queue but we have no indication if a
transmission is ongoing or not.
Thanks to recent additions, we can track the number of ongoing
transmissions so we know if the last transmission is over. Adding on top
of it an internal wait queue also allows to be woken up asynchronously
when this happens. If, beforehands, we marked the queue to be held and
stopped it, we end up flushing and stopping the tx queue.
Thanks to this feature, we will soon be able to introduce a synchronous
transmit API.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20220519150516.443078-9-miquel.raynal@bootlin.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Diffstat (limited to 'net/mac802154/util.c')
-rw-r--r-- | net/mac802154/util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/mac802154/util.c b/net/mac802154/util.c index 999534f64485..5e1fcc7b0123 100644 --- a/net/mac802154/util.c +++ b/net/mac802154/util.c @@ -140,7 +140,8 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb, } dev_consume_skb_any(skb); - atomic_dec(&hw->phy->ongoing_txs); + if (!atomic_dec_and_test(&hw->phy->ongoing_txs)) + wake_up(&hw->phy->sync_txq); } EXPORT_SYMBOL(ieee802154_xmit_complete); @@ -152,7 +153,8 @@ void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb, local->tx_result = reason; ieee802154_release_queue(local); dev_kfree_skb_any(skb); - atomic_dec(&hw->phy->ongoing_txs); + if (!atomic_dec_and_test(&hw->phy->ongoing_txs)) + wake_up(&hw->phy->sync_txq); } EXPORT_SYMBOL(ieee802154_xmit_error); |