summaryrefslogtreecommitdiff
path: root/net/mac802154/util.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2022-05-19 18:05:12 +0300
committerStefan Schmidt <stefan@datenfreihafen.org>2022-06-10 10:48:40 +0300
commita40612f399eabe23424acf5985643a35d4f2832e (patch)
tree87a0a6f4f6c9800150fed0739fca9f96c16c1f21 /net/mac802154/util.c
parent226730e1aa2844b6e5499a6fe6bea4db17a894a8 (diff)
downloadlinux-a40612f399eabe23424acf5985643a35d4f2832e.tar.xz
net: mac802154: Introduce a helper to disable the queue
Sometimes calling the stop queue helper is not enough because it does not hold any lock. In order to be safe and avoid racy situations when trying to (soon) sync the Tx queue, for instance before sending an MLME frame, let's now introduce an helper which actually hold the necessary locks when doing so. Suggested-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Alexander Aring <aahringo@redhat.com> Link: https://lore.kernel.org/r/20220519150516.443078-8-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.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/mac802154/util.c b/net/mac802154/util.c
index 0ed8b5bcbe8a..999534f64485 100644
--- a/net/mac802154/util.c
+++ b/net/mac802154/util.c
@@ -83,6 +83,20 @@ void ieee802154_release_queue(struct ieee802154_local *local)
spin_unlock_irqrestore(&local->phy->queue_lock, flags);
}
+void ieee802154_disable_queue(struct ieee802154_local *local)
+{
+ struct ieee802154_sub_if_data *sdata;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+ if (!sdata->dev)
+ continue;
+
+ netif_tx_disable(sdata->dev);
+ }
+ rcu_read_unlock();
+}
+
enum hrtimer_restart ieee802154_xmit_ifs_timer(struct hrtimer *timer)
{
struct ieee802154_local *local =