BPI-R2 slow ethernet speed

Hi, I’ve encountered a similar problem as sunarowicz, the gigabit ethernet speed when transfering data to the Pi is fine, 900-ish Mbps, but speeds in the other direction are under 1Mbps…

I’m using Frank W.'s debian image with 4.14 kernel. Downgrading to 4.9 solved the problem, but 4.9 doesn’t have GPIO support and I’m also unable to create more than one routing table.

Any idea what might be causing this? It isn’t a duplex mismatch problem, nor is it anything other than the network, I used iperf to test the speed. If you want I can provide screenshots of the tests, but they won’t tell you anything more than I have already.

Which kernel do you use (uname -r) exactly?

If I remember correctly, it was 4.14.62, the precompiled version from august 2018. I’ve been running 4.9 for two months now. The strange thing is that if I set the NIC to 100Mbps (or used a 100Mbps switch), it worked fine both ways, the problem was only with gigabit.

Have you tried a version of 4.14 prior to 4.14.52?

4.9 is not affected? You use my 4.9? How about 4.19?

with ssh/scp i got ~13MB/s if i download a file from PI…same in opposite direction…looks more like 100Mbit/s…

cat /sys/class/net/lan0/speed
1000
cat /sys/class/net/eth0/speed                                                                                    
1000

maybe it’s internally (wrong) handled as 100Mbit/s??

looking at top shows that ssh-process is running with 100% cpu (1core used)…so the Problem is the encryption. maybe this can be increased with hardware-encryption-acceleration, but i don’t know how set this up

traffic through http is slower (~7MB/s) and much more cpu-intensive (200%)

currently have no idea why this happens.

gigabit should reach ~115 MByte/s if not limited by CPU

@Ryder.Lee / @moore / @linkerosa / @Jackzeng can you test it with your boards?

