Motherboard Gigabyte Technology Co., Ltd. X870E AORUS ELITE WIFI7 = "r8169 unknown chip XID 688" - we are testing a combined driver

Found online a discussion by the r8169 driver maintainer r8169 unknown chip XID 688 prompted me to use the patch presented there and build a temporary kernel for the built-in RTL8125D ethernet card. For this purpose, I used the infrastructure of building a test kernel according to the guide Building a custom kernel - Fedora Project Wiki , Building a Custom Kernel :: Fedora Docs - in short, a complete success: until the official driver for this network card is added and planned in kernel 6.13, I recommend testing and using this “invention” - it is known that if someone uses a home PC, the fastest and most stable connection is a wired Ethernet connection and nothing can replace it, especially in terms of stability. I am attaching a patch that, as a standard, just needs to be added to the linux-kernel-test.patch file according to the instructions.

diff -rupN a/drivers/net/ethernet/realtek/r8169.h b/drivers/net/ethernet/realtek/r8169.h
--- a/drivers/net/ethernet/realtek/r8169.h	2024-11-01 02:02:44.000000000 +0100
+++ b/drivers/net/ethernet/realtek/r8169.h	2024-11-07 01:29:54.548648272 +0100
@@ -68,6 +68,7 @@ enum mac_version {
 	/* support for RTL_GIGA_MAC_VER_60 has been removed */
 	RTL_GIGA_MAC_VER_61,
 	RTL_GIGA_MAC_VER_63,
+	RTL_GIGA_MAC_VER_64,
 	RTL_GIGA_MAC_VER_65,
 	RTL_GIGA_MAC_NONE
 };
diff -rupN a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
--- a/drivers/net/ethernet/realtek/r8169_main.c	2024-11-01 02:02:44.000000000 +0100
+++ b/drivers/net/ethernet/realtek/r8169_main.c	2024-11-07 02:12:39.023827951 +0100
@@ -55,6 +55,7 @@
 #define FIRMWARE_8107E_2	"rtl_nic/rtl8107e-2.fw"
 #define FIRMWARE_8125A_3	"rtl_nic/rtl8125a-3.fw"
 #define FIRMWARE_8125B_2	"rtl_nic/rtl8125b-2.fw"
+#define FIRMWARE_8125D_1	"rtl_nic/rtl8125d-1.fw"
 #define FIRMWARE_8126A_2	"rtl_nic/rtl8126a-2.fw"
 
 #define TX_DMA_BURST	7	/* Maximum PCI burst, '7' is unlimited */
@@ -137,6 +138,7 @@ static const struct {
 	[RTL_GIGA_MAC_VER_61] = {"RTL8125A",		FIRMWARE_8125A_3},
 	/* reserve 62 for CFG_METHOD_4 in the vendor driver */
 	[RTL_GIGA_MAC_VER_63] = {"RTL8125B",		FIRMWARE_8125B_2},
+	[RTL_GIGA_MAC_VER_64] = {"RTL8125D",		FIRMWARE_8125D_1},
 	[RTL_GIGA_MAC_VER_65] = {"RTL8126A",		FIRMWARE_8126A_2},
 };
 
@@ -705,6 +707,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3);
 MODULE_FIRMWARE(FIRMWARE_8107E_2);
 MODULE_FIRMWARE(FIRMWARE_8125A_3);
 MODULE_FIRMWARE(FIRMWARE_8125B_2);
+MODULE_FIRMWARE(FIRMWARE_8125D_1);
 MODULE_FIRMWARE(FIRMWARE_8126A_2);
 
 static inline struct device *tp_to_dev(struct rtl8169_private *tp)
@@ -2095,9 +2098,7 @@ static void rtl_set_eee_txidle_timer(str
 		tp->tx_lpi_timer = timer_val;
 		r8168_mac_ocp_write(tp, 0xe048, timer_val);
 		break;
-	case RTL_GIGA_MAC_VER_61:
-	case RTL_GIGA_MAC_VER_63:
-	case RTL_GIGA_MAC_VER_65:
+	case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_65:
 		tp->tx_lpi_timer = timer_val;
 		RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val);
 		break;
