Support PCIe Ethernet RTL8125

Hi @frank-w

I’m porting an embedded PCIe ethernet module - RTL8125, on BPI-R4 board by using one of the SIM2 SIM3 slots as shown below, without WIFI plugin.

The product: PCle to 2.5GbE Ethernet (Realtek RTL8125) - RobotShop.

The official downloadable driver: Realtek PCIe FE / GbE / 2.5GbE / 5G / 10G Family Controller Software. It said 2.5G Ethernet LINUX driver r8125 for kernel up to 6.12.

It is plugged in to SIM2 slot but it seems inactivated:

root@bpi-r4:/# lspci
root@bpi-r4:/#
root@bpi-r4:/# ll /proc/bus/pci/*
-r--r--r-- 1 root root 0 Jul 11 19:52 /proc/bus/pci/devices
root@bpi-r4:/#
root@bpi-r4:/# cat /proc/bus/pci/devices
root@bpi-r4:/#

It is plugged in to SIM3 slot, PCI detected RTL8125 but the devices info is weird and pci errors are keep reporting behind the scenes:

root@bpi-r4:/# lspci
0001:00:00.0 PCI bridge: MEDIATEK Corp. Device 7988 (rev 01)
0001:01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
root@bpi-r4:/#
root@bpi-r4:/# ll /proc/bus/pci/*
-r--r--r-- 1 root root 0 Jul 11 19:55 /proc/bus/pci/devices

'/proc/bus/pci/0001:00':
total 0
dr-xr-xr-x 3 root root    0 Jul 11 19:55 ./
dr-xr-xr-x 5 root root    0 Jul 11 19:55 ../
-rw-r--r-- 1 root root 4096 Jul 11 19:55 00.0

'/proc/bus/pci/0001:01':
total 0
dr-xr-xr-x 3 root root    0 Jul 11 19:55 ./
dr-xr-xr-x 5 root root    0 Jul 11 19:55 ../
-rw-r--r-- 1 root root 4096 Jul 11 19:55 00.0
root@bpi-r4:/#
root@bpi-r4:/# cat /proc/bus/pci/devices
0000    14c37988        77              38300004                       0                       0                       0                     0                       0                       0                    8000                       0                     0                       0                       0                       0                       0      pcieport
0100    10ec8125        ff                200001                       0                38200004                       0              38220004                       0                38210000                     100                       0                 10000                       0                    4000                       0                   10000
root@bpi-r4:/#
root@bpi-r4:/# dmesg | grep -i pci | tail
[   81.135793] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:01:00.0
[   81.135806] pci 0001:01:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Transmitter ID)
[   81.135811] pci 0001:01:00.0:   device [10ec:8125] error status/mask=00001001/0000e000
[   81.135816] pci 0001:01:00.0:    [ 0] RxErr                  (First)
[   81.135821] pci 0001:01:00.0:    [12] Timeout
[   81.279606] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:01:00.0
[   81.279618] pci 0001:01:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Transmitter ID)
[   81.279624] pci 0001:01:00.0:   device [10ec:8125] error status/mask=00001001/0000e000
[   81.279629] pci 0001:01:00.0:    [ 0] RxErr                  (First)
[   81.279634] pci 0001:01:00.0:    [12] Timeout
root@bpi-r4:/#
root@bpi-r4:/# dmesg | grep -i pci | tail
[   85.703039] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:01:00.0
[   85.703057] pci 0001:01:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Transmitter ID)
[   85.703063] pci 0001:01:00.0:   device [10ec:8125] error status/mask=00001001/0000e000
[   85.703068] pci 0001:01:00.0:    [ 0] RxErr                  (First)
[   85.703074] pci 0001:01:00.0:    [12] Timeout
[   85.862519] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:01:00.0
[   85.862533] pci 0001:01:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Transmitter ID)
[   85.862539] pci 0001:01:00.0:   device [10ec:8125] error status/mask=00001001/0000e000
[   85.862544] pci 0001:01:00.0:    [ 0] RxErr                  (First)
[   85.862549] pci 0001:01:00.0:    [12] Timeout
root@bpi-r4:/# [  102.072806] pci 0001:01:00.0: AER:   Error of this Agent is reported first

