On RTL8852BE the station can stop transmitting for good while it stays associated and keeps receiving. The TX packet counter stops, ARP to the gateway goes INCOMPLETE, and on disconnect the driver logs "timed out to flush pci txch: 0". Only a reconnect or a driver reload brings TX back. rtw8852b_set_channel_help() saves R_AX_CTN_TXEN with a plain register read in rtw89_mac_stop_sch_tx(), stops the TX scheduler, reprograms the radio and writes the saved value back with rtw89_chip_resume_sch_tx(). Once firmware is running, both writes go through firmware (rtw89_hw_sch_tx_en_h2c()). Firmware also clears queues in that register on its own for short periods, for example while Bluetooth has the antenna, and the register then reads 0x0000 (or 0x0700, management queues only) instead of the normal 0xffff. If the save lands in such a period, the driver asks firmware to restore the paused value, and firmware applies that request once the pause ends. TX stays off, and every later channel change saves and restores the same value, so it never recovers on its own. It shows up with a 2.4 GHz AP that keeps switching between 20 and 40 MHz, since every switch goes through set_channel_help(), and is much more likely while a Bluetooth A2DP headset is streaming. During a stall the register reads 0x0000. A test build that logged the saved value caught 0x0700 once, asked firmware for 0x070f instead, and read exactly 0x070f back at the next channel change: firmware applies the restore request after its pause rather than dropping it. Nothing in the driver keeps the management or band-0 data queues off across a channel change. When the saved value has any of them off while firmware is running, restore all queues instead. Tested on RTL8852BE (firmware 0.29.29.19, RFE 1) with v7.3.6 against such an AP while a headset was streaming. Without the fix, TX stopped on 2 of 9 bandwidth changes. With this change, 1 of 19 bandwidth changes saved 0x0000 and TX kept working. An earlier version, which restored the last value seen with these queues on (always 0xffff here), caught 3 of 14 the same way. Fixes: d0a95ef3ed86 ("wifi: rtw89: 8852b: add chip_ops::set_channel_help") Signed-off-by: Nirmal Savinda --- Notes: - Bug report with full logs and register reads: https://lore.kernel.org/linux-wireless/20261205194114.2249269-1-nirmalsavinda29@gmail.com/ - The same save/restore exists in set_channel_help() of 8851b, 8852a and 8852bt, in their RFK helpers that call rtw89_chip_stop_sch_tx(), and in band1_enable_ax(). I only have RTL8852BE hardware, so this patch only touches 8852b. If you prefer, the check could move into rtw89_mac_stop_sch_tx() or rtw89_mac_resume_sch_tx() to cover all of them, or the driver could restore the value it last requested instead of reading the register back. - The tested build also checked the register periodically from the track work and rewrote it if TX stayed off for a whole 200 ms burst of reads. It never found TX stuck, so it is left out here. drivers/net/wireless/realtek/rtw89/rtw8852b.c | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c index 82f131ac77a5..4677630548ac 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c @@ -684,6 +684,35 @@ static void rtw8852b_adc_en(struct rtw89_dev *rtwdev, bool en) rtw89_phy_write32_mask(rtwdev, R_ADC_FIFO, B_ADC_FIFO_RST, 0xf); } +/* Queues a station cannot work without: management and band-0 data. */ +#define RTW8852B_TXEN_REQUIRED (B_AX_CTN_TXEN_MGQ | B_AX_CTN_TXEN_VO_0 | \ + B_AX_CTN_TXEN_VI_0 | B_AX_CTN_TXEN_BK_0 | \ + B_AX_CTN_TXEN_BE_0) + +/* + * The TX enable value saved when a channel change starts is a plain register + * read, but firmware also clears queues in that register for short periods, + * for example while Bluetooth has the antenna, and it applies a write that + * arrives during such a pause once the pause ends. Writing back a value saved + * during a pause would leave TX off for good. Nothing in the driver keeps + * these queues off across a channel change, so restore all queues instead. + */ +static u32 rtw8852b_txen_to_restore(struct rtw89_dev *rtwdev, u32 tx_en) +{ + if ((tx_en & RTW8852B_TXEN_REQUIRED) == RTW8852B_TXEN_REQUIRED) + return tx_en; + + if (!test_bit(RTW89_FLAG_FW_RDY, rtwdev->flags) || + test_bit(RTW89_FLAG_SER_HANDLING, rtwdev->flags)) + return tx_en; + + rtw89_debug(rtwdev, RTW89_DBG_TXRX, + "TX enable 0x%04x saved during a firmware pause, enabling all queues\n", + tx_en); + + return B_AX_CTN_TXEN_ALL_MASK; +} + static void rtw8852b_set_channel_help(struct rtw89_dev *rtwdev, bool enter, struct rtw89_channel_help_params *p, const struct rtw89_chan *chan, @@ -702,7 +731,8 @@ static void rtw8852b_set_channel_help(struct rtw89_dev *rtwdev, bool enter, rtw8852b_adc_en(rtwdev, true); rtw8852b_tssi_cont_en_phyidx(rtwdev, true, RTW89_PHY_0); rtw8852b_bb_reset_en(rtwdev, chan->band_type, phy_idx, true); - rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en); + rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, + rtw8852b_txen_to_restore(rtwdev, p->tx_en)); } } -- 2.56.1