From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev,
Arend van Spriel <arend.vanspriel@broadcom.com>
Subject: [PATCH -next v3 02/13] wifi: mac80211: stop using ieee80211_mgmt_tx_cookie()
Date: Fri, 31 Jul 2026 14:34:58 +0200 [thread overview]
Message-ID: <20260731123509.1975281-3-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <20260731123509.1975281-1-arend.vanspriel@broadcom.com>
Now that cfg80211 pre-assigns the cookie before calling into mac80211,
stop calling ieee80211_mgmt_tx_cookie() in all affected paths:
- ieee80211_start_roc_work(): for normal ROC use the pre-assigned value
directly instead of generating a new one.
- ieee80211_attach_ack_skb(): the cookie is already set by the caller;
remove the ieee80211_mgmt_tx_cookie() call and store it in the ack
SKB as-is. This covers both mgmt_tx and probe_peer since both call
ieee80211_attach_ack_skb().
- ieee80211_mgmt_tx(): the dummy 0xffffffff assignment for the
dont_wait_for_ack case is no longer needed; cfg80211_assign_cookie()
guarantees a non-zero value which is sufficient for the internal
ROC vs mgmt-tx distinction.
- ieee80211_store_ack_skb(): same fix for the tx_control_port path.
With no remaining callers, remove ieee80211_mgmt_tx_cookie() and the
roc_cookie_counter field from struct ieee80211_local.
Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/mac80211/cfg.c | 14 --------------
net/mac80211/ieee80211_i.h | 3 ---
net/mac80211/offchannel.c | 17 ++++-------------
net/mac80211/tx.c | 4 +---
4 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 0a9247be26af..b6d02d2b28f5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4831,19 +4831,6 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
return __ieee80211_channel_switch(wiphy, dev, params);
}
-u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local)
-{
- lockdep_assert_wiphy(local->hw.wiphy);
-
- local->roc_cookie_counter++;
-
- /* wow, you wrapped 64 bits ... more likely a bug */
- if (WARN_ON(local->roc_cookie_counter == 0))
- local->roc_cookie_counter++;
-
- return local->roc_cookie_counter;
-}
-
int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
u64 *cookie, gfp_t gfp)
{
@@ -4868,7 +4855,6 @@ int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
IEEE80211_SKB_CB(skb)->status_data_idr = 1;
IEEE80211_SKB_CB(skb)->status_data = id;
- *cookie = ieee80211_mgmt_tx_cookie(local);
IEEE80211_SKB_CB(ack_skb)->ack.cookie = *cookie;
return 0;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a1ef88fe846d..3760319ab079 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1710,8 +1710,6 @@ struct ieee80211_local {
struct list_head roc_list;
struct wiphy_work hw_roc_start, hw_roc_done;
unsigned long hw_roc_start_time;
- u64 roc_cookie_counter;
-
struct idr ack_status_frames;
spinlock_t ack_status_lock;
@@ -1991,7 +1989,6 @@ u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
void ieee80211_handle_queued_frames(struct ieee80211_local *local);
-u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local);
int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
u64 *cookie, gfp_t gfp);
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 2bceb73717c6..94be6497f259 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -602,14 +602,12 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
/*
* cookie is either the roc cookie (for normal roc)
- * or the SKB (for mgmt TX)
+ * or the mgmt_tx cookie; both are pre-assigned by cfg80211
*/
- if (!txskb) {
- roc->cookie = ieee80211_mgmt_tx_cookie(local);
- *cookie = roc->cookie;
- } else {
+ if (!txskb)
+ roc->cookie = *cookie;
+ else
roc->mgmt_tx_cookie = *cookie;
- }
req = wiphy_dereference(local->hw.wiphy, local->scan_req);
@@ -1021,13 +1019,6 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
kfree_skb(skb);
goto out_unlock;
}
- } else {
- /* Assign a dummy non-zero cookie, it's not sent to
- * userspace in this case but we rely on its value
- * internally in the need_offchan case to distinguish
- * mgmt-tx from remain-on-channel.
- */
- *cookie = 0xffffffff;
}
if (!need_offchan) {
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0cf5f6ec75e6..6993e694e835 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2605,10 +2605,8 @@ static u16 ieee80211_store_ack_skb(struct ieee80211_local *local,
if (id >= 0) {
info_id = id;
*info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
- if (cookie) {
- *cookie = ieee80211_mgmt_tx_cookie(local);
+ if (cookie)
IEEE80211_SKB_CB(ack_skb)->ack.cookie = *cookie;
- }
} else {
kfree_skb(ack_skb);
}
--
2.54.0
next prev parent reply other threads:[~2026-07-31 12:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 12:34 [PATCH -next v3 00/13] wifi: cfg80211: consolidate cookie assignment for async ops Arend van Spriel
2026-07-31 12:34 ` [PATCH -next v3 01/13] wifi: cfg80211: pre-assign cookie for driver callbacks Arend van Spriel
2026-07-31 12:34 ` Arend van Spriel [this message]
2026-07-31 12:34 ` [PATCH -next v3 03/13] wifi: ath6kl: use pre-assigned cookie for remain_on_channel and mgmt_tx Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 04/13] wifi: wil6210: use pre-assigned cookie for remain_on_channel, mgmt_tx and probe_peer Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 05/13] wifi: brcmfmac: use pre-assigned cookie for remain_on_channel and mgmt_tx Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 06/13] wifi: mwifiex: " Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 07/13] wifi: wilc1000: " Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 08/13] wifi: nxpwifi: " Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 09/13] wifi: qtnfmac: use pre-assigned cookie for mgmt_tx Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 10/13] wifi: rtl8723bs: " Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 11/13] wifi: cfg80211: convert cookie output to input parameter Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 12/13] wifi: cfg80211: convert tx_control_port cookie " Arend van Spriel
2026-07-31 12:35 ` [PATCH -next v3 13/13] wifi: nl80211: send frame tx status event only for non-zero cookie Arend van Spriel
2026-08-02 18:07 ` [PATCH -next v3 00/13] wifi: cfg80211: consolidate cookie assignment for async ops Johannes Berg
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=20260731123509.1975281-3-arend.vanspriel@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.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