Realtek RTL8125B 2.5G LAN on Centos 8.3

Issues related to configuring your network
Post Reply
TimH
Posts: 1
Joined: 2020/12/23 23:00:01

Realtek RTL8125B 2.5G LAN on Centos 8.3

Post by TimH » 2020/12/23 23:07:07

Hi -

I am trying to get my realtek network adapter working on Centos 8.3.

Code: Select all

lspci |grep Realtek
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)

Code: Select all

uname -a
Linux c8 4.18.0-240.1.1.el8_3.x86_64 #1 SMP Thu Nov 19 17:20:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
I downloaded the latest driver 2.5G Ethernet LINUX driver r8125 for kernel up to 5.6 ( version 9.004.01) from the realtek support page and running the autorun script to compile the module.

Unfortunately it comes to an compile error and I am stuck.

Code: Select all

./autorun.sh

Check old driver and unload it.
Build the module and install
/tmp/driver/r8125-9.004.01/src/r8125_n.c:10870:31: error: initialization of ‘void (*)(struct net_device *, unsigned int)’ from incompatible pointer type ‘void (*)(struct net_device *)’ [-Werror=incompatible-pointer-types]
         .ndo_tx_timeout     = rtl8125_tx_timeout,
                               ^~~~~~~~~~~~~~~~~~
/tmp/driver/r8125-9.004.01/src/r8125_n.c:10870:31: note: (near initialization for ‘rtl8125_netdev_ops.<anonymous>.ndo_tx_timeout’)
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:316: /tmp/driver/r8125-9.004.01/src/r8125_n.o] Error 1
make[2]: *** [Makefile:1544: _module_/tmp/driver/r8125-9.004.01/src] Error 2
make[1]: *** [Makefile:159: modules] Error 2
make: *** [Makefile:41: modules] Error 2
Google search didn't had any successful solutions so I am hoping finding here the right answer.
Any hints are appreciated.

Thanks.

sergigs
Posts: 1
Joined: 2021/03/08 21:52:35

Re: Realtek RTL8125B 2.5G LAN on Centos 8.3

Post by sergigs » 2021/03/08 22:11:02

Hello Tim.

I think I've figured this out after reading https://stackoverflow.com/questions/552 ... -pointer-t.

In the r8125_n.c file, find this line:

Code: Select all

static void rtl8125_tx_timeout(struct net_device *dev);
and replace it with:

Code: Select all

static void rtl8125_tx_timeout(struct net_device *dev, unsigned int txqueue);
You'll have to do this twice (line 298 and 13007). As I understand, CentOS 8 has a newer version of the kernel in which the structure "net_device" is declared as "struct net_device *dev, unsigned int txqueue", and not "struct net_device *dev".

For any future lost soul struggling with this, I also had to previously comment/remove line 62:

Code: Select all

include <linux/pci-aspm.h>
Please note that I'm literally an APE who's been using Windows all his life and who, by some sort of divine intervention, has figured this out. I can now thank that 3 month coding subject in college 10 years ago where we were briefly introduced to C.

User avatar
TrevorH
Forum Moderator
Posts: 31064
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Realtek RTL8125B 2.5G LAN on Centos 8.3

Post by TrevorH » 2021/03/10 17:11:18

There's a useful utility called 'diff' that you can use to share a patch like this. Before you make your code change, copy the original file to a new name , edit the original, make the change then run diff against the two files. e.g.

Code: Select all

cp -p r8125_n.c r8125_n.c.orig
<edit original, make changes, save>
diff -u r8125_n.c.orig r8125_n.c
You can now share the output from diff -u and it can be used to patch the source file by others using the 'patch' command. That same patch file can also be included in an RPM spec file to build the source and if done right, you can unpack the original tarball in there, have rpmbuild apply that patch and then build the result.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 8 - Networking Support”