Commit 6c1c78d0 authored by Alexander Aring's avatar Alexander Aring Committed by Stefan Schmidt

mac802154: fix atomic_dec_and_test checks

We need to call wake_up() when hold_txs reaches zero. The semantic of
atomic_dec_and_test() is that it returns true when it's zero.

Fixes: f0feb349 ("net: mac802154: Introduce a tx queue flushing mechanism")
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220613043735.1039895-3-aahringo@redhat.comSigned-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
parent 2ec2f6be
...@@ -44,7 +44,7 @@ void ieee802154_xmit_sync_worker(struct work_struct *work) ...@@ -44,7 +44,7 @@ void ieee802154_xmit_sync_worker(struct work_struct *work)
err_tx: err_tx:
/* Restart the netif queue on each sub_if_data object. */ /* Restart the netif queue on each sub_if_data object. */
ieee802154_release_queue(local); ieee802154_release_queue(local);
if (!atomic_dec_and_test(&local->phy->ongoing_txs)) if (atomic_dec_and_test(&local->phy->ongoing_txs))
wake_up(&local->phy->sync_txq); wake_up(&local->phy->sync_txq);
kfree_skb(skb); kfree_skb(skb);
netdev_dbg(dev, "transmission failed\n"); netdev_dbg(dev, "transmission failed\n");
...@@ -101,7 +101,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) ...@@ -101,7 +101,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
err_wake_netif_queue: err_wake_netif_queue:
ieee802154_release_queue(local); ieee802154_release_queue(local);
if (!atomic_dec_and_test(&local->phy->ongoing_txs)) if (atomic_dec_and_test(&local->phy->ongoing_txs))
wake_up(&local->phy->sync_txq); wake_up(&local->phy->sync_txq);
err_free_skb: err_free_skb:
kfree_skb(skb); kfree_skb(skb);
......
...@@ -141,7 +141,7 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb, ...@@ -141,7 +141,7 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
} }
dev_consume_skb_any(skb); dev_consume_skb_any(skb);
if (!atomic_dec_and_test(&hw->phy->ongoing_txs)) if (atomic_dec_and_test(&hw->phy->ongoing_txs))
wake_up(&hw->phy->sync_txq); wake_up(&hw->phy->sync_txq);
} }
EXPORT_SYMBOL(ieee802154_xmit_complete); EXPORT_SYMBOL(ieee802154_xmit_complete);
...@@ -154,7 +154,7 @@ void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb, ...@@ -154,7 +154,7 @@ void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb,
local->tx_result = reason; local->tx_result = reason;
ieee802154_release_queue(local); ieee802154_release_queue(local);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
if (!atomic_dec_and_test(&hw->phy->ongoing_txs)) if (atomic_dec_and_test(&hw->phy->ongoing_txs))
wake_up(&hw->phy->sync_txq); wake_up(&hw->phy->sync_txq);
} }
EXPORT_SYMBOL(ieee802154_xmit_error); EXPORT_SYMBOL(ieee802154_xmit_error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment