GithubHelp home page GithubHelp logo

csrutil / realtek-r8125-openwrt Goto Github PK

View Code? Open in Web Editor NEW
60.0 3.0 14.0 572 KB

realtek 8125b 2.5G ethernet driver for OpenWrt firmware

License: GNU General Public License v3.0

Makefile 0.75% C 99.04% Shell 0.21%
openwrt j4125 r8125 igb i211 i210

realtek-r8125-openwrt's Introduction

RTL8125B OpenWrt Driver

The repository is for building the Realtek 8125b driver for OpenWrt firmwares

Build Realtek r8125 driver for OpenWrt

Realtek RTL8125 / RTL8125B(S)(G)

The latest version of the driver has the RSS feature enable by default🎉

root@main:~# cat /proc/interrupts | grep 'CPU\|eth' | grep -v '0          0'
           CPU0       CPU1
 48:          1    8359439   PCI-MSI 3407888-edge      eth0-16
 50:    4146137    4039293   PCI-MSI 3407890-edge      eth0-18
 53:          0          1   PCI-MSI 3407893-edge      eth0-21
 64:    9385347          0   PCI-MSI 3424256-edge      eth1-0
 65:    3943462    3345782   PCI-MSI 3424257-edge      eth1-1
 80:          1    9252867   PCI-MSI 3424272-edge      eth1-16
 82:    3606778    3428598   PCI-MSI 3424274-edge      eth1-18
 85:          0          1   PCI-MSI 3424277-edge      eth1-21

root@main:~# cat /proc/net/r8125/eth*/debug/driver_var  | grep Rss
EnableRss       0x1
EnableRss       0x1

Setup

Attention⚠️, only support official firmware. If you are compiling your own firmware, please refer to the scripts in the action.

First, download the corresponding ipk file according to your version, scp it to your device, and then run

opkg -i kmod-r8125_4.14.275+9.011.01-x86-0_x86_64.ipk

If you are using the 5.15 kernel, the r8196 driver should automatically drive your network card. If you want to force the use of the driver from this project, you can delete the r8196 driver.

QA

if you're not the right speed, please check this command.

# https://forum.openwrt.org/t/realtek-8156b-2-5g-for-pi-4-and-openwrt-21-02-2/125102/11
ethtool -s eth1 autoneg on advertise 0x80000000002f

Donating 💸

  • Feel free to Buy Me a Coffee
  • XHV hvxyGJc7axz1hiQCiXVcrrLJbjhbkHHuuC4auW9oJTbCcWEg7x14VgmfWPkxEThLsSfq4Ss9uuTLqYGe8ugFqnQe6Daa2hj2L7

Credits

realtek-r8125-openwrt's People

Contributors

csrutil avatar usbhost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

realtek-r8125-openwrt's Issues

no queues

log is here

root@OpenWrt:~# dmesg   | grep r8125
[    5.792088] r8125 2.5Gigabit Ethernet driver 9.010.01-NAPI-RSS loaded
[    5.808613] r8125: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[    5.811352] r8125  Copyright (C) 2022 Realtek NIC software team <[email protected]>
[    5.813264] r8125 2.5Gigabit Ethernet driver 9.010.01-NAPI-RSS loaded
[    5.831110] r8125: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[    5.833851] r8125  Copyright (C) 2022 Realtek NIC software team <[email protected]>
[    5.835735] r8125 2.5Gigabit Ethernet driver 9.010.01-NAPI-RSS loaded
[    5.853713] r8125: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[    5.856464] r8125  Copyright (C) 2022 Realtek NIC software team <[email protected]>
[    5.858328] r8125 2.5Gigabit Ethernet driver 9.010.01-NAPI-RSS loaded
[    5.876295] r8125: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[    5.879029] r8125  Copyright (C) 2022 Realtek NIC software team <[email protected]>
[   10.086013] r8125: eth0: link up
root@OpenWrt:~# ethtool -S eth0 | grep q
root@OpenWrt:~# ethtool -S eth0
NIC statistics:
     tx_packets: 641
     rx_packets: 1340
     tx_errors: 0
     rx_errors: 0
     rx_missed: 0
     align_errors: 0
     tx_single_collisions: 0
     tx_multi_collisions: 0
     unicast: 521
     broadcast: 754
     multicast: 65
     tx_aborted: 0
     tx_underrun: 0
     tx_octets: 151034
     rx_octets: 126269
     rx_multicast64: 0
     tx_unicast64: 544
     tx_broadcast64: 17
     tx_multicast64: 80
     tx_pause_on: 0
     tx_pause_off: 0
     tx_pause_all: 0
     tx_deferred: 0
     tx_late_collision: 0
     tx_all_collision: 0
     tx_aborted32: 0
     align_errors32: 0
     rx_frame_too_long: 0
     rx_runt: 0
     rx_pause_on: 0
     rx_pause_off: 0
     rx_pause_all: 0
     rx_unknown_opcode: 0
     rx_mac_error: 0
     tx_underrun32: 0
     rx_mac_missed: 11
     rx_tcam_dropped: 0
     tdu: 0
     rdu: 0

