Realtek 8156B 2.5G for Pi 4 and OpenWrt 21.02.2

I'm trying to install a 2.5GB usb ethernet adapter to a Pi4. The chipset is RTL8156 / RTL8156B(S)(G)
Reading the Realtek site the 8152 driver should support this.
I can see the usb device , but the driver does not appear to work. Reading the forums most are over 2 years old and involve rebuilding openwrt.
Is this the only way.
I have downloaded the driver from realtek and compiled on ubuntu, then coped the files over the one on the Pi , but no difference.

Where do i start ?

root@OpenWrt:~# lsusb
Bus 002 Device 002: ID 0bda:8156 Realtek USB 10/100/1G/2.5G LAN
Bus 002 Device 001: ID 1d6b:0003 Linux 5.4.179 xhci-hcd xHCI Host Controller
Bus 001 Device 002: ID 2109:3431  USB2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux 5.4.179 xhci-hcd xHCI Host Controller
root@OpenWrt:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 2: Dev 2, If 0, Class=, Driver=, 5000M
    |__ Port 2: Dev 2, If 1, Class=, Driver=, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=, Driver=hub/4p, 480M

What does dmesg say when you insert the adapter?

Does modinfo list the same PID and VID as "supported" ?

Based on my experiences, 21.02.2 doesn't support this correctly yet. I was able to get my Asus USB-C2500 (8152 based) to be recognized and work only after I did a custom build of the master branch with a 5.10.x kernel.

Best of luck!

@frollic

here is the modinfo and dmesg

[ 3775.266336] usb 2-2: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[ 3775.291512] usb 2-2: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=31.00
[ 3775.299715] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=6
[ 3775.306873] usb 2-2: Product: USB 10/100/1G/2.5G LAN
[ 3775.311858] usb 2-2: Manufacturer: Realtek
[ 3775.315970] usb 2-2: SerialNumber: XXXXXXXXXX
root@OpenWrt:~# modinfo r8152
module:         /lib/modules/5.4.179/r8152.ko
license:        GPL
depends:
intree:         Y
name:           r8152
vermagic:       5.4.179 SMP mod_unload aarch64

Based on the comment by @rahlquist, you might want to try the snapshots instead.

I will do , is there any documents about how to build the driver you self . I build on ubuntu and then copied but this is probably not the way and did not work. I could then build an ipk file ?

FWIW I did not have to do anything to manually add the driver(other than setting them to M or Y in make menuconfig) to sources before doing my custom compile.

Pulled the sources, configured, compiled and it worked.

You might just want to try one of the latest snapshots. That way you dont have to muck with compiling. I'm willing to bet it would work then.

There are snapshot for 22.03 https://downloads.openwrt.org/releases/22.03-SNAPSHOT/targets/ , I don't have that kind of adapter to test, but maybe it could work.

1 Like

@Gost6 Nice recommendation,

Did the install on 22.03 snapshot and then installed the 8152 driver, this time there were two drivers which were dependant on each other (and larger in size similar to the version i compiled). after a reboot up came the nic and i can ping from another server.

I checked the speed/duplex

root@OpenWrt:~# ethtool eth1
Settings for eth1:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
                                2500baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
                                             2500baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Auto-negotiation: on
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00007fff (32767)
                               drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
        Link detected: yes

and it default to 1000/full

forced it across

root@OpenWrt:~# ethtool -s eth1 speed 2500 duplex full
root@OpenWrt:~# ethtool eth1
Settings for eth1:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
                                2500baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  2500baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
                                             2500baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 2500Mb/s
        Duplex: Half
        Auto-negotiation: on
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00007fff (32767)
                               drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol

Its set to 2500 half :frowning:

discovered you cant turn off auto negotiation

As a test i plugged the adapter and network cable in to a windows machine to see if the cable / switch / doble were good and they came back at

2500/full

Get-NetAdapter | SELECT name, LinkSpeed, fullduplex | ft -autosize

name                         LinkSpeed fullduplex
----                         --------- ----------
Ethernet 5                   2.5 Gbps        True

Any idea where to look next ?

I think this may be a bug in the beta code
as the advertised modes have switched back to 1000/full as has the negotiation.