same with my test-board and kernel 4.19.1 (without gmac#2)…both directions 12-13 MB/s (ssh with 100% cpu), but ftp is 9MB/s get and 20MB/s put

openssh uses openssl library to implament ssh command and openssl linrary use cryptodev to enable hw accererator feature. maybe you can refer to below thread and use openssl command to check performance first, thanks.

http://forum.banana-pi.org/t/is-it-possible-to-have-the-crypto-extensions-working/4034/2

ssh/scp is fastest…

Without encyption it’s the same problem…

i tested for dropped/corrupt packets, after transferring, but there no relevant error-count

frank@frank-N56VZ:~
[09:48:59]$ scp /media/data_ntfs/backup/system_backup_20181023.tar.gz [email protected]:/tmp
[email protected]'s password: 
system_backup_20181023.tar.gz                                                                 100%  395MB  13.5MB/s   00:29    
frank@frank-N56VZ:~
[09:49:44]$ scp [email protected]:/tmp/system_backup_20181023.tar.gz /tmp
[email protected]'s password: 
system_backup_20181023.tar.gz                                                                 100%  395MB  12.6MB/s   00:31 

eth_stats.txt (1,3 KB)

Please note, that scp copying speed may depend on emmc/SD/SSD/etc speed. Not bad way to test network speed is to use iperf - no disk IO, just network.

Here is my wifi example

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.0.1.64, port 54066
[  5] local 10.0.1.1 port 5201 connected to 10.0.1.64 port 54067
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  20.0 MBytes   168 Mbits/sec
[  5]   1.00-2.00   sec  23.6 MBytes   198 Mbits/sec
[  5]   2.00-3.00   sec  22.7 MBytes   190 Mbits/sec
[  5]   3.00-4.00   sec  23.0 MBytes   193 Mbits/sec
[  5]   4.00-5.00   sec  22.5 MBytes   189 Mbits/sec
[  5]   5.00-6.00   sec  22.1 MBytes   186 Mbits/sec
[  5]   6.00-7.00   sec  22.1 MBytes   186 Mbits/sec
[  5]   7.00-8.00   sec  22.2 MBytes   186 Mbits/sec
[  5]   8.00-9.00   sec  21.0 MBytes   176 Mbits/sec
[  5]   9.00-10.00  sec  20.8 MBytes   175 Mbits/sec
[  5]  10.00-10.04  sec   838 KBytes   164 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.04  sec   221 MBytes   184 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

scp on same setup gives only ~5MiB/s which is about 50Mbit/s

P.S. Note that i use wifi

Can you explain how you setup iperf (server config) and your client command?

root@bpi-r2:~# iperf -s                                                         
------------------------------------------------------------                    
Server listening on TCP port 5001                                               
TCP window size: 85.3 KByte (default)                                           
------------------------------------------------------------                    
[  4] local 192.168.0.42 port 5001 connected with 192.168.0.21 port 50830       
[ ID] Interval       Transfer     Bandwidth                                     
[  4]  0.0-10.0 sec  1.08 GBytes   931 Mbits/sec

running on client:

frank@frank-N56VZ:~
[19:05:12]$ iperf -c 192.168.0.42
------------------------------------------------------------
Client connecting to 192.168.0.42, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.21 port 50830 connected with 192.168.0.42 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.08 GBytes   931 Mbits/sec

info on r2 (kernel+ip-address)

root@bpi-r2:~# uname -r                                                         
4.19.4-bpi-r2-testing
root@bpi-r2:~# ip addr show wan                                                 
5: wan@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 0
    link/ether 8a:dc:3b:8b:15:ed brd ff:ff:ff:ff:ff:ff                          
    inet 192.168.0.42/24 brd 192.168.0.255 scope global wan                     
       valid_lft forever preferred_lft forever                                  
    inet6 fe80::88dc:3bff:fe8b:15ed/64 scope link                               
       valid_lft forever preferred_lft forever
1 Like

Looks like you’ve done everything right :slight_smile:

But i’m not sure that both directions are tested, anyway you can wsitch client and server side if there are no options for choosing traffic direction.

have done it the opposite direction and also over lan0, speed is comparable to the above results

1 Like

I never did find a solution to this issue other than to use some external USB-NICs not ideal by any stretch and sorta obviates the reason for choosing the R2 in the fist place.

I have the same issue you throw packets at the pi, but if the pi is generating packets even if its a simple script or something to just kick out zeros its terribly slow and the error rate is very high.

Myshob, sunarowicz, malvcr, Have you guys capture packets on both the pi side and client side? Do you see a lot of re-transmission?

I do also have an issue with BPi-R2 and network speed.

If I make tests with iperf, everything is fine. If I connect the R2 behind my providers router and do measures with https://fast.com I reach around 200 Mbit/s (should be 400Mbit/s which I do get when connecting directly to my providers router, but okay). If I connect more devices to all four ports of the R2 the speed measured with https://fast.com drops below 1Mbit/s. If I do exactly the same with a BPi-R1 I do reach arround 200Mbit/s on https://fast.com, also if the other devices are connected. During the tests with R1 and R2; the other devices were an Odroid-C2 and a Raspberry PI Zero, both running shairport-sync playing multiroom audio from a MacBook Pro.

Kernel used:

  • R2: 4.14.88-bpi-r2-main (frank-w)
  • R1: 4.14.55-1-ARCH

both running archlinux and using arno-iptables-firewall and dnsmasq. All LAN Ports are in one bridge.

@frank-w do you use the R2 as router or are you only doing some tests with it?

I use r2 (1 of 2) as router but i have only a adsl2+ with 12mbit/s

tested again with 4.19 and my gmac-patches

from r2 speed is ~940Mbit/s, to r2 i have only ~700Mbit/s

now i tested with iperf3 from r2 (first normal, second with -R, output from my laptop/client):

wan (eth1):

[18:46:48]$ iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.0.19, port 49282
[  5] local 192.168.0.21 port 5201 connected to 192.168.0.19 port 49284
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec   107 MBytes   895 Mbits/sec                  
[  5]   1.00-2.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   2.00-3.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   3.00-4.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   4.00-5.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   5.00-6.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   6.00-7.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   7.00-8.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   8.00-9.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   9.00-10.00  sec   112 MBytes   939 Mbits/sec                  
[  5]  10.00-10.05  sec  5.32 MBytes   939 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-10.05  sec  0.00 Bytes  0.00 bits/sec                  sender
[  5]   0.00-10.05  sec  1.09 GBytes   935 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.0.19, port 49286
[  5] local 192.168.0.21 port 5201 connected to 192.168.0.19 port 49288
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  5]   0.00-1.00   sec   102 MBytes   851 Mbits/sec    0    576 KBytes       
[  5]   1.00-2.00   sec   111 MBytes   934 Mbits/sec    0    576 KBytes       
[  5]   2.00-3.00   sec   111 MBytes   933 Mbits/sec    0    576 KBytes       
[  5]   3.00-4.00   sec  80.3 MBytes   674 Mbits/sec    0    771 KBytes       
[  5]   4.00-5.00   sec  73.0 MBytes   613 Mbits/sec    0    771 KBytes       
[  5]   5.00-6.00   sec  73.5 MBytes   617 Mbits/sec    0    771 KBytes       
[  5]   6.00-7.00   sec  73.5 MBytes   617 Mbits/sec    0    771 KBytes       
[  5]   7.00-8.00   sec  73.5 MBytes   617 Mbits/sec    0    771 KBytes       
[  5]   8.00-9.00   sec  73.5 MBytes   617 Mbits/sec    0    771 KBytes       
[  5]   9.00-10.00  sec  73.5 MBytes   616 Mbits/sec    0    771 KBytes       
[  5]  10.00-10.04  sec  2.49 MBytes   523 Mbits/sec    0    771 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  5]   0.00-10.04  sec   847 MBytes   708 Mbits/sec    0             sender
[  5]   0.00-10.04  sec  0.00 Bytes  0.00 bits/sec                  receiver