23.05 build error

23.05 build error

make[3]: Entering directory '/home/sjkhsl/openwrt-23.05/package/chajianbao/r8125'
touch /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/.prepared_a5a50cc73b09974d442155bf602a99f5_6664517399ebbbc92a37c5bb081b5c53_check
true
[ ! -d ./src/ ] || cp -fpR ./src/. /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01
touch /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/.prepared_a5a50cc73b09974d442155bf602a99f5_6664517399ebbbc92a37c5bb081b5c53
rm -f /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/.configured_*
rm -f /home/sjkhsl/openwrt-23.05/staging_dir/target-x86_64_musl/stamp/.r8125_installed
(cd /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/./; if [ -x ./configure ]; then find /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/ -name config.guess | xargs -r chmod u+w; find /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/ -name config.guess | xargs -r -n1 cp --remove-destination /home/sjkhsl/openwrt-23.05/scripts/config.guess; find /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/ -name config.sub | xargs -r chmod u+w; find /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/ -name config.sub | xargs -r -n1 cp --remove-destination /home/sjkhsl/openwrt-23.05/scripts/config.sub; AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-musl-gcc -c -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01=r8125-9.011.01 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=x86_64-openwrt-linux-musl-ld NM="x86_64-openwrt-linux-musl-gcc-nm" CC="x86_64-openwrt-linux-musl-gcc" GCC="x86_64-openwrt-linux-musl-gcc" CXX="x86_64-openwrt-linux-musl-g++" RANLIB="x86_64-openwrt-linux-musl-gcc-ranlib" STRIP=x86_64-openwrt-linux-musl-strip OBJCOPY=x86_64-openwrt-linux-musl-objcopy OBJDUMP=x86_64-openwrt-linux-musl-objdump SIZE=x86_64-openwrt-linux-musl-size CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01=r8125-9.011.01 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01=r8125-9.011.01 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/usr/include -I/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/include/fortify -I/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/include " LDFLAGS="-L/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/usr/lib -L/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib -znow -zrelro "   ./configure --target=x86_64-openwrt-linux --host=x86_64-openwrt-linux --build=x86_64-pc-linux-gnu --disable-dependency-tracking --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  ; fi; )
touch /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/.configured_68b329da9893e34099c7d8ad5cb9c940
rm -f /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/.built
touch /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/.built_check
make -C /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01 PATH="/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/bin:/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/bin:/home/sjkhsl/openwrt-23.05/staging_dir/host/bin:/home/sjkhsl/openwrt-23.05/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/bin:/home/sjkhsl/openwrt-23.05/staging_dir/host/bin:/home/sjkhsl/openwrt-23.05/staging_dir/host/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" ARCH="x86" CROSS_COMPILE="x86_64-openwrt-linux-musl-" TARGET="" TOOLPREFIX="x86_64-openwrt-linux-musl-" TOOLPATH="x86_64-openwrt-linux-musl-" KERNELPATH="/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/linux-5.15.112" KERNELDIR="/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/linux-5.15.112" LDOPTS=" " DOMULTI=1 modules
make[4]: Entering directory '/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01'
make -C /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/linux-5.15.112 M=/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01 modules
make[5]: Entering directory '/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/linux-5.15.112'
  CC [M]  /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_n.o
  CC [M]  /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/rtl_eeprom.o
  CC [M]  /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/rtltool.o
  CC [M]  /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.o
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c: In function 'rtl8125_get_rss_hash_opts':
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:59:27: error: this statement may fall through [-Werror=implicit-fallthrough=]
   59 |                 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:61:9: note: here
   61 |         case UDP_V4_FLOW:
      |         ^~~~
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:62:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
   62 |                 if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4)
      |                    ^
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:65:9: note: here
   65 |         case IPV4_FLOW:
      |         ^~~~
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:69:27: error: this statement may fall through [-Werror=implicit-fallthrough=]
   69 |                 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:71:9: note: here
   71 |         case UDP_V6_FLOW:
      |         ^~~~
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:72:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
   72 |                 if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6)
      |                    ^
