Rock 4A+ slow link speed on 100Mbit network

Hi there,

I have a Rock 4A+ running rock-pi-4a-plus_debian_bullseye_cli_b14

All is fine, except that I have 6 Rock 4A+ devices that all get decent download speed from the Teltonika RUT241 (4G Router), except for 1 Rock 4A+ device that just won’t download faster than 20 Kbps/

The strange thing is, when I connect the Rock 4A+ to my home network (Netgear router with DHCP) all is working just fine.

I am pretty much out of ideas here, does someone know what could cause this problem or how I can troubleshoot this?

I tried to find the cause of the problem, flashing different images does not seem to make a difference.

Output of dmesg:

# After connecting to 100Mbps router
[  459.690162] rk_gmac-dwmac fe300000.ethernet eth0: Link is Down
[  464.757267] rk_gmac-dwmac fe300000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off

# After connecting to Gbit router

[  170.853801] rk_gmac-dwmac fe300000.ethernet eth0: Link is Down
[  174.934313] rk_gmac-dwmac fe300000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

No obvious errors. I ran some iperf3 tests from the router (I already tested different Rock 4A+ devices with this router, most of them work just fine!)

With router as server:

root@Teltonika-RUT241:~# iperf3 -c 172.16.6.151 -p 5000 -t 10
Connecting to host 172.16.6.151, port 5000
[  5] local 172.16.6.1 port 47176 connected to 172.16.6.151 port 5000
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  45.2 KBytes   370 Kbits/sec    9   1.41 KBytes
[  5]   1.00-2.00   sec  0.00 Bytes  0.00 bits/sec    1   1.41 KBytes
[  5]   2.00-3.00   sec  0.00 Bytes  0.00 bits/sec    0   1.41 KBytes
[  5]   3.00-4.00   sec  0.00 Bytes  0.00 bits/sec    1   1.00 KBytes
[  5]   4.00-5.00   sec  0.00 Bytes  0.00 bits/sec    0   1.00 KBytes
[  5]   5.00-6.00   sec  0.00 Bytes  0.00 bits/sec    0   1.00 KBytes
[  5]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec   16   1.00 KBytes
[  5]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec   14    512 Bytes
[  5]   8.00-9.00   sec  38.9 KBytes   319 Kbits/sec   13    256 Bytes
[  5]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec   10    512 Bytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  84.1 KBytes  68.9 Kbits/sec   64             sender
[  5]   0.00-10.00  sec  35.1 KBytes  28.8 Kbits/sec                  receiver

iperf Done.

As you can see the speed is just not what it should be on a 100Mbit link.

Iperf 3 with RockPi as client:

radxa@rock-pi-4a-plus:~$ iperf3 -c 172.16.6.1 -p 5000 -t 10
Connecting to host 172.16.6.1, port 5000
[  5] local 172.16.6.151 port 47292 connected to 172.16.6.1 port 5000
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  11.3 MBytes  94.9 Mbits/sec    0    148 KBytes
[  5]   1.00-2.00   sec  11.6 MBytes  97.0 Mbits/sec    0    256 KBytes
[  5]   2.00-3.00   sec  11.2 MBytes  93.8 Mbits/sec    0    327 KBytes
[  5]   3.00-4.00   sec  10.9 MBytes  91.2 Mbits/sec    0    386 KBytes
[  5]   4.00-5.00   sec  11.1 MBytes  92.8 Mbits/sec    0    386 KBytes
[  5]   5.00-6.00   sec  10.2 MBytes  85.5 Mbits/sec    0    386 KBytes
[  5]   6.00-7.00   sec  10.8 MBytes  90.2 Mbits/sec    0    413 KBytes
[  5]   7.00-8.00   sec  11.6 MBytes  96.9 Mbits/sec    0    413 KBytes
[  5]   8.00-9.00   sec  10.3 MBytes  86.6 Mbits/sec    0    413 KBytes
[  5]   9.00-10.00  sec  10.6 MBytes  88.6 Mbits/sec    0    413 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   109 MBytes  91.7 Mbits/sec    0             sender
[  5]   0.00-10.01  sec   107 MBytes  89.8 Mbits/sec                  receiver

iperf Done.

Interesting, there we get almost 100 Mbits. So strange!

So it seems that sending or receiving data (I am not too sure with Iperf who is the sender or receiver) works pretty well.

So now I am out of ideas. @RadxaYuntian do you have any pointers?

I ran a speedtest-cli, and it is interesting to see that the upload is at least in the Mbit range, but the download speed is just not there. So there really is something going on with the download part, upload seems to be fine.


Retrieving speedtest.net configuration...
Testing from [Redacted]
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Korton Group BV (Nieuw-Vennep) [19.35 km]: 46.646 ms
Testing download speed................................................................................
Download: 0.00 Mbit/s
Testing upload speed......................................................................................................
Upload: 4.52 Mbit/s

It seems that the rx_delay setting was wrong.

This solved my problem temporarily:

echo 0x28 0x20 > /sys/class/net/eth0/device/driver/fe300000.ethernet/rgmii_delayline

Does anyone know how to make this permanent?

Credits to the @sfo for his info in this thread:

Edit:
For now I just created a cron job @reboot:

@reboot echo 0x28 0x20 > /sys/class/net/eth0/device/driver/fe300000.ethernet/rgmii_delayline

Still curious if there is a better way to fix this, and if these settings are optimal or not. The default 0x28 0x11 works fine on my Gbit lan, but on my 100 Mbit lan it just won’t work for about 3 out of 10 RockPis.

Hi Mathijs, can you try 0x2a 0x21 instead? This is what Realtek provided to us on another RK3399 products when using fast Ethernet.