root@bpi-r4:/#
root@bpi-r4:/# dmesg | grep -i pci | tail
[  108.407371] pcieport 0001:00:00.0:   device [14c3:7988] error status/mask=00000001/00006000
[  108.407377] pcieport 0001:00:00.0:    [ 0] RxErr                  (First)
[  108.423236] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:00:00.0
[  108.423244] pcieport 0001:00:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Receiver ID)
[  108.423249] pcieport 0001:00:00.0:   device [14c3:7988] error status/mask=00000001/00006000
[  108.423254] pcieport 0001:00:00.0:    [ 0] RxErr                  (First)
[  108.432535] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:00:00.0
[  108.432543] pcieport 0001:00:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Receiver ID)
[  108.432547] pcieport 0001:00:00.0:   device [14c3:7988] error status/mask=00000001/00006000
[  108.432551] pcieport 0001:00:00.0:    [ 0] RxErr                  (First)
root@bpi-r4:/#
root@bpi-r4:/# dmesg | grep -i pci | tail
[  213.764355] pcieport 0001:00:00.0:    [ 0] RxErr                  (First)
[  213.774747] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:00:00.0
[  213.774755] pcieport 0001:00:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Receiver ID)
[  213.774760] pcieport 0001:00:00.0:   device [14c3:7988] error status/mask=00000001/00006000
[  213.774765] pcieport 0001:00:00.0:    [ 0] RxErr                  (First)
[  213.848725] pcieport 0001:00:00.0: AER: Multiple Correctable error message received from 0001:01:00.0
[  213.848734] pci 0001:01:00.0: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Transmitter ID)
[  213.848738] pci 0001:01:00.0:   device [10ec:8125] error status/mask=00001001/0000e000
[  213.848743] pci 0001:01:00.0:    [ 0] RxErr                  (First)
[  213.848748] pci 0001:01:00.0:    [12] Timeout
root@bpi-r4:/#

As it provided driver resources with Linux kernel up to 6.12, it should be at least portable to your Linux 6.12-main branch?

Inside the tarball, there are source code and Makefiles for it. How can we build it in kernel?

Thanks

I guess you mean pcie#2/3? But afair the mpcie slots are pcie0+1

Nethertheless lspcie should see the card is bot slots. But be careful to have 12V switched off!

For driver part you can fork my repo and then you could integrate the driver in correct folder (drivers/pcie/…) add to kconfig and makefile and enable it in your defconfig for r4.

From 6.16, it is included in linux kernel.

Yes, these two:

image

However, plugging to pcie0 (SIM2) that has nothing happened, while plugging to pcie1 (SIM3) that keeps reporting pcie errors.

My R4 is currently running on linux 6.17 Ubuntu noble.

There are reports of some m.2 to mpcie adapters not functioning, while others are. The same may be for the pcie to mpcie adapter you are using, it may also be cause of the problem.

Does the pcie card use 5V or 12V? Do you need to supply that? Or does the adapter create these voltages then is 3.3v overloaded?

Could try a m.2 rtl8125 card with adapter, it is designed to use 3.3v, not any higher voltages., You might have more luck or maybe not. Perhaps even trying different models of adapters.

Another note, using the rtl8125, it cannot be used with hardware offloading of the flow, if you would ever want to use it. In this case you may be better off using a sfp module with the rtl8221b accessible through rollball protocol.

The PCIe RTL8125 should be exactly this one: https://www.amazon.co.uk/2-5Gbase-T-Realtek-RTL8125-Network-Ethernet/dp/B0B7RZ9JWM

I found “Voltage voltage: 3.3V_AUX, 12V, 3.3V.” from the page.

About the pcie-mpcie adapter, I think it does accept and transfer reasonable voltage from the BPI-R4 input. The extra 12V switch supply can be turned off. I plugged-in the adapter which 4 LEDs just lighted up.

And I have tested the PCIe RTL8125 with pcie-mpcie adapter plugged-in on the original shipped BPI-R4 NAND Openwrt firmware. The result is:

  • pcie0 (mPCIe SIM2 slot) interface did not report any PCI devices.
  • pcie1 (mPCIe SIM3 slot) interface reported the board PCI bridge and RTL8125. It seems look good but it should have no specific linux driver enabled.

So I can probably confirm the PCIe RTL8125 and pci-mpcie adapter are good to the pcie1 (mPCIe SIM3 slot).

Do you mean to set the SFP module as disabled in .dts?

image

image

I mean using the sfp instead of a PCIe ethernet interface. Only using the internal mac (or mtk-wifi) it is possible to use hardware flow offloading. In the case of the R4, one could choose a 10G sfp instead.

If you do not plan to use hardware offloading of flow, then both options are ok.

But of course, it is always nice to know if the PCIe to mpcie adapter works and if the rtl8125 can be used. Would need to test under full load, pulling the maximum watts.