* [PATCH rtw-next] wifi: rtw88: restore channel when leaving idle in monitor mode
@ 2026-12-03 8:04 Martin
2026-12-03 8:30 ` Ping-Ke Shih
0 siblings, 1 reply; 2+ messages in thread
From: Martin @ 2026-12-03 8:04 UTC (permalink / raw)
To: Ping-Ke Shih
Cc: linux-wireless, Luka Gejak, Bitterblue Smith, linux-kernel, Martin
After a monitor interface is set up a second time on the same channel
(down, monitor, up, same frequency), the chip no longer works on that
channel. On 5 GHz the RTL8814AU neither receives nor transmits, and
the RTL8812AU does not transmit. Setting up the interface on a
different channel works.
Stopping the last interface powers the chip off, but mac80211 keeps
the chandef. When the interface comes up again on the same channel,
ieee80211_hw_conf_init() does not set IEEE80211_CONF_CHANGE_CHANNEL,
so rtw_ops_config() does not call rtw_set_channel() after the chip
was powered on. The RF and baseband settings stay at their init
values; on the RTL8814AU the RFE pinmux keeps the value from the
baseband init table.
Like rtw89 commit e07c9af7bbc8 ("wifi: rtw89: restore channel when
leaving idle on non-chanctx devices"), set
IEEE80211_CONF_CHANGE_CHANNEL when a monitor interface leaves idle, so
the channel is programmed again. rtw88 does not use the chanctx
callbacks, so no check for that is needed.
Closes: https://lore.kernel.org/linux-wireless/20261201205032.Horde.Z7ChCCtVnG0Kme7KFHo6v7B@mail.your-server.de/
Suggested-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Martin <martin@rfdeck.de>
---
Tested with an RTL8814AU and an RTL8812AU (USB) on Ubuntu 7.0.0-43,
with the same hunk applied to its rtw88 (stock mac80211). After the
second setup on 5180 MHz at 80 MHz width, the RTL8814AU receives as
many beacons as after the first setup (none without the change), and
both adapters inject again (50 of 50 frames at a second receiver).
The same holds for a second setup on 5200 MHz, for deleting and
re-adding the monitor interface, for down/up without changing the
interface type, and for restarting Kismet. No warnings in dmesg. The
patch applies to rtw-next as is; I did not build rtw-next itself.
Luka Gejak traced the problem to ieee80211_hw_conf_init(). Calling
rtw_set_channel() in rtw_ops_start() and setting
IEEE80211_CONF_CHANGE_CHANNEL in ieee80211_hw_conf_init() fix it too;
this version follows rtw89, as Ping-Ke preferred.
AI tool use (Documentation/process/generated-content.rst): the
analysis, the patch and the changelog were written with help from
Claude Code, from the register dumps and mac80211 traces of my tests
and the discussion on the list. I reviewed and tested the change.
drivers/net/wireless/realtek/rtw88/mac80211.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index b14d7fffb98..97ec7609a23 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -86,6 +86,16 @@ static int rtw_ops_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
rtw_leave_lps_deep(rtwdev);
+ /* The chip was powered off while mac80211 kept the chandef, so a
+ * monitor interface that comes up again on the same channel does
+ * not get IEEE80211_CONF_CHANGE_CHANNEL. Program the channel anyway.
+ */
+ if (changed & IEEE80211_CONF_CHANGE_IDLE &&
+ changed & IEEE80211_CONF_CHANGE_MONITOR &&
+ !(hw->conf.flags & IEEE80211_CONF_IDLE) &&
+ hw->conf.flags & IEEE80211_CONF_MONITOR)
+ changed |= IEEE80211_CONF_CHANGE_CHANNEL;
+
if ((changed & IEEE80211_CONF_CHANGE_IDLE) &&
!(hw->conf.flags & IEEE80211_CONF_IDLE)) {
ret = rtw_leave_ips(rtwdev);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH rtw-next] wifi: rtw88: restore channel when leaving idle in monitor mode
2026-12-03 8:04 [PATCH rtw-next] wifi: rtw88: restore channel when leaving idle in monitor mode Martin
@ 2026-12-03 8:30 ` Ping-Ke Shih
0 siblings, 0 replies; 2+ messages in thread
From: Ping-Ke Shih @ 2026-12-03 8:30 UTC (permalink / raw)
To: Martin; +Cc: linux-wireless, Luka Gejak, Bitterblue Smith, linux-kernel
Martin <martin@rfdeck.de> wrote:
> After a monitor interface is set up a second time on the same channel
> (down, monitor, up, same frequency), the chip no longer works on that
> channel. On 5 GHz the RTL8814AU neither receives nor transmits, and
> the RTL8812AU does not transmit. Setting up the interface on a
> different channel works.
I think this is enough.
>
> Stopping the last interface powers the chip off, but mac80211 keeps
> the chandef. When the interface comes up again on the same channel,
> ieee80211_hw_conf_init() does not set IEEE80211_CONF_CHANGE_CHANNEL,
> so rtw_ops_config() does not call rtw_set_channel() after the chip
> was powered on. The RF and baseband settings stay at their init
> values; on the RTL8814AU the RFE pinmux keeps the value from the
> baseband init table.
No need to describe your trace. I think the Closes link gives much
things already.
>
> Like rtw89 commit e07c9af7bbc8 ("wifi: rtw89: restore channel when
> leaving idle on non-chanctx devices"), set
> IEEE80211_CONF_CHANGE_CHANNEL when a monitor interface leaves idle, so
> the channel is programmed again. rtw88 does not use the chanctx
> callbacks, so no check for that is needed.
Just put this after "---".
But actually, I guess Closes link has this too.
>
> Closes:
> https://lore.kernel.org/linux-wireless/20261201205032.Horde.Z7ChCCtVnG0Kme7KFHo6v7B@mail.your-serv
> er.de/
> Suggested-by: Ping-Ke Shih <pkshih@realtek.com>
> Signed-off-by: Martin <martin@rfdeck.de>
> ---
> Tested with an RTL8814AU and an RTL8812AU (USB)
It is worth to put the tested adapters in commit message.
> on Ubuntu 7.0.0-43,
> with the same hunk applied to its rtw88 (stock mac80211). After the
> second setup on 5180 MHz at 80 MHz width, the RTL8814AU receives as
> many beacons as after the first setup (none without the change), and
> both adapters inject again (50 of 50 frames at a second receiver).
> The same holds for a second setup on 5200 MHz, for deleting and
> re-adding the monitor interface, for down/up without changing the
> interface type, and for restarting Kismet. No warnings in dmesg. The
> patch applies to rtw-next as is; I did not build rtw-next itself.
>
> Luka Gejak traced the problem to ieee80211_hw_conf_init(). Calling
> rtw_set_channel() in rtw_ops_start() and setting
> IEEE80211_CONF_CHANGE_CHANNEL in ieee80211_hw_conf_init() fix it too;
> this version follows rtw89, as Ping-Ke preferred.
>
> AI tool use (Documentation/process/generated-content.rst): the
> analysis, the patch and the changelog were written with help from
> Claude Code, from the register dumps and mac80211 traces of my tests
> and the discussion on the list. I reviewed and tested the change.
>
> drivers/net/wireless/realtek/rtw88/mac80211.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c
> b/drivers/net/wireless/realtek/rtw88/mac80211.c
> index b14d7fffb98..97ec7609a23 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac80211.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
> @@ -86,6 +86,16 @@ static int rtw_ops_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
>
> rtw_leave_lps_deep(rtwdev);
>
> + /* The chip was powered off while mac80211 kept the chandef, so a
> + * monitor interface that comes up again on the same channel does
> + * not get IEEE80211_CONF_CHANGE_CHANNEL. Program the channel anyway.
> + */
No need this comment.
> + if (changed & IEEE80211_CONF_CHANGE_IDLE &&
> + changed & IEEE80211_CONF_CHANGE_MONITOR &&
> + !(hw->conf.flags & IEEE80211_CONF_IDLE) &&
> + hw->conf.flags & IEEE80211_CONF_MONITOR)
> + changed |= IEEE80211_CONF_CHANGE_CHANNEL;
> +
> if ((changed & IEEE80211_CONF_CHANGE_IDLE) &&
> !(hw->conf.flags & IEEE80211_CONF_IDLE)) {
> ret = rtw_leave_ips(rtwdev);
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 8:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 8:04 [PATCH rtw-next] wifi: rtw88: restore channel when leaving idle in monitor mode Martin
2026-12-03 8:30 ` Ping-Ke Shih
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®