* [PATCH v2] wifi: mac80211: don't reconfigure when the last emulated chanctx is removed
@ 2026-09-04 3:22 Nerijus Bendžiūnas
2026-09-14 12:56 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Nerijus Bendžiūnas @ 2026-09-04 3:22 UTC (permalink / raw)
To: Johannes Berg, linux-wireless; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] wifi: mac80211: don't reconfigure when the last emulated chanctx is removed
2026-09-04 3:22 [PATCH v2] wifi: mac80211: don't reconfigure when the last emulated chanctx is removed Nerijus Bendžiūnas
@ 2026-09-14 12:56 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2026-09-14 12:56 UTC (permalink / raw)
To: Nerijus Bendžiūnas, linux-wireless; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-14 12:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 3:22 [PATCH v2] wifi: mac80211: don't reconfigure when the last emulated chanctx is removed Nerijus Bendžiūnas
2026-09-14 12:56 ` Johannes Berg
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®