From: Alexander Aring <aahringo@redhat.com>
To: stefan@datenfreihafen.org
Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org,
miquel.raynal@bootlin.com, aahringo@redhat.com
Subject: [PATCHv2 wpan-next 2/2] mac802154: fix atomic_dec_and_test checks
Date: Mon, 13 Jun 2022 00:37:35 -0400 [thread overview]
Message-ID: <20220613043735.1039895-3-aahringo@redhat.com> (raw)
In-Reply-To: <20220613043735.1039895-1-aahringo@redhat.com>
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: f0feb3490473 ("net: mac802154: Introduce a tx queue flushing mechanism")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/mac802154/tx.c | 4 ++--
net/mac802154/util.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 5b471e932271..8ddcd2e841ca 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -44,7 +44,7 @@ void ieee802154_xmit_sync_worker(struct work_struct *work)
err_tx:
/* Restart the netif queue on each sub_if_data object. */
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);
kfree_skb(skb);
netdev_dbg(dev, "transmission failed\n");
@@ -101,7 +101,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
err_wake_netif_queue:
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);
err_free_skb:
kfree_skb(skb);
diff --git a/net/mac802154/util.c b/net/mac802154/util.c
index 60f6c0f10641..f08605f59b60 100644
--- a/net/mac802154/util.c
+++ b/net/mac802154/util.c
@@ -141,7 +141,7 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *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);
}
EXPORT_SYMBOL(ieee802154_xmit_complete);
@@ -154,7 +154,7 @@ 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);
- if (!atomic_dec_and_test(&hw->phy->ongoing_txs))
+ if (atomic_dec_and_test(&hw->phy->ongoing_txs))
wake_up(&hw->phy->sync_txq);
}
EXPORT_SYMBOL(ieee802154_xmit_error);
--
2.31.1
next prev parent reply other threads:[~2022-06-13 4:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 4:37 [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Alexander Aring
2022-06-13 4:37 ` [PATCHv2 wpan-next 1/2] mac802154: util: fix release queue handling Alexander Aring
2022-06-13 4:37 ` Alexander Aring [this message]
2022-06-13 14:14 ` [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Miquel Raynal
2022-06-15 2:53 ` Alexander Aring
2022-06-15 7:25 ` Miquel Raynal
2022-06-15 9:08 ` Miquel Raynal
2022-06-14 8:32 ` Stefan Schmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220613043735.1039895-3-aahringo@redhat.com \
--to=aahringo@redhat.com \
--cc=linux-wpan@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=stefan@datenfreihafen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).