Re: [PATCH ath-next] wifi: ath9k_htc: do not fetch the beacon of a finished countdown

From: Mehmet Fide

Date: Tue Nov 17 2026 - 07:26:57 EST


Hi Toke,

> if (ath9k_htc_csa_is_finished(priv))
> return;

That would skip one beacon at most. ath9k_htc_csa_is_finished() clears
csa_vif when it calls ieee80211_csa_finish(), but csa_active stays set
until the second round of __ieee80211_csa_finalize(), after the channel
change, and ath9k_htc_set_channel() turns beaconing back on in between.
The next SWBA finds csa_vif NULL and fetches the CSA beacon again.

On an AR9271 AP, with a sniffer on each channel counting CSA beacons
heard on the new channel, in 120 switches: 3 without a change, 5 with
the early return, 1 with this patch.

The one left comes from mac80211. __ieee80211_csa_finalize() clears
csa_active before ieee80211_set_after_csa_beacon() replaces the CSA
beacon, and ieee80211_beacon_get() still counts that beacon down, so an
SWBA in between passes the csa_active test and gets the old beacon.
With a print added: 3 such fetches in 200 switches, the same 3 beacons
on the air. ath9k_csa_is_finished() has the same window.

Dropping the csa_active test here would close it, but
ieee80211_beacon_cntdwn_is_complete() warns when the AP has no beacon,
and ieee80211_stop_ap() removes it before beaconing is disabled. So I'd
rather fix the order in mac80211 in a separate patch. Does that sound
right to you?

On csa_vif: remove_interface, bss_info_changed and
channel_switch_beacon all run under the wiphy mutex; only the WMI
tasklet does not, as wmi_lock is dropped before the SWBA is handled.
250 back-to-back switches and 25 AP stops in a countdown showed no
problem.

Mehmet