[Plugin] Realtek R8125 R8168 and R8152\6 drivers


Recommended Posts

Hello everyone,

I had a kernel panic today. Some setting on the network card does not seem to be ok. Have any of you seen this or even managed to solve it?

 

01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 54
        IOMMU group: 10
        ...
        Kernel driver in use: r8168
        Kernel modules: r8169, r8168
root@Storage:~# ethtool -i eth0
driver: r8168
version: 8.052.01-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
root@Storage:~# modinfo r8168
filename:       /lib/modules/6.1.64-Unraid/kernel/drivers/net/ethernet/realtek/r8168.ko.xz
version:        8.052.01-NAPI
license:        GPL
description:    RealTek RTL-8168 Gigabit Ethernet driver
author:         Realtek and the Linux r8168 crew <netdev@vger.kernel.org>
[Thu Feb  8 13:00:16 2024] r8168: loading out-of-tree module taints kernel.
[Thu Feb  8 13:00:16 2024] r8168 Gigabit Ethernet driver 8.052.01-NAPI loaded
[Thu Feb  8 13:00:16 2024] r8168 0000:01:00.0: enabling device (0000 -> 0003)
[Thu Feb  8 13:00:16 2024] r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[Thu Feb  8 13:00:16 2024] r8168  Copyright (C) 2023 Realtek NIC software team <[email protected]>
[Thu Feb  8 13:00:16 2024] r8168 Gigabit Ethernet driver 8.052.01-NAPI loaded
[Thu Feb  8 13:00:16 2024] r8168 0000:02:00.0: enabling device (0000 -> 0003)
[Thu Feb  8 13:00:16 2024] r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[Thu Feb  8 13:00:16 2024] r8168  Copyright (C) 2023 Realtek NIC software team <[email protected]>
[Thu Feb  8 13:00:18 2024] r8168 Gigabit Ethernet driver 8.052.01-NAPI loaded
[Thu Feb  8 13:00:18 2024] r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[Thu Feb  8 13:00:18 2024] r8168  Copyright (C) 2023 Realtek NIC software team <[email protected]>
[Thu Feb  8 13:00:18 2024] r8168 Gigabit Ethernet driver 8.052.01-NAPI loaded
[Thu Feb  8 13:00:18 2024] r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[Thu Feb  8 13:00:18 2024] r8168  Copyright (C) 2023 Realtek NIC software team <[email protected]>
[Thu Feb  8 13:06:31 2024] r8168: eth0: link up
[Thu Feb  8 13:06:35 2024] r8168: eth1: link up
[Thu Feb  8 13:26:11 2024] r8168: eth0: link up
[Thu Feb  8 13:31:07 2024] r8168: eth1: link up
[Thu Feb  8 13:41:47 2024] r8168: eth0: link up
[Thu Feb  8 23:14:11 2024] r8168: eth1: link up
...
[Sat Feb 10 00:46:12 2024] r8168: eth1: link up
[Sat Feb 10 01:35:56 2024] r8168: eth1: link up
[Sat Feb 10 01:43:00 2024] r8168: eth1: link up
[Sat Feb 10 01:48:23 2024] r8168 0000:01:00.0 eth0: test_phy_ocp ResetPhyType = 0x02
[Sat Feb 10 01:48:30 2024] WARNING: CPU: 11 PID: 16114 at /usr/src/unraid-r8125-r8152-driver/r8168/src/r8168_n.c:8418 rtl8168_wait_phy_state_ready.isra.0+0x50/0x64 [r8168]
[Sat Feb 10 01:48:30 2024] Modules linked in: macvlan udp_diag cdc_acm xt_CHECKSUM ipt_REJECT nf_reject_ipv4 ip6table_mangle ip6table_nat iptable_mangle vhost_net tun vhost vhost_iotlb tap xt_nat xt_tcpudp veth xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xt_addrtype br_netfilter xfs md_mod zfs(PO) zunicode(PO) zzstd(O) zlua(O) zavl(PO) icp(PO) zcommon(PO) znvpair(PO) spl(O) tcp_diag inet_diag corefreqk(O) ip6table_filter ip6_tables iptable_filter ip_tables x_tables efivarfs bridge stp llc r8168(O) amdgpu edac_mce_amd edac_core intel_rapl_msr intel_rapl_common iosf_mbi kvm_amd kvm gpu_sched drm_buddy i2c_algo_bit drm_ttm_helper ttm drm_display_helper crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel sha512_ssse3 sha256_ssse3 sha1_ssse3 wmi_bmof aesni_intel drm_kms_helper crypto_simd ahci cryptd drm rapl libahci k10temp i2c_piix4 nvme amd_sfh agpgart nvme_core i2c_core syscopyarea ccp sysfillrect
[Sat Feb 10 01:48:30 2024]  sysimgblt fb_sys_fops tpm_crb video tpm_tis tpm_tis_core wmi tpm backlight acpi_cpufreq button unix [last unloaded: r8168(O)]
[Sat Feb 10 01:48:30 2024] Workqueue: events rtl8168_esd_task [r8168]
[Sat Feb 10 01:48:30 2024] RIP: 0010:rtl8168_wait_phy_state_ready.isra.0+0x50/0x64 [r8168]
[Sat Feb 10 01:48:30 2024]  ? rtl8168_wait_phy_state_ready.isra.0+0x50/0x64 [r8168]
[Sat Feb 10 01:48:30 2024]  ? rtl8168_wait_phy_state_ready.isra.0+0x50/0x64 [r8168]
[Sat Feb 10 01:48:30 2024]  rtl8168_esd_task+0x6e0/0xc0e [r8168]
[Sat Feb 10 01:48:31 2024] WARNING: CPU: 11 PID: 16114 at /usr/src/unraid-r8125-r8152-driver/r8168/src/r8168_n.c:8654 rtl8168_wait_phy_ups_resume+0x4a/0x57 [r8168]
[Sat Feb 10 01:48:31 2024] Modules linked in: macvlan udp_diag cdc_acm xt_CHECKSUM ipt_REJECT nf_reject_ipv4 ip6table_mangle ip6table_nat iptable_mangle vhost_net tun vhost vhost_iotlb tap xt_nat xt_tcpudp veth xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xt_addrtype br_netfilter xfs md_mod zfs(PO) zunicode(PO) zzstd(O) zlua(O) zavl(PO) icp(PO) zcommon(PO) znvpair(PO) spl(O) tcp_diag inet_diag corefreqk(O) ip6table_filter ip6_tables iptable_filter ip_tables x_tables efivarfs bridge stp llc r8168(O) amdgpu edac_mce_amd edac_core intel_rapl_msr intel_rapl_common iosf_mbi kvm_amd kvm gpu_sched drm_buddy i2c_algo_bit drm_ttm_helper ttm drm_display_helper crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel sha512_ssse3 sha256_ssse3 sha1_ssse3 wmi_bmof aesni_intel drm_kms_helper crypto_simd ahci cryptd drm rapl libahci k10temp i2c_piix4 nvme amd_sfh agpgart nvme_core i2c_core syscopyarea ccp sysfillrect
[Sat Feb 10 01:48:31 2024]  sysimgblt fb_sys_fops tpm_crb video tpm_tis tpm_tis_core wmi tpm backlight acpi_cpufreq button unix [last unloaded: r8168(O)]
[Sat Feb 10 01:48:31 2024] Workqueue: events rtl8168_esd_task [r8168]
[Sat Feb 10 01:48:31 2024] RIP: 0010:rtl8168_wait_phy_ups_resume+0x4a/0x57 [r8168]
[Sat Feb 10 01:48:31 2024]  ? rtl8168_wait_phy_ups_resume+0x4a/0x57 [r8168]
[Sat Feb 10 01:48:31 2024]  ? rtl8168_wait_phy_ups_resume+0x4a/0x57 [r8168]
[Sat Feb 10 01:48:31 2024]  ? rtl8168_wait_phy_ups_resume+0x37/0x57 [r8168]
[Sat Feb 10 01:48:31 2024]  rtl8168_esd_task+0xb99/0xc0e [r8168]
[Sat Feb 10 01:49:04 2024] r8168: eth0: link up
[Sat Feb 10 02:02:59 2024] r8168: eth1: link up
[Sat Feb 10 02:11:24 2024] r8168: eth0: link up

 

