linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode
@ 2024-10-08 18:44 Bitterblue Smith
  2024-10-09  0:18 ` Ping-Ke Shih
  2024-10-17 14:24 ` Kalle Valo
  0 siblings, 2 replies; 7+ messages in thread
From: Bitterblue Smith @ 2024-10-08 18:44 UTC (permalink / raw)
  To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih, Kalle Valo

RTL8822CU, RTL8822BU, and RTL8821CU don't need BIT_EN_PRE_CALC.
In fact, RTL8822BU in USB 3 mode doesn't pass all the frames to the
driver, resulting in much lower download speed than normal:

$ iperf3 -c 192.168.0.1 -R
Connecting to host 192.168.0.1, port 5201
Reverse mode, remote host 192.168.0.1 is sending
[  5] local 192.168.0.50 port 43062 connected to 192.168.0.1 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  26.9 MBytes   225 Mbits/sec                  
[  5]   1.00-2.00   sec  7.50 MBytes  62.9 Mbits/sec                  
[  5]   2.00-3.00   sec  8.50 MBytes  71.3 Mbits/sec                  
[  5]   3.00-4.00   sec  8.38 MBytes  70.3 Mbits/sec                  
[  5]   4.00-5.00   sec  7.75 MBytes  65.0 Mbits/sec                  
[  5]   5.00-6.00   sec  8.00 MBytes  67.1 Mbits/sec                  
[  5]   6.00-7.00   sec  8.00 MBytes  67.1 Mbits/sec                  
[  5]   7.00-8.00   sec  7.75 MBytes  65.0 Mbits/sec                  
[  5]   8.00-9.00   sec  7.88 MBytes  66.1 Mbits/sec                  
[  5]   9.00-10.00  sec  7.88 MBytes  66.1 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.02  sec   102 MBytes  85.1 Mbits/sec  224             sender
[  5]   0.00-10.00  sec  98.6 MBytes  82.7 Mbits/sec                  receiver

Don't set BIT_EN_PRE_CALC. Then the speed is much better:

% iperf3 -c 192.168.0.1 -R    
Connecting to host 192.168.0.1, port 5201
Reverse mode, remote host 192.168.0.1 is sending
[  5] local 192.168.0.50 port 39000 connected to 192.168.0.1 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  52.8 MBytes   442 Mbits/sec                  
[  5]   1.00-2.00   sec  71.9 MBytes   603 Mbits/sec                  
[  5]   2.00-3.00   sec  74.8 MBytes   627 Mbits/sec                  
[  5]   3.00-4.00   sec  75.9 MBytes   636 Mbits/sec                  
[  5]   4.00-5.00   sec  76.0 MBytes   638 Mbits/sec                  
[  5]   5.00-6.00   sec  74.1 MBytes   622 Mbits/sec                  
[  5]   6.00-7.00   sec  74.0 MBytes   621 Mbits/sec                  
[  5]   7.00-8.00   sec  76.0 MBytes   638 Mbits/sec                  
[  5]   8.00-9.00   sec  74.4 MBytes   624 Mbits/sec                  
[  5]   9.00-10.00  sec  63.9 MBytes   536 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   717 MBytes   601 Mbits/sec   24             sender
[  5]   0.00-10.00  sec   714 MBytes   599 Mbits/sec                  receiver

Fixes: 002a5db9a52a ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c")
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
The code in the official drivers is a little broken. It sets
BIT_EN_PRE_CALC and then immediately unsets it. I didn't notice that
before.

Maybe this should go to kernel 6.12, if it's not too late. Commit 002a5db9a52a
("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c") first appears
in 6.12.
---
 drivers/net/wireless/realtek/rtw88/usb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
index 10b840d59ebd..74ee5bdbb036 100644
--- a/drivers/net/wireless/realtek/rtw88/usb.c
+++ b/drivers/net/wireless/realtek/rtw88/usb.c
@@ -772,7 +772,6 @@ static void rtw_usb_dynamic_rx_agg_v1(struct rtw_dev *rtwdev, bool enable)
 	u8 size, timeout;
 	u16 val16;
 
-	rtw_write32_set(rtwdev, REG_RXDMA_AGG_PG_TH, BIT_EN_PRE_CALC);
 	rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN);
 	rtw_write8_clr(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7));
 
