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

From: Luka Gejak

Date: Mon Nov 16 2026 - 09:25:01 EST


Hi Mehmet,

Thanks for the v11. Three comments below.

On November 16, 2026 8:19:51 AM GMT+01:00, Mehmet Fide
<mehmet.fide@xxxxxxxxx> wrote:

> diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c

[ ... ]

> + if (!ieee80211_beacon_cntdwn_is_complete(vif, 0)) {
> + ieee80211_beacon_update_cntdwn(vif, 0);
> + rtw_fw_download_rsvd_page(rtwdev);
> + rtw_send_rsvd_page_h2c(rtwdev);
> + rtw_fw_csa_queue(rtwdev, vif);
> + } else {
> + ieee80211_csa_finish(vif, 0);
> + }

As far as I can see, the template fetch writes the new count into
mac80211's beacon before the transfer can fail. If the allocation in
rtw_tx_write_data_rsvd_page_get() fails at count 1, the next work still
finds the countdown complete. With patch 3 and count 2, this can finish
the switch without any CSA beacon going out.

Could a failed download keep that count pending for a retry before
allowing completion?

[ ... ]

> diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c

[ ... ]

> + csa = rtw_fw_csa_stop(rtwdev, vif);

[ ... ]

> + } else if (csa) {
> + /* what the countdown held back */
> + rtw_fw_download_rsvd_page(rtwdev);
> + rtw_send_rsvd_page_h2c(rtwdev);
> + }

I think ieee80211_stop_ap() can clear csa_active and the countdown work
can then clear csa_vif before stop_ap gets the driver mutex.
rtw_fw_csa_stop() returns false, so this refresh is skipped even with a
station left running. Any deferred station PG backup or association
download is then lost.

Maybe the refresh should not depend on csa_vif still being set? The
wiphy lock does not exclude the countdown work.

[ ... ]

> + else
> + rtw_iterate_vifs(rtwdev, rtw_ops_csa_resume_iter, rtwdev);

rtw_iterate_vifs() silently skips a vif if its GFP_ATOMIC entry
allocation fails. With an AP counting down next to an associated station
on the 8822C, skipping the AP leaves csa_active set and the work
cancelled. Resume returns 0, so mac80211 sends no beacon replay and the
countdown stays stuck. TIM downloads fetch a template and do not advance
it either.

Could the AP be found without allocating an entry?

Best regards,
Luka Gejak