Skip to contentSkip to conversation

wifi: rtw88: Fix RX aggregation settings for RTL8723DS

PATCH Superseded Bitterblue Smith 2 participants 5 messages Apr 28, 2025 – Apr 29, 2025 Realtek wireless driver (rtw88)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 wifi: rtw88: Fix RX aggregation settings for RTL8723DS

Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.

---
 drivers/net/wireless/realtek/rtw88/sdio.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/sdio.c +10 -2
index c57f683d9af8..6f63fd5db665 100644
@@ -677,12 +677,20 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev)
 {
 	u8 size, timeout;
 
-	if (rtw_chip_wcpu_11n(rtwdev)) {
+	switch (rtwdev->chip->id) {
+	case RTW_CHIP_TYPE_8703B:
 		size = 0x6;
 		timeout = 0x6;
-	} else {
+		break;
+	case RTW_CHIP_TYPE_8723D:
+		size = 0xa;
+		timeout = 0x3;
+		rtw_write8_set(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7));
+		break;
+	default:
 		size = 0xff;
 		timeout = 0x1;
+		break;
 	}
 
 	/* Make the firmware honor the size limit configured below */
Signature · 1 line
2.49.0
#1 lore raw

PATCH 2/2 wifi: rtw88: Handle RTL8723D(S) with blank efuse

Some users have RTL8723DS chips with nearly blank efuse. Currently these chips cannot connect when using rtw88, but they do work using the old out-of-tree driver.

Use reasonable default values for TX power, antenna configuration, and crystal cap if the chip's efuse is missing these things.

RTL8723D can use the same default values as RTL8703B, so simply move the code from rtl8703b_read_efuse() to the shared function __rtl8723x_read_efuse().

---
 drivers/net/wireless/realtek/rtw88/rtw8703b.c | 60 -------------------
 drivers/net/wireless/realtek/rtw88/rtw8723x.c | 59 ++++++++++++++++++
 2 files changed, 59 insertions(+), 60 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8703b.c +0 -60
index 5e59cfe4dfdf..9e6700c43a63 100644
@@ -519,15 +519,6 @@ static const struct rtw_rqpn rqpn_table_8703b[] = {
 	 RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH},
 };
 
-/* Default power index table for RTL8703B, used if EFUSE does not
- * contain valid data. Replaces EFUSE data from offset 0x10 (start of
- * txpwr_idx_table).
- */
-static const u8 rtw8703b_txpwr_idx_table[] = {
-	0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D,
-	0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x02
-};
-
 static void try_mac_from_devicetree(struct rtw_dev *rtwdev)
 {
 	struct device_node *node = rtwdev->dev->of_node;
@@ -544,15 +535,9 @@ static void try_mac_from_devicetree(struct rtw_dev *rtwdev)
 	}
 }
 