If you can confirm this value works we can merge this PR to fix this for everyone.

Hi @RadxaYuntian sure thing.

I will try to test everything as throughly as possible, so I will run some iperf3 tests from the following devices:

  • My laptop
  • Rockpi 4A+ which runs fine out of the box with default delayline settings
  • Rockpi 4A+ which barely runs with default delayline settings

Laptop

First my laptop to get a baseline. This is iperf3 under Winows 11, and the 100 Mbit router isn’t that fast either.

iperf3 -c 172.16.2.1 -p 5000 -t 10
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec   103 MBytes  86.2 Mbits/sec                  sender
[  4]   0.00-10.00  sec   103 MBytes  86.1 Mbits/sec                  receiver

iperf3 -c 172.16.2.1 -p 5000 -t 10 -R
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  94.5 MBytes  79.3 Mbits/sec    0             sender
[  4]   0.00-10.00  sec  94.5 MBytes  79.3 Mbits/sec                  receiver

Problematic RockPi 4A+

Using tx delayline: 0x28, rx delayline: 0x20

iperf3 -c 172.16.2.1 -p 5000 -t 10
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  98.8 MBytes  82.9 Mbits/sec    2             sender
[  5]   0.00-10.02  sec  97.0 MBytes  81.2 Mbits/sec                  receiver

iperf3 -c 172.16.2.1 -p 5000 -t 10 -R
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.02  sec  89.2 MBytes  74.7 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  88.4 MBytes  74.2 Mbits/sec                  receiver

Using suggested tx delayline: 0x2a, rx delayline: 0x21

iperf3 -c 172.16.2.1 -p 5000 -t 10
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   101 MBytes  85.0 Mbits/sec    0             sender
[  5]   0.00-10.02  sec  98.9 MBytes  82.8 Mbits/sec                  receiver

iperf3 -c 172.16.2.1 -p 5000 -t 10 -R
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.10  sec  92.5 MBytes  76.8 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  91.7 MBytes  76.9 Mbits/sec                  receiver

Speed seems to be slightly higher with the settings you mentioned.

RockPi 4A+ without problems

Just to verify that this device also works I ran a test on this RockPi as well.

Using the default tx delayline: 0x28, rx delayline: 0x11

iperf3 -c 172.16.6.1 -p 5000 -t 10
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   109 MBytes  91.7 Mbits/sec    0             sender
[  5]   0.00-10.01  sec   107 MBytes  89.7 Mbits/sec                  receiver

iperf3 -c 172.16.6.1 -p 5000 -t 10 -R
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  90.6 MBytes  76.0 Mbits/sec  222             sender
[  5]   0.00-10.00  sec  90.4 MBytes  75.9 Mbits/sec                  receiver

Using suggested tx delayline: 0x2a, rx delayline: 0x21

iperf3 -c 172.16.6.1 -p 5000 -t 10
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   110 MBytes  92.1 Mbits/sec    0             sender
[  5]   0.00-10.02  sec   108 MBytes  90.5 Mbits/sec                  receiver

iperf3 -c 172.16.6.1 -p 5000 -t 10 -R
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   106 MBytes  89.2 Mbits/sec    0             sender
[  5]   0.00-10.00  sec   106 MBytes  88.7 Mbits/sec                  receiver

Looks to me like the new values are beneficial for devices that don’t experience propblems.

Final thoughts

Both Rock devices were running with default cpu behaviour, using this image rock-pi-4a-plus_debian_bullseye_cli_b14.

The suggested values seem to be working for a problematic device and for a device that experienced no problems. In both cases the speed seemed to increase a little bit as well.

I can’t test the values on a Gigabit network right now. I would also need to increase the CPU speed on my rock to get to those speeds anyway and I don’t know how to do that on this image. If you can tell me how to do that I will test it later today.

Gigabit testing

I ran some iperf tests using my Gigabit network with 40 seconds per test. Still without adjusting CPU the results look good.

Using the default tx delayline: 0x28, rx delayline: 0x11

iperf3 -c 192.168.3.228 -p 5000 -t 40
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-40.00  sec  4.35 GBytes   933 Mbits/sec    0             sender
[  5]   0.00-40.07  sec  4.35 GBytes   932 Mbits/sec                  receiver

iperf3 -c 192.168.3.228 -p 5000 -t 40 -R
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-40.04  sec  3.86 GBytes   827 Mbits/sec    0             sender
[  5]   0.00-40.00  sec  3.85 GBytes   827 Mbits/sec                  receiver

Using suggested tx delayline: 0x2a, rx delayline: 0x21

iperf3 -c 192.168.3.228 -p 5000 -t 40
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-40.00  sec  4.35 GBytes   933 Mbits/sec    0             sender
[  5]   0.00-40.07  sec  4.35 GBytes   932 Mbits/sec                  receiver

iperf3 -c 192.168.3.228 -p 5000 -t 40 -R
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-40.05  sec  3.92 GBytes   841 Mbits/sec    1             sender
[  5]   0.00-40.00  sec  3.92 GBytes   841 Mbits/sec                  receiver

I think everyone can be happy with these settings!

Please first check if you have anything listed under /sys/devices/system/cpu/cpufreq/ folder. If it is empty you might be missing some driver to enable higher CPU clocks.

That is indeed missing. I think it got removed from the debian images in recent months, it was included by default somewhere in may I think. I just don’t know how to get it back, there is no overlay included in the image either.

You can run echo rockchip-cpufreq | sudo tee -a /etc/modules then reboot. It should work afterwards. You can also try upgrade the system to latest kernel.

1 Like

Do you have an estimation when this will be merged? The PR is still open on Github :slightly_smiling_face:

Waiting for @Stephen’s approval.

1 Like