Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796499875; b=C9wi0puGNG75cHpJb9SmqBwYmQm/+0EnG4xjJ3KIZpDAQKnOVj0k5rVQ7/V0FoyTOhRK GcAdDPUj0rFAvV6erFHbapSIE/yO6xOnQLlowaGMOqEIQ3Kfh4uKmA+AWf2lNclqRUGAY nmAKhPkT6x8pUrIiHmXTok2wbEQ7K1OvesnJcDBxh9CX1JbK9zOaSylLTmMCMp1n112mu Nyi9C1p68l8erAJRMLs9uEQLfbzwpCqRnJ03594jcCLhtupcv9doXHLghqjIiWt4pHs47 UppqV9/TCtBIrFAKwkDbF9axbMyLpaY5BQ9YiOT+FyRdDw/kVEJ2pA6M60eytmj8OIg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796499875; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=1UK3aJ9wjKS8BiZZ3mxodI17A2wUecMKVewczb9q37A=; b=HrNe/gopc7dYXasC4LxXG4QT77VispV8d4msdJCEsmbwwRNV4c30BKgjk+yS0/9wN15s KIwBLjT2/m81LKOw/7VHSiFO9co8VAiDREnmLeKz9Ly5+g73JQOzXHgmujSNYnOu2z4oS SeeQVmykSwmMkE9qoBLgAYj62N/SAfF9A2P4FiVQm8+rkQbVrA2GEhE8tyOMwrIfcsahr QID33Lbvvet3Fw4V9Runt3OTkpeOYtrNflLGaB9/RbZEporRBCAMX6OhE7kfEnvLgbEa8 +p6wF7iIXvnq85VNg55B2JUF1mqvlXdItICxaF6Zixhmg1jpg0te2nePHP4RZe2N+1A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hKScJxzT; arc=none smtp.remote-ip=74.125.82.174 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EE26606A322 for ; Sat, 5 Dec 2026 19:44:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3EE26606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hKScJxzT Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-3282db206d3so978879eec.0 for ; Sat, 05 Dec 2026 11:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796499874; x=1797104674; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=1UK3aJ9wjKS8BiZZ3mxodI17A2wUecMKVewczb9q37A=; b=hKScJxzT26QEFFWToNYyuBZs3hfpllzaIzcLVUEo5V+Jdp63bnXaj+946L5QShZLY/ ArknBqFR9Q12AvrnirrKRRp3XCnSR+fEezVam5ddOkKpT21wKE0D0cPfiiScZWJLfoSf 0iXpsunbVjtitveExxiHq/8GlBoXo2xcHtRDZ3QCLhE5v6KhZW3TFMNSgTTiNunuWroq lEkRdtUOX0GTdB1hnjLKZ+hlWnUQqyCfGVuA5KMpjUDNbn9eRY08nD2kkGbzn0B7QKyd BiPobrsPPn1FdlQorSyE0LW9Y8EvpC5AfAXMI8AOSVgynKEuGZJNIaBiOGSzOOVUqg2j FMOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796499874; x=1797104674; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1UK3aJ9wjKS8BiZZ3mxodI17A2wUecMKVewczb9q37A=; b=w5YQ5xt6TX3EM6gCMKuJ2AqeAVv/Dj3EYFirto9fLOLjl/sDwZk50YTq92PUqiWOqX fu4El8aXxUpuE+1apqcn07xrhf2B+pkxt0zOBoKIxrg8KlMKMLjyfYWS0J1+9mOx2G5C Eph4zhy9pD6qjtbIiYHjcaoQ/c2ovcaxaHyay4GyhobHNo9LMxe4WgSjgeEdeWdcROlJ RRNwHb6347xqSfKxnzE6/exE3AmqK7QzSN7WzcbQLK/o1ncCEdINILUxTSopV0FWvOj1 2sHrSTkN0FxXPpXkEdV0q+A/MNvjlTsLRRnJMpJjmuR5+KHnCtQUFFCoHzTpsUbGnIGq ESHQ== X-Gm-Message-State: AB4q+uEVUT5CYhRIU8oDLJEmIRCER8xmVYoueSurNjc8i3OgoShjuv5i QSvQ/UmDmiQFs95V9ni8zutHblx2jIQTgNSgtYcgcBGDwdYru9EltrlnCHK5Nw== X-Gm-Gg: AZFdTZcPhu7XGNgzjamMtc79+9CzSVy/Vkktk99Hyowwf3hALupiTtwZRZP4f5eYF+f de5iELnez2bDaIb2m7fOEVtJn9QpbDgM8sH2hhJvZ7tc7dqjnmfpQNBUn4Dg3q3SXKRGeJxpecU B3ZOa+zo6sa0FgazQIa1pajbxVEzBeEs2u/L5/RuSyyu5rxWGr5wkCbgOL5IQYVYGcUvRQaIirr ISU2bWOUivejuCD3VAAXALBH2sVdtfC0ERhIqtp5z0Z50h5p7mM6nhiMxIE+HGU6xfoEPvnYaWI jXFvxvemtSL2JmBXBLiLjVgPslgmvuNtnlF5akUFyC9rUF7rZ+FfUSVdRpfRvtTEMF2V2jW3499 g7j8ouisKyaPbXrd/8OzTlTwjfoMeqqSeHkdHl+U7ax2CWZPGHIqWrkgE5laEtFiNuhSY3qT4kW nssV43L6AopHFEDHFJNIpymYjgEbBTc1TrBaLHWhyFAfP7qutTlim5W4GhmxC+I9XevNlUSw7aQ S4Q3C34k/7NS8iKHTUeYRVxSFhoKoOobZJjiPuySRlGlYLUO/yP+iHr2xDTH2zk/3KS9+D7ZKwO HtgYPegFTgc2IIW9trpdMPqnRfubIAP71ySB X-Received: by 2002:a05:7300:d205:b0:36a:12c1:3adb with SMTP id 5a478bee46e88-38752133efamr6334327eec.20.1796499874148; Sat, 05 Dec 2026 11:44:34 -0800 (PST) Received: from nirmal-arch ([61.245.169.173]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3875226fa94sm20870180eec.29.2026.12.05.11.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 11:44:33 -0800 (PST) From: Nirmal Savinda To: Ping-Ke Shih Cc: linux-wireless@vger.kernel.org Subject: [RFC PATCH rtw-next] wifi: rtw89: 8852b: don't restore TX enable saved during a firmware pause Date: Sun, 6 Dec 2026 01:14:20 +0530 Message-ID: <20261205194420.2259796-1-nirmalsavinda29@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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