lan0 (eth0):

Accepted connection from 192.168.0.19, port 49290
[  5] local 192.168.0.21 port 5201 connected to 192.168.0.19 port 49292
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec   107 MBytes   894 Mbits/sec                  
[  5]   1.00-2.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   2.00-3.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   3.00-4.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   4.00-5.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   5.00-6.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   6.00-7.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   7.00-8.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   8.00-9.00   sec   112 MBytes   939 Mbits/sec                  
[  5]   9.00-10.00  sec   112 MBytes   939 Mbits/sec                  
[  5]  10.00-10.05  sec  5.27 MBytes   935 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-10.05  sec  0.00 Bytes  0.00 bits/sec                  sender
[  5]   0.00-10.05  sec  1.09 GBytes   935 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.0.19, port 49294
[  5] local 192.168.0.21 port 5201 connected to 192.168.0.19 port 49296
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  5]   0.00-1.00   sec   106 MBytes   887 Mbits/sec    0    143 KBytes       
[  5]   1.00-2.00   sec  85.0 MBytes   713 Mbits/sec    0    583 KBytes       
[  5]   2.00-3.00   sec  73.5 MBytes   617 Mbits/sec    0    583 KBytes       
[  5]   3.00-4.00   sec  73.5 MBytes   617 Mbits/sec    0    583 KBytes       
[  5]   4.00-5.00   sec  73.5 MBytes   617 Mbits/sec    0    583 KBytes       
[  5]   5.00-6.00   sec  74.0 MBytes   621 Mbits/sec    0    583 KBytes       
[  5]   6.00-7.00   sec  73.3 MBytes   614 Mbits/sec    0    583 KBytes       
[  5]   7.00-8.00   sec  73.5 MBytes   617 Mbits/sec    0    583 KBytes       
[  5]   8.00-9.00   sec  73.4 MBytes   616 Mbits/sec    0    583 KBytes       
[  5]   9.00-10.00  sec  73.4 MBytes   615 Mbits/sec    0    583 KBytes       
[  5]  10.00-10.05  sec  3.01 MBytes   537 Mbits/sec    0    583 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  5]   0.00-10.05  sec   782 MBytes   653 Mbits/sec    0             sender
[  5]   0.00-10.05  sec  0.00 Bytes  0.00 bits/sec                  receiver

Today I did more tests.

As long as I do only connect 1 device to the lan ports (no matter which one) I do get ~200MBit/s with https://fast.com

If I connect more devices to the other lan ports, even if these device do not do any network communication, the more devices I do connect; the data-rate goes down to 3 MBit/s or even only some kbit/s.

  1. So I tried to not use arno-iptables-firewall, but did only activate forward and a masquerade rule, nothing else: Same result

  2. Then I thought maybe the bridge is the problem, so I removed the bridge and configured every lan port with it’s own subnet: same result

Then I thought maybe the MAC Addresses cause an issue, so I tried 2 different things:

  1. Give the same mac address to eth1 and wan, like it is the default: Same result
  2. Give every interface (eth0,eth1,lan0-lan3,wan) a different MAC address: Same result

So I have no idea what is causing this. BPI-R2 is not usable as router for my personal setup.

EDIT: tested with kernel 4.14.92_main selfcompiled and from frank’s github releases

1 Like

Important info that this issue only appears only if more than 1 lanport is connected as my tests are only over one lan/wan-port or from lan to wan.

On my main-router i also have only 1 lan connected because this lan is a trunk to managed switch there my other devices are connected

@Ryder.Lee / @moore / @linkerosa / @Jackzeng can bpi-r2 operate without dsa-driver in 4.14+ like it works in 4.4 (eth1 fixed to wan,eth0 to lan-ports)

As I mentioned in the other thread, I’m getting slow speeds. I’ll put my network configuration details in here.

My main router is a Netgear WNDR3800 running OpenWRT. I was testing out the banana pi r2, hoping it could replace the netgear. The netgear has an internal IP address of 192.168.15.1. It connects to my ISP using PPPOE. I posted details of its configuration on the OpenWRT board.

