Re: [PATCH rtw-next v17 2/3] wifi: rtw88: support channel switch in AP mode

From: Luka Gejak

Date: Thu Dec 03 2026 - 15:08:00 EST


On December 3, 2026 9:06:10 PM GMT+01:00, Luka Gejak <luka.gejak@xxxxxxxxx>
wrote:
>On December 3, 2026 7:46:59 PM GMT+01:00, Mehmet Fide
><mehmet.fide@xxxxxxxxx> wrote:
>>From: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>
>>
>>The driver does not set WIPHY_FLAG_HAS_CHANNEL_SWITCH, so hostapd's
>>CHAN_SWITCH is refused and an rtw88 AP can only change its channel by
>>restarting.
>>
>>The firmware repeats the beacon of the first reserved page, so the
>>driver has to step the countdown. Set the flag, and when
>>BSS_CHANGED_BEACON brings a beacon with CSA, start a delayed work that
>>advances the count with ieee80211_beacon_update_cntdwn() and downloads
>>the page once per beacon interval. It calls ieee80211_csa_finish() one
>>interval after the count of 1 was downloaded, and repeats a failed
>>download with the same count. IBSS uses the same page and work.
>>
>>The countdown stops when the AP stops, the interface is removed,
>>beaconing is disabled, on WoWLAN suspend and in rtw_core_stop(). It
>>starts again when beaconing is enabled and when a hardware restart
>>replays the beacon. The CSA state and work are under the driver mutex,
>>and only the stop paths clear csa.vif.
>>
>>During a countdown the page beacon is fetched with
>>ieee80211_beacon_get_template(), which leaves the count alone, so any
>>other download carries the current count. The TIM update, the PG backup
>>and the download on association are left to the next step. An AP that
>>stops with a station interface left downloads the page once more.
>>Scans are refused, as they would take the AP off its channel.
>>
>>A channel change outside a scan and outside an off-channel period,
>>while an AP is up or a station is associated, runs the calibration that
>>start_ap and the association run. This also covers a count of 0 or 1,
>>which mac80211 finalizes without a countdown, and a station that
>>follows the switch of its AP. On the RTL8822C the calibration includes
>>the GAPK and the DPK, which take about 0.2 s over PCIe and up to 1.7 s
>>over USB. mac80211 replaces the beacon only after the channel change,
>>so until then the firmware repeats the beacon with the count of 1 on
>>the new channel. A switch is refused while a second interface is up:
>>that interface keeps the shared channel, and mac80211 would stop the AP
>>at the end of the countdown.
>>
>>Signed-off-by: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>
>>---
>>
>
>Same nit as for patch 1.
>
>Reviewed-by: Luka Gejak <luka.gejak@xxxxxxxxx>
>
>Best regards,
>Luka Gejak
>
Please ignore this email. I accidentally sent it to patch 2.