What is everyone view, and if everyone believes its a bug , where do i report

Thanks for all the help so far.

root@OpenWrt:/etc/config# ethtool eth1
Settings for eth1:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
                                2500baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        **Advertised link modes:  10baseT/Half 10baseT/Full**
**                                100baseT/Half 100baseT/Full**
**                                1000baseT/Full**
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
                                             2500baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        **Speed: 1000Mb/s**
**        Duplex: Full**
        Auto-negotiation: on
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00007fff (32767)
                               drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol

These adapters should work on the current snapshot.

Unrelated, but If your adapter has a USB type C to USB 3 try inverting the USB C connector I seen performance increase doing this when I connect an external ssd drive.

1 Like

Found it,

From the reading i did last night with the new interfaces 2.5GB + you can't force the speed and duplex. Lets face it unless there was a bug somewhere forcing the speeds just caused network hangs any way.

The fix is to control the advertising
I added
ethtool -s eth1 autoneg on advertise 0x80000000002f

to /etc/rc.local on the openwrt snapshot 21.02.3

and it works.

        Speed: 2500Mb/s
        Duplex: Full
        Auto-negotiation: on

My goal here is to be able to route almost 1.2gps, with a 2.5GB lan interface, then bonding two 1GB nics (the built in one and another USB one.)

If anyone is interested I will post the results.

3 Likes

Please do as I will be doing similar possibly

So far i built a pi4 B (8GB) in three configurations

Config 1

Openwrt 21.02

Current OpenWRT released build 21.02

1 gig usb dongle(wan) and network port(lan).

Enabled software acceleration / irq balancing and receive packet steering

Modules installed: kmod-boding , kmod-usb-net-ax88179 , mii-tool , mwan3

On a near 1.2Gb connection got about 840-860 mbs

Very low cpu utilisation, sirq in the low percent , can’t see where the bottle next is, but I must be getting close the net port max especially when you take in to account overheads.

I read on the forums that if you bond the wan connections, you may get more.

Config 2

Openwrt 21.02

2 x 1 gig usb dongle(wan) bonded round robin and network port(lan).

Enabled software acceleration / irq balancing and receive packet steering / mwan3

Modules installed kmod-boding , kmod-usb-net-ax88179 , mii-tool , mwan3

On a near 1.2Gb connection got about 890-920 mbs

That’s better, I could see the traffic going across both wan ports (not evenly balanced but it works)

This now points the lan port

Config 3

Openwrt 21.03

1 x 1 gig usb dongle(wan) + onboard network bonded round robin

1x2.5gb usb dongle for lan

Enabled software acceleration / irq balancing and receive packet steering

Modules installed kmod-boding , kmod-usb-net-ax88179 , mii-tool , mwan3, r8152 drivers

On a near 1.2Gb connection got about 290 - 320 mbs (that’s the magic number for USB2 , but the dongles are using the usb3 ports) I know they both share a single channel , but a single channel on USB3 is big enough)

I did have a lot of issues, but this is beta s/w.

The issues so far:

Openwrt 21.02 had an old driver for r8252. The new r8152 driver also support the R8256b (my chip in the 2.5gb dongle).

The 2.5gb interface by default runs at 1000/full and required the advertised links to be changed (see above)

Mwan3 complains about iptables-legacy and iptables-legacy6 - Resolved by installing the modules

The usb nic for the bonding at boot stays down, and hence the bond will not start, When you do start it the shell freezes and disconnects, even though I am using the wan. most strange

Requires ip link set ethx up

The poor performance (still looking into this)

1 Like

Think i'm getting there. I'm trying to set up a round robin bond for virgin
using this as a guide

if i turn arp off on the bond using

ip link set ${interface name} arp off

nothing gets transferred (fair enough). How do i set up manual arp entries for bond 0 which uses eth0 and eth2. I believe that are looking for a single arp for the bond. Currently the arp for the bond is the same as eth0

Think i am going to to give up on this for a while. It appears no one knows the answer above. With iperf3 i can get 2.3 Gb down and about 1.5gb up, but i know there are issues with the driver. Alsop when running in a bond i'm loosing 50% throughput, disconnecting either cable instantly increased the throughput by 100%

