Skip to content

Commit 7a5b971

Browse files
authored
Add files via upload
9.016.01
0 parents  commit 7a5b971

22 files changed

+29732
-0
lines changed

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
################################################################################
3+
#
4+
# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet
5+
# controllers with PCI-Express interface.
6+
#
7+
# Copyright(c) 2025 Realtek Semiconductor Corp. All rights reserved.
8+
#
9+
# This program is free software; you can redistribute it and/or modify it
10+
# under the terms of the GNU General Public License as published by the Free
11+
# Software Foundation; either version 2 of the License, or (at your option)
12+
# any later version.
13+
#
14+
# This program is distributed in the hope that it will be useful, but WITHOUT
15+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17+
# more details.
18+
#
19+
# You should have received a copy of the GNU General Public License along with
20+
# this program; if not, see <http://www.gnu.org/licenses/>.
21+
#
22+
# Author:
23+
# Realtek NIC software team <nicfae@realtek.com>
24+
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25+
#
26+
################################################################################
27+
28+
################################################################################
29+
# This product is covered by one or more of the following patents:
30+
# US6,570,884, US6,115,776, and US6,327,625.
31+
################################################################################
32+
33+
KFLAG := 2$(shell uname -r | sed -ne 's/^2\.[4]\..*/4/p')x
34+
35+
all: clean modules install
36+
37+
modules:
38+
ifeq ($(KFLAG),24x)
39+
$(MAKE) -C src/ -f Makefile_linux24x modules
40+
else
41+
$(MAKE) -C src/ modules
42+
endif
43+
44+
clean:
45+
ifeq ($(KFLAG),24x)
46+
$(MAKE) -C src/ -f Makefile_linux24x clean
47+
else
48+
$(MAKE) -C src/ clean
49+
endif
50+
51+
install:
52+
ifeq ($(KFLAG),24x)
53+
$(MAKE) -C src/ -f Makefile_linux24x install
54+
else
55+
$(MAKE) -C src/ install
56+
endif
57+
58+
59+

README

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<Linux device driver for Realtek Ethernet controllers>
2+
3+
This is the Linux device driver released for Realtek 2.5 Gigabit Ethernet controllers with PCI-Express interface.
4+
5+
<Requirements>
6+
7+
- Kernel source tree (supported Linux kernel 2.6.x and 2.4.x)
8+
- For linux kernel 2.4.x, this driver supports 2.4.20 and latter.
9+
- Compiler/binutils for kernel compilation
10+
11+
<Quick install with proper kernel settings>
12+
Unpack the tarball :
13+
# tar vjxf r8125-9.aaa.bb.tar.bz2
14+
15+
Change to the directory:
16+
# cd r8125-9.aaa.bb
17+
18+
If you are running the target kernel, then you should be able to do :
19+
20+
# ./autorun.sh (as root or with sudo)
21+
22+
You can check whether the driver is loaded by using following commands.
23+
24+
# lsmod | grep r8125
25+
# ifconfig -a
26+
27+
If there is a device name, ethX, shown on the monitor, the linux
28+
driver is loaded. Then, you can use the following command to activate
29+
the ethX.
30+
31+
# ifconfig ethX up
32+
33+
,where X=0,1,2,...
34+
35+
<Set the network related information>
36+
1. Set manually
37+
a. Set the IP address of your machine.
38+
39+
# ifconfig ethX "the IP address of your machine"
40+
41+
b. Set the IP address of DNS.
42+
43+
Insert the following configuration in /etc/resolv.conf.
44+
45+
nameserver "the IP address of DNS"
46+
47+
c. Set the IP address of gateway.
48+
49+
# route add default gw "the IP address of gateway"
50+
51+
2. Set by doing configurations in /etc/sysconfig/network-scripts
52+
/ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network
53+
/ifcfg-ethX for SuSE. There are two examples to set network
54+
configurations.
55+
56+
a. Fixed IP address:
57+
DEVICE=eth0
58+
BOOTPROTO=static
59+
ONBOOT=yes
60+
TYPE=ethernet
61+
NETMASK=255.255.255.0
62+
IPADDR=192.168.1.1
63+
GATEWAY=192.168.1.254
64+
BROADCAST=192.168.1.255
65+
66+
b. DHCP:
67+
DEVICE=eth0
68+
BOOTPROTO=dhcp
69+
ONBOOT=yes
70+
71+
<Modify the MAC address>
72+
There are two ways to modify the MAC address of the NIC.
73+
1. Use ifconfig:
74+
75+
# ifconfig ethX hw ether YY:YY:YY:YY:YY:YY
76+
77+
,where X is the device number assigned by Linux kernel, and
78+
YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
79+
80+
2. Use ip:
81+
82+
# ip link set ethX address YY:YY:YY:YY:YY:YY
83+
84+
,where X is the device number assigned by Linux kernel, and
85+
YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
86+
87+
<Force Link Status>
88+
89+
1. Force the link status when insert the driver.
90+
91+
If the user is in the path ~/r8125, the link status can be forced
92+
to one of the 5 modes as following command.
93+
94+
# insmod ./src/r8125.ko speed=SPEED_MODE duplex=DUPLEX_MODE autoneg=NWAY_OPTION
95+
96+
,where
97+
SPEED_MODE = 1000 for 1000Mbps
98+
= 100 for 100Mbps
99+
= 10 for 10Mbps
100+
DUPLEX_MODE = 0 for half-duplex
101+
= 1 for full-duplex
102+
NWAY_OPTION = 0 for auto-negotiation off (true force)
103+
= 1 for auto-negotiation on (nway force)
104+
For example:
105+
106+
# insmod ./src/r8125.ko speed=100 duplex=0 autoneg=1
107+
108+
will force PHY to operate in 100Mpbs Half-duplex(nway force).
109+
110+
2. Force the link status by using ethtool.
111+
a. Insert the driver first.
112+
b. Make sure that ethtool exists in /sbin.
113+
c. Force the link status as the following command.
114+
115+
2.5G before kernel v4.10
116+
# ethtool -s eth0 autoneg on advertise 0x802f
117+
118+
2.5G for kernel v4.10 and later
119+
# ethtool -s eth0 autoneg on advertise 0x80000000002f
120+
121+
# ethtool -s eth0 autoneg on advertise 0x002f (1G)
122+
# ethtool -s eth0 autoneg on advertise 0x000f (100M full)
123+
# ethtool -s eth0 autoneg on advertise 0x0003 (10M full)
124+
125+
<Jumbo Frame>
126+
Transmitting Jumbo Frames, whose packet size is bigger than 1500 bytes, please change mtu by the following command.
127+
128+
# ifconfig ethX mtu MTU
129+
130+
, where X=0,1,2,..., and MTU is configured by user.
131+
132+
RTL8125 supports Jumbo Frame size up to 9 kBytes.
133+
134+
<EEE>
135+
Get/Set device EEE status
136+
137+
Get EEE device status
138+
# ethtool --show-eee enp1s0
139+
140+
Set EEE device status
141+
# ethtool --set-eee enp1s0 eee on tx-lpi on tx-timer 1546 advertise 0x0008 (100M full)
142+
# ethtool --set-eee enp1s0 eee on tx-lpi on tx-timer 1546 advertise 0x0020 (1G)
143+
# ethtool --set-eee enp1s0 eee on tx-lpi on tx-timer 1546 advertise 0x8000 (2.5G)

