I am going to show you how to install TP-Link 2.5GB PCIe Network Card (TX201) in CentOS 7.
There are few methods. The first method is to compile the driver from the Realtek website. If you want to try it, don’t be fooled by the file name (r8125-9.016.01.tar.tgz). It is in bzip2 format. Also, good luck to compile from the source as it not compilable with the gcc installed in RHEL7.
Here are some errors if you are interested:
CC: cc
CCVERSION: 4.8.5
KERNEL_GCC_VERSION: 4.8.5
KVER: 3.10.0-1160.119.1.el7.x86_64
KMAJ: 3
KMIN: 10
KREV: 0
BASEDIR: /lib/modules/3.10.0-1160.119.1.el7.x86_64
DRIVERDIR: /lib/modules/3.10.0-1160.119.1.el7.x86_64/kernel/drivers/net/ethernet/realtek
PWD: /tmp/r8125/r8125-9.016.01/src
RTKDIR: kernel/drivers/net/ethernet/realtek
make -C /lib/modules/3.10.0-1160.119.1.el7.x86_64/build M=/tmp/r8125/r8125-9.016.01/src clean
make[1]: Entering directory `/usr/src/kernels/3.10.0-1160.119.1.el7.x86_64'
CLEAN /tmp/r8125/r8125-9.016.01/src/.tmp_versions
make[1]: Leaving directory `/usr/src/kernels/3.10.0-1160.119.1.el7.x86_64'
make -C /lib/modules/3.10.0-1160.119.1.el7.x86_64/build M=/tmp/r8125/r8125-9.016.01/src modules
make[1]: Entering directory `/usr/src/kernels/3.10.0-1160.119.1.el7.x86_64'
CC [M] /tmp/r8125/r8125-9.016.01/src/r8125_n.o
In file included from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:87:0:
/tmp/r8125/r8125-9.016.01/src/r8125.h:130:9: error: static declaration of ‘strscpy’ follows non-static declaration
ssize_t strscpy(char *dest, const char *src, size_t count)
^
In file included from include/linux/bitmap.h:8:0,
from include/linux/cpumask.h:11,
from ./arch/x86/include/asm/cpumask.h:4,
from ./arch/x86/include/asm/msr.h:10,
from ./arch/x86/include/asm/processor.h:20,
from ./arch/x86/include/asm/cpufeature.h:7,
from ./arch/x86/include/asm/thread_info.h:22,
from include/linux/thread_info.h:66,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:39:
include/linux/string.h:31:9: note: previous declaration of ‘strscpy’ was here
ssize_t strscpy(char *, const char *, size_t);
^
In file included from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:87:0:
/tmp/r8125/r8125-9.016.01/src/r8125.h:157:30: error: redefinition of ‘skb_checksum_start’
static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
^
In file included from include/linux/if_ether.h:23:0,
from include/uapi/linux/ethtool.h:18,
from include/linux/ethtool.h:17,
from include/linux/netdevice.h:43,
from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:42:
include/linux/skbuff.h:2347:30: note: previous definition of ‘skb_checksum_start’ was here
static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
^
In file included from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:87:0:
/tmp/r8125/r8125-9.016.01/src/r8125.h:209:20: error: redefinition of ‘page_is_pfmemalloc’
static inline bool page_is_pfmemalloc(struct page *page)
^
In file included from ./arch/x86/include/asm/pci.h:4:0,
from include/linux/pci.h:1644,
from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:41:
include/linux/mm.h:1161:20: note: previous definition of ‘page_is_pfmemalloc’ was here
static inline bool page_is_pfmemalloc(struct page *page)
^
In file included from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:87:0:
/tmp/r8125/r8125-9.016.01/src/r8125.h:255:20: error: redefinition of ‘ether_addr_copy’
static inline void ether_addr_copy(u8 *dst, const u8 *src)
^
In file included from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:43:0:
include/linux/etherdevice.h:246:20: note: previous definition of ‘ether_addr_copy’ was here
static inline void ether_addr_copy(u8 *dst, const u8 *src)
^
/tmp/r8125/r8125-9.016.01/src/r8125_n.c:16851:12: error: static declaration of ‘pci_enable_msix_range’ follows non-static declaration
static int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
^
In file included from /tmp/r8125/r8125-9.016.01/src/r8125_n.c:41:0:
include/linux/pci.h:1336:5: note: previous declaration of ‘pci_enable_msix_range’ was here
int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
^
/tmp/r8125/r8125-9.016.01/src/r8125_n.c:17066:9: error: unknown field ‘ndo_change_mtu’ specified in initializer
.ndo_change_mtu = rtl8125_change_mtu,
^
/tmp/r8125/r8125-9.016.01/src/r8125_n.c:17066:9: warning: missing braces around initializer [-Wmissing-braces]
/tmp/r8125/r8125-9.016.01/src/r8125_n.c:17066:9: warning: (near initialization for ‘rtl8125_netdev_ops.’) [-Wmissing-braces]
/tmp/r8125/r8125-9.016.01/src/r8125_n.c:17066:9: warning: initialization from incompatible pointer type [enabled by default]
/tmp/r8125/r8125-9.016.01/src/r8125_n.c:17066:9: warning: (near initialization for ‘rtl8125_netdev_ops. .ndo_get_stats64’) [enabled by default]
/tmp/r8125/r8125-9.016.01/src/r8125_n.c: In function ‘rtl8125_rx_interrupt’:
/tmp/r8125/r8125-9.016.01/src/r8125_n.c:20713:20: error: ‘struct net_device’ has no member named ‘last_rx’
dev->last_rx = jiffies;
^
make[2]: *** [/tmp/r8125/r8125-9.016.01/src/r8125_n.o] Error 1
make[1]: *** [_module_/tmp/r8125/r8125-9.016.01/src] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.10.0-1160.119.1.el7.x86_64'
make: *** [modules] Error 2
The second method is here:
First, download the compiled driver from here. There are multiple versions, I suggest to pick the latest version (e.g., kmod-r8125-9.013.02-1.el7_9.elrepo.x86_64.rpm)
#wget ftp://ftp.icm.edu.pl/vol/rzm5/linux-elrepo/archive/elrepo/el7/x86_64/RPMS/kmod-r8125-9.013.02-1.el7_9.elrepo.x86_64.rpm #sudo yum install kmod-r8125-9.013.02-1.el7_9.elrepo.x86_64.rpm
After that, verify the driver has been installed:
#kmod list | grep r8125 r8125 208216 0
To load the driver, run the following:
#sudo modprobe r8125
To verify the driver is loaded:
#ifconfig p4p1: flags=4163mtu 1500 inet 192.168.1.123 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::8e78:31b7:7130:f1e9 prefixlen 64 scopeid 0x20 ether 00:11:22:33:44:55 txqueuelen 1000 (Ethernet)
Verify the speed is correct:
ethtool p4p1 | grep Speed
Cannot get wake-on-lan settings: Operation not permitted
Speed: 2500Mb/s
That’s it, hope it helps.
Our sponsors:
