* [PATCH wireless v2 2/4] wifi: mac80211: release monitor channels on suspend
2026-11-10 18:54 [PATCH wireless v2 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel Felix Fietkau
@ 2026-11-10 18:54 ` Felix Fietkau
2026-11-23 5:35 ` Devin Wittmayer
2026-11-10 18:54 ` [PATCH wireless v2 3/4] wifi: mac80211: remove real monitors from the driver " Felix Fietkau
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Felix Fietkau @ 2026-11-10 18:54 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes
A monitor with its own channel keeps its channel context across
suspend, which triggers the warning in __ieee80211_suspend() about
remaining channel contexts.
Release the channel on suspend and acquire it again on resume, like for
the virtual monitor.
Fixes: 9d40f7e32774 ("wifi: mac80211: add flag to opt out of virtual monitor support")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
net/mac80211/pm.c | 2 ++
net/mac80211/util.c | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index f63676c44853..de0d7b093520 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -151,7 +151,9 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan,
continue;
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP_VLAN:
+ continue;
case NL80211_IFTYPE_MONITOR:
+ ieee80211_link_release_channel(&sdata->deflink);
continue;
case NL80211_IFTYPE_STATION:
ieee80211_mgd_quiesce(sdata);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 44feb80274c6..34402200baec 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1748,6 +1748,30 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local,
}
}
+static void ieee80211_reconfig_monitors(struct ieee80211_local *local)
+{
+ struct ieee80211_sub_if_data *sdata;
+
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ list_for_each_entry(sdata, &local->interfaces, list) {
+ struct ieee80211_chan_req chanreq = sdata->vif.bss_conf.chanreq;
+
+ if (sdata->vif.type != NL80211_IFTYPE_MONITOR ||
+ !chanreq.oper.chan ||
+ rcu_access_pointer(sdata->deflink.conf->chanctx_conf))
+ continue;
+
+ if (!ieee80211_link_use_channel(&sdata->deflink, &chanreq,
+ IEEE80211_CHANCTX_SHARED))
+ continue;
+
+ sdata_info(sdata, "failed to restore monitor channel\n");
+ memset(&sdata->vif.bss_conf.chanreq, 0,
+ sizeof(sdata->vif.bss_conf.chanreq));
+ }
+}
+
static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
@@ -2382,6 +2406,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
local->virt_monitors == local->open_count)
ieee80211_add_virtual_monitor(local, NULL);
+ ieee80211_reconfig_monitors(local);
+
if (!suspended)
return 0;
--
2.47.3
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH wireless v2 3/4] wifi: mac80211: remove real monitors from the driver on suspend
2026-11-10 18:54 [PATCH wireless v2 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel Felix Fietkau
2026-11-10 18:54 ` [PATCH wireless v2 2/4] wifi: mac80211: release monitor channels on suspend Felix Fietkau
@ 2026-11-10 18:54 ` Felix Fietkau
2026-11-23 5:36 ` Devin Wittmayer
2026-11-10 18:54 ` [PATCH wireless v2 4/4] wifi: mac80211: reject a monitor channel without a running interface Felix Fietkau
2026-11-23 5:35 ` [PATCH wireless v2 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel Devin Wittmayer
3 siblings, 1 reply; 8+ messages in thread
From: Felix Fietkau @ 2026-11-10 18:54 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes
With NO_VIRTUAL_MONITOR, ieee80211_reconfig() adds running monitors to
the driver on resume, but __ieee80211_suspend() does not remove them.
Each resume without WoWLAN thus adds an interface that the driver
already has.
Remove these monitors on suspend, like all other interfaces that
ieee80211_reconfig() adds.
Fixes: 9d40f7e32774 ("wifi: mac80211: add flag to opt out of virtual monitor support")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
net/mac80211/pm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index de0d7b093520..24989ded2830 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -154,7 +154,9 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan,
continue;
case NL80211_IFTYPE_MONITOR:
ieee80211_link_release_channel(&sdata->deflink);
- continue;
+ if (!ieee80211_hw_check(hw, NO_VIRTUAL_MONITOR))
+ continue;
+ break;
case NL80211_IFTYPE_STATION:
ieee80211_mgd_quiesce(sdata);
break;
--
2.47.3
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH wireless v2 4/4] wifi: mac80211: reject a monitor channel without a running interface
2026-11-10 18:54 [PATCH wireless v2 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel Felix Fietkau
2026-11-10 18:54 ` [PATCH wireless v2 2/4] wifi: mac80211: release monitor channels on suspend Felix Fietkau
2026-11-10 18:54 ` [PATCH wireless v2 3/4] wifi: mac80211: remove real monitors from the driver " Felix Fietkau
@ 2026-11-10 18:54 ` Felix Fietkau
2026-11-23 5:36 ` Devin Wittmayer
2026-11-23 5:35 ` [PATCH wireless v2 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel Devin Wittmayer
3 siblings, 1 reply; 8+ messages in thread
From: Felix Fietkau @ 2026-11-10 18:54 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes
With NO_VIRTUAL_MONITOR, ieee80211_set_monitor_channel() applies the
channel to the interface of the request. While a monitor is running,
nl80211_set_wiphy() can send a request without an interface, and sdata
is then invalid. A request for another monitor that is down triggers
the warning in check_sdata_in_driver().
Reject both requests, since the channel can only be applied to a
running monitor.
Fixes: 9d40f7e32774 ("wifi: mac80211: add flag to opt out of virtual monitor support")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
net/mac80211/cfg.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 64e2bd0cf124..62f8cf88f8f4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1155,6 +1155,10 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
sdata = wiphy_dereference(wiphy, local->monitor_sdata);
if (!sdata)
goto done;
+ } else if (!dev) {
+ return -EOPNOTSUPP;
+ } else if (!ieee80211_sdata_running(sdata)) {
+ return -ENETDOWN;
}
if (rcu_access_pointer(sdata->deflink.conf->chanctx_conf) &&
--
2.47.3
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH wireless v2 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel
2026-11-10 18:54 [PATCH wireless v2 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel Felix Fietkau
` (2 preceding siblings ...)
2026-11-10 18:54 ` [PATCH wireless v2 4/4] wifi: mac80211: reject a monitor channel without a running interface Felix Fietkau
@ 2026-11-23 5:35 ` Devin Wittmayer
3 siblings, 0 replies; 8+ messages in thread
From: Devin Wittmayer @ 2026-11-23 5:35 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, johannes
On Tue, 10 Nov 2026 19:54:33 +0100, Felix Fietkau wrote:
> ieee80211_do_stop() releases the channel of a monitor, but leaves its
> chanreq filled. When the monitor comes back up it has no channel, yet
> the RX path still filters on the old chanreq and drops all frames
> received on other frequencies.
I tested all four on two machines:
mini PC your mt76 tree at afe54fd58a87, MT7922 and MT7925,
monitors passed to the driver by the mt792x active
monitor series (v2 coming)
laptop Framework 13, 7.3.5, MT7927 (stock already passes its
monitors to the driver), MT7925 as a control
without with
monitor on another channel, taken 0 beacons from 87 to 88
down and up; a second monitor on the AP in 10 s
the AP's channel
channel set on a monitor that is down -EIO, warning -ENETDOWN
channel set on the phy, a monitor up oops -EOPNOTSUPP
s2idle with monitors up warning, added clean, all
again on resume hear again
five s2idle cycles the add fails 0 failures
with -ENOSPC on
the fourth
The stock s2idle rows and the oops come from the mini PC alone; I kept
the laptop out of those. The five cycles and the oops ran on the MT7922.
The laptop's MT7925, which still uses the virtual monitor, read the
same with and without.
Tested-by: Devin Wittmayer <lucid_duck@justthetip.ca>
^ permalink raw reply [flat|nested] 8+ messages in thread