autorun.sh

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0-only
3+
4+
# invoke insmod with all arguments we got
5+
# and use a pathname, as insmod doesn't look in . by default
6+
7+
TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net/ethernet -name realtek -type d)
8+
if [ "$TARGET_PATH" = "" ]; then
9+
TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net -name realtek -type d)
10+
fi
11+
if [ "$TARGET_PATH" = "" ]; then
12+
TARGET_PATH=/lib/modules/$(uname -r)/kernel/drivers/net
13+
fi
14+
echo
15+
echo "Check old driver and unload it."
16+
check=`lsmod | grep r8169`
17+
if [ "$check" != "" ]; then
18+
echo "rmmod r8169"
19+
/sbin/rmmod r8169
20+
fi
21+
22+
check=`lsmod | grep r8125`
23+
if [ "$check" != "" ]; then
24+
echo "rmmod r8125"
25+
/sbin/rmmod r8125
26+
fi
27+
28+
echo "Build the module and install"
29+
echo "-------------------------------" >> log.txt
30+
date 1>>log.txt
31+
make $@ all 1>>log.txt || exit 1
32+
module=`ls src/*.ko`
33+
module=${module#src/}
34+
module=${module%.ko}
35+
36+
if [ "$module" = "" ]; then
37+
echo "No driver exists!!!"
38+
exit 1
39+
elif [ "$module" != "r8169" ]; then
40+
if test -e $TARGET_PATH/r8169.ko ; then
41+
echo "Backup r8169.ko"
42+
if test -e $TARGET_PATH/r8169.bak ; then
43+
i=0
44+
while test -e $TARGET_PATH/r8169.bak$i
45+
do
46+
i=$(($i+1))
47+
done
48+
echo "rename r8169.ko to r8169.bak$i"
49+
mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak$i
50+
else
51+
echo "rename r8169.ko to r8169.bak"
52+
mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak
53+
fi
54+
fi
55+
if test -e $TARGET_PATH/r8169.ko.zst ; then
56+
echo "Backup r8169.ko.zst"
57+
if test -e $TARGET_PATH/r8169.zst.bak ; then
58+
i=0
59+
while test -e $TARGET_PATH/r8169.zst.bak$i
60+
do
61+
i=$(($i+1))
62+
done
63+
echo "rename r8169.ko.zst to r8169.zst.bak$i"
64+
mv $TARGET_PATH/r8169.ko.zst $TARGET_PATH/r8169.zst.bak$i
65+
else
66+
echo "rename r8169.ko.zst to r8169.zst.bak"
67+
mv $TARGET_PATH/r8169.ko.zst $TARGET_PATH/r8169.zst.bak
68+
fi
69+
fi
70+
fi
71+
72+
echo "DEPMOD $(uname -r)"
73+
depmod `uname -r`
74+
echo "load module $module"
75+
modprobe $module
76+
77+
is_update_initramfs=n
78+
distrib_list="ubuntu debian"
79+
80+
if [ -r /etc/debian_version ]; then
81+
is_update_initramfs=y
82+
elif [ -r /etc/lsb-release ]; then
83+
for distrib in $distrib_list
84+
do
85+
/bin/grep -i "$distrib" /etc/lsb-release 2>&1 /dev/null && \
86+
is_update_initramfs=y && break
87+
done
88+
fi
89+
90+
if [ "$is_update_initramfs" = "y" ]; then
91+
if which update-initramfs >/dev/null ; then
92+
echo "Updating initramfs. Please wait."
93+
update-initramfs -u -k $(uname -r)
94+
else
95+
echo "update-initramfs: command not found"
96+
exit 1
97+
fi
98+
fi
99+
100+
echo "Completed."
101+
exit 0

0 commit comments

Comments
 (0)