A few days ago, I reviewed a USB 3.0 to 2.5 Gbps Ethernet adapter based on Realtek RTL8156B chip in Ubuntu 20.04, and let’s say the reliability and performance were underwhelming. I got some recommendations like changing cables, the MTU size, etc…
Playing around with cables did no help, but one comment mentioned the cdc_ncm driver could be the issue, followed by another saying that updating to Linux kernel 5.14 should install the correct r8152 driver… So I just did that:
1 |
sudo apt install linux-oem-20.04d |
This upgraded Linux 5.13 (shipped with Ubuntu 20.04 + HWE) to Linux 5.14, but still no luck as the system kept using the cdc_ncm driver with a half-duplex link:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
jaufranc@cnx-laptop-4:~$ inxi -n Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 IF: enp2s0f1 state: down mac: 98:28:a6:0f:06:07 Device-2: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter driver: ath10k_pci IF: wlp3s0 state: up mac: 70:c9:4e:b7:84:77 Device-3: Realtek USB 10/100/1G/2.5G LAN type: USB driver: cdc_ncm IF: enx1cbfced40321 state: up speed: 2500 Mbps duplex: half mac: 1c:bf:ce:d4:03:21 jaufranc@cnx-laptop-4:~$ uname -a Linux cnx-laptop-4 5.14.0-1022-oem #24-Ubuntu SMP Mon Jan 31 16:00:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
But then I thought I may have to use udev rules to prevent loading the cdc_ncm driver, and there’s indeed 50-usb-realtek-net.rules in r8152 driver to do just that. So I copied the file in /etc/udev/rules.d/ folder. Since I did not want to reboot, I unloaded the modules I did not need, and restart udev to try it out:
1 2 3 |
sudo rmmod cdc_mbim sudo rmmod cdc_ncm service udev restart |
Let’s see…
1 2 3 4 5 6 7 8 9 10 11 |
sudo inxi -n Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 IF: enp2s0f1 state: down mac: 98:28:a6:0f:06:07 Device-2: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter driver: ath10k_pci IF: wlp3s0 state: up mac: 70:c9:4e:b7:84:77 Device-3: Realtek USB 10/100/1G/2.5G LAN type: USB driver: r8152 IF: enx1cbfced40321 state: up speed: 2500 Mbps duplex: full mac: 1c:bf:ce:d4:03:21 |
Great! It’s now using r8152 driver and we’ve got a full-duplex connection.
Let’s go through all our tests again to compare the results.
iperf2
upload
1 2 3 4 5 6 7 8 |
iperf -t 60 -c 192.168.31.12 ------------------------------------------------------------ Client connecting to 192.168.31.12, TCP port 5001 TCP window size: 1.40 MByte (default) ------------------------------------------------------------ [ 3] local 192.168.31.166 port 41266 connected with 192.168.31.12 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-60.0 sec 16.4 GBytes 2.35 Gbits/sec |
download:
1 2 3 4 5 6 7 8 |
iperf -t 60 -c 192.168.31.166 ------------------------------------------------------------ Client connecting to 192.168.31.166, TCP port 5001 TCP window size: 901 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.31.12 port 37188 connected with 192.168.31.166 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-60.0 sec 10.8 GBytes 1.55 Gbits/sec |
There’s an improvement to the download speed (was 600 Mbps with cdc_ncm driver), but still not quite close to 2.3 Gbps.
Let’s try full-duplex for fun:
1 2 3 4 5 6 7 |
Client connecting to 192.168.31.166, TCP port 5001 TCP window size: 799 KByte (default) ------------------------------------------------------------ [ 4] local 192.168.31.12 port 5001 connected with 192.168.31.166 port 41290 [ 6] local 192.168.31.12 port 37194 connected with 192.168.31.166 port 5001 [ 6] 0.0-60.1 sec 8.06 GBytes 1.15 Gbits/sec [ 4] 0.0-60.4 sec 16.3 GBytes 2.32 Gbits/sec |
That’s actually not too bad.
iperf3
upload:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
iperf3 -t 60 -c 192.168.31.12 -i 5 Connecting to host 192.168.31.12, port 5201 [ 5] local 192.168.31.166 port 32848 connected to 192.168.31.12 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-5.00 sec 1.37 GBytes 2.36 Gbits/sec 0 847 KBytes [ 5] 5.00-10.00 sec 1.37 GBytes 2.35 Gbits/sec 0 889 KBytes [ 5] 10.00-15.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.14 MBytes [ 5] 15.00-20.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.14 MBytes [ 5] 20.00-25.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.14 MBytes [ 5] 25.00-30.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.14 MBytes [ 5] 30.00-35.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.73 MBytes [ 5] 35.00-40.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.73 MBytes [ 5] 40.00-45.00 sec 1.37 GBytes 2.35 Gbits/sec 0 3.92 MBytes [ 5] 45.00-50.00 sec 1.37 GBytes 2.35 Gbits/sec 0 3.92 MBytes [ 5] 50.00-55.00 sec 1.37 GBytes 2.35 Gbits/sec 0 3.92 MBytes [ 5] 55.00-60.00 sec 1.37 GBytes 2.35 Gbits/sec 0 3.92 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-60.00 sec 16.4 GBytes 2.35 Gbits/sec 0 sender [ 5] 0.00-60.05 sec 16.4 GBytes 2.35 Gbits/sec receiver iperf Done. |
download:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
iperf3 -t 60 -c 192.168.31.166 -i 5 Connecting to host 192.168.31.166, port 5201 [ 5] local 192.168.31.12 port 53112 connected to 192.168.31.166 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-5.00 sec 802 MBytes 1.35 Gbits/sec 641 222 KBytes [ 5] 5.00-10.00 sec 856 MBytes 1.44 Gbits/sec 618 83.4 KBytes [ 5] 10.00-15.00 sec 852 MBytes 1.43 Gbits/sec 583 87.7 KBytes [ 5] 15.00-20.00 sec 843 MBytes 1.41 Gbits/sec 592 168 KBytes [ 5] 20.00-25.00 sec 831 MBytes 1.39 Gbits/sec 642 91.9 KBytes [ 5] 25.00-30.00 sec 810 MBytes 1.36 Gbits/sec 666 97.6 KBytes [ 5] 30.00-35.00 sec 831 MBytes 1.39 Gbits/sec 590 123 KBytes [ 5] 35.00-40.00 sec 827 MBytes 1.39 Gbits/sec 652 298 KBytes [ 5] 40.00-45.00 sec 843 MBytes 1.41 Gbits/sec 605 93.3 KBytes [ 5] 45.00-50.00 sec 844 MBytes 1.42 Gbits/sec 635 96.2 KBytes [ 5] 50.00-55.00 sec 862 MBytes 1.45 Gbits/sec 565 84.8 KBytes [ 5] 55.00-60.00 sec 858 MBytes 1.44 Gbits/sec 583 82.0 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-60.00 sec 9.82 GBytes 1.41 Gbits/sec 7372 sender [ 5] 0.00-60.00 sec 9.82 GBytes 1.41 Gbits/sec receiver iperf Done. |
About the same as iperf2.
iperf3 did not have support for full-duplex for many years, but version 3.7 reintroduced the feature. So let’s give it a go:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
iperf3 -t 60 -c 192.168.31.12 --bidir -i 5 Connecting to host 192.168.31.12, port 5201 [ 5] local 192.168.31.166 port 32858 connected to 192.168.31.12 port 5201 [ 7] local 192.168.31.166 port 32860 connected to 192.168.31.12 port 5201 [ ID][Role] Interval Transfer Bitrate Retr Cwnd [ 5][TX-C] 0.00-5.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.41 MBytes [ 7][RX-C] 0.00-5.00 sec 643 MBytes 1.08 Gbits/sec [ 5][TX-C] 5.00-10.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.48 MBytes [ 7][RX-C] 5.00-10.00 sec 673 MBytes 1.13 Gbits/sec [ 5][TX-C] 10.00-15.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.78 MBytes [ 7][RX-C] 10.00-15.00 sec 690 MBytes 1.16 Gbits/sec [ 5][TX-C] 15.00-20.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.78 MBytes [ 7][RX-C] 15.00-20.00 sec 695 MBytes 1.17 Gbits/sec [ 5][TX-C] 20.00-25.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.78 MBytes [ 7][RX-C] 20.00-25.00 sec 703 MBytes 1.18 Gbits/sec [ 5][TX-C] 25.00-30.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.78 MBytes [ 7][RX-C] 25.00-30.00 sec 704 MBytes 1.18 Gbits/sec [ 5][TX-C] 30.00-35.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.78 MBytes [ 7][RX-C] 30.00-35.00 sec 711 MBytes 1.19 Gbits/sec [ 5][TX-C] 35.00-40.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.78 MBytes [ 7][RX-C] 35.00-40.00 sec 697 MBytes 1.17 Gbits/sec [ 5][TX-C] 40.00-45.00 sec 28.8 MBytes 48.2 Mbits/sec 4 1.41 KBytes [ 7][RX-C] 40.00-45.00 sec 15.0 MBytes 25.2 Mbits/sec [ 5][TX-C] 45.00-50.00 sec 0.00 Bytes 0.00 bits/sec 1 1.41 KBytes [ 7][RX-C] 45.00-50.00 sec 0.00 Bytes 0.00 bits/sec [ 5][TX-C] 50.00-55.00 sec 0.00 Bytes 0.00 bits/sec 1 1.41 KBytes [ 7][RX-C] 50.00-55.00 sec 0.00 Bytes 0.00 bits/sec iperf3: error - control socket has closed unexpectedly |
Oops! What happened? There are some error messages in the kernel log as well.
1 2 3 4 5 6 7 8 9 |
[18424.279351] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 [18424.287497] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 [18424.295735] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 [18424.303858] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 [18430.885965] net_ratelimit: 107 callbacks suppressed [18430.885975] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 [18431.251643] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 [18431.909792] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 [18437.797786] r8152 2-1:1.0 enx1cbfced40321: Tx status -71 |
I’m not the only one to have this problem, and that’s an open issue in r8156 driver’s Github repo. Here’s the answer from the developer for reference:
I suspect a problem on the ethernet adapter side, as there are many reports of it working with the DS918+. (Eg. design of power line, overheat, etc.)
https://github.com/bb-qq/r8152/wiki/CompatibilityCould you try another vendor? Also using a USB Hub with an external power supply might improve the situation.
At this point, the Ethernet did not work at all, and I had to unplug and reinsert the USB dongle. The second time “worked”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
iperf3 -t 60 -c 192.168.31.12 --bidir -i 5 Connecting to host 192.168.31.12, port 5201 [ 5] local 192.168.31.166 port 32872 connected to 192.168.31.12 port 5201 [ 7] local 192.168.31.166 port 32874 connected to 192.168.31.12 port 5201 [ ID][Role] Interval Transfer Bitrate Retr Cwnd [ 5][TX-C] 0.00-5.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.59 MBytes [ 7][RX-C] 0.00-5.00 sec 515 MBytes 864 Mbits/sec [ 5][TX-C] 5.00-10.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.75 MBytes [ 7][RX-C] 5.00-10.00 sec 489 MBytes 820 Mbits/sec [ 5][TX-C] 10.00-15.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.75 MBytes [ 7][RX-C] 10.00-15.00 sec 530 MBytes 889 Mbits/sec [ 5][TX-C] 15.00-20.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.75 MBytes [ 7][RX-C] 15.00-20.00 sec 564 MBytes 947 Mbits/sec [ 5][TX-C] 20.00-25.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.75 MBytes [ 7][RX-C] 20.00-25.00 sec 560 MBytes 940 Mbits/sec [ 5][TX-C] 25.00-30.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.63 MBytes [ 7][RX-C] 25.00-30.00 sec 578 MBytes 970 Mbits/sec [ 5][TX-C] 30.00-35.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.63 MBytes [ 7][RX-C] 30.00-35.00 sec 561 MBytes 942 Mbits/sec [ 5][TX-C] 35.00-40.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.63 MBytes [ 7][RX-C] 35.00-40.00 sec 572 MBytes 960 Mbits/sec [ 5][TX-C] 40.00-45.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.63 MBytes [ 7][RX-C] 40.00-45.00 sec 570 MBytes 956 Mbits/sec [ 5][TX-C] 45.00-50.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.63 MBytes [ 7][RX-C] 45.00-50.00 sec 572 MBytes 960 Mbits/sec [ 5][TX-C] 50.00-55.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.63 MBytes [ 7][RX-C] 50.00-55.00 sec 570 MBytes 957 Mbits/sec [ 5][TX-C] 55.00-60.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.63 MBytes [ 7][RX-C] 55.00-60.00 sec 571 MBytes 958 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID][Role] Interval Transfer Bitrate Retr [ 5][TX-C] 0.00-60.00 sec 16.3 GBytes 2.34 Gbits/sec 0 sender [ 5][TX-C] 0.00-60.05 sec 16.3 GBytes 2.34 Gbits/sec receiver [ 7][RX-C] 0.00-60.00 sec 6.50 GBytes 931 Mbits/sec 58 sender [ 7][RX-C] 0.00-60.05 sec 6.50 GBytes 929 Mbits/sec receiver iperf Done. |
There are still retransmissions on the Rx side which could help explain the lower speed.
SAMBA
From my laptop with the RTL8156B dongle, and SATA SSD to UP Xtreme i11 mini PC with a 2.5GbE port, and a MINIX USB-C dock with a 480GB SSD.
Around 930 Mbps with r8152 driver against 750 Mbps with cdc_ncm driver.
Now from the mini PC to the laptop (aka download)…
It’s slower as expected at 837 Mbps, but better than the under 500 Mbps I got with the cdc_ncm driver.
scp
laptop to mini PC:
1 2 3 4 5 6 7 |
time scp Libero_SoC_v2021.2_lin.bin devkit@192.168.31.12:/home/devkit/NEO_Storage devkit@192.168.31.12's password: Libero_SoC_v2021.2_lin.bin 100% 10GB 115.0MB/s 01:32 real 1m34.981s user 0m55.750s sys 0m42.668s |
mini PC to laptop:
1 2 3 4 5 6 7 |
time scp devkit@192.168.31.12:/home/devkit/NEO_Storage/Libero_SoC_v2021.2_lin.bin . devkit@192.168.31.12's password: Libero_SoC_v2021.2_lin.bin 100% 10GB 111.7MB/s 01:35 real 1m36.896s user 0m56.926s sys 0m55.330s |
It’s almost the same speed between download and upload with scp which is odd. The bottleneck here looks to be my SATA SSD:
1 2 3 4 5 6 7 8 |
iozone -e -I -a -s 1000M -r 16384k -i 0 -i 1 Iozone: Performance Test of File I/O Version $Revision: 3.489 $ Compiled for 64 bit mode. Build: linux-AMD64 random random bkwd record stride kB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 1024000 16384 141794 139550 149591 145020 |
Read is limited by around 145 MB/s, while write is around 140 MB/s.
The SSD used in MINIX NEO Storage Plus USB-C dock is quite faster with, last time I tested, 379MB/s for sequential reads, and 240+MB/s for sequential writes.
So let’s see the speed we can get throwing away the data to /dev/null
download to laptop:
1 2 3 4 5 6 7 |
time scp -c aes128-ctr devkit@192.168.31.12:/home/devkit/NEO_Storage/Libero_SoC_v2021.2_lin.bin /dev/null devkit@192.168.31.12's password: Libero_SoC_v2021.2_lin.bin 100% 10GB 133.0MB/s 01:20 real 1m21.880s user 0m18.931s sys 0m33.838s |
upload from laptop:
1 2 3 4 5 6 7 |
time scp -c aes128-ctr Libero_SoC_v2021.2_lin.bin devkit@192.168.31.12:/dev/null devkit@192.168.31.12's password: Libero_SoC_v2021.2_lin.bin 100% 10GB 239.9MB/s 00:44 real 0m46.094s user 0m17.174s sys 0m36.793s |
So that’s more like it for the upload at least. I still have a problem with the download speed, but the performance was still greatly improved with the r8152 driver.
Testing with NanoPi R4S
While it’s much better, it’s not optimal. I have a NanoPi R4S router with two USB 3.0 ports, so I first tried it using the latest OpenWrt (FriendlyWrt) 21.02 image with Linux 5.15:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
root@FriendlyWrt:~# iperf3 -t 60 -c 192.168.2.207 --bidir -i 5 Connecting to host 192.168.2.207, port 5201 [ 5] local 192.168.2.161 port 21836 connected to 192.168.2.207 port 5201 [ 7] local 192.168.2.161 port 21838 connected to 192.168.2.207 port 5201 [ ID][Role] Interval Transfer Bitrate Retr Cwnd [ 5][TX-C] 0.00-5.00 sec 348 MBytes 583 Mbits/sec 4 413 KBytes [ 7][RX-C] 0.00-5.00 sec 220 MBytes 369 Mbits/sec [ 5][TX-C] 5.00-10.00 sec 480 MBytes 805 Mbits/sec 5 684 KBytes [ 7][RX-C] 5.00-10.00 sec 218 MBytes 366 Mbits/sec [ 5][TX-C] 10.00-15.00 sec 574 MBytes 963 Mbits/sec 47 557 KBytes [ 7][RX-C] 10.00-15.00 sec 183 MBytes 307 Mbits/sec [ 5][TX-C] 15.00-20.00 sec 481 MBytes 807 Mbits/sec 3 699 KBytes [ 7][RX-C] 15.00-20.00 sec 179 MBytes 301 Mbits/sec [ 5][TX-C] 20.00-25.00 sec 464 MBytes 779 Mbits/sec 18 701 KBytes [ 7][RX-C] 20.00-25.00 sec 214 MBytes 359 Mbits/sec [ 5][TX-C] 25.00-30.00 sec 549 MBytes 920 Mbits/sec 26 580 KBytes [ 7][RX-C] 25.00-30.00 sec 178 MBytes 298 Mbits/sec [ 5][TX-C] 30.00-35.00 sec 472 MBytes 792 Mbits/sec 3 526 KBytes [ 7][RX-C] 30.00-35.00 sec 207 MBytes 347 Mbits/sec [ 5][TX-C] 35.00-40.00 sec 465 MBytes 781 Mbits/sec 15 410 KBytes [ 7][RX-C] 35.00-40.00 sec 195 MBytes 326 Mbits/sec [ 5][TX-C] 40.00-45.00 sec 385 MBytes 645 Mbits/sec 0 376 KBytes [ 7][RX-C] 40.00-45.00 sec 217 MBytes 364 Mbits/sec [ 5][TX-C] 45.00-50.00 sec 497 MBytes 833 Mbits/sec 9 478 KBytes [ 7][RX-C] 45.00-50.00 sec 201 MBytes 338 Mbits/sec [ 5][TX-C] 50.00-55.00 sec 434 MBytes 728 Mbits/sec 0 543 KBytes [ 7][RX-C] 50.00-55.00 sec 208 MBytes 349 Mbits/sec [ 5][TX-C] 55.00-60.00 sec 451 MBytes 756 Mbits/sec 6 823 KBytes [ 7][RX-C] 55.00-60.00 sec 220 MBytes 370 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID][Role] Interval Transfer Bitrate Retr [ 5][TX-C] 0.00-60.00 sec 5.47 GBytes 783 Mbits/sec 136 sender [ 5][TX-C] 0.00-60.01 sec 5.47 GBytes 783 Mbits/sec receiver [ 7][RX-C] 0.00-60.00 sec 2.39 GBytes 342 Mbits/sec 94 sender [ 7][RX-C] 0.00-60.01 sec 2.38 GBytes 341 Mbits/sec receiver iperf Done. |
It’s really ugly with lots of retransmissions on both sides.
1 2 3 4 5 6 7 8 9 10 |
[ 276.268986] usb 8-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=31.00 [ 276.269798] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6 [ 276.270471] usb 8-1: Product: USB 10/100/1G/2.5G LAN [ 276.272112] usb 8-1: Manufacturer: Realtek [ 276.272519] usb 8-1: SerialNumber: 0013000000 [ 276.359625] cdc_ncm 8-1:2.0: MAC-Address: 1c:bf:ce:d4:03:21 [ 276.360178] cdc_ncm 8-1:2.0: setting rx_max = 16384 [ 276.360758] cdc_ncm 8-1:2.0: setting tx_max = 16384 [ 276.362948] cdc_ncm 8-1:2.0 eth2: register 'cdc_ncm' at usb-xhci-hcd.1.auto-1, CDC NCM, 1c:bf:ce:d4:03:21 [ 459.919597] IPv6: ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready |
Looking at the kernel log, our RTL8156B USB dongle is using that CDC NCM driver again, just like in Ubuntu… There’s an r8152 driver too, but whatever module I remove in /etc/modules.d either the CDC NCM is loaded or the eth2 interface does not show up at all. So I’ve switched to the Ubuntu 20.04-based FriendlyCore OS, also featuring Linux 5.15, that will be closer to the setup on my laptop.
As one might have expected, the RTL8156B adapter uses the CDC NCM driver by default in Ubuntu:
1 2 3 4 5 6 7 8 9 10 11 |
[ 682.701529] usb 8-1: new SuperSpeed USB device number 3 using xhci-hcd [ 682.727125] usb 8-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=31.00 [ 682.727163] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6 [ 682.727179] usb 8-1: Product: USB 10/100/1G/2.5G LAN [ 682.727191] usb 8-1: Manufacturer: Realtek [ 682.727203] usb 8-1: SerialNumber: 0013000000 [ 682.806350] cdc_ncm 8-1:2.0: MAC-Address: 1c:bf:ce:d4:03:21 [ 682.806387] cdc_ncm 8-1:2.0: setting rx_max = 16384 [ 682.806561] cdc_ncm 8-1:2.0: setting tx_max = 16384 [ 682.807963] cdc_ncm 8-1:2.0 eth1: register 'cdc_ncm' at usb-xhci-hcd.1.auto-1, CDC NCM, 1c:bf:ce:d4:03:21 [ 682.834550] cdc_ncm 8-1:2.0 enx1cbfced40321: renamed from eth1 |
eth1 is not showing up with ifconfig, so I just went ahead and change udev rules to use the r8152 driver…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[ 882.081445] usb 7-1: new high-speed USB device number 3 using xhci-hcd [ 882.209358] usb 7-1: Device not responding to setup address. [ 882.417542] usb 7-1: Device not responding to setup address. [ 882.625432] usb 7-1: device not accepting address 3, error -71 [ 886.597570] usb 8-1: new SuperSpeed USB device number 4 using xhci-hcd [ 886.619484] usb 8-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=31.00 [ 886.619534] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6 [ 886.619556] usb 8-1: Product: USB 10/100/1G/2.5G LAN [ 886.619574] usb 8-1: Manufacturer: Realtek [ 886.619591] usb 8-1: SerialNumber: 0013000000 [ 886.911033] usb 8-1: reset SuperSpeed USB device number 4 using xhci-hcd [ 886.960598] r8152 8-1:1.0: Direct firmware load for rtl_nic/rtl8156b-2.fw failed with error -2 [ 886.960631] r8152 8-1:1.0: Falling back to sysfs fallback for: rtl_nic/rtl8156b-2.fw [ 947.165730] r8152 8-1:1.0: unable to load firmware patch rtl_nic/rtl8156b-2.fw (-110) [ 947.210940] r8152 8-1:1.0 (unnamed net_device) (uninitialized): netif_napi_add() called with weight 256 [ 947.237480] r8152 8-1:1.0 eth1: v1.12.11 [ 947.254755] usbcore: registered new interface driver cdc_ncm [ 947.257112] usbcore: registered new interface driver cdc_mbim [ 947.290865] r8152 8-1:1.0 enx1cbfced40321: renamed from eth1 |
It’s getting depressing. Let’s update the system first.
1 2 3 4 5 |
sudo apt update sudo apt install python3-pip sudo pip3 install apt-mirror-updater apt-mirror-updater -c http://ftp.tu-chemnitz.de/pub/linux/ubuntu-ports sudo apt dist-upgrade |
I followed all those steps since the FriendlyCore image relies on servers from China, which are very slow from where I have (just running apt update can take 15 minutes), so the update was possibly faster that way, although it still took a couple of hours! (See Changing Ubuntu Apt Mirror from the Command Line for details).
It did not help with the firmware issue. So instead I search for that rtl_nic/rtl8156b-2.fw file. It is in the firmware-realtek Debian package, or linux-firmware Ubuntu Impish package.
I downloaded the latter, extracted rtl8156b-2.fw and copied it to /etc/firmware/rtl_nic. It now works:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[ 2172.098871] usb 8-1: new SuperSpeed USB device number 4 using xhci-hcd [ 2172.120681] usb 8-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=31.00 [ 2172.120731] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6 [ 2172.120754] usb 8-1: Product: USB 10/100/1G/2.5G LAN [ 2172.120771] usb 8-1: Manufacturer: Realtek [ 2172.120788] usb 8-1: SerialNumber: 0013000000 [ 2172.183460] cdc_ncm 8-1:2.0: MAC-Address: 1c:bf:ce:d4:03:21 [ 2172.183494] cdc_ncm 8-1:2.0: setting rx_max = 16384 [ 2172.183620] cdc_ncm 8-1:2.0: setting tx_max = 16384 [ 2172.184904] cdc_ncm 8-1:2.0 eth1: register 'cdc_ncm' at usb-xhci-hcd.1.auto-1, CDC NCM, 1c:bf:ce:d4:03:21 [ 2172.189439] cdc_ncm 8-1:2.0 eth1: unregister 'cdc_ncm' usb-xhci-hcd.1.auto-1, CDC NCM [ 2172.451015] usb 8-1: reset SuperSpeed USB device number 4 using xhci-hcd [ 2172.535166] r8152 8-1:1.0: load rtl8156b-2 v1 04/15/21 successfully [ 2172.598459] r8152 8-1:1.0 eth1: v1.12.11 |
Somehow the interface is still not up, and adding it manually to /etc/network/interfaces.d, does not work.
Back to the Ubuntu laptop with rtl8156b-2.fw firmware
So instead, I went back to my laptop, and copied the firmware file to /lib/firmware/rtl_nic directory. The result was the same as in NanoPi R4S:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[23050.245495] usb 2-1: new SuperSpeed USB device number 3 using xhci_hcd [23050.266025] usb 2-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=31.00 [23050.266038] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6 [23050.266043] usb 2-1: Product: USB 10/100/1G/2.5G LAN [23050.266047] usb 2-1: Manufacturer: Realtek [23050.266050] usb 2-1: SerialNumber: 0013000000 [23050.325714] cdc_ncm 2-1:2.0: MAC-Address: 1c:bf:ce:d4:03:21 [23050.325720] cdc_ncm 2-1:2.0: setting rx_max = 16384 [23050.325762] cdc_ncm 2-1:2.0: setting tx_max = 16384 [23050.326199] cdc_ncm 2-1:2.0 eth0: register 'cdc_ncm' at usb-0000:04:00.3-1, CDC NCM, 1c:bf:ce:d4:03:21 [23050.334723] cdc_ncm 2-1:2.0 eth0: unregister 'cdc_ncm' usb-0000:04:00.3-1, CDC NCM [23050.559779] usb 2-1: reset SuperSpeed USB device number 3 using xhci_hcd [23050.617459] r8152 2-1:1.0: load rtl8156b-2 v1 04/15/21 successfully [23050.654344] r8152 2-1:1.0 eth0: v1.12.11 |
Let’s try iperf3 upload:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
iperf3 -t 30 -c 192.168.31.12 -i 5 Connecting to host 192.168.31.12, port 5201 [ 5] local 192.168.31.166 port 50222 connected to 192.168.31.12 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-5.00 sec 1.37 GBytes 2.36 Gbits/sec 0 609 KBytes [ 5] 5.00-10.00 sec 1.37 GBytes 2.35 Gbits/sec 0 691 KBytes [ 5] 10.00-15.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.35 MBytes [ 5] 15.00-20.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.35 MBytes [ 5] 20.00-25.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.35 MBytes [ 5] 25.00-30.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.35 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-30.00 sec 8.22 GBytes 2.35 Gbits/sec 0 sender [ 5] 0.00-30.04 sec 8.22 GBytes 2.35 Gbits/sec receiver iperf Done. |
Same as before, so no regression. Now for the iperf3 download:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
iperf3 -t 30 -c 192.168.31.12 -i 5 -R Connecting to host 192.168.31.12, port 5201 Reverse mode, remote host 192.168.31.12 is sending [ 5] local 192.168.31.166 port 50226 connected to 192.168.31.12 port 5201 [ ID] Interval Transfer Bitrate [ 5] 0.00-5.00 sec 969 MBytes 1.63 Gbits/sec [ 5] 5.00-10.00 sec 990 MBytes 1.66 Gbits/sec [ 5] 10.00-15.00 sec 982 MBytes 1.65 Gbits/sec [ 5] 15.00-20.00 sec 984 MBytes 1.65 Gbits/sec [ 5] 20.00-25.00 sec 1012 MBytes 1.70 Gbits/sec [ 5] 25.00-30.00 sec 1007 MBytes 1.69 Gbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-30.02 sec 5.81 GBytes 1.66 Gbits/sec 3181 sender [ 5] 0.00-30.00 sec 5.80 GBytes 1.66 Gbits/sec receiver iperf Done. |
It’s getting better, although we are not there yet, and the retransmissions are through the roof. I’m really tired now… Let me know if you have other ideas.
Realtek RTL8156BG USB 3.0 to 2.5GbE dongle to the rescue.
[Update: Realtek sent me one of their USB 3.0 to 2.5GbE adapters and it does not have the same performance issue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
$ iperf3 -t 60 -c 192.168.31.12 --bidir -i 5 Connecting to host 192.168.31.12, port 5201 [ 5] local 192.168.31.85 port 47164 connected to 192.168.31.12 port 5201 [ 7] local 192.168.31.85 port 47168 connected to 192.168.31.12 port 5201 [ ID][Role] Interval Transfer Bitrate Retr Cwnd [ 5][TX-C] 0.00-5.00 sec 1.35 GBytes 2.31 Gbits/sec 0 1.54 MBytes [ 7][RX-C] 0.00-5.00 sec 1.25 GBytes 2.14 Gbits/sec [ 5][TX-C] 5.00-10.00 sec 1.37 GBytes 2.35 Gbits/sec 0 1.54 MBytes [ 7][RX-C] 5.00-10.00 sec 1.36 GBytes 2.34 Gbits/sec [ 5][TX-C] 10.00-15.00 sec 1.36 GBytes 2.34 Gbits/sec 0 1.54 MBytes [ 7][RX-C] 10.00-15.00 sec 1.34 GBytes 2.31 Gbits/sec [ 5][TX-C] 15.00-20.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 15.00-20.00 sec 1.32 GBytes 2.28 Gbits/sec [ 5][TX-C] 20.00-25.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 20.00-25.00 sec 1.36 GBytes 2.33 Gbits/sec [ 5][TX-C] 25.00-30.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 25.00-30.00 sec 1.34 GBytes 2.30 Gbits/sec [ 5][TX-C] 30.00-35.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 30.00-35.00 sec 1.36 GBytes 2.33 Gbits/sec [ 5][TX-C] 35.00-40.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 35.00-40.00 sec 1.33 GBytes 2.28 Gbits/sec [ 5][TX-C] 40.00-45.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 40.00-45.00 sec 1.35 GBytes 2.32 Gbits/sec [ 5][TX-C] 45.00-50.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 45.00-50.00 sec 1.35 GBytes 2.32 Gbits/sec [ 5][TX-C] 50.00-55.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 50.00-55.00 sec 1.35 GBytes 2.31 Gbits/sec [ 5][TX-C] 55.00-60.00 sec 1.36 GBytes 2.34 Gbits/sec 0 2.34 MBytes [ 7][RX-C] 55.00-60.00 sec 1.32 GBytes 2.26 Gbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID][Role] Interval Transfer Bitrate Retr [ 5][TX-C] 0.00-60.00 sec 16.3 GBytes 2.34 Gbits/sec 0 sender [ 5][TX-C] 0.00-60.05 sec 16.3 GBytes 2.34 Gbits/sec receiver [ 7][RX-C] 0.00-60.00 sec 16.0 GBytes 2.29 Gbits/sec 25 sender [ 7][RX-C] 0.00-60.05 sec 16.0 GBytes 2.29 Gbits/sec receiver iperf Done. |
]
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Have you already checked whether it can be related to overheating (thumb test, operating the thing open)? The RTL8156 dongles we use (Delock 65990) have a rather heavy metal enclosure allowing for good heat dissipation…
I don’t think it’s an overheating issue. I tried this morning right after starting the laptop, and I got around 1 Gbps with iperf3 right from the start.
I’ve seen an older post with tweaks: https://wu.renjie.im/blog/network/ax88u-nbase-t/#performance-tuning
But none of those help. I’ll probably try with another laptop I have with me.
As for the horribly low SMB performance with Linux as client you should check whether you used gfvs and if that’s the case better switch to mount.cifs instead (might require installation of cifs-utils package).
@Jean-Luc
(1) reading this article and the previous one, I went back to testing rtl8156b on ARM (an Odroid N2+). The driver I use provides the expected max speed you can hope for: 2.35Gbits/sec in one direction and 2.05 Gbits/sec because the ARM CPU would probably need to run at 3Ghz to support 2.35Gbits/sec in reverse, meaning sending.)
(2) To my dismay, with the driver I use plus the current ARM kernel on Odroid N2+ (4.9.277-121) hard disconnection is showing up its ugly head again (same thing using the Kernel driver too) in one direction 🙁
See https://forum.odroid.com/viewtopic.php?f=181&t=44027 for details.
(3) In your case, the RK3568 may not be enough (a guess) to send beyond 1.55 Gbits/sec. The Odroid N2+ OC at 2400 Ghz tops at 2.05 Gbits/sec.
The hard disconnection reappearing is a downer. It requires a USB reset to get the adapter working back.
@Jean-Luc
You may also want to try between the UP Xtreme i11 and another PC. On my side, Odroid H2+ <–> an AMD r7-5700g go full speed high flying colors, no disconnection.
I’m now going to try Armbian images on the Odroid N2+, I think I remember Igor saying at the time that he took care of integrating and testing the Realtek drivers. I’ll try Armbian_20.05.1_Odroidn2_focal_current_5.6.15 and Armbian_21.08.9_Odroidn2_focal_current_5.10.81.
It could be that a full working Realtek driver started to appear with Kernel 5.6…
We’ll see.
I tested Armbian on the Odroid N2+. It provides a tiny optimization in speed but I see the same pattern of hard disconnection. I posted my results on the Odroid forum whose link is in my first comment here.
My laptop is using an AMD Ryzen 7 2700U processor, and the UP Xtreme mini PC is based on an Intel Core Tiger Lake processor, so the CPUs should not be the bottleneck.
Oh, I thought you were testing with the RK3568 on the Radxa.
Nope, I’m not there yet. I can’t even boot the Radxa.
a) What OS do you run on each host?
b) What does sudo ethtool -i <nic_name_in_ip_a> show?
c) After testing what does sudo ethtool -S <nic…> show?
In the meantime, may be I was lucky between my H2+ and 5700g with only 300-second sessions. I’m gonna run a 3600-second session just to be sure.
Ubuntu 20.04 + HWE (Linux 5.13) on both platforms.
I’ve just switched to another older laptop that’s running Ubuntu 20.04 with Linux 5.4. Tried iperf3 out of the box at around 250 Mbps… Currently updating it, and I’ll try again.
The OS update in the other laptop is complete… This is what happens now when I insert the USB adapter (after a reboot):
The kernel output is still OK on my regular laptop. Go figure…
The 1H session between a H2+ and a 5700g went fine full speed BUT and it’s a big one, both PC were unresponsive to console commands after the test. I had to reboot to get control back. So as of today, I’m no longer relying on these adapters, something is wrong with the current drivers and kernel. Two years ago, I ran 10H sessions with not a peep of an error. It’s a regression and clearly Realtek has not cleaned up its act.
and
Yes, whatever the actual origin of the driver, they all refer to the 2.15 version from 04/15/21 on the Realtek web site. I diffed the r8152.c from the git project you referred to and from the download from the Realtek web site, it’s the same source code with just a few additions for ASUS and Trendnet branding.
Mmm… Strike that. There are differences in compatibility.h plus usage of #ifdef ACPI_TYPE_BUFFER in r8152.c. So you may want to compare your testing between the version from the RealTek web site and the git project you referred to:
domih@trx:~/Downloads$ diff r8152-master/r8152.c r8152-2.15.0/r8152.c
301,303d300
< #ifdef CR_TE
< #undef CR_TE
< #endif
794d790
< #define VENDOR_ID_ASUS 0x0b05
801d796
< #define VENDOR_ID_TRENDNET 0x20f4
1452d1446
< #ifdef ACPI_TYPE_BUFFER
1499d1492
< #endif
1509d1501
< #ifdef ACPI_TYPE_BUFFER
1521,1522d1512
< #endif
<
20081d20070
< netif_info(tp, probe, netdev, “chip rev %d\n”, tp->version);
20193,20195d20181
< /* TRENDnet */
< {REALTEK_USB_DEVICE(VENDOR_ID_TRENDNET, 0xe02b)},
<
20198,20200d20183
<
< /* ASUS */
< {REALTEK_USB_DEVICE(VENDOR_ID_ASUS, 0x1976)},
domih@trx:~/Downloads$ diff r8152-master/50-usb-realtek-net.rules r8152-2.15.0/50-usb-realtek-net.rules
domih@trx:~/Downloads$ diff r8152-master/compatibility.h r8152-2.15.0/compatibility.h
11,14d10
<
< #include <linux/acpi.h>
< // FIXME: Some platform do not have asm/acpi.h which is included by acpi/acpi.h
< #ifdef ACPI_TYPE_BUFFER
16d11
< #endif
38,41d32
< #else
< # if __has_attribute (__fallthrough__)
< # define fallthrough __attribute__((__fallthrough__))
< # endif
43,44c34,37
<
< #ifndef fallthrough
—
>
> #if __has_attribute(__fallthrough__)
> # define fallthrough __attribute__((__fallthrough__))
> #else
48,56d40
< // https://github.com/torvalds/linux/commit/99b60d56a35b18af267f275559a530db372bfad7
< #define MDIO_EEE_2_5GT 0x0001 /* 2.5GT EEE cap */
< #define MDIO_EEE_5GT 0x0002 /* 5GT EEE cap */
<
< #if LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
< // https://github.com/torvalds/linux/commit/7fd8afa8933a095a97995885740999f174e61b60
< #define MDIO_AN_10GBT_CTRL_ADV2_5G 0x0080 /* Advertise 2.5GBASE-T */
< #define MDIO_AN_10GBT_CTRL_ADV5G 0x0100 /* Advertise 5GBASE-T */
<
93,106d76
<
< // Added for old platforms
< enum skb_free_reason {
< SKB_REASON_CONSUMED,
< SKB_REASON_DROPPED,
< };
< static inline void dev_consume_skb_irq(struct sk_buff *skb)
< {
< dev_kfree_skb_irq(skb);
< }
< static inline void dev_consume_skb_any(struct sk_buff *skb)
< {
< dev_kfree_skb_any(skb);
< }
112d81
<
119,156d87
<
< // Added for old platforms
< #ifndef CLASS_ATTR_RW
< #define CLASS_ATTR_RW(_name) \
< struct class_attribute class_attr_##_name = __ATTR_RW(_name)
< #endif
< #ifndef CLASS_ATTR_RO
< #define CLASS_ATTR_RO(_name) \
< struct class_attribute class_attr_##_name = __ATTR_RO(_name)
< #endif
< #define ATTRIBUTE_GROUPS_BACKPORT(_name) \
< static struct BP_ATTR_GRP_STRUCT _name##_dev_attrs[ARRAY_SIZE(_name##_attrs)];\
< static void init_##_name##_attrs(void) \
< { \
< int i; \
< for (i = 0; _name##_attrs[i]; i++) \
< _name##_dev_attrs[i] = \
< *container_of(_name##_attrs[i], \
< struct BP_ATTR_GRP_STRUCT, \
< attr); \
< }
< #ifndef __ATTRIBUTE_GROUPS
< #define __ATTRIBUTE_GROUPS(_name) \
< static const struct attribute_group *_name##_groups[] = { \
< &_name##_group, \
< NULL, \
< }
< #endif /* __ATTRIBUTE_GROUPS */
< #undef ATTRIBUTE_GROUPS
< #define ATTRIBUTE_GROUPS(_name) \
< static const struct attribute_group _name##_group = { \
< .attrs = _name##_attrs, \
< }; \
< static inline void init_##_name##_attrs(void) {} \
< __ATTRIBUTE_GROUPS(_name)
<
< #define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
<
160,166d90
<
< // Added for armadaxp and evansport
< static inline void sg_unmark_end(struct scatterlist *sg)
< {
< sg->page_link &= ~0x02;
< }
<
187,190d110
< // Added for armadaxp and evansport
< #define skb_add_rx_frag(skb, i, page, off, size, truesize) \
< skb_add_rx_frag(skb, i, page, off, size)
<
580d499
<
633d551
< #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0) */
> the CPUs should not be the bottleneck.
But have you actually looked with atop in parallel while testing?
I had not… Screenshots for Tx and Rx are attached for reference.
Tx
Just one general comment though that’s certainly not the cause of your current issue given the low rates involved, that’s a huge number of parasitic processes on your machine! The machine should be at exactly 0% CPU when the test does not run, and it should be dedicated to the test software **exclusively**. If you don’t want to kill these parasitic processes, just send them a kill -STOP before the tests, and a kill -CONT after (don’t forget to reduce your browser windows before kill -STOP as you won’t be able to move them). I’m personally used to seeing perf numbers drop by 30-40% just when a browser is opened for example due to it refreshing some ads on some pages and periodically turning from 0% to 30%, and so on. At high speeds, wasting some CPUs on heavy tasks can even result in packet loss on the Rx path when queues fill quickly and the same core is shared between the softirq and the process! And regardless of the CPUs involved, there’s always the TLB and L3 cache pollution, DRAM bandwidth, sometimes even locking inside the kernel for certain operations, etc. I’m saying this so that you waste less time on similar issues in the future, and that you can also produce undisputable numbers.
> the CPUs should not be the bottleneck
It could be if the driver is crappy or the rings are too small, resulting in lots of wakeups/sleeps or IRQs. It would be interesting to see “top” and check if you’re seeing ksoftirqd at 100% on one core, especially during the Rx tests. In this case it could be useful to enable RPS (/sys/class/net/eth1/queues/rx*/rps_cpus) to make other cores deal with the incoming traffic. Maybe the USB stack is busy enough on the receiving core.
There’s a single Rx queue, which I set to “f” this morning, but it did not seem to make a difference. I’ll check atop during the test a bit later.
> testing rtl8156b on ARM (an Odroid N2+)
Did Hardkernel replace the Genesys Logic GL3523 hub from the N2 on the N2+ or is it still the same thing?
domih@n2pa:~$ lsusb
Bus 002 Device 003: ID 152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS567 SATA 6Gb/s bridge
Bus 002 Device 002: ID 05e3:0620 Genesys Logic, Inc. USB3.1 Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 0b95:6801 ASIX Electronics Corp.
Bus 001 Device 006: ID 0b95:6801 ASIX Electronics Corp. USB2.1 Hub
Bus 001 Device 005: ID 0b95:6808 ASIX Electronics Corp.
Bus 001 Device 003: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Thank you. So still ‘broken by design’ 🙁
I really wonder why they did not use the VL817 for N2+ (as they did on the C4. But even then everything behind an USB hub is sort of ‘broken by design’. Those Amlogic SoCs have USB3 and PCIe multiplexed so why not using a PCIe attached USB3 host controller like the VL805 instead to provide four USB3 ports?).
Is there a chance for testing RTL8156 related hardware with Windows 10/11 from https://realtek-download.com/realtek-usb-fe-gbe-2-5g-rtl8156-rtl8153-rtl8152b-gaming-ethernet-family-controller/ ?
That would indeed be good. It would rule out whether it is linux driver problems or if it has hardware/overheating issues.
Why either/or when it’s most probably about driver and hardware issues here? 🙂
Cheap hardware is involved, one of the most crappy receptacles ever designed (USB3-A with its extra tiny SuperSpeed pins) and an OS where a user has to waste hours of his life to get at least an idea which driver to try…
thats ‘normality’ for a big part of this world (?)
What’s the real difference between a 5Gbe for $75 and a 2.5Gbe for $15 if most around have cell phone and average global income per day is somewhere ~$25 (while that’s average (after tax) in Cuba or Venezuela for a whole month!)?
Honestly, taking that into account means we’re still talking about Win7 drivers compatibility (guess ~2billion computers globally: Win7 (end of support 01/2020), 2020 share 31%->~22% vs. WinXp ~25million globally, Win10 >60% global coverage of Windows systems)
(just adding to that: a starlink deposit can be £89.00 or >$500 or $99(CA) means ios or android OS )
I’m patiently waiting for starlink to become available at my current location.
I recently moved from where I had gigabit download to a rural location where no ISP is available. There is a microwave based ISP who told me they were adding a tower in the next two weeks which would allow me to receive 25/5 which I will indeed use if this tower appears.
It’s no starlink but when nothing is available it’s a life-saver.
Can try on one machine through virtual systems but to connect networks in adapters among themselves by a patchcord.and keep trying. Maybe the arm driver is weak.
Try loop.
Searching for issues with the usb ethernet chipset you have, shows it is popular for problems and driver issues. Seems you bought a world of pain.
Yep!
I was contacted by Realtek, and an FAE told me to run the two commands below as I had Rx missed issues:
It did not help in my case, but it may help others.
Please note that this large an rx-usecs is only going to increase losses at best, as it tries to deliver IRQs no more than every 250ms, i.e. it can fill the rx ring and deliver the IRQ once completely filled. I think that instead it would be useful to try with lower values (like 30 which can cause up to 33k irq/s and will trigger after no more than 108 packets in ring at 2.5 GbE). It’s also common for many chips not to use accurate timings, so another test you can make is to use “rx-frames 1” to try to provoke one irq per frame. It should eat quite a lot of CPU and should normally be slower. If it ends up being faster, it indicates that it’s one of these numerous chips which have broken timers and cannot deliver IRQs in time, letting incoming data rot in rx buffers.
Great. Is there a good documentation somewhere describing the meaning of these TX and RX parameters? I can play with these, but I need to know what I’m doing/testing. TIA!
I guess it’s in “man ethtool”, but the names look pretty natural to me: everything suffixed with “usecs” indicates a delay, others are counts.
With:
domih@r7-5700g:~$ sudo ethtool -i enx00e04c680184
driver: cdc_ncm
version: 5.13.0-30-generic
firmware-version: CDC NCM
expansion-rom-version:
bus-info: usb-0000:08:00.3-1
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
domih@r7-5700g:~$ sudo ethtool -c enx00e04c680184
Coalesce parameters for enx00e04c680184:
Cannot get device coalesce settings: Operation not supported
domih@r7-5700g:~$ sudo ethtool -C enx00e04c680184 rx-usecs 250000
Cannot get device coalesce settings: Operation not supported
domih@r7-5700g:~$ sudo ethtool -g enx00e04c680184
Ring parameters for enx00e04c680184:
Cannot get device ring settings: Operation not supported
domih@r7-5700g:~$ sudo ethtool -G enx00e04c680184 rx 1000
Cannot get device ring settings: Operation not supported
So I guess I’ll have to try it with the Realtek driver…
ALSO, I will definitely take into account what @Willy wrote below.
I also need to retrieve the IRQ table after a test to see which cores are involved.
Finally, I don’t have @Jean-Luc issue, my speed is OK and constant. My problem is hard disconnection at some point and the PC left in an unstable condition 🙁
After back and forth testing with Realtek, they concluded it was probably a USB host issue. Since I still have NanoPi M4V2 with me, I connected the dongle, and the problem remains. It’s most likely a problem with the adapter design.
I’ve finally received another USB 3.0 to 2.5GbE adapter from Realtek, and it does not have any issue. See update at the end of the post.
What does this new RTL8156B dongle report when querying it for bcdDevice?
Friendly reminder to provide the details on the new RTL8156B dongle report.
Here’s the output from the command:
Thank you! That’s at least a third variant after ‘30.00’ (RTL8156) and ‘31.00’ (RTL8156B).
The marking on the chip is RTL8156BG.
Ok, it starts to make sense (at least from a Linux perspective):
RTL81XX: don’t buy, doesn’t work
RTL81XXB: barely working
RTL81XXBG: barely working but good enough
I had sent my RTL8156B dongle to Realtek Taiwan office. I’ve just asked them if they could reproduce the issue. They used a similar AMD Ryzen laptop and had no problem with either the cdc-ncm or r8152 driver.
cdc-ncm 2.35G 2.15G
r8152(v1.12.11) 2.35G 2.13G
The first number is for upload and the second for download.
No performance and no stability issue on their side. I can’t see any retransmissions either on the iperf screenshots.
Hmm… strange since what remains then? AMD Ryzen means USB3/XHCI host controller being part of the CPU or some AMD chipset? Same controller in both laptops?
If that’s the case the only remaining difference could be unstable powering triggering issues with the RTL8156B but not with the different/new RTL8156BG dongle?
repost ( may have forgot to submit)
Good to see it was not just me with these issues.
I have multiple usb3 – 2.5GB dongles with R8156b chips. Running on Ubuntu Jammy and win 11.
Terrible issues with performance and old drivers limiting ubuntu to 2500 / half. Using ethtool to force the speeds (or at least advertised speeds) was throwing errors.
I even had the interface going off line overnight, (I think I fixed it by disabling power savings, still testing, I have read the driver crashes if told to sleep).
I was also seeing huge fluctuations in performance which I initially put down to the multiple 2.5Gb switches the traffic is traveling through, and I could get better performance the closer I got to the server.
Although I had the same 2.3gb from iperf in reverse mode but only about 1.4 – 1.6 in forward (depending on how far I was from the server.)
My solution was a little different though I used the latest driver from Realtek, which while it would compile on Ubuntu focal would not on Ubuntu Jammy. I found some references in the code were not correct for Jammy.
I have posted an upgrade request on Ubuntu Launch pad for an upgrade
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1969211
I don’t know how Realtek can say the driver is in the linux kernel (well at least a working version), even for the latest build
linux-5.18-rc2
The driver version is 1.12.12, when the version on the Realtek site 2.15 !!!
/* Information for net-next */
#define NETNEXT_VERSION “12”
/* Information for net */
#define NET_VERSION “12”
q#define DRIVER_VERSION “v1.” NETNEXT_VERSION “.” NET_VERSION
#define DRIVER_AUTHOR “Realtek linux nic maintainers <nic_swsd@realtek.com>”
#define DRIVER_DESC “Realtek RTL8152/RTL8153 Based USB Ethernet Adapters”
#define MODULENAME “r8152”
Any way after changing the r8152.c v2.15 file to make it build (sort of the signing did not work, but it produced a .ko file) on Jammy (I’m not a dev so may not have made the most optimal changes), I had control over the device and could make it run at 2500/full.
When testing from windows to ubuntu jammy I was getting 2.3Gbs ish in iperf3 reverse mode and between 1.4 ad 1.6 Gbs in iperf3 normal mode.
I then tried windows to windows (all the windows devices had the latest drivers from Realtek) I got the same results. So may be not the linux driver at fault.
Looking in the windows nic advanced properties there was a setting called “Miscellaneous Transfer setting” set to disabled.
So I enabled it to see what happened.
IT WORKED !!! 😊
c:\iperf-3.1.3-win64>iperf3 -c testsvr
Connecting to host testsvr, port 5201
[ 4] local 192.168.1.6 port 51115 connected to x.x.x.x port 5201
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-1.00 sec 278 MBytes 2.33 Gbits/sec
[ 4] 1.00-2.00 sec 279 MBytes 2.34 Gbits/sec
[ 4] 2.00-3.00 sec 280 MBytes 2.35 Gbits/sec
[ 4] 3.00-4.00 sec 280 MBytes 2.35 Gbits/sec
[ 4] 4.00-5.00 sec 280 MBytes 2.35 Gbits/sec
[ 4] 5.00-6.00 sec 280 MBytes 2.35 Gbits/sec
[ 4] 6.00-7.00 sec 280 MBytes 2.35 Gbits/sec
[ 4] 7.00-8.00 sec 280 MBytes 2.35 Gbits/sec
[ 4] 8.00-9.00 sec 280 MBytes 2.35 Gbits/sec
[ 4] 9.00-10.00 sec 280 MBytes 2.35 Gbits/sec
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-10.00 sec 2.73 GBytes 2.35 Gbits/sec sender
[ 4] 0.00-10.00 sec 2.73 GBytes 2.35 Gbits/sec receiver
iperf Done.
c:\iperf-3.1.3-win64>iperf3 -c testsvr -R
Connecting to host testsvr, port 5201
Reverse mode, remote host testsvr is sending
[ 4] local 192.168.1.6 port 51119 connected to x.x.x.x port 5201
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-1.00 sec 283 MBytes 2.38 Gbits/sec
[ 4] 1.00-2.00 sec 283 MBytes 2.37 Gbits/sec
[ 4] 2.00-3.00 sec 283 MBytes 2.37 Gbits/sec
[ 4] 3.00-4.00 sec 282 MBytes 2.36 Gbits/sec
[ 4] 4.00-5.00 sec 283 MBytes 2.37 Gbits/sec
[ 4] 5.00-6.00 sec 283 MBytes 2.37 Gbits/sec
[ 4] 6.00-7.00 sec 283 MBytes 2.37 Gbits/sec
[ 4] 7.00-8.00 sec 283 MBytes 2.37 Gbits/sec
[ 4] 8.00-9.00 sec 283 MBytes 2.37 Gbits/sec
[ 4] 9.00-10.00 sec 283 MBytes 2.37 Gbits/sec
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 2.76 GBytes 2.37 Gbits/sec 0 sender
[ 4] 0.00-10.00 sec 2.76 GBytes 2.37 Gbits/sec receiver
iperf Done.
Interesting. This option sounds very much like “workaround for known but undisclosed chip bug” :-/
Hi, Andrew, Thanks a lot for your findings!
I was able to compile the r8152.c driver on Linux Kernel 5.15 thanks to you.
static int rtl8152_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *coalesce,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
static int rtl8152_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *coalesce,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
I came out with the following little script:
sudo apt install lshw -y
sudo cp rtl8156b-2.fw /usr/lib/firmware/rtl_nic/rtl8156b-2.fw
make clean
make all
make install
modprobe r8152
sudo cp 50-usb-realtek-net.rules /etc/udev/rules.d/50-usb-realtek-net.rules
sudo depmod -a
sudo update-initramfs -u
sudo rm -rf /usr/lib/modules/$(uname -r)/kernel/drivers/net/usb/cdc_ncm.ko
It now works great, with full duplex and all!
Update! They can reproduce it too, but not 100% of the time, and not when the USB protocol analyzer is in the way.
> With the USB protocol analyzer sniffer in between, the issue does not occur.
Reminds me of the situation at a former customer over a decade ago. Their ‘network department’ was never able to reproduce issues when they put their Ethernet sniffer in between. Turned out the thing was pretty old and only capable of Fast Ethernet. 🙂
And final Realtek answer after additional testing:
Another post where I see that RTL81xxBG is showing quietly and fixing performance issues.
I saw the same chipset in review for DIEWU network card ASM1812 + RTL8125BG chipsets…
This is exactly my macOS experience as well. Maybe it’s better on the Windows side?
Thanks Jean-Luc! The brand new Ubuntu 22.04 has the same problem, and the 50-usb-realtek-net.rules trick worked for me. Kernel already is at 5.15 however, so no need to upgrade that.
Hi all,
I’ve just purchased 4 units of Alxum 2.5 Gigabit Ethernet Adapter, 2.5 Gigabit Network Adapter with RTL8156B (https://amzn.to/3k8SwKD), at one go/in the same purchase.
Something funny (crazy?) is happening:
And guess what ?
Very difficult to know what should (or shouldn’t) be used, or done, in order to enjoy the best performances with these adapters.
If you’re in a similar situation, please raise your hand.
The r8152 driver is the preferred one and if you want to debug why some install chooses this driver and the other another one, probably udevadm is of help: https://unix.stackexchange.com/a/607935
Module blacklisting might be the other source of different driver ‘choices’ so if you’re not administrating the RPi yourself check /etc/modprobe.d/ and ‘grep blacklist /proc/cmdline’
For your information,
I also ordered the ASUS USB-C2500 2.5G Ethernet USB Adapter, and plugged it on my RPi 4B with the latest official 64 bit RaspiOS, and Kernel 5.15.
The bcdDevice version is even higher: 31.05.
This post was extremely helpful. I finally managed to track down a USB Ethernet adapter with the RTL8156B(S)G, the StarTech US2GC30, and it seems to have fixed all my dumb networking issues.
Thank you so much!
Hi,
I can confirm, I have bought a StarTech US2GC30 thanks to your advise and I have ran iperf3 (server and client) on my Dell 7510 connected to a NXP RDB3 board and perf3 results are as expected:
Notice I used 2.5Gbps cable first for my tests, and then I have used a 1 meter CAT6 Ethernet Cable (as 2.5Gbps was a loan…) with same results (results above were with CAT6 Ethenet cable).
Thank you all for your testing
@jean-luc At the end of this article, you posted;
Realtek RTL8156BG USB 3.0 to 2.5GbE dongle to the rescue.
[Update: Realtek sent me one of their USB 3.0 to 2.5GbE adapters and it does not have the same performance issue]
I own several adapters based on this Realtek chip design. Can you specify what one they sent you? Is their a specific model #? There are so many different vendors using this chipset family, it would be nice to have one directly from Realtek that doesn’t have issues.
I have 3 dongles, all with a version of the 8156 family chip, one is the regular rtl8156, the other is the rtl8156b, and one is the dragon gaming version. They all behave differently, would be nice to have a uniformed performance for my network. Anyways, was the one they sent you made by Realtek? If so, how can I get my hands on it.
Thank you!
I don’t have any specific model number, I think Realtek just sent me a reference board (no enclosure). You can see the photo in another comment.
Tested on Fedora 36, USB 2.5G after using 50-usb-realtek-net.rules. WHY ARE TX VALUES N/A?
ethtool -g enp0s20u1
Ring parameters for enp0s20u1:
Pre-set maximums:
RX: 4096
RX Mini: n/a
RX Jumbo: n/a
TX: n/a
Current hardware settings:
RX: 4096
RX Mini: n/a
RX Jumbo: n/a
TX: n/a
RX Buf Len: n/a
CQE Size: n/a
TX Push: n/a
It might be because you need to run the command as root, or with sudo.
Dang, the RTL8156BG is so much more expensive than the RTL8156B, and not very plentiful in the wild.
Just used this article to set up my USB3 NIC. It looks much shorter and works fine:
I think you need to revisit this topic.
I’ve gone through three different USB-C dongles that use the RTL8156 chipset.
The latest one, which uses RTL8156BG (version 31.04), can sustain 2.48 Gbps…
…but every so often it will drop/reconnect, and I will see this in my system log:
The dongle does not even get warm. (I keep it cool with a DC-fan, that’s not even connected to the laptop, using a different power source.)
It it “usable”? I guess? But in my opinion, it’s not acceptable if you take data integrity seriously, such as saving and editing files on a local NAS server.
What happens if you let it run an indefinite iperf3 test?
Do you notice it will occassionally “drop” (as seen with “0.00 bits/sec” and an entry of “carrier off” in your dmesg log?
I have such usb nic with version 31.04 and with Ubuntu 22.04 with newest HWA kernel 6.2.0 I have no problems at all.
My tests are showing:
[ 5][RX-S] 171.00-172.00 sec 280 MBytes 2.35 Gbits/sec
[ 8][TX-S] 171.00-172.00 sec 280 MBytes 2.35 Gbits/sec 0 3.55 MBytes
I don’t see any drops or other performance issues even if I run iperf3 for hours.
I’m using Cable Matters NIC from auction: https://www.amazon.co.uk/Cable-Matters-Ethernet-Adapter-Charging/dp/B0BKMPT6N3/ref=sr_1_3?crid=2KZT0EJVT86EP&keywords=cable+matters+usb+c+2.5&qid=1691526483&sprefix=cable+matters+usb+c+2.5%2Caps%2C87&sr=8-3
This NIC looks very simple. I don’t see big radiators but it doesn’t seem to heat.
I ordered one more NIC from same manufacturer to check it, but as usual, amazon sent me two cards from same manufacturer in two separate packages and I need to wait: https://www.amazon.co.uk/Cable-Matters-201095-Network-Adapters/dp/B08574CM8V/ref=sr_1_5?crid=2KZT0EJVT86EP&keywords=cable+matters+usb+c+2.5&qid=1691526634&sprefix=cable+matters+usb+c+2.5%2Caps%2C87&sr=8-5
You can also try newest driver installable via dkms:
https://github.com/awesometic/realtek-r8152-dkms. In my case, everything worked perfectly just with 6.2.0 kernel driver.
My card is connected directly to usb-c port of Dell laptop, without any hubs or docking stations.
Looks like the generic adapter is now being sold with RTL8156BG inside and for me it works perfectly on both Windows and Ubuntu (iperf3 shows 2.37 Gbps with zero fluctuations). My only complain is the flat cable but on the other hand it cost me just 7 bucks.