* [PATCH wireless-next] wifi: mac80211: replace the CSA beacon before clearing csa_active
@ 2026-11-17 15:31 Mehmet Fide
2026-11-24 13:52 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Mehmet Fide @ 2026-11-17 15:31 UTC (permalink / raw)
To: Johannes Berg
Cc: Simon Wunderlich, Toke Høiland-Jørgensen,
linux-wireless, linux-kernel, mehmet.fide
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
__ieee80211_csa_finalize() clears csa_active and only then replaces the
CSA beacon with the one for after the switch. A driver that fetches its
beacons with ieee80211_beacon_get() and skips them once the countdown
is complete, as ath9k does in ath9k_csa_is_finished(), tests csa_active
first. A beacon fetched between the two steps passes that test and gets
the CSA beacon again, which goes out on the new channel, and
ieee80211_beacon_get() reports "beacon TX faster than countdown".
Replace the beacon first, as the finalize work did before the clear was
moved ahead of it. csa_active is still cleared when replacing the
beacon fails.
Fixes: e487eaeb076a ("cfg80211/mac80211/ath6kl: acquire wdev lock outside ch_switch_notify")
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
Notes:
Tested on rtw-next on an i.MX8MP board with an AR9271 as AP, ath9k_htc
with "wifi: ath9k_htc: do not fetch the beacon of a finished countdown"
v2 (link below), hostapd switching between channel 1 and 6, one sniffer
on each channel counting CSA beacons heard on the new channel. Before:
3 in 200 switches with a count of 5, and a print in the driver showed 3
fetches between the two steps. After: none in 200 switches with a count
of 5 and 80 with a count of 2. With v1 of that driver patch,
back-to-back switches and AP stops in and out of a countdown gave no
warning from mac80211. The rtw88 AP channel switch under review
(RTL8822BU, RTL8822CE) counts down on the air as before.
https://lore.kernel.org/r/20261117151703.1802556-1-mehmet.fide@gmail.com/
net/mac80211/cfg.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9e47360ee8f5..9458838bfe63 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4776,9 +4776,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
&link_data->csa.chanreq.oper))
return -EINVAL;
- link_conf->csa_active = false;
-
err = ieee80211_set_after_csa_beacon(link_data, &changed);
+ link_conf->csa_active = false;
if (err)
return err;
base-commit: 5dbf2415ca9821a611d09308e3b29d2c37e7cd77
--
2.56.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH wireless-next] wifi: mac80211: replace the CSA beacon before clearing csa_active
2026-11-17 15:31 [PATCH wireless-next] wifi: mac80211: replace the CSA beacon before clearing csa_active Mehmet Fide
@ 2026-11-24 13:52 ` Johannes Berg
2026-11-24 16:56 ` Mehmet Fide
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2026-11-24 13:52 UTC (permalink / raw)
To: Mehmet Fide
Cc: Simon Wunderlich, Toke Høiland-Jørgensen,
linux-wireless, linux-kernel, mehmet.fide
On Tue, 2026-11-17 at 16:31 +0100, Mehmet Fide wrote:
> From: Mehmet Fide <mehmet.fide@screeningeagle.com>
>
> __ieee80211_csa_finalize() clears csa_active and only then replaces the
> CSA beacon with the one for after the switch. A driver that fetches its
> beacons with ieee80211_beacon_get() and skips them once the countdown
> is complete, as ath9k does in ath9k_csa_is_finished(), tests csa_active
> first. A beacon fetched between the two steps passes that test and gets
> the CSA beacon again, which goes out on the new channel, and
> ieee80211_beacon_get() reports "beacon TX faster than countdown".
>
> Replace the beacon first, as the finalize work did before the clear was
> moved ahead of it. csa_active is still cleared when replacing the
> beacon fails.
>
> Fixes: e487eaeb076a ("cfg80211/mac80211/ath6kl: acquire wdev lock outside ch_switch_notify")
I don't see why it would be that?? Please explain that.
johannes
--
pw-bot: cr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH wireless-next] wifi: mac80211: replace the CSA beacon before clearing csa_active
2026-11-24 13:52 ` Johannes Berg
@ 2026-11-24 16:56 ` Mehmet Fide
0 siblings, 0 replies; 3+ messages in thread
From: Mehmet Fide @ 2026-11-24 16:56 UTC (permalink / raw)
To: Johannes Berg
Cc: Simon Wunderlich, Toke Høiland-Jørgensen,
linux-wireless, linux-kernel, mehmet.fide
Hi Johannes,
> > Fixes: e487eaeb076a ("cfg80211/mac80211/ath6kl: acquire wdev lock outside ch_switch_notify")
>
> I don't see why it would be that?? Please explain that.
That commit is where the clear moved ahead of the beacon replacement.
Before it, ieee80211_csa_finalize_work() assigned next_beacon first and
cleared csa_active only after the switch statement. e487eaeb076a added
the "goto unlock" error paths and moved the clear up, just before the
switch, so ieee80211_assign_beacon() now runs with csa_active already
false. 66199506fb91 ("mac80211: split CSA finalize function") and
1a96bb4e8a79 ("wifi: mac80211: start and finalize channel switch on
link basis") kept that order.
ath9k already tested csa_active before the countdown since d074e8d54785
("ath9k: enable CSA functionality in ath9k"), so the window opened for
it with e487eaeb076a.
Mehmet
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-24 16:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 15:31 [PATCH wireless-next] wifi: mac80211: replace the CSA beacon before clearing csa_active Mehmet Fide
2026-11-24 13:52 ` Johannes Berg
2026-11-24 16:56 ` Mehmet Fide
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox