diff mbox series

[v2] wifi: rtw88: Fix USB/SDIO devices not transmitting beacons

Message ID 49de73b5-698f-4865-ab63-100e28dfc4a1@gmail.com
State New
Headers show
Series [v2] wifi: rtw88: Fix USB/SDIO devices not transmitting beacons | expand

Commit Message

Bitterblue Smith Aug. 21, 2024, 1:11 p.m. UTC
All USB devices supported by rtw88 have the same problem: they don't
transmit beacons in AP mode. (Some?) SDIO devices are also affected.
The cause appears to be clearing BIT_EN_BCNQ_DL of REG_FWHW_TXQ_CTRL
before uploading the beacon reserved page, so don't clear the bit for
USB and SDIO devices.

Tested with RTL8811CU and RTL8723DU.

Cc: <stable@vger.kernel.org> # 6.6.x
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
 - Only clear BIT_EN_BCNQ_DL for PCIE devices:
   https://lore.kernel.org/linux-wireless/CAP8xZ6n8utvFJCmTwnRzFccRkZZzk+R5Bf69UArbbzd4Ev9aRQ@mail.gmail.com/
 - Update the commit message.
---
 drivers/net/wireless/realtek/rtw88/fw.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Ping-Ke Shih Aug. 30, 2024, 12:30 a.m. UTC | #1
Hi Bitterblue, 

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> 
> All USB devices supported by rtw88 have the same problem: they don't
> transmit beacons in AP mode. (Some?) SDIO devices are also affected.
> The cause appears to be clearing BIT_EN_BCNQ_DL of REG_FWHW_TXQ_CTRL
> before uploading the beacon reserved page, so don't clear the bit for
> USB and SDIO devices.
> 
> Tested with RTL8811CU and RTL8723DU.
> 
> Cc: <stable@vger.kernel.org> # 6.6.x
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>

Can I say two below patchset are equivalent in your side?

[Patchset 1: your v1]
13744097 New          [1/2] wifi: rtw88: Fix USB devices not transmitting beacons
13744098 New          [2/2] wifi: rtw88: Avoid using macid 0 in AP mode

[Patchset 2: your v2 + mine]
13771597 New          [v2] wifi: rtw88: Fix USB/SDIO devices not transmitting beacons
13767746 New          wifi: rtw88: assign mac_id for vif/sta and update to TX desc

If this can make AP mode on USB devices step forward, I will merge them ahead.
Bitterblue Smith Aug. 30, 2024, 10:27 a.m. UTC | #2
On 30/08/2024 03:30, Ping-Ke Shih wrote:
> Hi Bitterblue, 
> 
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>>
>> All USB devices supported by rtw88 have the same problem: they don't
>> transmit beacons in AP mode. (Some?) SDIO devices are also affected.
>> The cause appears to be clearing BIT_EN_BCNQ_DL of REG_FWHW_TXQ_CTRL
>> before uploading the beacon reserved page, so don't clear the bit for
>> USB and SDIO devices.
>>
>> Tested with RTL8811CU and RTL8723DU.
>>
>> Cc: <stable@vger.kernel.org> # 6.6.x
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> 
> Can I say two below patchset are equivalent in your side?
> 
> [Patchset 1: your v1]
> 13744097 New          [1/2] wifi: rtw88: Fix USB devices not transmitting beacons
> 13744098 New          [2/2] wifi: rtw88: Avoid using macid 0 in AP mode
> 
> [Patchset 2: your v2 + mine]
> 13771597 New          [v2] wifi: rtw88: Fix USB/SDIO devices not transmitting beacons
> 13767746 New          wifi: rtw88: assign mac_id for vif/sta and update to TX desc
> 
> If this can make AP mode on USB devices step forward, I will merge them ahead.  
> 

Yes, patchset 2 works for me.
Ping-Ke Shih Sept. 2, 2024, 12:44 a.m. UTC | #3
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:

> All USB devices supported by rtw88 have the same problem: they don't
> transmit beacons in AP mode. (Some?) SDIO devices are also affected.
> The cause appears to be clearing BIT_EN_BCNQ_DL of REG_FWHW_TXQ_CTRL
> before uploading the beacon reserved page, so don't clear the bit for
> USB and SDIO devices.
> 
> Tested with RTL8811CU and RTL8723DU.
> 
> Cc: <stable@vger.kernel.org> # 6.6.x
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

faa2e484b393 wifi: rtw88: Fix USB/SDIO devices not transmitting beacons

---
https://github.com/pkshih/rtw.git
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index ab7d414d0ba6..b9b0114e253b 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -1468,10 +1468,12 @@  int rtw_fw_write_data_rsvd_page(struct rtw_dev *rtwdev, u16 pg_addr,
 	val |= BIT_ENSWBCN >> 8;
 	rtw_write8(rtwdev, REG_CR + 1, val);
 
-	val = rtw_read8(rtwdev, REG_FWHW_TXQ_CTRL + 2);
-	bckp[1] = val;
-	val &= ~(BIT_EN_BCNQ_DL >> 16);
-	rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, val);
+	if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE) {
+		val = rtw_read8(rtwdev, REG_FWHW_TXQ_CTRL + 2);
+		bckp[1] = val;
+		val &= ~(BIT_EN_BCNQ_DL >> 16);
+		rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, val);
+	}
 
 	ret = rtw_hci_write_data_rsvd_page(rtwdev, buf, size);
 	if (ret) {
@@ -1496,7 +1498,8 @@  int rtw_fw_write_data_rsvd_page(struct rtw_dev *rtwdev, u16 pg_addr,
 	rsvd_pg_head = rtwdev->fifo.rsvd_boundary;
 	rtw_write16(rtwdev, REG_FIFOPAGE_CTRL_2,
 		    rsvd_pg_head | BIT_BCN_VALID_V1);
-	rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, bckp[1]);
+	if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE)
+		rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, bckp[1]);
 	rtw_write8(rtwdev, REG_CR + 1, bckp[0]);
 
 	return ret;