One of the lan ports of my router is connected to a switch. I am running the test between 2 computers. One of the computers, mihoshi is connected to that switch, and has an IP of 192.168.15.2. Because my main internet connection goes through PPPoE, mihoshi’s MTU is 1492.

The wan port of the Banana PI R2 is connected to the switch. The other computer, ryoko is connected to lan3 of the Banana Pi R2. The Banana Pi is performing a NAT translation between the two computers. I’ve set ryoko’s MTU to 1492 to match mihoshi’s.

Here’s how I’m measuring the speed:

$ ssh [email protected] 'cat /dev/zero' | pv >/dev/null
^C02GiB 0:01:29 [37.3MiB/s]

I think mihoshi and ryoko’s network settings are correct, because the gets about 90MiB/s when I use an expressobin instead of the banana pi.

Here is the configuration of my banana pi:

root@bpi-r2:~# uname -a
Linux bpi-r2 4.14.80-bpi-r2-main #177 SMP Sun Nov 11 10:03:58 CET 2018 armv7l GNU/Linux
root@bpi-r2:~# iptables-save 
# Generated by iptables-save v1.6.0 on Sun Jan 20 09:26:23 2019
*filter
:INPUT ACCEPT [8827:730234]
:FORWARD ACCEPT [54709:25786012]
:OUTPUT ACCEPT [9931:1198866]
COMMIT
# Completed on Sun Jan 20 09:26:23 2019
# Generated by iptables-save v1.6.0 on Sun Jan 20 09:26:23 2019
*nat
:PREROUTING ACCEPT [6742:849916]
:INPUT ACCEPT [3444:241724]
:OUTPUT ACCEPT [2492:166578]
:POSTROUTING ACCEPT [11:1615]
-A POSTROUTING -o wan -j MASQUERADE
COMMIT
# Completed on Sun Jan 20 09:26:23 2019
root@bpi-r2:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 3e:8c:11:69:29:8e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::3c8c:11ff:fe69:298e/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:b1:52:1b:25:98 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::50b1:52ff:fe1b:2598/64 scope link 
       valid_lft forever preferred_lft forever
4: wan@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 10000
    link/ether 52:b1:52:1b:25:98 brd ff:ff:ff:ff:ff:ff
    inet 192.168.15.140/24 brd 192.168.15.255 scope global wan
       valid_lft forever preferred_lft forever
    inet6 2602:ae:1592:e100:50b1:52ff:fe1b:2598/64 scope global mngtmpaddr dynamic 
       valid_lft forever preferred_lft forever
    inet6 fe80::50b1:52ff:fe1b:2598/64 scope link 
       valid_lft forever preferred_lft forever
5: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 3e:8c:11:69:29:8e brd ff:ff:ff:ff:ff:ff
6: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 3e:8c:11:69:29:8e brd ff:ff:ff:ff:ff:ff
7: lan2@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 3e:8c:11:69:29:8e brd ff:ff:ff:ff:ff:ff
8: lan3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
    link/ether 3e:8c:11:69:29:8e brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 3e:8c:11:69:29:8e brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.1/24 brd 192.168.2.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::3c8c:11ff:fe69:298e/64 scope link 
       valid_lft forever preferred_lft forever
root@bpi-r2:~# lsmod
Module                  Size  Used by
iptable_filter         16384  0
mtkhnat                24576  0
ipt_MASQUERADE         16384  1
nf_nat_masquerade_ipv4    16384  1 ipt_MASQUERADE
iptable_nat            16384  1
nf_conntrack_ipv4      16384  2
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4
nf_nat_ipv4            16384  1 iptable_nat
nf_nat                 32768  2 nf_nat_masquerade_ipv4,nf_nat_ipv4
nf_conntrack          126976  5 nf_conntrack_ipv4,ipt_MASQUERADE,nf_nat_masquerade_ipv4,nf_nat_ipv4,nf_nat
bridge                151552  0
mtk_thermal            16384  0
thermal_sys            61440  1 mtk_thermal
spi_mt65xx             20480  0
pwm_mediatek           16384  0
mt6577_auxadc          16384  0
nvmem_mtk_efuse        16384  0
mtk_pmic_keys          16384  0
rtc_mt6397             16384  1
ip_tables              24576  2 iptable_filter,iptable_nat
x_tables               28672  3 ip_tables,iptable_filter,ipt_MASQUERADE
ipv6                  409600  23 bridge

Since you said you had difficulty reproducing this, I ran a speed test to the internet from ryoko. Strangely, I am getting 355Mb/s download and 308Mb/s upload, which is much higher than I expected considering the problems talking to a much closer computer. When ryoko connects directly to the switch, it gets 553Mb/s download and 451Mb/s upload.