Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net
Subject: [PATCH wireless v2 2/4] wifi: mac80211: release monitor channels on suspend
Date: Tue, 10 Nov 2026 19:54:34 +0100	[thread overview]
Message-ID: <20261110185436.2015505-2-nbd@nbd.name> (raw)
In-Reply-To: <20261110185436.2015505-1-nbd@nbd.name>

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


  reply	other threads:[~2026-11-10 18:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-11-23  5:35   ` [PATCH wireless v2 2/4] wifi: mac80211: release monitor channels on suspend Devin Wittmayer
2026-11-10 18:54 ` [PATCH wireless v2 3/4] wifi: mac80211: remove real monitors from the driver " 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: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

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=20261110185436.2015505-2-nbd@nbd.name \
    --to=nbd@nbd.name \
    --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