Bug 205923

Summary: TP-Link UE300 USB 3.0 to GigaBit ethernet adpater using r8152 module very slow after kernel 5.4 upgrade
Product: Drivers Reporter: Louis Erasmus (ras.elect)
Component: NetworkAssignee: drivers_network (drivers_network)
Status: NEW ---    
Severity: normal CC: billk, nevermind1025, oymul-palapan, rob, yu
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 5.4.1 - 5.10.8 Subsystem:
Regression: Yes Bisected commit-id:

Description Louis Erasmus 2019-12-20 06:29:05 UTC
Steps to reproduce:
1) Power cycle router and switch
2) Boot with Arch Linux Install kernel 5.4.1 - 5.4.5
3) Run speedtest from terminal multiple times = 57 Mbit/s
4) Boot with Arch Linux Dec 2019 ISO kernel 5.3.13
5) pacman -Syy
6) pacman -S speedtest-cli
7) Run speedtest from terminal multiple times = 199 Mbit/s
8) Boot with Arch Linux Install kernel 5.4.1 - 5.4.5
9) Network LAN transfer speed no faster than 3 MiB/s

Manufacturer: TOSHIBA
Product Name: Satellite A350
Version: PSAL6C-04S015
Comment 1 Louis Erasmus 2019-12-22 04:08:48 UTC
Same problem with kernel 5.4.6
Comment 2 Louis Erasmus 2020-01-01 22:06:08 UTC
Same problem with kernel 5.4.7
Comment 3 Louis Erasmus 2020-01-05 17:31:18 UTC
Same problem with kernel 5.4.8
Comment 4 Louis Erasmus 2020-01-09 23:23:05 UTC
Same problem with kernel 5.4.10
Comment 5 Louis Erasmus 2020-01-13 16:47:26 UTC
Same problem with kernel 5.4.11
Comment 6 Louis Erasmus 2020-01-17 04:47:25 UTC
Same problem with kernel 5.4.12
Comment 7 Louis Erasmus 2020-01-19 20:12:25 UTC
Same problem with kernel 5.4.13
Comment 8 Louis Erasmus 2020-01-24 15:03:57 UTC
Same problem with kernel 5.4.14
Comment 9 Louis Erasmus 2020-01-27 00:09:06 UTC
Same problem with kernel 5.4.15
Comment 10 Alexey Dubrov 2020-02-01 18:59:59 UTC
Same here on Arch and Debian Testing

When TP-LINK UE330 is connected to the USB 3.0 port, the network speed is about 1Gbps, however when the USB 2.0 is used, the download speed is limited to 60 Mbps, the upload speed is about 200 Mbps
Comment 11 Louis Erasmus 2020-02-03 16:55:39 UTC
Same problem with kernel 5.5.1
Comment 12 Louis Erasmus 2020-02-12 18:39:08 UTC
Problem still unresolved kernel 5.5.3
Comment 13 Louis Erasmus 2020-02-22 02:21:05 UTC
Problem still unresolved kernel 5.5.5
Comment 14 Louis Erasmus 2020-03-01 17:30:57 UTC
Problem still unresolved kernel 5.5.7
Comment 15 Denis Skorenko 2020-03-06 20:30:01 UTC
I have exactly the same problem on the Lenovo ThinkPad USB 3.0 Ethernet Adapter:
Arch Linux kernel 5.5.8
driver: r8152
version: v1.11.11
firmware-version: rtl8153a-2 v1 10/23/19:
when connected to the USB 2.0 port, the download speed is limited to 60 Mbps, the upload speed is about 200 Mbps.

On Debian Stable on the same USB 2.0 port, the speed and downloads and uploads are 300 Mbps.
Comment 16 Louis Erasmus 2020-03-19 16:03:09 UTC
Problem still unresolved kernel 5.5.10
Comment 17 Shung-Hsi Yu 2020-04-18 10:33:50 UTC
I too have this problem with TP-Link UE300 when used on USB 2.0 port using Arch Linux (Kernel 5.6.3).

Bisect points me to ec5791c202aca90c1b3b99dff268a995cf2d6aa1 (included since 5.4) as the commit which causes this issue; it increased the rx buffer size for r8153 from 16 KB to 32 KB. 

Before this commit I get about 3xx Mbits/sec for receive. After the commit I can only go up to 5x Mbits/sec for receive. Transmission speed seems unaffected by this commit, which makes sense since this commit does not touch anything that is transmission related.

Changing the rx buffer size back to 16 KB (through modifying the source code, as the driver does not allow changing buffer size through ethtool) make this issue go away, further confirming commit ec5791c202aca90c1b3b99dff268a995cf2d6aa1 is to blame.

However I have no idea why increased rx buffer size affects performance nor if this issue is device specific.
Comment 18 Louis Erasmus 2020-04-18 15:42:09 UTC
Thanks Shung-Hsi Yu. Hope it gets patched soon.
Comment 19 Bill K. 2020-05-08 00:58:56 UTC
I can confirm this on 5.4.38 (gentoo-sources) - USB2, RTL8153 chipset using the r8152 driver.  I suspect the bug only occurs with the above configuration and its actually a USB2 problem.

