Realtek 8125, huge packets loss at 2.5 Gbits

Just to add this for people looking for infomations.

On Fedora 43, my network interface was OK at 1Gbits but had a huge amout of packets loss at 2.5Gbits (~ 40%)

My mother board : B850 AORUS ELITE WIFI7 ICE

My network device :

# lspci -v | grep -A 8 RTL8125
0a:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 0c)
	Subsystem: Gigabyte Technology Co., Ltd Device e000
	Flags: bus master, fast devsel, latency 0, IRQ 44, IOMMU group 21
	I/O ports at c000 [size=256]
	Memory at dfa00000 (64-bit, non-prefetchable) [size=64K]
	Memory at dfa10000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [40] Power Management version 3
	Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
	Capabilities: [70] Express Endpoint, IntMsgNum 1

To get it working properly at 2.5Gbits I tried everything, the only solution I found was to download the following driver :
2.5G Ethernet LINUX driver r8125 for kernel up to 6.12 9.016.01 2025/08/15 122 KB
from : Realtek

I thow here what I did to get it works :

# File to block of loading of the non-working driver :
cat  /etc/modprobe.d/local-dontload.conf 
blacklist r8169
install r8169 /bin/false

# steps to build and install the good driver
tar tvjf r8125-9.016.01.tar.bz2
cd r8125-9.016.01/
./autorun.sh
cp r8125.ko /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/realtek/r8125.ko
modprobe -v r8125
echo "r8125" > /etc/modules-load.d/r8125.conf

The only thing who is painfull is the need to do it at every kernel change.
You can block kernel updates and do it by hands when you need it.

You are expected to use akmods or DKMS for custom modules.
This allows to automate module installation for new kernels:

# Set up DKMS
sudo dnf install dkms openssl
sudo dkms generate_mok
MOK_PASSWD="fedora"
sudo mokutil -i /var/lib/dkms/mok.pub << EOI
${MOK_PASSWD}
${MOK_PASSWD}
EOI
sudo systemctl reboot

# Install rtl8125 with DKMS
sudo dnf install git-core
git clone https://github.com/openwrt/rtl8125.git
tee rtl8125/dkms.conf << EOF > /dev/null
PACKAGE_NAME="r8125"
PACKAGE_VERSION="git"
DEST_MODULE_LOCATION="/extra"
AUTOINSTALL="yes"
EOF
sudo dkms install rtl8125
sudo tee /etc/modprobe.d/rtl8125.conf << EOF > /dev/null
blacklist r8169
EOF
sudo tee /etc/modules-load.d/rtl8125.conf << EOF > /dev/null
r8125
EOF
sudo systemctl restart systemd-modules-load.service