-- 
2.46.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode
  2024-10-08 18:44 [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode Bitterblue Smith
@ 2024-10-09  0:18 ` Ping-Ke Shih
  2024-10-09 16:11   ` Bitterblue Smith
  2024-10-11 11:56   ` Kalle Valo
  2024-10-17 14:24 ` Kalle Valo
  1 sibling, 2 replies; 7+ messages in thread
From: Ping-Ke Shih @ 2024-10-09  0:18 UTC (permalink / raw)
  To: Bitterblue Smith, linux-wireless@vger.kernel.org, Kalle Valo

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> RTL8822CU, RTL8822BU, and RTL8821CU don't need BIT_EN_PRE_CALC.
> In fact, RTL8822BU in USB 3 mode doesn't pass all the frames to the
> driver, resulting in much lower download speed than normal:

Have you also tested in USB 2 mode? Just want to know this patch works on
both modes. 

> [  5]   0.00-10.00  sec  98.6 MBytes  82.7 Mbits/sec                  receiver
> 
> Don't set BIT_EN_PRE_CALC. Then the speed is much better:
> 
> [  5]   0.00-10.00  sec   714 MBytes   599 Mbits/sec                  receiver

Good job. That improves ten times of RX throughput!

> 
> Fixes: 002a5db9a52a ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c")
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>

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

> ---
> The code in the official drivers is a little broken. It sets
> BIT_EN_PRE_CALC and then immediately unsets it. I didn't notice that
> before.
> 
> Maybe this should go to kernel 6.12, if it's not too late. Commit 002a5db9a52a
> ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c") first appears
> in 6.12.

Kalle, could you help to take this patch via wireless tree? If yes, I will
assign this to you in patchwork. 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode
  2024-10-09  0:18 ` Ping-Ke Shih
@ 2024-10-09 16:11   ` Bitterblue Smith
  2024-10-11 11:56   ` Kalle Valo
  1 sibling, 0 replies; 7+ messages in thread
From: Bitterblue Smith @ 2024-10-09 16:11 UTC (permalink / raw)
  To: Ping-Ke Shih, linux-wireless@vger.kernel.org, Kalle Valo

On 09/10/2024 03:18, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> RTL8822CU, RTL8822BU, and RTL8821CU don't need BIT_EN_PRE_CALC.
>> In fact, RTL8822BU in USB 3 mode doesn't pass all the frames to the
>> driver, resulting in much lower download speed than normal:
> 
> Have you also tested in USB 2 mode? Just want to know this patch works on
> both modes. 
> 

Yes, USB 2 mode was working before and it still works after this patch.

>> [  5]   0.00-10.00  sec  98.6 MBytes  82.7 Mbits/sec                  receiver
>>
>> Don't set BIT_EN_PRE_CALC. Then the speed is much better:
>>
>> [  5]   0.00-10.00  sec   714 MBytes   599 Mbits/sec                  receiver
> 
> Good job. That improves ten times of RX throughput!
> 
>>
>> Fixes: 002a5db9a52a ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c")
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> 
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> 
>> ---
>> The code in the official drivers is a little broken. It sets
>> BIT_EN_PRE_CALC and then immediately unsets it. I didn't notice that
>> before.
>>
>> Maybe this should go to kernel 6.12, if it's not too late. Commit 002a5db9a52a
>> ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c") first appears
>> in 6.12.
> 
> Kalle, could you help to take this patch via wireless tree? If yes, I will
> assign this to you in patchwork. 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode
  2024-10-09  0:18 ` Ping-Ke Shih
  2024-10-09 16:11   ` Bitterblue Smith
@ 2024-10-11 11:56   ` Kalle Valo
  2024-10-11 12:48     ` Ping-Ke Shih
  1 sibling, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2024-10-11 11:56 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: Bitterblue Smith, linux-wireless@vger.kernel.org

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

> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> RTL8822CU, RTL8822BU, and RTL8821CU don't need BIT_EN_PRE_CALC.
>> In fact, RTL8822BU in USB 3 mode doesn't pass all the frames to the
>> driver, resulting in much lower download speed than normal:
>
> Have you also tested in USB 2 mode? Just want to know this patch works on
> both modes. 
>
>> [  5]   0.00-10.00  sec  98.6 MBytes  82.7 Mbits/sec                  receiver
>> 
>> Don't set BIT_EN_PRE_CALC. Then the speed is much better:
>> 
>> [  5]   0.00-10.00  sec   714 MBytes   599 Mbits/sec                  receiver
>
> Good job. That improves ten times of RX throughput!
>
>> 
>> Fixes: 002a5db9a52a ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c")
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
>
>> ---
>> The code in the official drivers is a little broken. It sets
>> BIT_EN_PRE_CALC and then immediately unsets it. I didn't notice that
>> before.
>> 
>> Maybe this should go to kernel 6.12, if it's not too late. Commit 002a5db9a52a
>> ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c") first appears
>> in 6.12.
>
> Kalle, could you help to take this patch via wireless tree? If yes, I will
> assign this to you in patchwork. 

Yes, let's take this to wireless. And you don't need to ask me, just
mention that this should go to wireless tree and assign the patch to me :)

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode
  2024-10-11 11:56   ` Kalle Valo
@ 2024-10-11 12:48     ` Ping-Ke Shih
  2024-10-11 13:44       ` Kalle Valo
  0 siblings, 1 reply; 7+ messages in thread
From: Ping-Ke Shih @ 2024-10-11 12:48 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Bitterblue Smith, linux-wireless@vger.kernel.org

Kalle Valo <kvalo@kernel.org> wrote:
> Yes, let's take this to wireless. And you don't need to ask me, just
> mention that this should go to wireless tree and assign the patch to me :)

