From: "Luka Gejak" <luka.gejak@linux.dev>
To: "Mehmet Fide" <mehmet.fide@gmail.com>,
"Ping-Ke Shih" <pkshih@realtek.com>
Cc: "Bitterblue Smith" <rtl8821cerfe2@gmail.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
mehmet.fide@screeningeagle.com
Subject: Re: [PATCH rtw-next v8 2/3] wifi: rtw88: support channel switch in AP mode
Date: Sun, 25 Oct 2026 13:24:36 +0000 [thread overview]
Message-ID: <796598480d47c5bf474d11828769e864b8209558@linux.dev> (raw)
In-Reply-To: <20261021114543.4132776-3-mehmet.fide@gmail.com>
Hi Mehmet, Ping-Ke,
Sorry for late review, few comments below.
October 21, 2026 at 1:45 PM, "Mehmet Fide" <mehmet.fide@gmail.com> wrote:
>
> From: Mehmet Fide <mehmet.fide@screeningeagle.com>
>
> hostapd's CHAN_SWITCH is refused because the driver does not announce
> channel switch support, so an rtw88 AP can only change its channel by
> being torn down and started again.
>
> Declare WIPHY_FLAG_HAS_CHANNEL_SWITCH and implement
> channel_switch_beacon: the firmware repeats the beacon held in the
> first reserved page, so while a switch is announced the page is
> downloaded again every beacon interval to advance the countdown, and
> ieee80211_csa_finish() is called once it completes. IBSS shares the
> page and the work.
>
> The work is a delayed work of the device and csa_vif names the
> interface, both under the driver mutex. The countdown is cancelled when
> the AP stops, when the interface goes away, on WoWLAN suspend and in
> rtw_core_stop(); the BSS_CHANGED_BEACON replay after a hardware restart
> resumes it. The other page downloads during a countdown, the TIM update,
> the PG backup and the one on association, are skipped until the beacon
> after the switch, since every beacon fetch advances the countdown; the
> next download carries their changes. A scan is refused: it would take
> the AP off the channel its stations count down to.
>
> Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> ---
[ ... ]
> diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
> index 2a9b09fa76e7..182aecc76820 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac80211.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
[ ... ]
> @@ -438,6 +443,11 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,
> rtw_set_dtim_period(rtwdev, conf->dtim_period);
> rtw_fw_download_rsvd_page(rtwdev);
> rtw_send_rsvd_page_h2c(rtwdev);
> + /* restart replay resumes it, a beacon without CSA ends it */
> + if (conf->csa_active)
> + rtw_fw_csa_start(rtwdev, vif);
> + else
> + rtw_fw_csa_stop(rtwdev, vif);
> }
>
> if (changed & BSS_CHANGED_BEACON_ENABLED) {
What happens when an IBSS is left during its countdown and joined again?
ieee80211_ibss_disconnect() leaves csa_active set and reports no
BSS_CHANGED_BEACON, so only the idle path through rtw_core_stop() clears
csa_vif. The next join reports BSS_CHANGED_BEACON with csa_active still
set and this starts a new countdown. The new beacon has no counter, so
ieee80211_beacon_cntdwn_is_complete() never returns true. The page is then
downloaded every beacon interval and scans return -EBUSY until the
interface goes down.
Would clearing csa_active in ieee80211_ibss_disconnect(), same way
ieee80211_stop_ap() does, be the right fix?
[ ... ]
> @@ -846,6 +869,7 @@ static int rtw_ops_suspend(struct ieee80211_hw *hw,
> int ret;
>
> mutex_lock(&rtwdev->mutex);
> + rtw_fw_csa_stop(rtwdev, rtwdev->csa_vif);
> ret = rtw_wow_suspend(rtwdev, wowlan);
> if (ret)
> rtw_err(rtwdev, "failed to suspend for wow %d\n", ret);
What restarts the countdown after a successful WoWLAN resume?
The 8822C registers rtw_iface_combs and a wowlan_stub, so an AP can be
counting down next to an associated station when the system suspends.
rtw_wow_vif_iter() only picks the station, so rtw_wow_suspend() succeeds
and mac80211 keeps the AP running with csa_active set.
rtw_ops_resume() then returns 0 and ieee80211_reconfig() skips the
replay:
res = drv_resume(local);
...
if (res == 0)
goto wake_up;
So no BSS_CHANGED_BEACON arrives, csa_vif stays NULL and
ieee80211_csa_finish() is never called. csa_active stays set on the AP,
so ieee80211_change_beacon() and any later channel switch return -EBUSY
until the AP is restarted. Also each TIM download fetches the beacon
again, since csa_vif no longer gates it, and keeps stepping the count.
Maybe rtw_ops_resume() could restart the countdown when the AP still has
csa_active set?
Best regards,
Luka Gejak
next prev parent reply other threads:[~2026-10-25 13:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 11:45 [PATCH rtw-next v8 0/3] wifi: rtw88: " Mehmet Fide
2026-10-21 11:45 ` [PATCH rtw-next v8 1/3] wifi: rtw88: download the beacon the reserved page was built with Mehmet Fide
2026-10-21 11:45 ` [PATCH rtw-next v8 2/3] wifi: rtw88: support channel switch in AP mode Mehmet Fide
2026-10-25 13:24 ` Luka Gejak [this message]
2026-10-25 18:47 ` Mehmet Fide
2026-10-27 2:02 ` Ping-Ke Shih
2026-10-21 11:45 ` [PATCH rtw-next v8 3/3] wifi: rtw88: time the countdown downloads from the TBTT Mehmet Fide
2026-10-22 1:57 ` Ping-Ke Shih
2026-10-25 12:50 ` Luka Gejak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=796598480d47c5bf474d11828769e864b8209558@linux.dev \
--to=luka.gejak@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mehmet.fide@gmail.com \
--cc=mehmet.fide@screeningeagle.com \
--cc=pkshih@realtek.com \
--cc=rtl8821cerfe2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®