mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nerijus Bendžiūnas" <nerijus.bendziunas@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2] wifi: mac80211: don't reconfigure when the last emulated chanctx is removed
Date: Fri,  4 Sep 2026 06:22:35 +0300	[thread overview]
Message-ID: <20260904032235.355479-1-nerijus.bendziunas@gmail.com> (raw)

ieee80211_emulate_remove_chanctx() calls _ieee80211_hw_conf_chan() after
the last channel context has been removed. With no context left,
ieee80211_calc_hw_conf_chan() falls back to the default channel, so the
driver is switched to a channel nobody asked for, and the next context
switches it again.

A monitor interface retunes by removing its context and adding a new
one, so every retune costs the driver two channel changes. Nothing is
transmitting or receiving without a context, and the new context sets
the channel, so the extra reconfiguration is unnecessary. Keep clearing
radar_enabled so the next configuration starts clean.

Measured on an AR9271 (ath9k_htc), where a channel change is a full chip
reset over USB, hopping across the 13 channels in 2.4 GHz, 1000 hops:

                  drv_config calls   median hop   p95 hop
  before                     2006      123.5 ms    183 ms
  after                      1006       92.0 ms    105 ms

Delivery of injected frames to a second card was 99.1% before and 98.3%
after (3863 and 3835 of 3900).

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
---
Changes in v2:
- Add the Assisted-by tag.
- Rewrite the commit message and shorten the in-code comment. No change
  to the code.

 net/mac80211/main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index a59837b9f480..643d59e878c9 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -289,9 +289,12 @@ void ieee80211_emulate_remove_chanctx(struct ieee80211_hw *hw,
 {
 	struct ieee80211_local *local = hw_to_local(hw);
 
+	/*
+	 * No context is left, so there is nothing to configure; the next
+	 * context sets the channel. Reconfiguring here would switch the
+	 * driver to the default channel only to switch it again.
+	 */
 	local->hw.conf.radar_enabled = false;
-
-	_ieee80211_hw_conf_chan(local, NULL);
 }
 EXPORT_SYMBOL(ieee80211_emulate_remove_chanctx);
 

base-commit: ca800a9302764c445de0da0e84d2252400a770ee
-- 
2.55.0


                 reply	other threads:[~2026-09-04  3:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260904032235.355479-1-nerijus.bendziunas@gmail.com \
    --to=nerijus.bendziunas@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®