You are doing better than I have been. If I lock the adapter in my laptop to 1Gbps I get that speed from iperf3. If I let it autonegotiate to 2.5 best I can get from iperf is 608Mbps...

That is on my own compile though.
Linux ghost 5.15.45 #0 SMP Sat Jun 11 19:22:58 2022 x86_64 GNU/Linux

What's been pointed out before, there's a reason why you don't see Realtek or USB at all in network appliances where stability and throughput is a priority. There are also reports of 2.5G adapters running hot leading to various interesting issues. What you could try is to use CDC-NCM mode (which Realtek controllers "should" support) to see if that helps in terms of performance but I wouldn't hold my breath. According to https://en.wikipedia.org/wiki/USB_3.0 effective throughput is about 4Gbit/s on USB 3.0 although I think it's probably safe to say that your run of the mill cheap as chips SoC wont do that reliably so what you're getting running iperf3 is most likely about the limit of what the hardware can do.

1 Like

Mine is currently using cdc-ncm which at least on my custom build is broken somewhat it seems because ethtool is not happy.

root@ghost:/mnt/usb1/openwrt/bin/packages/x86_64/packages# ethtool eth3
Settings for eth3:
        Supported ports: [  ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 2500Mb/s
        Duplex: Half
        Auto-negotiation: off
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        MDI-X: Unknown
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
root@ghost:/mnt/usb1/openwrt/bin/packages/x86_64/packages# ip link show dev eth3
15: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 9c:b6:d0:3c:20:6e brd ff:ff:ff:ff:ff:ff
root@ghost:/mnt/usb1/openwrt/bin/packages/x86_64/packages# lsusb
Bus 001 Device 002: ID 0438:7900
Bus 003 Device 008: ID 152d:1561 SABRENT SABRENT
Bus 001 Device 001: ID 1d6b:0002 Linux 5.15.45 ehci_hcd EHCI Host Controller
Bus 003 Device 007: ID 1a56:3100 Rivet USB 10/100/1G/2.5G LAN
Bus 003 Device 006: ID 2109:8110 VIA Labs, Inc.          USB3.0 Hub
Bus 002 Device 003: ID 2109:2811 VIA Labs, Inc.          USB2.0 Hub
Bus 002 Device 001: ID 1d6b:0002 Linux 5.15.45 xhci-hcd xHCI Host Controller
Bus 003 Device 001: ID 1d6b:0003 Linux 5.15.45 xhci-hcd xHCI Host Controller
root@ghost:/mnt/usb1/openwrt/bin/packages/x86_64/packages# lsusb -t
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
    |__ Port 1: Dev 6, If 0, Class=, Driver=hub/4p, 5000M
        |__ Port 2: Dev 8, If 0, Class=, Driver=usb-storage, 5000M
        |__ Port 4: Dev 7, If 0, Class=, Driver=cdc_ncm, 5000M
        |__ Port 4: Dev 7, If 1, Class=, Driver=cdc_ncm, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
    |__ Port 1: Dev 3, If 0, Class=, Driver=hub/4p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=, Driver=hub/4p, 480M

What I have found today incontrovertably is @slh is correct. APU2 is on verge of EOL. iperf3 or iperf running 1 instance cpu limits the speed when a 2.5Gbps adapter gets used at a link speed of 2.5Gbps.

If I use the router as iperf 2 or 3 client I can get 1.1Gbps over the 2.5Gbps link. So looks like its time to upgrade.

As for my adapters;
Killer E3100 USB-C 3.1 to RJ-45 2.5Gbps Ethernet Adapter (100123) Realtek R8169 based
ASUS 2.5G Ethernet USB Adapter (USB-C2500) Realtek R8152 based

Both have issues on other linux platforms as well. I can barely get them functional on manjaro using just normal repo modules/drivers/firmware

My only other possible way to get more than 1Gbps out of this is something like https://www.aliexpress.com/item/3256803346704168.html?gatewayAdapt=4itemAdapt

Its a damn shame, the APU is a great unit, but with my inbound traffic capable of 1.2Gbps I want more capability.