Re: [PATCH v2 2/2] wifi: rtw88: support channel switch in AP mode

From: Luka Gejak

Date: Thu Oct 01 2026 - 03:19:16 EST


On Wed, 30 Sep 2026, Mehmet Fide wrote:

> @@ -1813,6 +1813,47 @@ void rtw_fw_update_beacon_work(struct work_struct *work)
> + if (!ieee80211_beacon_cntdwn_is_complete(vif, 0)) {
> + rtw_fw_download_rsvd_page(rtwdev);
> + rtw_send_rsvd_page_h2c(rtwdev);
> +
> + wiphy_delayed_work_queue(wiphy, &rtwdev->csa_beacon_work,
> + usecs_to_jiffies(delay));

This work is not the only one that re-downloads the page. Every page download
fetches a beacon, through rtw_get_rsvd_page_skb():

case RSVD_BEACON:
skb_new = ieee80211_beacon_get_tim(hw, vif, &tim_offset, NULL, 0);
rsvd_pkt->tim_offset = tim_offset;
break;

and mac80211 moves the countdown on that fetch, not once per beacon that is
transmitted:

if (beacon->cntdwn_counter_offsets[0]) {
if (!is_template)
ieee80211_beacon_update_cntdwn(vif, link->link_id);

ieee80211_set_beacon_cntdwn(sdata, beacon, link);
}

rtw_ops_set_tim() queues update_beacon_work:

ieee80211_queue_work(hw, &rtwdev->update_beacon_work);

and the work itself re-downloads the page:

void rtw_fw_update_beacon_work(struct work_struct *work)
{
struct rtw_dev *rtwdev = container_of(work, struct rtw_dev,
update_beacon_work);

mutex_lock(&rtwdev->mutex);
rtw_fw_download_rsvd_page(rtwdev);
rtw_send_rsvd_page_h2c(rtwdev);
mutex_unlock(&rtwdev->mutex);
}

A station that wakes up in power save during the countdown is enough, so one
interval can move the count twice, for example 4 on air and then 2, and a fetch
that lands after the counter reached 1 makes mac80211 log "beacon TX faster than
countdown". Can the set_tim work skip the download while a switch is announced?
rtw_fw_csa_beacon_work() rebuilds the page one interval later, so the new TIM
still gets out and the countdown keeps one step per interval.

Best regards,
Luka Gejak