diff mbox series

wifi: rtlwifi: rtl8192cu: Fix 2T2R chip type detection

Message ID ed960059-5c77-422d-ac4e-fe9fc9d0d296@gmail.com
State New
Headers show
Series wifi: rtlwifi: rtl8192cu: Fix 2T2R chip type detection | expand

Commit Message

Bitterblue Smith Feb. 13, 2024, 2:33 p.m. UTC
rtl8192cu handles 1T1R devices (RTL8188CUS), 1T2R devices (RTL8191CU),
and 2T2R devices (RTL8192CU). The 2T2R devices were incorrectly detected
as 1T2R because of a mistake in the IS_92C_1T2R macro.

The visible effect of this is that the firmware was allowed to use
TX rates only up to MCS7.

Fix the IS_92C_1T2R macro.

Now my 2T2R device has much better upload speed.
Before: 46 Mbps.
After:  82 Mbps.

Also fix a debug message which was printing "RF_1T1R" even for 1T2R
chips.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Ping-Ke Shih Feb. 15, 2024, 7:28 a.m. UTC | #1
> -----Original Message-----
> From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Sent: Tuesday, February 13, 2024 10:33 PM
> To: linux-wireless@vger.kernel.org
> Cc: Ping-Ke Shih <pkshih@realtek.com>; Larry Finger <Larry.Finger@lwfinger.net>
> Subject: [PATCH] wifi: rtlwifi: rtl8192cu: Fix 2T2R chip type detection
> 
> rtl8192cu handles 1T1R devices (RTL8188CUS), 1T2R devices (RTL8191CU),
> and 2T2R devices (RTL8192CU). The 2T2R devices were incorrectly detected
> as 1T2R because of a mistake in the IS_92C_1T2R macro.
> 
> The visible effect of this is that the firmware was allowed to use
> TX rates only up to MCS7.
> 
> Fix the IS_92C_1T2R macro.
> 
> Now my 2T2R device has much better upload speed.
> Before: 46 Mbps.
> After:  82 Mbps.
> 
> Also fix a debug message which was printing "RF_1T1R" even for 1T2R
> chips.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Kalle Valo Feb. 15, 2024, 11:10 a.m. UTC | #2
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:

> rtl8192cu handles 1T1R devices (RTL8188CUS), 1T2R devices (RTL8191CU),
> and 2T2R devices (RTL8192CU). The 2T2R devices were incorrectly detected
> as 1T2R because of a mistake in the IS_92C_1T2R macro.
> 
> The visible effect of this is that the firmware was allowed to use
> TX rates only up to MCS7.
> 
> Fix the IS_92C_1T2R macro.
> 
> Now my 2T2R device has much better upload speed.
> Before: 46 Mbps.
> After:  82 Mbps.
> 
> Also fix a debug message which was printing "RF_1T1R" even for 1T2R
> chips.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

bcfcbf23a98c wifi: rtlwifi: rtl8192cu: Fix 2T2R chip type detection
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h
index 91e4427ab022..4757f93b84e4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h
@@ -11,7 +11,7 @@ 
 #define CHIP_VENDOR_UMC_B_CUT		BIT(6)
 
 #define IS_92C_1T2R(version)		\
-	(((version) & CHIP_92C) && ((version) & CHIP_92C_1T2R))
+	(((version) & CHIP_92C_1T2R) == CHIP_92C_1T2R)
 
 #define IS_VENDOR_UMC(version)		\
 	(((version) & CHIP_VENDOR_UMC) ? true : false)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
index 4ff0d4118193..a76f2dc8a977 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
@@ -101,7 +101,8 @@  void rtl92c_read_chip_version(struct ieee80211_hw *hw)
 		rtlphy->rf_type = RF_1T1R;
 	rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD,
 		"Chip RF Type: %s\n",
-		rtlphy->rf_type == RF_2T2R ? "RF_2T2R" : "RF_1T1R");
+		rtlphy->rf_type == RF_2T2R ? "RF_2T2R" :
+		rtlphy->rf_type == RF_1T2R ? "RF_1T2R" : "RF_1T1R");
 	if (get_rf_type(rtlphy) == RF_1T1R)
 		rtlpriv->dm.rfpath_rxenable[0] = true;
 	else