Link to comment
On 11/6/2023 at 11:06 AM, jinlife said:

@ich777 @tnthalftime 

I totally agree with ich777. The R8125 does have performance issues with ASPM enabled sometimes, especially on weaker CPUs, I've encountered it myself, so I disabled it by default as it works for most situations. On the other hand, the network card may only save 0.5~1? watts, which I don't think is a huge cost. I would rather spend some watts to ensure performance.

BTW: It's free and open source, and I kinda don't want to spend more of my personal time maintaining two source codes. Sorry about that.

 

Adding 8125 (Trendnet) adds exactly 4 watts to the kill-a-watt measurement at the tap. The problem is, the card prevents Packaged C-states - with it, I am stuck at C3; with card removed, it goes to C8. 4 watts may not be alot, but put it another way, it is 25% of this system usage (no HDD connected yet). 13 vs 17 watt at idle.

If you share how to enable ASPM in the driver (I might find it by the time your respond, still reading), I can test to meassure the actual difference with ASPM on vs off. Thanks

  • Like 1
Link to comment
On 2/11/2024 at 3:25 AM, OrdinaryButt said:

Adding 8125 (Trendnet) adds exactly 4 watts to the kill-a-watt measurement at the tap. The problem is, the card prevents Packaged C-states - with it, I am stuck at C3; with card removed, it goes to C8. 4 watts may not be alot, but put it another way, it is 25% of this system usage (no HDD connected yet). 13 vs 17 watt at idle.

