The chip is reset by power_off()/power_on(), but mac80211 only calls ieee80211_ops::config() when its own channel state changes. After a stop/start cycle, such as ip link set down ip link set up the channel is unchanged from mac80211's point of view, so the radio is never reprogrammed. The device then listens on whatever channel the hardware came up on while iw reports the configured one, and receives almost nothing. Observed with an RTL8814AU (ALFA AWUS1900) in monitor mode on an aarch64 host. A 25 s capture on channel 6 after a down/up cycle yields 3 frames, and 431 frames as soon as any real channel change is requested. An RTL8812AU (Linksys WUSB6300) on the same host, the same channel and the same second yields 2438 frames. Program the channel in rtw_ops_start(), like rtw_ips_pwr_up() already does when leaving IPS. Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver") Assisted-by: LLM Signed-off-by: Jeremy Fareau --- drivers/net/wireless/realtek/rtw88/mac80211.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index b01b98d24b0a..827f38390969 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -57,6 +57,17 @@ static int rtw_ops_start(struct ieee80211_hw *hw) mutex_lock(&rtwdev->mutex); ret = rtw_core_start(rtwdev); + + /* The chip is reset by power_off()/power_on(), but mac80211 only calls + * ieee80211_ops::config() when its own channel state changes. After a + * stop/start cycle the channel is unchanged from mac80211's point of + * view, so the radio would never be reprogrammed and the device would + * receive nothing. Program it here, like rtw_ips_pwr_up() already does + * when leaving IPS. + */ + if (!ret && hw->conf.chandef.chan) + rtw_set_channel(rtwdev); + mutex_unlock(&rtwdev->mutex); return ret; -- 2.43.0 Commit ed51a86b787f ("wifi: rtw88: Enable receiving control frames in monitor mode") writes REG_RXFLTMAP1 from configure_filter(), but that register is reset to the chip default by the chip's mac_init() during power_on(). mac80211 only calls ieee80211_ops::configure_filter() when its own filter flags change, so after a stop/start cycle the flags are unchanged and the control frame filter silently reverts: monitor mode stops delivering control frames again. Keep track of the value configure_filter() last asked for and restore it in rtw_core_start(), next to the RCR restore, which exists for the same reason. Measured on an RTL8814AU and an RTL8812AU in monitor mode on channel 6, 40 s captures taken after a down/up cycle. Control frames go from 0 to 23184 and from 0 to 483 respectively; without this change both are 0. Fixes: ed51a86b787f ("wifi: rtw88: Enable receiving control frames in monitor mode") Assisted-by: LLM Signed-off-by: Jeremy Fareau --- drivers/net/wireless/realtek/rtw88/mac80211.c | 5 +++-- drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++++ drivers/net/wireless/realtek/rtw88/main.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index 827f38390969..84d869f1efe0 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -300,9 +300,10 @@ static void rtw_ops_configure_filter(struct ieee80211_hw *hw, if (changed_flags & FIF_CONTROL) { if (*new_flags & FIF_CONTROL) - rtw_write16(rtwdev, REG_RXFLTMAP1, 0xffff); + rtwdev->hal.rxfltmap1_cur = 0xffff; else - rtw_write16(rtwdev, REG_RXFLTMAP1, rtwdev->hal.rxfltmap1); + rtwdev->hal.rxfltmap1_cur = rtwdev->hal.rxfltmap1; + rtw_write16(rtwdev, REG_RXFLTMAP1, rtwdev->hal.rxfltmap1_cur); } if (changed_flags & FIF_ALLMULTI) { if (*new_flags & FIF_ALLMULTI) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index cd9254370fcc..ea61020a0622 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1528,6 +1528,14 @@ int rtw_core_start(struct rtw_dev *rtwdev) /* rcr reset after powered on */ rtw_write32(rtwdev, REG_RCR, rtwdev->hal.rcr); + /* REG_RXFLTMAP1 is reset by the chip's mac_init() during power_on(), + * and mac80211 only calls ieee80211_ops::configure_filter() when its + * own filter flags change. After a stop/start cycle the flags are + * unchanged, so restore the value configure_filter() last asked for. + */ + if (rtwdev->hal.rxfltmap1_cur) + rtw_write16(rtwdev, REG_RXFLTMAP1, rtwdev->hal.rxfltmap1_cur); + ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->watch_dog_work, RTW_WATCH_DOG_DELAY_TIME); diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index c6e981ba7986..5a9bcc4fdff9 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -1964,6 +1964,7 @@ struct rtw_sar { struct rtw_hal { u32 rcr; u16 rxfltmap1; + u16 rxfltmap1_cur; u32 chip_version; u8 cut_version; -- 2.43.0