I have two of these adaptors, two different manufacturers using the same RTL8153 chipset.  Using the following nullifies the commit above (resets the buffer to 16Kb for the r8153 chipset.)

--- /root/tmp/r8152.c   2020-05-07 20:25:31.635253447 +0800
+++ drivers/net/usb/r8152.c     2020-05-07 20:42:32.853603314 +0800
@@ -789,7 +789,7 @@
        u32 tx_qlen;
        u32 coalesce;
        u32 advertising;
-       u32 rx_buf_sz;
+       u16 rx_buf_sz;
        u32 rx_copybreak;
        u32 rx_pending;
 
@@ -5552,7 +5552,7 @@
                ops->in_nway            = rtl8153_in_nway;
                ops->hw_phy_cfg         = r8153_hw_phy_cfg;
                ops->autosuspend_en     = rtl8153_runtime_enable;
-               tp->rx_buf_sz           = 32 * 1024;
+               tp->rx_buf_sz           = 16 * 1024;
                tp->eee_en              = true;
                tp->eee_adv             = MDIO_EEE_1000T | MDIO_EEE_100TX;
                break;
@@ -5570,7 +5570,7 @@
                ops->in_nway            = rtl8153_in_nway;
                ops->hw_phy_cfg         = r8153b_hw_phy_cfg;
                ops->autosuspend_en     = rtl8153b_runtime_enable;
-               tp->rx_buf_sz           = 32 * 1024;
+               tp->rx_buf_sz           = 16 * 1024;
                tp->eee_en              = true;
                tp->eee_adv             = MDIO_EEE_1000T | MDIO_EEE_100TX;
                break;
Comment 20 Louis Erasmus 2020-06-11 17:06:36 UTC
Problem still unresolved kernel 5.7.2
Comment 21 Louis Erasmus 2020-08-05 16:55:25 UTC
Problem still unresolved kernel 5.7.12
Comment 22 Louis Erasmus 2020-08-15 03:32:01 UTC
Problem still unresolved kernel 5.8.1
Comment 23 Louis Erasmus 2020-12-31 00:38:35 UTC
Problem still unresolved kernel 5.10.3
Comment 24 Louis Erasmus 2021-01-19 21:01:23 UTC
Problem still unresolved kernel 5.10.8
Comment 25 RobertDavies 2021-01-20 09:59:55 UTC
I get this in kernel 5.10.8

I'm using Xubuntu 20.04 and my UE300 adapter is connected via USB2 on a Dell D830 laptop. I get 60Mb/s download on a 200Mb/s connection. I get this using the default kernel (5.4.0-62-generic) or mainline. If I use kernel 4.19.168 I get 220Mb/s download.

A family member has an Acer laptop (E5-571) using Xubuntu 20.04 with default kernel (5.4.0-62-generic), it has USB2 and USB3. On this laptop though, I get 220Mb/s download when the above UE300 adapter is connected via USB3, I also get 200Mb/s download when its connected via USB2.

This seems inconsistent.

Could it be more than just this driver?
Comment 26 Louis Erasmus 2021-01-20 18:18:52 UTC
Yes Robert, if you scroll back and look at Bill K's comment; it appears to be a USB2 problem.
Comment 27 RobertDavies 2021-01-20 19:01:58 UTC
Thanks Louis, thanks for clarifying that. I must have miss understood what Bill K meant.
Comment 28 Louis Erasmus 2021-01-20 19:13:50 UTC
You're welcome Robert. Disappointing that I can't use the UE300 at full speed since Kernel 5.4. I mean it would be easy just to get another adapter with the ASIX AX88179 chipset that I know would work fine; but still hoping for a fix.
Comment 29 Bill K. 2021-01-21 00:25:11 UTC
It is specific to the chipset and usb2 - if you cant move it to usb3 you
could patch and rebuild the kernel.  Not a big task.  It might also help
if you raise a bug with your distro kernel ... the kernel devs seem to
be very slow on doing what seems a simple rollback of a change that
causes a serious problem - the distro might be more responsive.

BillK


On 21/1/21 3:13 am, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=205923
>
> --- Comment #28 from Louis Erasmus (ras.elect@gmail.com) ---
> You're welcome Robert. Disappointing that I can't use the UE300 at full speed
> since Kernel 5.4. I mean it would be easy just to get another adapter with
> the
> ASIX AX88179 chipset that I know would work fine; but still hoping for a fix.
>
Comment 30 Louis Erasmus 2021-01-21 00:44:42 UTC
Thanks Bill. I initially in 12/2019 reported the bug to Archlinux. It was closed in 02/2020 : https://bugs.archlinux.org/task/64869
Comment 31 RobertDavies 2021-03-09 07:47:54 UTC
Hi

I brought it up with Ubuntu, seems like I will have to wait until upstream fixes it. So I have emailed realtek to see if they can/will help

Rob
Comment 32 RobertDavies 2021-03-19 09:42:05 UTC
Good news

https://marc.info/?l=linux-usb&m=161613955715931&w=2
Comment 33 Louis Erasmus 2021-03-19 14:53:01 UTC
Thanks Rob!