Understand and assigned. :)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode
  2024-10-11 12:48     ` Ping-Ke Shih
@ 2024-10-11 13:44       ` Kalle Valo
  0 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2024-10-11 13:44 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: Bitterblue Smith, linux-wireless@vger.kernel.org

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

> Kalle Valo <kvalo@kernel.org> wrote:
>> Yes, let's take this to wireless. And you don't need to ask me, just
>> mention that this should go to wireless tree and assign the patch to me :)
>
> Understand and assigned. :)

Thanks, I'll try to catch up with patches over the weekend.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode
  2024-10-08 18:44 [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode Bitterblue Smith
  2024-10-09  0:18 ` Ping-Ke Shih
@ 2024-10-17 14:24 ` Kalle Valo
  1 sibling, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2024-10-17 14:24 UTC (permalink / raw)
  To: Bitterblue Smith; +Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:

> RTL8822CU, RTL8822BU, and RTL8821CU don't need BIT_EN_PRE_CALC.
> In fact, RTL8822BU in USB 3 mode doesn't pass all the frames to the
> driver, resulting in much lower download speed than normal:
> 
> $ iperf3 -c 192.168.0.1 -R
> Connecting to host 192.168.0.1, port 5201
> Reverse mode, remote host 192.168.0.1 is sending
> [  5] local 192.168.0.50 port 43062 connected to 192.168.0.1 port 5201
> [ ID] Interval           Transfer     Bitrate
> [  5]   0.00-1.00   sec  26.9 MBytes   225 Mbits/sec                  
> [  5]   1.00-2.00   sec  7.50 MBytes  62.9 Mbits/sec                  
> [  5]   2.00-3.00   sec  8.50 MBytes  71.3 Mbits/sec                  
> [  5]   3.00-4.00   sec  8.38 MBytes  70.3 Mbits/sec                  
> [  5]   4.00-5.00   sec  7.75 MBytes  65.0 Mbits/sec                  
> [  5]   5.00-6.00   sec  8.00 MBytes  67.1 Mbits/sec                  
> [  5]   6.00-7.00   sec  8.00 MBytes  67.1 Mbits/sec                  
> [  5]   7.00-8.00   sec  7.75 MBytes  65.0 Mbits/sec                  
> [  5]   8.00-9.00   sec  7.88 MBytes  66.1 Mbits/sec                  
> [  5]   9.00-10.00  sec  7.88 MBytes  66.1 Mbits/sec                  
> - - - - - - - - - - - - - - - - - - - - - - - - -
> [ ID] Interval           Transfer     Bitrate         Retr
> [  5]   0.00-10.02  sec   102 MBytes  85.1 Mbits/sec  224             sender
> [  5]   0.00-10.00  sec  98.6 MBytes  82.7 Mbits/sec                  receiver
> 
> Don't set BIT_EN_PRE_CALC. Then the speed is much better:
> 
> % iperf3 -c 192.168.0.1 -R    
> Connecting to host 192.168.0.1, port 5201
> Reverse mode, remote host 192.168.0.1 is sending
> [  5] local 192.168.0.50 port 39000 connected to 192.168.0.1 port 5201
> [ ID] Interval           Transfer     Bitrate
> [  5]   0.00-1.00   sec  52.8 MBytes   442 Mbits/sec                  
> [  5]   1.00-2.00   sec  71.9 MBytes   603 Mbits/sec                  
> [  5]   2.00-3.00   sec  74.8 MBytes   627 Mbits/sec                  
> [  5]   3.00-4.00   sec  75.9 MBytes   636 Mbits/sec                  
> [  5]   4.00-5.00   sec  76.0 MBytes   638 Mbits/sec                  
> [  5]   5.00-6.00   sec  74.1 MBytes   622 Mbits/sec                  
> [  5]   6.00-7.00   sec  74.0 MBytes   621 Mbits/sec                  
> [  5]   7.00-8.00   sec  76.0 MBytes   638 Mbits/sec                  
> [  5]   8.00-9.00   sec  74.4 MBytes   624 Mbits/sec                  
> [  5]   9.00-10.00  sec  63.9 MBytes   536 Mbits/sec                  
> - - - - - - - - - - - - - - - - - - - - - - - - -
> [ ID] Interval           Transfer     Bitrate         Retr
> [  5]   0.00-10.00  sec   717 MBytes   601 Mbits/sec   24             sender
> [  5]   0.00-10.00  sec   714 MBytes   599 Mbits/sec                  receiver
> 
> Fixes: 002a5db9a52a ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c")
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless.git, thanks.

4aefde403da7 wifi: rtw88: Fix the RX aggregation in USB 3 mode

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/afb94a82-3d18-459e-97fc-1a217608cdf0@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-17 14:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 18:44 [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode Bitterblue Smith
2024-10-09  0:18 ` Ping-Ke Shih
2024-10-09 16:11   ` Bitterblue Smith
2024-10-11 11:56   ` Kalle Valo
2024-10-11 12:48     ` Ping-Ke Shih
2024-10-11 13:44       ` Kalle Valo
2024-10-17 14:24 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).