mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "Nerijus Bendžiūnas" <nerijus.bendziunas@gmail.com>,
	linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] wifi: mac80211: don't reconfigure when the last emulated chanctx is removed
Date: Mon, 14 Sep 2026 14:56:12 +0200	[thread overview]
Message-ID: <f54733f96719f5efc360cfae62555e7413ddc696.camel@sipsolutions.net> (raw)
In-Reply-To: <20260904032235.355479-1-nerijus.bendziunas@gmail.com> (sfid-20260904_052244_513528_82A5051C)

On Fri, 2026-09-04 at 06:22 +0300, Nerijus Bendžiūnas wrote:
> 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.
> +	 */

Don't leave useless LLM comments in the code - clearly that comment was
only written by the LLM because of the case you were trying to fix, it's
not really related to the code at all ...

Either way though, this is wrong - if regulatory kicks you off a channel
then we don't even allow monitor, but this change would leave the
monitor on it anyway.

johannes

      reply	other threads:[~2026-09-14 12:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  3:22 Nerijus Bendžiūnas
2026-09-14 12:56 ` Johannes Berg [this message]

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=f54733f96719f5efc360cfae62555e7413ddc696.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nerijus.bendziunas@gmail.com \
    /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®