/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.c:75:9: note: here
   75 |         case IPV6_FLOW:
      |         ^~~~
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:289: /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/r8125_rss.o] Error 1
make[5]: *** [Makefile:1906: /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01] Error 2
make[5]: Leaving directory '/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/linux-5.15.112'
make[4]: *** [Makefile:188: modules] Error 2
make[4]: Leaving directory '/home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01'
make[3]: *** [Makefile:43: /home/sjkhsl/openwrt-23.05/build_dir/target-x86_64_musl/linux-x86_64/r8125-9.011.01/.built] Error 2
make[3]: Leaving directory '/home/sjkhsl/openwrt-23.05/package/chajianbao/r8125'
time: package/chajianbao/r8125/compile#3.52#2.64#6.23
    ERROR: package/chajianbao/r8125 failed to build.
make[2]: *** [package/Makefile:120: package/chajianbao/r8125/compile] Error 1
make[2]: Leaving directory '/home/sjkhsl/openwrt-23.05'
make[1]: *** [package/Makefile:114: /home/sjkhsl/openwrt-23.05/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/sjkhsl/openwrt-23.05'
make: *** [/home/sjkhsl/openwrt-23.05/include/toplevel.mk:231: world] Error 2

Always link down (23.05 )

root@OpenWrt:~# uname -a
Linux OpenWrt 5.15.134 #0 SMP Mon Oct 9 21:45:35 2023 x86_64 GNU/Linux

kernel log:
[ 1482.059393] eth0: 0xffffc90000300000, c4:83:4f:16:0c:85, IRQ 22
[ 1482.138852] eth1: 0xffffc900003d0000, c4:83:4f:16:0c:86, IRQ 22
[ 1482.224484] eth2: 0xffffc90000410000, c4:83:4f:16:0c:87, IRQ 22
[ 1484.991950] r8125: eth0: link up
[ 1484.993361] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 1485.081837] r8125: eth1: link up
[ 1485.083243] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 1485.141828] r8125: eth2: link up
[ 1485.143220] IPv6: ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready
[ 1490.313320] pppoe-PPPoE: renamed from ppp0

openwrt snapshot linux 6.1.29 driver autoneg stick to 1000mb/s, forcing via ethtool works

I was able to compile on openwrt snapshot using kernal 6.1.29 (for the nanopi R5C),

yet I see 1 PCI error (copy paste below) after boot/init and the interface if stuck in 1000 ful-duplex until I force it with ethtool (then it works ok full speed)

Any idea where this could come from or if you experience the 1Gps issue?

kern.info kernel: [   19.872045] r8125: eth0: link up
Tue May 23 02:11:40 2023 kern.info kernel: [   19.872376] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Tue May 23 02:11:41 2023 kern.info kernel: [   20.519515] pcieport 0002:00:00.0: AER: Multiple Corrected error received: 0002:00:00.0
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.520260] pcieport 0002:00:00.0: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Receiver ID)
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.521113] pcieport 0002:00:00.0:   device [1d87:3566] error status/mask=00000041/0000e000
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.521844] pcieport 0002:00:00.0:    [ 0] RxErr                  (First)
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.522438] pcieport 0002:00:00.0:    [ 6] BadTLP
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.522984] r8125 0002:01:00.0: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Transmitter ID)
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.523851] r8125 0002:01:00.0:   device [10ec:8125] error status/mask=00001001/0000e000
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.524573] r8125 0002:01:00.0:    [ 0] RxErr                  (First)
Tue May 23 02:11:41 2023 kern.warn kernel: [   20.525145] r8125 0002:01:00.0:    [12] Timeout

r8125b跑不满带宽?

我直接clone你的r8125源码,加入到openwrt官方master分支编译,软路由J4125+r8125b安装pve+openwrt,总是跑不满带宽,1000M的宽带,只能跑600多~700多的样子,是什么情况?你有这种情况吗?

RSS question

Hi! Thank you for releasing drivers with RSS for openwrt!
i can't get the documentation, you set 2 cores for intel i211 2 queues for 2 nic's

For example i have x2 i210 nic's with 4 queues and 2 core 4 thread cpu, should i put RSS=4,8? or 2,4? RSS=x,y?

Is there any chance for the intel i226-v driver port to the kernel 4.14.275 (OpenWrt 19.07.x) ?

First, thanks for the GREAT job 👍 , the r8125b 2.5G NIC works very well on my X86 Router (OpenWrt 19.07.10).
Now I'm going to buy another machine :
( https://cwwk.net/products/the-12th-generation-u-series-small-and-large-core-mixed-architecture-mini-host )
It is built in with 6 intel i226-v NIC.
For some reason, I'd like to run OpenWrt 19.07.10, because the kernel 4.14.275 is more stable than the kernel 5.x .
Could you please compile a driver ipk for the OpenWrt 19.07.x with intel i226-v NIC ?
Thank you very much.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.