From: Mehmet Fide __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 --- 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