@@ -2228,6 +2229,9 @@ static enum mac_version rtl8169_get_mac_
 		/* 8126A family. */
 		{ 0x7cf, 0x649,	RTL_GIGA_MAC_VER_65 },
 
+		/* 8125D family. */
+		{ 0x7cf, 0x688,	RTL_GIGA_MAC_VER_64 },
+
 		/* 8125B family. */
 		{ 0x7cf, 0x641,	RTL_GIGA_MAC_VER_63 },
 
@@ -2495,8 +2499,7 @@ static void rtl_init_rxcfg(struct rtl816
 	case RTL_GIGA_MAC_VER_61:
 		RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST);
 		break;
-	case RTL_GIGA_MAC_VER_63:
-	case RTL_GIGA_MAC_VER_65:
+	case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_65:
 		RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST |
 			RX_PAUSE_SLOT_ON);
 		break;
@@ -3803,6 +3806,12 @@ static void rtl_hw_start_8125b(struct rt
 	rtl_hw_start_8125_common(tp);
 }
 
+static void rtl_hw_start_8125d(struct rtl8169_private *tp)
+{
+	rtl_set_def_aspm_entry_latency(tp);
+	rtl_hw_start_8125_common(tp);
+}
+
 static void rtl_hw_start_8126a(struct rtl8169_private *tp)
 {
 	rtl_set_def_aspm_entry_latency(tp);
@@ -3851,6 +3860,7 @@ static void rtl_hw_config(struct rtl8169
 		[RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117,
 		[RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2,
 		[RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b,
+		[RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d,
 		[RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a,
 	};
 
@@ -3867,6 +3877,7 @@ static void rtl_hw_start_8125(struct rtl
 	/* disable interrupt coalescing */
 	switch (tp->mac_version) {
 	case RTL_GIGA_MAC_VER_61:
+	case RTL_GIGA_MAC_VER_64:
 		for (i = 0xa00; i < 0xb00; i += 4)
 			RTL_W32(tp, i, 0);
 		break;
diff -rupN a/drivers/net/ethernet/realtek/r8169_phy_config.c b/drivers/net/ethernet/realtek/r8169_phy_config.c
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c	2024-11-01 02:02:44.000000000 +0100
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c	2024-11-07 02:23:46.533513765 +0100
@@ -1104,6 +1104,15 @@ static void rtl8125b_hw_phy_config(struc
 	rtl8125b_config_eee_phy(phydev);
 }
 
+static void rtl8125d_hw_phy_config(struct rtl8169_private *tp,
+				   struct phy_device *phydev)
+{
+	r8169_apply_firmware(tp);
+	rtl8125_legacy_force_mode(phydev);
+	rtl8168g_disable_aldps(phydev);
+	rtl8125b_config_eee_phy(phydev);
+}
+
 static void rtl8126a_hw_phy_config(struct rtl8169_private *tp,
 				   struct phy_device *phydev)
 {
@@ -1160,6 +1169,7 @@ void r8169_hw_phy_config(struct rtl8169_
 		[RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config,
 		[RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config,
 		[RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config,
+		[RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config,
 		[RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config,
 	};
 
diff -rupN a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
--- a/drivers/net/phy/realtek.c	2024-11-01 02:02:44.000000000 +0100
+++ b/drivers/net/phy/realtek.c	2024-11-07 04:20:33.932771484 +0100
@@ -1348,7 +1348,7 @@ static struct phy_driver realtek_drvs[]
 		.read_mmd	= rtl822x_read_mmd,
 		.write_mmd	= rtl822x_write_mmd,
 	}, {
-		PHY_ID_MATCH_EXACT(0x001cc840),
+		PHY_ID_MATCH_EXACT(0x001cc841),
 		.name		= "RTL8226B_RTL8221B 2.5Gbps PHY",
 		.get_features	= rtl822x_get_features,
 		.config_aneg	= rtl822x_config_aneg,

some details about my kernel version (Fedora Workstation 41) and this driver:

slawek@maszyna:~$ sudo dmesg|grep r8169
[sudo] hasło użytkownika slawek: 
[    7.622629] r8169 0000:10:00.0 eth0: RTL8125D, 10:ff:e0:xx:xx:xx, XID 688, IRQ 158
[    7.622634] r8169 0000:10:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
[    7.661706] r8169 0000:10:00.0 enp16s0: renamed from eth0
[   10.004401] RTL8226B_RTL8221B 2.5Gbps PHY r8169-0-1000:00: attached PHY driver (mii_bus:phy_addr=r8169-0-1000:00, irq=MAC)
[   11.112078] r8169 0000:10:00.0 enp16s0: Link is Down
[   14.012721] r8169 0000:10:00.0 enp16s0: Link is Up - 1Gbps/Full - flow control rx/tx

slawek@maszyna:~$ uname -a
Linux maszyna 6.11.6-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov  7 12:31:45 CET 2024 x86_64 GNU/Linux

slawek@maszyna:~$ ifconfig
enp16s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.xxx.xxx  netmask 255.255.255.0  broadcast 192.168.xxx.255
        ether 10:ff:e0:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 2663853  bytes 3706892516 (3.4 GiB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 1144136  bytes 1255566796 (1.1 GiB)
        TX errors 0  dropped 5 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2096  bytes 1261771 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2096  bytes 1261771 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp15s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.xxx.xxx  netmask 255.255.255.0  broadcast 192.168.xxx.255
        ether xx:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 11686  bytes 2153123 (2.0 MiB)
        RX errors 0  dropped 529  overruns 0  frame 0
        TX packets 1540  bytes 243739 (238.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

slawek@maszyna:~$ sudo ethtool enp16s0
[sudo] hasło użytkownika slawek: 
Settings for enp16s0:
	Supported ports: [ TP	 MII ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	                        2500baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	                        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/Half 1000baseT/Full
	Link partner advertised pause frame use: Symmetric
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	master-slave cfg: preferred slave
	master-slave status: master
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: external
	MDI-X: Unknown
	Supports Wake-on: pumbg
	Wake-on: d
	Link detected: yes

Unfortunately, I could not show the full speed of this Ethernet card because I only have 1Gb/300Mb internet

1 Like

A few notes on the documentation describing the custom kernel building process, which in my case caused the computer to boot correctly with the hardware option “SecurBoot enable” enabled:

  1. In the documentation Building a Custom Kernel :: Fedora Docs it is not selected by default to execute key commands with root privileges:
sudo mokutil --import "cert.der"
sudo certutil -A -i cert.der -n "<MOK certificate nickname>" -d /etc/pki/pesign/ -t "Pu,Pu,Pu"
sudo pk12util -i key.p12 -d /etc/pki/pesign

In addition, in order for the building process to finish correctly, the workaround for the known bug 1651020 – pesign rpm macro contains syntax error should be forced using --force switch as follows:

pesign -f -c %{pe_signing_cert} --certdir /etc/pki/pesign/ -s -i $KernelImage -o vmlinuz.signed

I realize that I may have a corrupted configuration of key scripts/system commands, but I wanted to share these observations in case someone else, like me, has problems with completing the building of the expected .rpm kernel packages.

in addition, the build command must also be executed as root:

sudo fedpkg local

I hope this short pseudo-guide will help you enjoy a stable wired connection using the built-in Ethernet card until proper support is added to the main kernel branch - probably sometime in spring or later.

Unfortunately, I was not able to wait that long, hence this pseudo-guide
:innocent: :wink: