Skip to contentSkip to conversation

wifi: rtw88: 8822c: Fix reported RX band width

PATCH In review Bitterblue Smith 3 participants 4 messages Jul 23, 2024 – Jul 31, 2024 Realtek wireless driver (rtw88)

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 wifi: rtw88: 8822c: Fix reported RX band width

"iw dev wlp2s0 station dump" shows incorrect rx bitrate:

tx bitrate:     866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
rx bitrate:     86.7 MBit/s VHT-MCS 9 VHT-NSS 1

This is because the RX band width is calculated incorrectly. Fix the calculation according to the phydm_rxsc_2_bw() function from the official drivers.

After:

tx bitrate:     866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
rx bitrate:     390.0 MBit/s VHT-MCS 9 80MHz VHT-NSS 1

It also works correctly with the AP configured for 20 MHz and 40 MHz.

Tested with RTL8822CE.

Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")

---
v3:
- Use Fixes and Cc: stable.

v2:
- Use Fixes instead of Cc: stable.

---
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822c.c +6 -4
index bc807b13e9ce..e265a35184ab 100644
@@ -2612,12 +2612,14 @@ static void query_phy_status_page1(struct rtw_dev *rtwdev, u8 *phy_status,
 	else
 		rxsc = GET_PHY_STAT_P1_HT_RXSC(phy_status);
 
-	if (rxsc >= 9 && rxsc <= 12)
+	if (rxsc == 0)
+		bw = rtwdev->hal.current_band_width;
+	else if (rxsc >= 1 && rxsc <= 8)
+		bw = RTW_CHANNEL_WIDTH_20;
+	else if (rxsc >= 9 && rxsc <= 12)
 		bw = RTW_CHANNEL_WIDTH_40;
-	else if (rxsc >= 13)
-		bw = RTW_CHANNEL_WIDTH_80;
 	else
-		bw = RTW_CHANNEL_WIDTH_20;
+		bw = RTW_CHANNEL_WIDTH_80;
 
 	channel = GET_PHY_STAT_P1_CHANNEL(phy_status);
 	rtw_set_rx_freq_band(pkt_stat, channel);
Signature · 1 line
2.45.2
#1 lore raw

PATCH v3 2/2 wifi: rtw88: 8703b: Fix reported RX band width

The definition of GET_RX_DESC_BW is incorrect. Fix it according to the GET_RX_STATUS_DESC_BW_8703B macro from the official driver.

Tested only with RTL8812AU, which uses the same bits.

Fixes 9bb762b3a957 ("wifi: rtw88: Add definitions for 8703b chip")

---
v3:
- Use Fixes and Cc: stable.

v2:
- Use Fixes instead of Cc: stable.

---
 drivers/net/wireless/realtek/rtw88/rx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/rx.h +1 -1
index d3668c4efc24..8a072dd3d73c 100644
@@ -41,7 +41,7 @@ enum rtw_rx_desc_enc {
 #define GET_RX_DESC_TSFL(rxdesc)                                               \
 	le32_get_bits(*((__le32 *)(rxdesc) + 0x05), GENMASK(31, 0))
 #define GET_RX_DESC_BW(rxdesc)                                                 \
-	(le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(31, 24)))
+	(le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(5, 4)))
 
 void rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
 		  struct sk_buff *skb);
Signature · 1 line
2.45.2
Tested-by on v3 2/2
#2 lore raw

Re: [PATCH v3 2/2] wifi: rtw88: 8703b: Fix reported RX band width

Am 23.07.24 um 21:32 schrieb Bitterblue Smith:

Quoted 4 lines

The definition of GET_RX_DESC_BW is incorrect. Fix it according to the GET_RX_STATUS_DESC_BW_8703B macro from the official driver.

Tested only with RTL8812AU, which uses the same bits.

Thanks for catching this! Confirmed that RTL8723CS correctly reports 20MHz, my radio environment is too noisy to connect with HT40.

Quoted 18 lines
Fixes 9bb762b3a957 ("wifi: rtw88: Add definitions for 8703b chip")

---
v3:
- Use Fixes and Cc: stable.

v2:
- Use Fixes instead of Cc: stable.

---
  drivers/net/wireless/realtek/rtw88/rx.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/rx.h +0 -0
index d3668c4efc24..8a072dd3d73c 100644

drivers/net/wireless/realtek/rtw88/rx.h enum rtw_rx_desc_enc { · line 47

Quoted 8 lines
drivers/net/wireless/realtek/rtw88/rx.h +1 -1
@@ -41,7 +41,7 @@ enum rtw_rx_desc_enc {
  #define GET_RX_DESC_TSFL(rxdesc)                                               \
  	le32_get_bits(*((__le32 *)(rxdesc) + 0x05), GENMASK(31, 0))
  #define GET_RX_DESC_BW(rxdesc)                                                 \
-	(le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(31, 24)))
+	(le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(5, 4)))
 
  void rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
  		  struct sk_buff *skb);

--
Dipl.-Ing. Fiona Klute
Mollwitzer Str. 2
44141 Dortmund
Germany

USt.-ID/VAT number: DE363488944

maintainer
#3 lore raw
In reply to Bitterblue Smith
Quoted 14 lines · Bitterblue Smith

"iw dev wlp2s0 station dump" shows incorrect rx bitrate:

tx bitrate:     866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
rx bitrate:     86.7 MBit/s VHT-MCS 9 VHT-NSS 1

This is because the RX band width is calculated incorrectly. Fix the calculation according to the phydm_rxsc_2_bw() function from the official drivers.

After:

tx bitrate:     866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
rx bitrate:     390.0 MBit/s VHT-MCS 9 80MHz VHT-NSS 1
Quoted 7 lines

It also works correctly with the AP configured for 20 MHz and 40 MHz.

Tested with RTL8822CE.

Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")

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

a71ed5898dfa wifi: rtw88: 8822c: Fix reported RX band width 0129e5ff2842 wifi: rtw88: 8703b: Fix reported RX band width

---
https://github.com/pkshih/rtw.git