Skip to contentSkip to conversation

wifi: mac80211: restore non-chanctx injection behaviour

PATCH New Johannes Berg 1 participant 1 message Dec 16, 2025

Subsystems (2)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH v2 1/1 wifi: mac80211: restore non-chanctx injection behaviour

From: Johannes Berg <[email protected]>

During the transition to use channel contexts throughout, the ability to do injection while in monitor mode concurrent with another interface was lost, since the (virtual) monitor won't have a chanctx assigned in this scenario.

We could use the local->hw.conf.chandef in the emulation case, but that wouldn't fix drivers (such as mt76) that themselves are now using channel contexts.

So instead, assume that if there's just a single chanctx that must be the one meant for injection, addressing both cases.

Fixes 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx drivers")

---
v2: use the single chanctx if such a thing exists to fix both
cases of emulation and drivers that changed like mt76

---
 net/mac80211/tx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
net/mac80211/tx.c +12 -0
index 9d8b0a25f73c..22d0df442ac0 100644
@@ -2395,6 +2395,18 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
 				rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf);
 	}
 
+	if (!chanctx_conf) {
+		struct ieee80211_chanctx *ctx;
+		bool first = true;
+
+		list_for_each_entry_rcu(ctx, &local->chanctx_list, list) {
+			if (!first)
+				goto fail_rcu;
+			chanctx_conf = &ctx->conf;
+			first = false;
+		}
+	}
+
 	if (chanctx_conf)
 		chandef = &chanctx_conf->def;
 	else
Signature · 1 line
2.52.0