If you share how to enable ASPM in the driver (I might find it by the time your respond, still reading), I can test to meassure the actual difference with ASPM on vs off. Thanks

You need to modify the R8125 source code and compile it yourself. Since this is not easy, I recommend you to uninstall the R8125 plugin and use the built-in R8169 driver, probably it doesn't have ASPM settings. If the R8169 linux built-in driver also disables ASPM, then you have to find a solution yourself. 

BTW: If you are modifying C states in BIOS, it might not only save energy from card but also CPU. 4 watts are too much for just one network card.

Edited by jinlife
  • Like 1
Link to comment
20 hours ago, jinlife said:

You need to modify the R8125 source code and compile it yourself. Since this is not easy, I recommend you to uninstall the R8125 plugin and use the built-in R8169 driver, probably it doesn't have ASPM settings. If the R8169 linux built-in driver also disables ASPM, then you have to find a solution yourself. 

BTW: If you are modifying C states in BIOS, it might not only save energy from card but also CPU. 4 watts are too much for just one network card.

That is exactly what I meant when I said "I am stuck at C3". Because the driver doesn't support ASPM, the system (not just the card) uses more power (presumably PCIe lanes). Any chance we can see from you a driver with ASPM enabled, even if it is not published, for testing only? I read somewhere that Realtek has recently updated Linux drivers, but haven't had a chance to dig deeper.

Link to comment

About the same question for me, and plus Fix common problems found a new error that is related to this driver :

Quote

The plugin unraid-r8168.plg is not known to Community Applications and is possibly incompatible with your server

I guess it is now safe to remove it ?

Link to comment
54 minutes ago, A.sch3 said:

About the same question for me, and plus Fix common problems found a new error that is related to this driver

A issue with the CA App feed, should be resolved in a few hours.

 

Please ignore that message for now.

Link to comment
On 2/18/2024 at 7:13 AM, xyzeratul said:

I see the new 6.12.8 upgrade note mention something about fixing the problem, should I remove this plugin once I upgrade?

The plugin was automatically removed during my upgrade to 6.12.8, and the NIC seems to be working just fine without the plugin installed.

Link to comment

Hello!
For Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 03)

Should I / Must I install a driver? if yes which one from the community apps?

Thank you

Link to comment
1 minute ago, Aviv said:

Should I / Must I install a driver?

Is everything working? If yes then no. If not then yes.

 

2 minutes ago, Aviv said:

Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 03)

I think you've answered your question yourself since only one matches your model number:
 

grafik.png

Link to comment
1 hour ago, electronicbard said:

The plugin was automatically removed during my upgrade to 6.12.8, and the NIC seems to be working just fine without the plugin installed.

Nice. Do you have any issues? What is the question? If you have no issues, leave it as it is.

 

Are you sure it is not under Plugin Errors in the Plugin tab in the Unraid WebUI?

Link to comment
  • 2 weeks later...
On 2/21/2024 at 7:28 AM, electronicbard said:

The plugin was automatically removed during my upgrade to 6.12.8, and the NIC seems to be working just fine without the plugin installed.

It was not automatially removed during update from 6.12.6 to 6.12.8 in my case. The System update even automatically updated the realtek driver plugin to a version compatible to 6.12.8 before applying the system upgrade itself.
 

I' using a RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15) - no hickups so far

Link to comment
3 hours ago, frimu said:

The System update even automatically updated the realtek driver plugin to a version compatible to 6.12.8 before applying the system upgrade itself.

That's how it works usually, some users don't read that they should wait for the message that it's safe to reboot and reboot instantly, that can cause issues.

Link to comment
On 2/10/2024 at 8:25 PM, OrdinaryButt said:

Adding 8125 (Trendnet) adds exactly 4 watts to the kill-a-watt measurement at the tap. The problem is, the card prevents Packaged C-states - with it, I am stuck at C3; with card removed, it goes to C8. 4 watts may not be alot, but put it another way, it is 25% of this system usage (no HDD connected yet). 13 vs 17 watt at idle.

If you share how to enable ASPM in the driver (I might find it by the time your respond, still reading), I can test to meassure the actual difference with ASPM on vs off. Thanks

 

On 2/15/2024 at 3:52 AM, jinlife said:

You need to modify the R8125 source code and compile it yourself. Since this is not easy, I recommend you to uninstall the R8125 plugin and use the built-in R8169 driver, probably it doesn't have ASPM settings. If the R8169 linux built-in driver also disables ASPM, then you have to find a solution yourself. 

BTW: If you are modifying C states in BIOS, it might not only save energy from card but also CPU. 4 watts are too much for just one network card.

There are many unexplained  stories about Realtek cards and ASPM ... so I made a little investigation:

 

The kernel in-tree r8169 driver is a generic driver for all Realtek network cards, despite its name. It contains lots of workaround for different Realtek chipset. It also has a very strict condition for using ASPM (this condition was removed for a few weeks last year then reverted back...). It enables ASPM only for RTL8125A and RTL8125B chipset and only if a bit in a register is set in the chip  by the system vendor, which signals to the driver that vendor successfully tested ASPM 1.2 on this configuration. (Probably not many motherboard vendor bothers to do this ...). If this condition not met it tries to disable ASPM, if it is denied by BIOS then it uses ASPM whatever the chipset is ...


This behaviour cannot be overridden. That basically means low chance  for having ASPM with the in-tree driver.

 

I also checked the r8125 driver (from Realtek) used by this plugin. It contains CONFIG_ASPM = n in the Makefile but this just sets the default value of ASPM, it is not a real compile time option. After installing this plugin you can easily enable ASMP if you create a file r8125.conf in /boot/config/modprobe.d with the following line:

options r8125 aspm=1

It enables ASPM the correct way. With this my server reaches C10 package state...

 

@jinlife please try to enable firmware load support with ENABLE_USE_FIRMWARE_FILE = y. The firmware files are already in /lib/firmware/rtl_nic/ as the in-tree driver uses them. Probably most of these cards are shipped with outdated firmware, so enabling this option would help.

Correction:  The r8125 source code contains the firmware file in binary form. No need to enable  ENABLE_USE_FIRMWARE_FILE.


The speed issues can be caused by EEE (Energy Efficient Ethernet) which is enabled by default by this driver. You can check the status with

ethtool --show-eee eth0

Or disable it with an extra line in r8125.conf 

options r8125 eee=0 

 

Edited by Fuzzy0101
  • Like 5
  • Upvote 1
Link to comment

i have 8156 and problems with the NIC. It just disapears on high Data rates, so i have to restart the server. I tried to check what kernel module is loaded 4 the device and found out that the r8152 module isnt in use.. whats wrong here ? How can the 8156 working without an attached kernel module?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.