-#define DBG_EFUSE_FIX(rtwdev, name)					\
-	rtw_dbg(rtwdev, RTW_DBG_EFUSE, "Fixed invalid EFUSE value: "	\
-		# name "=0x%x\n", rtwdev->efuse.name)
-
 static int rtw8703b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
 {
 	struct rtw_efuse *efuse = &rtwdev->efuse;
-	u8 *pwr = (u8 *)efuse->txpwr_idx_table;
-	bool valid = false;
 	int ret;
 
 	ret = rtw8723x_read_efuse(rtwdev, log_map);
@@ -562,51 +547,6 @@ static int rtw8703b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
 	if (!is_valid_ether_addr(efuse->addr))
 		try_mac_from_devicetree(rtwdev);
 
-	/* If TX power index table in EFUSE is invalid, fall back to
-	 * built-in table.
-	 */
-	for (int i = 0; i < ARRAY_SIZE(rtw8703b_txpwr_idx_table); i++)
-		if (pwr[i] != 0xff) {
-			valid = true;
-			break;
-		}
-	if (!valid) {
-		for (int i = 0; i < ARRAY_SIZE(rtw8703b_txpwr_idx_table); i++)
-			pwr[i] = rtw8703b_txpwr_idx_table[i];
-		rtw_dbg(rtwdev, RTW_DBG_EFUSE,
-			"Replaced invalid EFUSE TX power index table.");
-		rtw8723x_debug_txpwr_limit(rtwdev,
-					   efuse->txpwr_idx_table, 2);
-	}
-
-	/* Override invalid antenna settings. */
-	if (efuse->bt_setting == 0xff) {
-		/* shared antenna */
-		efuse->bt_setting |= BIT(0);
-		/* RF path A */
-		efuse->bt_setting &= ~BIT(6);
-		DBG_EFUSE_FIX(rtwdev, bt_setting);
-	}
-
-	/* Override invalid board options: The coex code incorrectly
-	 * assumes that if bits 6 & 7 are set the board doesn't
-	 * support coex. Regd is also derived from rf_board_option and
-	 * should be 0 if there's no valid data.
-	 */
-	if (efuse->rf_board_option == 0xff) {
-		efuse->regd = 0;
-		efuse->rf_board_option &= GENMASK(5, 0);
-		DBG_EFUSE_FIX(rtwdev, rf_board_option);
-	}
-
-	/* Override invalid crystal cap setting, default comes from
-	 * vendor driver. Chip specific.
-	 */
-	if (efuse->crystal_cap == 0xff) {
-		efuse->crystal_cap = 0x20;
-		DBG_EFUSE_FIX(rtwdev, crystal_cap);
-	}
-
 	return 0;
 }
 
drivers/net/wireless/realtek/rtw88/rtw8723x.c +59 -0

81 lines not on this page · raw message

Signature · 1 line
2.49.0
maintainer Acked-by on v1 2/2
#2 lore raw

RE: [PATCH rtw-next 2/2] wifi: rtw88: Handle RTL8723D(S) with blank efuse

Quoted 7 lines · Bitterblue Smith

Some users have RTL8723DS chips with nearly blank efuse. Currently these chips cannot connect when using rtw88, but they do work using the old out-of-tree driver.

Use reasonable default values for TX power, antenna configuration, and crystal cap if the chip's efuse is missing these things.

Quoted 6 lines

RTL8723D can use the same default values as RTL8703B, so simply move the code from rtl8703b_read_efuse() to the shared function __rtl8723x_read_efuse().

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

Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.

---
 drivers/net/wireless/realtek/rtw88/sdio.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/sdio.c +0 -0
index c57f683d9af8..6f63fd5db665 100644

drivers/net/wireless/realtek/rtw88/sdio.c static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev) · line 680

Quoted 4 lines
drivers/net/wireless/realtek/rtw88/sdio.c +0 -1
@@ -677,12 +677,20 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev)
 {
        u8 size, timeout;
 
-       if (rtw_chip_wcpu_11n(rtwdev)) {

Originally this only affects 11n chips, but now it affects all chips by default case. Is that in your expectation?

And have you tested chips other than RTL8723DS you mentioned in commit message. If so, please add them to commit message.

Quoted 20 lines
drivers/net/wireless/realtek/rtw88/sdio.c +10 -2
+       switch (rtwdev->chip->id) {
+       case RTW_CHIP_TYPE_8703B:
                size = 0x6;
                timeout = 0x6;
-       } else {
+               break;
+       case RTW_CHIP_TYPE_8723D:
+               size = 0xa;
+               timeout = 0x3;
+               rtw_write8_set(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7));
+               break;
+       default:
                size = 0xff;
                timeout = 0x1;
+               break;
        }
 
        /* Make the firmware honor the size limit configured below */
--

2.49.0

#4 lore raw
Quoted 18 lines · Ping-Ke Shih
Quoted 17 lines · Bitterblue Smith

Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.

---
 drivers/net/wireless/realtek/rtw88/sdio.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/sdio.c +0 -0
index c57f683d9af8..6f63fd5db665 100644
@@ -677,12 +677,20 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev)
 {
        u8 size, timeout;
 
Quoted 5 lines

drivers/net/wireless/realtek/rtw88/sdio.c static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev) · line 680

Quoted 1 line
drivers/net/wireless/realtek/rtw88/sdio.c +0 -1
-       if (rtw_chip_wcpu_11n(rtwdev)) {

Originally this only affects 11n chips, but now it affects all chips by default case. Is that in your expectation?

I think it only changes the behaviour for RTL8723D, RTL8821A, and RTL8812A. These last two don't have SDIO drivers in rtw88, but I can add them to the switch so they get the same size and timeout as before.

Quoted 3 lines

And have you tested chips other than RTL8723DS you mentioned in commit message. If so, please add them to commit message.

I only tested RTL8723DS. I don't have others.

Quoted 21 lines
Quoted 20 lines
drivers/net/wireless/realtek/rtw88/sdio.c +10 -2
+       switch (rtwdev->chip->id) {
+       case RTW_CHIP_TYPE_8703B:
                size = 0x6;
                timeout = 0x6;
-       } else {
+               break;
+       case RTW_CHIP_TYPE_8723D:
+               size = 0xa;
+               timeout = 0x3;
+               rtw_write8_set(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7));
+               break;
+       default:
                size = 0xff;
                timeout = 0x1;
+               break;
        }
 
        /* Make the firmware honor the size limit configured below */
--

2.49.0