Re: [PATCH rtw-next v11 3/3] wifi: rtw88: time the countdown downloads from the TBTT
From: Luka Gejak
Date: Mon Nov 16 2026 - 09:26:20 EST
Hi Mehmet,
Thanks for the v11. One comment below.
On November 16, 2026 8:19:52 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
[ ... ]
> + rtwdev->csa_tbtt += interval;
> + delay = rtwdev->csa_tbtt + RTW_CSA_TBTT_MARGIN_US - tsf;
> + if (start || delay > interval + RTW_CSA_TBTT_MARGIN_US ||
> + delay < -(s64)interval) {
> + /* at the start, or the download ran too late: the next TBTT */
> + div_u64_rem(tsf, interval, &rem);
> + rtwdev->csa_tbtt = tsf - rem + interval;
> + delay = rtwdev->csa_tbtt + RTW_CSA_TBTT_MARGIN_US - tsf;
> + }
[ ... ]
> ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->csa_beacon_work,
> usecs_to_jiffies(max(delay, 0)));
Could the first count still be replaced before it goes out if the first
work runs late? With patch 3 that work is also the first download of a
CSA beacon.
For example, with a 100 TU interval and a count of 2:
first work due: TSF 112400
first download done: TSF 224800
csa_tbtt after +=: TSF 204800
delay: -10000 us
next TBTT: TSF 307200
The delay is not below -102400, so this queues the next work immediately.
The download just installed count 1, and that work can call
ieee80211_csa_finish() before the next TBTT. So if I read it right, no
CSA beacon has gone out at all, even though the download succeeded.
I understand skipping an intermediate count when a download runs late,
but with a count of 2 there is no earlier CSA beacon for the station to
follow. Could the next step wait for a TBTT that can send the first
download, including when the first work has missed its scheduled one?
Best regards,
Luka Gejak