diff mbox series

[rtw-next,v2,1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS

Message ID 4c79fdc1-54bc-4986-9931-bb3ceb418b97@gmail.com
State New
Headers show
Series [rtw-next,v2,1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS | expand

Commit Message

Bitterblue Smith May 2, 2025, 11:49 a.m. UTC
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.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
 - Restore the original behaviour for RTL8821A and RTL8812A.
---
 drivers/net/wireless/realtek/rtw88/sdio.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Ping-Ke Shih May 5, 2025, 12:45 a.m. UTC | #1
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> 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.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> ---
> v2:
>  - Restore the original behaviour for RTL8821A and RTL8812A.

This patch actually restores the behavior of RTL8821A and RTL8812A. But
they are 802.11ac chips [1] [2], somehow defined as RTW_WCPU_11N. 

I can accept this patch ahead. Please help to think how we can correct
this mistake. 

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

[1] https://www.realtek.com/Product/Index?id=577&cate_id=194
[2] https://www.realtek.com/Product/Index?id=590&cate_id=194

> ---
>  drivers/net/wireless/realtek/rtw88/sdio.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
> index c57f683d9af8..71cbe49b6c59 100644
> --- a/drivers/net/wireless/realtek/rtw88/sdio.c
> +++ b/drivers/net/wireless/realtek/rtw88/sdio.c
> @@ -677,12 +677,22 @@ 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:
> +       case RTW_CHIP_TYPE_8821A:
> +       case RTW_CHIP_TYPE_8812A:
>                 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
Bitterblue Smith May 5, 2025, 11:52 a.m. UTC | #2
On 05/05/2025 03:45, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> 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.
>>
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>> ---
>> v2:
>>  - Restore the original behaviour for RTL8821A and RTL8812A.
> 
> This patch actually restores the behavior of RTL8821A and RTL8812A. But
> they are 802.11ac chips [1] [2], somehow defined as RTW_WCPU_11N. 
> 
> I can accept this patch ahead. Please help to think how we can correct
> this mistake. 
> 

Yes, the enums RTW_WCPU_11AC and RTW_WCPU_11N have wrong names.
RTL8821A and RTL8812A are 11ac chips but their MCU is the
RTW_WCPU_11N type. RTL8733BU (not supported in rtw88) is 11n but its
MCU is the RTW_WCPU_11AC type.

I was thinking to rename them:

RTW_WCPU_11N  -> RTW_WCPU_8051
RTW_WCPU_11AC -> RTW_WCPU_3081

8051 and 3081 are the names used in the vendor drivers:

#define PHYDM_IC_8051_SERIES	(ODM_RTL8881A | ODM_RTL8812 | ODM_RTL8821 |\
				 ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8703B |\
				 ODM_RTL8188F | ODM_RTL8192F | ODM_RTL8721D |\
				 ODM_RTL8710C)
#define PHYDM_IC_3081_SERIES	(ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8197F |\
				 ODM_RTL8821C | ODM_RTL8195B | ODM_RTL8198F |\
				 ODM_RTL8822C | ODM_RTL8812F | ODM_RTL8814B |\
				 ODM_RTL8197G)

> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> 
> [1] https://www.realtek.com/Product/Index?id=577&cate_id=194
> [2] https://www.realtek.com/Product/Index?id=590&cate_id=194
> 
>> ---
>>  drivers/net/wireless/realtek/rtw88/sdio.c | 14 ++++++++++++--
>>  1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
>> index c57f683d9af8..71cbe49b6c59 100644
>> --- a/drivers/net/wireless/realtek/rtw88/sdio.c
>> +++ b/drivers/net/wireless/realtek/rtw88/sdio.c
>> @@ -677,12 +677,22 @@ 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:
>> +       case RTW_CHIP_TYPE_8821A:
>> +       case RTW_CHIP_TYPE_8812A:
>>                 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
>
Ping-Ke Shih May 6, 2025, 1:56 a.m. UTC | #3
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> On 05/05/2025 03:45, Ping-Ke Shih wrote:
> > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> >> 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.
> >>
> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> >> ---
> >> v2:
> >>  - Restore the original behaviour for RTL8821A and RTL8812A.
> >
> > This patch actually restores the behavior of RTL8821A and RTL8812A. But
> > they are 802.11ac chips [1] [2], somehow defined as RTW_WCPU_11N.
> >
> > I can accept this patch ahead. Please help to think how we can correct
> > this mistake.
> >
> 
> Yes, the enums RTW_WCPU_11AC and RTW_WCPU_11N have wrong names.
> RTL8821A and RTL8812A are 11ac chips but their MCU is the
> RTW_WCPU_11N type. RTL8733BU (not supported in rtw88) is 11n but its
> MCU is the RTW_WCPU_11AC type.
> 
> I was thinking to rename them:
> 
> RTW_WCPU_11N  -> RTW_WCPU_8051
> RTW_WCPU_11AC -> RTW_WCPU_3081
> 
> 8051 and 3081 are the names used in the vendor drivers:
> 
> #define PHYDM_IC_8051_SERIES    (ODM_RTL8881A | ODM_RTL8812 | ODM_RTL8821 |\
>                                  ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8703B |\
>                                  ODM_RTL8188F | ODM_RTL8192F | ODM_RTL8721D |\
>                                  ODM_RTL8710C)
> #define PHYDM_IC_3081_SERIES    (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8197F |\
>                                  ODM_RTL8821C | ODM_RTL8195B | ODM_RTL8198F |\
>                                  ODM_RTL8822C | ODM_RTL8812F | ODM_RTL8814B |\
>                                  ODM_RTL8197G)

Thanks. Please help making a patch.
Bitterblue Smith May 7, 2025, 12:33 p.m. UTC | #4
On 06/05/2025 04:56, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> On 05/05/2025 03:45, Ping-Ke Shih wrote:
>>> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>>>> 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.
>>>>
>>>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>>>> ---
>>>> v2:
>>>>  - Restore the original behaviour for RTL8821A and RTL8812A.
>>>
>>> This patch actually restores the behavior of RTL8821A and RTL8812A. But
>>> they are 802.11ac chips [1] [2], somehow defined as RTW_WCPU_11N.
>>>
>>> I can accept this patch ahead. Please help to think how we can correct
>>> this mistake.
>>>
>>
>> Yes, the enums RTW_WCPU_11AC and RTW_WCPU_11N have wrong names.
>> RTL8821A and RTL8812A are 11ac chips but their MCU is the
>> RTW_WCPU_11N type. RTL8733BU (not supported in rtw88) is 11n but its
>> MCU is the RTW_WCPU_11AC type.
>>
>> I was thinking to rename them:
>>
>> RTW_WCPU_11N  -> RTW_WCPU_8051
>> RTW_WCPU_11AC -> RTW_WCPU_3081
>>
>> 8051 and 3081 are the names used in the vendor drivers:
>>
>> #define PHYDM_IC_8051_SERIES    (ODM_RTL8881A | ODM_RTL8812 | ODM_RTL8821 |\
>>                                  ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8703B |\
>>                                  ODM_RTL8188F | ODM_RTL8192F | ODM_RTL8721D |\
>>                                  ODM_RTL8710C)
>> #define PHYDM_IC_3081_SERIES    (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8197F |\
>>                                  ODM_RTL8821C | ODM_RTL8195B | ODM_RTL8198F |\
>>                                  ODM_RTL8822C | ODM_RTL8812F | ODM_RTL8814B |\
>>                                  ODM_RTL8197G)
> 
> Thanks. Please help making a patch. 
> 
> 

I will do it soon.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
index c57f683d9af8..71cbe49b6c59 100644
--- a/drivers/net/wireless/realtek/rtw88/sdio.c
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c
@@ -677,12 +677,22 @@  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:
+	case RTW_CHIP_TYPE_8821A:
+	case RTW_CHIP_TYPE_8812A:
 		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 */