src: update

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2023-10-26 15:35:37 +02:00
parent 834fa240ae
commit 03bf3141f5
37 changed files with 585 additions and 3277 deletions

4
.gitignore vendored
View File

@ -1,4 +0,0 @@
debian/.debhelper*
debian/debhelper*
debian/realtek-r8125-dkms*
debian/files

339
LICENSE
View File

@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

176
Makefile
View File

@ -30,28 +30,168 @@
# US6,570,884, US6,115,776, and US6,327,625.
################################################################################
KFLAG := 2$(shell "$KVER" | sed -ne 's/^2\.[4]\..*/4/p')x
BSRC ?= /lib/modules/$(shell uname -r)
CONFIG_SOC_LAN = n
ENABLE_REALWOW_SUPPORT = n
ENABLE_DASH_SUPPORT = n
ENABLE_DASH_PRINTER_SUPPORT = n
CONFIG_DOWN_SPEED_100 = n
CONFIG_ASPM = y
ENABLE_S5WOL = y
ENABLE_S5_KEEP_CURR_MAC = n
ENABLE_EEE = y
ENABLE_S0_MAGIC_PACKET = n
ENABLE_TX_NO_CLOSE = y
ENABLE_MULTIPLE_TX_QUEUE = n
ENABLE_PTP_SUPPORT = n
ENABLE_PTP_MASTER_MODE = n
ENABLE_RSS_SUPPORT = n
ENABLE_LIB_SUPPORT = n
ENABLE_USE_FIRMWARE_FILE = n
DISABLE_PM_SUPPORT = n
DISABLE_MULTI_MSIX_VECTOR = n
all: clean modules install
ifneq ($(KERNELRELEASE),)
obj-m := r8125.o
r8125-objs := r8125_n.o rtl_eeprom.o rtltool.o
ifeq ($(CONFIG_SOC_LAN), y)
EXTRA_CFLAGS += -DCONFIG_SOC_LAN
endif
ifeq ($(ENABLE_REALWOW_SUPPORT), y)
r8125-objs += r8125_realwow.o
EXTRA_CFLAGS += -DENABLE_REALWOW_SUPPORT
endif
ifeq ($(ENABLE_DASH_SUPPORT), y)
r8125-objs += r8125_dash.o
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT
endif
ifeq ($(ENABLE_DASH_PRINTER_SUPPORT), y)
r8125-objs += r8125_dash.o
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT -DENABLE_DASH_PRINTER_SUPPORT
endif
EXTRA_CFLAGS += -DCONFIG_R8125_NAPI
EXTRA_CFLAGS += -DCONFIG_R8125_VLAN
ifeq ($(CONFIG_DOWN_SPEED_100), y)
EXTRA_CFLAGS += -DCONFIG_DOWN_SPEED_100
endif
ifeq ($(CONFIG_ASPM), y)
EXTRA_CFLAGS += -DCONFIG_ASPM
endif
ifeq ($(ENABLE_S5WOL), y)
EXTRA_CFLAGS += -DENABLE_S5WOL
endif
ifeq ($(ENABLE_S5_KEEP_CURR_MAC), y)
EXTRA_CFLAGS += -DENABLE_S5_KEEP_CURR_MAC
endif
ifeq ($(ENABLE_EEE), y)
EXTRA_CFLAGS += -DENABLE_EEE
endif
ifeq ($(ENABLE_S0_MAGIC_PACKET), y)
EXTRA_CFLAGS += -DENABLE_S0_MAGIC_PACKET
endif
ifeq ($(ENABLE_TX_NO_CLOSE), y)
EXTRA_CFLAGS += -DENABLE_TX_NO_CLOSE
endif
ifeq ($(ENABLE_MULTIPLE_TX_QUEUE), y)
EXTRA_CFLAGS += -DENABLE_MULTIPLE_TX_QUEUE
endif
ifeq ($(ENABLE_PTP_SUPPORT), y)
r8125-objs += r8125_ptp.o
EXTRA_CFLAGS += -DENABLE_PTP_SUPPORT
endif
ifeq ($(ENABLE_PTP_MASTER_MODE), y)
EXTRA_CFLAGS += -DENABLE_PTP_MASTER_MODE
endif
ifeq ($(ENABLE_RSS_SUPPORT), y)
r8125-objs += r8125_rss.o
EXTRA_CFLAGS += -DENABLE_RSS_SUPPORT
endif
ifeq ($(ENABLE_LIB_SUPPORT), y)
r8125-objs += r8125_lib.o
EXTRA_CFLAGS += -DENABLE_LIB_SUPPORT
endif
ifeq ($(ENABLE_USE_FIRMWARE_FILE), y)
r8125-objs += r8125_firmware.o
EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE
endif
ifeq ($(DISABLE_PM_SUPPORT), y)
EXTRA_CFLAGS += -DDISABLE_PM_SUPPORT
endif
ifeq ($(DISABLE_MULTI_MSIX_VECTOR), y)
EXTRA_CFLAGS += -DDISABLE_MULTI_MSIX_VECTOR
endif
else
BASEDIR := /lib/modules/$(shell uname -r)
KERNELDIR ?= $(BASEDIR)/build
PWD :=$(shell pwd)
DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net/ethernet -name realtek -type d)
ifeq ($(DRIVERDIR),)
DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d)
endif
ifeq ($(DRIVERDIR),)
DRIVERDIR := $(BASEDIR)/kernel/drivers/net
endif
RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR))
KERNEL_GCC_VERSION := $(shell cat /proc/version | sed -n 's/.*gcc version \([[:digit:]]\.[[:digit:]]\.[[:digit:]]\).*/\1/p')
CCVERSION = $(shell $(CC) -dumpversion)
KVER = $(shell uname -r)
KMAJ = $(shell echo $(KVER) | \
sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')
KMIN = $(shell echo $(KVER) | \
sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')
KREV = $(shell echo $(KVER) | \
sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/')
kver_ge = $(shell \
echo test | awk '{if($(KMAJ) < $(1)) {print 0} else { \
if($(KMAJ) > $(1)) {print 1} else { \
if($(KMIN) < $(2)) {print 0} else { \
if($(KMIN) > $(2)) {print 1} else { \
if($(KREV) < $(3)) {print 0} else { print 1 } \
}}}}}' \
)
.PHONY: all
all: print_vars clean modules install
print_vars:
@echo
@echo "CC: " $(CC)
@echo "CCVERSION: " $(CCVERSION)
@echo "KERNEL_GCC_VERSION: " $(KERNEL_GCC_VERSION)
@echo "KVER: " $(KVER)
@echo "KMAJ: " $(KMAJ)
@echo "KMIN: " $(KMIN)
@echo "KREV: " $(KREV)
@echo "BASEDIR: " $(BASEDIR)
@echo "DRIVERDIR: " $(DRIVERDIR)
@echo "PWD: " $(PWD)
@echo "RTKDIR: " $(RTKDIR)
@echo
.PHONY:modules
modules:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ KVER=$(KVER) BASEDIR=$(BSRC) -f Makefile_linux24x modules
else
$(MAKE) -C src/ KVER=$(KVER) BASEDIR=$(BSRC) modules
endif
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
#endif
.PHONY:clean
clean:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ KVER=$(KVER) BASEDIR=$(BSRC) -f Makefile_linux24x clean
else
$(MAKE) -C src/ KVER=$(KVER) BASEDIR=$(BSRC) clean
endif
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean
#endif
.PHONY:install
install:
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
#endif
install: modules
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ KVER=$(KVER) BASEDIR=$(BSRC) -f Makefile_linux24x install
else
$(MAKE) -C src/ KVER=$(KVER) BASEDIR=$(BSRC) install
endif

134
README.md
View File

@ -1,134 +0,0 @@
# Realtek r8125 DKMS
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/awesometic/realtek-r8125-dkms?sort=semver&style=for-the-badge)
This provides Realtek r8125 driver in DKMS way so that you can keep the latest driver even after the kernel upgrade.
## Before use
This DKMS package is for Realtek RTL8125 (r8125 in module name) Ethernet, which is designed for the PCI interface.
If you are searching for the Realtek 2.5 Gbits **USB Ethernet**, which may use RTL8156 (r8152 in module name), you are in the wrong place. Please refer to another DKMS project for that Realtek driver.
- [Realtek R8152 DKMS](https://github.com/awesometic/realtek-r8152-dkms)
## Installation
There are 3 ways to install this DKMS module. Choose one as your tastes.
Those are not interfering with each other. So you can do all 3 methods but absolutely you don't need to.
Installation using the Debian package is recommended for the sake of getting the newer driver.
### Debian package
#### Released package file
Download the latest Debian package from the Release tab on the Github repository.
Then enter the following command.
```bash
sudo dpkg -i realtek-r8125-dkms*.deb
```
> If multiple files selected by the wild card, you should type the specific version of the file.
>
> ```bash
> sudo dpkg -i realtek-r8125-dkms_9.011.01-1_amd64.deb
> ```
If dependency error occurs, try to fix that with `apt` command.
```bash
sudo apt install --fix-broken
```
#### Launchpad PPA (Recommended)
Add the Launchpad PPA.
```bash
sudo add-apt-repository ppa:awesometic/ppa
```
Then install the package using `apt` tool.
```bash
sudo apt install realtek-r8125-dkms
```
### autorun.sh
Using the `autorun.sh` script that Realtek provides on their original driver package. This is **not installed as a DKMS**, only efforts to the current kernel.
Download or clone this repository and move to the extracted directory, then run the script.
```bash
sudo ./autorun.sh
```
### dkms-install.sh
This script is from aircrack-ng team. You can install the DKMS module by a simple command.
Download or clone this repository and move to the extracted directory, then run the script.
```bash
sudo ./dkms-install.sh
```
## Verify the module is loaded successfully
After installing the DKMS package, you may not be able to use the new `r8125` module on the fly. This because the existing `r8169` module will be loaded priority to `r8125` so that it prevents working of the `r8125` module.
Check if the `r8169` module loaded currently.
```bash
lsmod | grep -i r8169
```
If there is a result, maybe the `r8125` module wasn't loaded properly. You can check out modules currently in use via `lspci -k` or `dmesg` too.
To use the `r8125` module explicitly you can add the `r8169` module to not be loaded by adding it to a blacklist file.
Enter the following command to configure the blacklist.
```bash
sudo tee -a /etc/modprobe.d/blacklist-r8169.conf > /dev/null <<EOT
# To use r8125 driver explicitly
blacklist r8169
EOT
```
To apply the new blacklist to your kernel, update your initramfs via
```bash
sudo update-initramfs -u
```
Finally, reboot to take effect.
> - If you need to load both r8169 and r8125, maybe removing r8125 firmware could make it work. Please enter `sudo rm -f /lib/firmware/rtl_nic/rtl8125*` to remove all the r8125 firmwares on the system. But it is just a workaround, you should have to do this every time installing the new kernel version or new Linux firmware.
> - In the case of the Debian package, I will update the scripts to make it do this during the installation.
## Debian package build
You can build yourself this after installing some dependencies including `dkms`.
```bash
sudo apt install devscripts debmake debhelper build-essential dkms
```
```bash
dpkg-buildpackage -b -rfakeroot -us -uc
```
## LICENSE
GPL-2 on Realtek driver and the debian packaing.
## References
- [Realtek r8125 driver release page](https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software)
- [ParrotSec's realtek-rtl88xxau-dkms, where got hint from](https://github.com/ParrotSec/realtek-rtl88xxau-dkms)

View File

@ -1,143 +0,0 @@
<Linux device driver for Realtek Ethernet controllers>
This is the Linux device driver released for RealTek RTL8125 2.5Gigabit Ethernet controllers with PCI-Express interface.
<Requirements>
- Kernel source tree (supported Linux kernel 2.6.x and 2.4.x)
- For linux kernel 2.4.x, this driver supports 2.4.20 and latter.
- Compiler/binutils for kernel compilation
<Quick install with proper kernel settings>
Unpack the tarball :
# tar vjxf r8125-9.aaa.bb.tar.bz2
Change to the directory:
# cd r8125-9.aaa.bb
If you are running the target kernel, then you should be able to do :
# ./autorun.sh (as root or with sudo)
You can check whether the driver is loaded by using following commands.
# lsmod | grep r8125
# ifconfig -a
If there is a device name, ethX, shown on the monitor, the linux
driver is loaded. Then, you can use the following command to activate
the ethX.
# ifconfig ethX up
,where X=0,1,2,...
<Set the network related information>
1. Set manually
a. Set the IP address of your machine.
# ifconfig ethX "the IP address of your machine"
b. Set the IP address of DNS.
Insert the following configuration in /etc/resolv.conf.
nameserver "the IP address of DNS"
c. Set the IP address of gateway.
# route add default gw "the IP address of gateway"
2. Set by doing configurations in /etc/sysconfig/network-scripts
/ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network
/ifcfg-ethX for SuSE. There are two examples to set network
configurations.
a. Fixed IP address:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.1
GATEWAY=192.168.1.254
BROADCAST=192.168.1.255
b. DHCP:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
<Modify the MAC address>
There are two ways to modify the MAC address of the NIC.
1. Use ifconfig:
# ifconfig ethX hw ether YY:YY:YY:YY:YY:YY
,where X is the device number assigned by Linux kernel, and
YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
2. Use ip:
# ip link set ethX address YY:YY:YY:YY:YY:YY
,where X is the device number assigned by Linux kernel, and
YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
<Force Link Status>
1. Force the link status when insert the driver.
If the user is in the path ~/r8125, the link status can be forced
to one of the 5 modes as following command.
# insmod ./src/r8125.ko speed=SPEED_MODE duplex=DUPLEX_MODE autoneg=NWAY_OPTION
,where
SPEED_MODE = 1000 for 1000Mbps
= 100 for 100Mbps
= 10 for 10Mbps
DUPLEX_MODE = 0 for half-duplex
= 1 for full-duplex
NWAY_OPTION = 0 for auto-negotiation off (true force)
= 1 for auto-negotiation on (nway force)
For example:
# insmod ./src/r8125.ko speed=100 duplex=0 autoneg=1
will force PHY to operate in 100Mpbs Half-duplex(nway force).
2. Force the link status by using ethtool.
a. Insert the driver first.
b. Make sure that ethtool exists in /sbin.
c. Force the link status as the following command.
2.5G before kernel v4.10
# ethtool -s eth0 autoneg on advertise 0x802f
2.5G for kernel v4.10 and later
# ethtool -s eth0 autoneg on advertise 0x80000000002f
# ethtool -s eth0 autoneg on advertise 0x002f (1G)
# ethtool -s eth0 autoneg on advertise 0x000f (100M full)
# ethtool -s eth0 autoneg on advertise 0x0003 (10M full)
<Jumbo Frame>
Transmitting Jumbo Frames, whose packet size is bigger than 1500 bytes, please change mtu by the following command.
# ifconfig ethX mtu MTU
, where X=0,1,2,..., and MTU is configured by user.
RTL8125 supports Jumbo Frame size up to 9 kBytes.
<EEE>
Get/Set device EEE status
Get EEE device status
# ethtool --show-eee enp1s0
Set EEE device status
# ethtool --set-eee enp1s0 eee on tx-lpi on tx-timer 1546 advertise 0x0008 (100M full)
# ethtool --set-eee enp1s0 eee on tx-lpi on tx-timer 1546 advertise 0x0020 (1G)
# ethtool --set-eee enp1s0 eee on tx-lpi on tx-timer 1546 advertise 0x8000 (2.5G)

View File

@ -1,87 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# invoke insmod with all arguments we got
# and use a pathname, as insmod doesn't look in . by default
TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net/ethernet -name realtek -type d)
if [ "$TARGET_PATH" = "" ]; then
TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net -name realtek -type d)
fi
if [ "$TARGET_PATH" = "" ]; then
TARGET_PATH=/lib/modules/$(uname -r)/kernel/drivers/net
fi
echo
echo "Check old driver and unload it."
check=`lsmod | grep r8169`
if [ "$check" != "" ]; then
echo "rmmod r8169"
/sbin/rmmod r8169
fi
check=`lsmod | grep r8125`
if [ "$check" != "" ]; then
echo "rmmod r8125"
/sbin/rmmod r8125
fi
echo "Build the module and install"
echo "-------------------------------" >> log.txt
date 1>>log.txt
make $@ all 1>>log.txt || exit 1
module=`ls src/*.ko`
module=${module#src/}
module=${module%.ko}
if [ "$module" = "" ]; then
echo "No driver exists!!!"
exit 1
elif [ "$module" != "r8169" ]; then
if test -e $TARGET_PATH/r8169.ko ; then
echo "Backup r8169.ko"
if test -e $TARGET_PATH/r8169.bak ; then
i=0
while test -e $TARGET_PATH/r8169.bak$i
do
i=$(($i+1))
done
echo "rename r8169.ko to r8169.bak$i"
mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak$i
else
echo "rename r8169.ko to r8169.bak"
mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak
fi
fi
fi
echo "DEPMOD $(uname -r)"
depmod `uname -r`
echo "load module $module"
modprobe $module
is_update_initramfs=n
distrib_list="ubuntu debian"
if [ -r /etc/debian_version ]; then
is_update_initramfs=y
elif [ -r /etc/lsb-release ]; then
for distrib in $distrib_list
do
/bin/grep -i "$distrib" /etc/lsb-release 2>&1 /dev/null && \
is_update_initramfs=y && break
done
fi
if [ "$is_update_initramfs" = "y" ]; then
if which update-initramfs >/dev/null ; then
echo "Updating initramfs. Please wait."
update-initramfs -u -k $(uname -r)
else
echo "update-initramfs: command not found"
exit 1
fi
fi
echo "Completed."
exit 0

View File

@ -1,5 +0,0 @@
realtek-r8125-dkms for Debian
This installs a DKMS for Realtek r8125 drivers.
-- Deokgyu Yang <secugyu@gmail.com> Fri, 12 Jun 2020 12:27:29 +0900

View File

@ -1,6 +0,0 @@
realtek-r8125-dkms for Debian
The driver source can be found here:
https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software
-- Deokgyu Yang <secugyu@gmail.com> Fri, 12 Jun 2020 12:27:29 +0900

113
debian/changelog vendored
View File

@ -1,113 +0,0 @@
realtek-r8125-dkms (9.011.01-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.011.01
-- Deokgyu Yang <secugyu@gmail.com> Wed, 26 Apr 2023 13:55:30 +0900
realtek-r8125-dkms (9.011.00-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.011.00 with remaining support for kernel
6.1 or above by the previous patch
-- Deokgyu Yang <secugyu@gmail.com> Thu, 05 Jan 2023 10:32:06 +0900
realtek-r8125-dkms (9.010.01-2) stable; urgency=medium
* Add support for kernel 6.1
-- Deokgyu Yang <secugyu@gmail.com> Mon, 19 Dec 2022 12:18:51 +0900
realtek-r8125-dkms (9.010.01-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.010.01
* Use tar.xz compression when building Debian package
-- Deokgyu Yang <secugyu@gmail.com> Mon, 07 Nov 2022 10:52:01 +0900
realtek-r8125-dkms (9.009.02-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.009.02
-- Deokgyu Yang <secugyu@gmail.com> Sun, 10 Jul 2022 22:26:34 +0900
realtek-r8125-dkms (9.009.01-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.009.01
-- Deokgyu Yang <secugyu@gmail.com> Tue, 07 Jun 2022 18:09:13 +0900
realtek-r8125-dkms (9.009.00-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.009.00
-- Deokgyu Yang <secugyu@gmail.com> Fri, 29 Apr 2022 09:38:17 +0800
realtek-r8125-dkms (9.008.00-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.008.00
-- Deokgyu Yang <secugyu@gmail.com> Fri, 18 Mar 2022 13:03:33 +0100
realtek-r8125-dkms (9.007.01-2) stable; urgency=medium
* dkms.conf: Pass KVER value to make clean target
* dkms.conf: Correct the make target to avoid unnecessary copy
-- Deokgyu Yang <secugyu@gmail.com> Sun, 09 Jan 2022 13:00:22 +0900
realtek-r8125-dkms (9.007.01-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.007.01
-- Deokgyu Yang <secugyu@gmail.com> Mon, 22 Nov 2021 15:03:33 +0100
realtek-r8125-dkms (9.006.04-3) stable; urgency=medium
* Fix a potential dependency problem during Makefile
-- Deokgyu Yang <secugyu@gmail.com> Wed, 03 Nov 2021 15:55:27 +0900
realtek-r8125-dkms (9.006.04-2) stable; urgency=medium
* Add spinlock_t lock member back to the r8125_private struct
-- Deokgyu Yang <secugyu@gmail.com> Wed, 29 Sep 2021 20:39:07 +0900
realtek-r8125-dkms (9.006.04-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.006.04
-- Deokgyu Yang <secugyu@gmail.com> Thu, 19 Aug 2021 21:23:11 +0900
realtek-r8125-dkms (9.005.06-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.005.06
-- Deokgyu Yang <secugyu@gmail.com> Fri, 04 Jun 2021 14:57:04 +0900
realtek-r8125-dkms (9.005.01-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.005.01
-- Deokgyu Yang <secugyu@gmail.com> Tue, 02 Feb 2021 15:34:42 +0900
realtek-r8125-dkms (9.004.01-1) stable; urgency=medium
* Update Realtek r8125 driver to 9.004.01
-- Deokgyu Yang <secugyu@gmail.com> Thu, 22 Oct 2020 09:35:28 +0900
realtek-r8125-dkms (9.003.05-1) stable; urgency=low
* Now DKMS working
* Change DKMS version by Debian package to the driver's version
-- Deokgyu Yang <secugyu@gmail.com> Tue, 16 Jun 2020 00:52:35 +0900
realtek-r8125-dkms (0.1) UNRELEASED; urgency=low
* Initial release
* This package will be installed but DKMS won't work
Do not install this version, otherwise your system will be corrupted
-- Deokgyu Yang <secugyu@gmail.com> Fri, 12 Jun 2020 12:27:29 +0900

1
debian/compat vendored
View File

@ -1 +0,0 @@
11

16
debian/control vendored
View File

@ -1,16 +0,0 @@
Source: realtek-r8125-dkms
Section: contrib/kernel
Priority: optional
Maintainer: Deokgyu Yang <secugyu@gmail.com>
Build-Depends: debhelper (>=11~), dkms
Standards-Version: 4.1.4
Homepage: https://github.com/awesometic/realtek-r8125-dkms
Package: realtek-r8125-dkms
Architecture: any
Multi-Arch: foreign
Depends: dkms (>= 1.95), ${misc:Depends}
Description: Realtek RTL8125 driver in DKMS format
This package provides the source code for RTL8125 Linux driver that may
include supporting other Realtek 2.5 GbE chipsets to be build with dkms.
Kernel sources or headers are required to compile this module.

50
debian/copyright vendored
View File

@ -1,50 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: realtek-r8125-dkms
Source: https://github.com/awesometic/realtek-r8125-dkms
Files: *
Copyright: 2019-2022 Realtek Semiconductor Corp.
License: GPL-2
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
.
You should have received a copy of the GNU General Public License along with
this program; if not, see <http://www.gnu.org/licenses/>.
.
Author:
Realtek NIC software team <nicfae@realtek.com>
No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
.
This product is covered by one or more of the following patents:
US6,570,884, US6,115,776, and US6,327,625.
.
On Debian systems, the complete text of the GNU General Public License
Version 2 can be found in `/usr/share/common-licenses/GPL-2'.
Files: debian/*
Copyright: 2020-2022 Deokgyu Yang <secugyu@gmail.com>
License: GPL-2
License: GPL-2
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110, USA
.
On Debian systems, the complete text of the GNU General Public License
version 2 can be found in "/usr/share/common-licenses/GPL-2"

1
debian/dirs vendored
View File

@ -1 +0,0 @@
usr/src

1
debian/docs vendored
View File

@ -1 +0,0 @@
README.md REALTEK_README.txt LICENSE

49
debian/postinst vendored
View File

@ -1,49 +0,0 @@
#!/bin/sh
# Copyright (C) 2002-2005 Flavio Stanchina
# Copyright (C) 2005-2006 Aric Cyr
# Copyright (C) 2007 Mario Limonciello
# Copyright (C) 2009 Alberto Milone
set -e
NAME=realtek-r8125
PACKAGE_NAME=$NAME-dkms
DEB_NAME=$(echo $PACKAGE_NAME | sed 's,_,-,')
CVERSION=`dpkg-query -W -f='${Version}' $DEB_NAME | awk -F "-" '{print $1}' | cut -d\: -f2`
ARCH=`dpkg --print-architecture`
dkms_configure () {
for POSTINST in /usr/lib/dkms/common.postinst "/usr/share/$PACKAGE_NAME/postinst"; do
if [ -f "$POSTINST" ]; then
"$POSTINST" "$NAME" "$CVERSION" "/usr/share/$PACKAGE_NAME" "$ARCH" "$2"
return $?
fi
echo "WARNING: $POSTINST does not exist." >&2
done
echo "ERROR: DKMS version is too old and $PACKAGE_NAME was not" >&2
echo "built with legacy DKMS support." >&2
echo "You must either rebuild $PACKAGE_NAME with legacy postinst" >&2
echo "support or upgrade DKMS to a more current version." >&2
return 1
}
case "$1" in
configure)
dkms_configure
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

26
debian/prerm vendored
View File

@ -1,26 +0,0 @@
#!/bin/sh
NAME=realtek-r8125
VERSION=9.011.01
set -e
case "$1" in
remove|upgrade|deconfigure)
if [ "`dkms status -m $NAME`" ]; then
dkms remove -m $NAME -v $VERSION --all
fi
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

30
debian/rules vendored
View File

@ -1,30 +0,0 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
#just use base version
VERSION := $(shell dpkg-parsechangelog -S Version | sed 's/-.*//' | sed 's/+pristine//')
%:
dh $@ --parallel --with dkms
override_dh_install:
dh_install dkms.conf REALTEK_README.txt Makefile usr/src/realtek-r8125-$(VERSION)
dh_install src/* usr/src/realtek-r8125-$(VERSION)/src
override_dh_dkms:
dh_dkms -V $(VERSION)
override_dh_fixperms:
dh_fixperms
find debian/realtek-r8125-dkms/usr/src -type f -exec chmod -x {} \;
override_dh_builddeb:
dh_builddeb -- -Zxz
# Nothing to configure, build or auto-install
override_dh_auto_configure:
override_dh_auto_build:
override_dh_auto_test:
override_dh_auto_install:
override_dh_auto_clean:

View File

@ -1 +0,0 @@
3.0 (quilt)

View File

@ -1,23 +0,0 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must run this with superuser priviliges. Try \"sudo ./dkms-install.sh\"" 2>&1
exit 1
else
echo "About to run dkms install steps..."
fi
DRV_DIR="$(pwd)"
DRV_NAME=r8125
DRV_VERSION=9.011.01
cp -r ${DRV_DIR} /usr/src/${DRV_NAME}-${DRV_VERSION}
dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
RESULT=$?
echo "Finished running dkms install steps."
exit $RESULT

View File

@ -1,24 +0,0 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must run this with superuser priviliges. Try \"sudo ./dkms-remove.sh\"" 2>&1
exit 1
else
echo "About to run dkms removal steps..."
fi
DRV_DIR="$(pwd)"
DRV_NAME=r8125
DRV_VERSION=9.011.01
dkms remove ${DRV_NAME}/${DRV_VERSION} --all
rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION}
RESULT=$?
if [[ "$RESULT" != "0" ]]; then
echo "Error occurred while running dkms remove." 2>&1
else
echo "Finished running dkms removal steps."
fi
exit $RESULT

View File

@ -1,11 +0,0 @@
PACKAGE_NAME="realtek-r8125"
PACKAGE_VERSION="9.011.01"
PROCS_NUM=`nproc`
[ $PROCS_NUM -gt 16 ] && PROCS_NUM=16
MAKE="'make' -j$PROCS_NUM KVER=${kernelver} BSRC=/lib/modules/${kernelver} modules"
CLEAN="'make' KVER=${kernelver} BSRC=/lib/modules/${kernelver} clean"
BUILT_MODULE_NAME[0]="r8125"
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/updates"
AUTOINSTALL="yes"
REMAKE_INITRD=no

View File

@ -51,35 +51,12 @@
typedef int netdev_tx_t;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
static inline bool dev_page_is_reusable(const struct page *page)
{
return likely(page_to_nid(page) == numa_mem_id() &&
!page_is_pfmemalloc(page));
}
#endif
/*
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)&& !defined(ENABLE_LIB_SUPPORT)
#define RTL_USE_NEW_INTR_API
#endif
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
#define dma_map_page_attrs(dev, page, offset, size, dir, attrs) \
dma_map_page(dev, page, offset, size, dir)
#define dma_unmap_page_attrs(dev, page, size, dir, attrs) \
dma_unmap_page(dev, page, size, dir)
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
#define page_ref_inc(page) atomic_inc(&page->_count)
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,216)
#define page_ref_count(page) atomic_read(&page->_count)
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,4,216)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
#define skb_transport_offset(skb) (skb->h.raw - skb->data)
#endif
@ -177,14 +154,6 @@ do { \
#endif
#endif
#define RTL_BUILD_SKB_INTR(data, frag_size) build_skb(data, frag_size)
#ifdef CONFIG_R8125_NAPI
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)
#undef RTL_BUILD_SKB_INTR
#define RTL_BUILD_SKB_INTR(data, frag_size) napi_build_skb(data, frag_size)
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
#define eth_random_addr(addr) random_ether_addr(addr)
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
@ -365,7 +334,7 @@ do { \
#ifndef NET_IP_ALIGN
#define NET_IP_ALIGN 2
#endif
#define R8125_RX_ALIGN NET_IP_ALIGN
#define RTK_RX_ALIGN 8
#ifdef CONFIG_R8125_NAPI
#define NAPI_SUFFIX "-NAPI"
@ -398,7 +367,7 @@ do { \
#define RSS_SUFFIX ""
#endif
#define RTL8125_VERSION "9.011.01" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX
#define RTL8125_VERSION "9.009.02" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX
#define MODULENAME "r8125"
#define PFX MODULENAME ": "
@ -491,8 +460,6 @@ This is free software, and you are welcome to redistribute it under certain cond
#define RTL8125_LINK_TIMEOUT (1 * HZ)
#define RTL8125_ESD_TIMEOUT (2 * HZ)
#define rtl8125_rx_page_size(order) (PAGE_SIZE << order)
#define MAX_NUM_TX_DESC 1024 /* Maximum number of Tx descriptor registers */
#define MAX_NUM_RX_DESC 1024 /* Maximum number of Rx descriptor registers */
@ -510,11 +477,6 @@ This is free software, and you are welcome to redistribute it under certain cond
#define OCP_STD_PHY_BASE 0xa400
//Channel Wait Count
#define R8125_CHANNEL_WAIT_COUNT (20000)
#define R8125_CHANNEL_WAIT_TIME (1) // 1us
#define R8125_CHANNEL_EXIT_DELAY_TIME (20) //20us
#ifdef ENABLE_LIB_SUPPORT
#define R8125_MULTI_RX_Q(tp) 0
#else
@ -586,11 +548,8 @@ This is free software, and you are welcome to redistribute it under certain cond
#ifndef ADVERTISED_2500baseX_Full
#define ADVERTISED_2500baseX_Full 0x8000
#endif
#define RTK_ADVERTISED_5000baseX_Full BIT(48)
#define RTK_ADVERTISE_2500FULL 0x80
#define RTK_ADVERTISE_5000FULL 0x100
#define RTK_ADVERTISE_10000FULL 0x1000
#define RTK_LPA_ADVERTISE_2500FULL 0x20
#define RTK_LPA_ADVERTISE_5000FULL 0x40
#define RTK_LPA_ADVERTISE_10000FULL 0x800
@ -600,9 +559,6 @@ This is free software, and you are welcome to redistribute it under certain cond
/* Tx NO CLOSE */
#define MAX_TX_NO_CLOSE_DESC_PTR_V2 0x10000
#define MAX_TX_NO_CLOSE_DESC_PTR_MASK_V2 0xFFFF
#define MAX_TX_NO_CLOSE_DESC_PTR_V3 0x100000000
#define MAX_TX_NO_CLOSE_DESC_PTR_MASK_V3 0xFFFFFFFF
#define TX_NO_CLOSE_SW_PTR_MASK_V2 0x1FFFF
#ifndef ETH_MIN_MTU
@ -622,10 +578,6 @@ This is free software, and you are welcome to redistribute it under certain cond
#define READ_ONCE(var) (*((volatile typeof(var) *)(&(var))))
#endif
#ifndef SPEED_5000
#define SPEED_5000 5000
#endif
/*****************************************************************************/
//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)
@ -1276,15 +1228,12 @@ enum RTL8125_registers {
IMR_V2_SET_REG_8125 = 0x0D0C,
TDU_STA_8125 = 0x0D08,
RDU_STA_8125 = 0x0D0A,
DOUBLE_VLAN_CONFIG = 0x1000,
TX_NEW_CTRL = 0x203E,
TNPDS_Q1_LOW_8125 = 0x2100,
PLA_TXQ0_IDLE_CREDIT = 0x2500,
PLA_TXQ1_IDLE_CREDIT = 0x2504,
SW_TAIL_PTR0_8125 = 0x2800,
HW_CLO_PTR0_8125 = 0x2802,
SW_TAIL_PTR0_8126 = 0x2800,
HW_CLO_PTR0_8126 = 0x2800,
RDSAR_Q1_LOW_8125 = 0x4000,
RSS_CTRL_8125 = 0x4500,
Q_NUM_CTRL_8125 = 0x4800,
@ -1432,7 +1381,6 @@ enum RTL8125_register_content {
/* rtl8125_PHYstatus */
PowerSaveStatus = 0x80,
_5000bpsF = 0x1000,
_2500bpsF = 0x400,
TxFlowCtrl = 0x40,
RxFlowCtrl = 0x20,
@ -1678,17 +1626,7 @@ enum bits {
BIT_31 = (1 << 31)
};
#define RTL8125_CP_NUM 4
#define RTL8125_MAX_SUPPORT_cp_len 110
enum rtl8125_cp_status {
rtl8125_cp_normal = 0,
rtl8125_cp_short,
rtl8125_cp_open,
rtl8125_cp_unknown
};
enum efuse {
enum effuse {
EFUSE_NOT_SUPPORT = 0,
EFUSE_SUPPORT_V1,
EFUSE_SUPPORT_V2,
@ -1826,7 +1764,6 @@ struct rtl8125_tx_ring {
u32 num_tx_desc; /* Number of Tx descriptor registers */
struct TxDesc *TxDescArray; /* 256-aligned Tx descriptor ring */
dma_addr_t TxPhyAddr;
u32 TxDescAllocSize;
struct ring_info tx_skb[MAX_NUM_TX_DESC]; /* Tx data buffers */
u32 NextHwDesCloPtr;
@ -1838,14 +1775,6 @@ struct rtl8125_tx_ring {
u16 tdsar_reg; /* Transmit Descriptor Start Address */
};
struct rtl8125_rx_buffer {
struct page *page;
u32 page_offset;
dma_addr_t dma;
void* data;
struct sk_buff *skb;
};
struct rtl8125_rx_ring {
void* priv;
u32 index;
@ -1853,15 +1782,9 @@ struct rtl8125_rx_ring {
u32 dirty_rx;
u32 num_rx_desc; /* Number of Rx descriptor registers */
struct RxDesc *RxDescArray; /* 256-aligned Rx descriptor ring */
u32 RxDescAllocSize;
u64 RxDescPhyAddr[MAX_NUM_RX_DESC]; /* Rx desc physical address*/
dma_addr_t RxPhyAddr;
#ifdef ENABLE_PAGE_REUSE
struct rtl8125_rx_buffer rx_buffer[MAX_NUM_RX_DESC];
u16 rx_offset;
#else
struct sk_buff *Rx_skbuff[MAX_NUM_RX_DESC]; /* Rx data buffers */
#endif //ENABLE_PAGE_REUSE
u16 rdsar_reg; /* Receive Descriptor Start Address */
};
@ -2129,11 +2052,6 @@ struct rtl8125_private {
//struct sk_buff *Rx_skbuff[MAX_NUM_RX_DESC]; /* Rx data buffers */
//struct ring_info tx_skb[MAX_NUM_TX_DESC]; /* Tx data buffers */
unsigned rx_buf_sz;
#ifdef ENABLE_PAGE_REUSE
unsigned rx_buf_page_order;
unsigned rx_buf_page_size;
u32 page_reuse_fail_cnt;
#endif //ENABLE_PAGE_REUSE
u16 HwSuppNumTxQueues;
u16 HwSuppNumRxQueues;
unsigned int num_tx_rings;
@ -2151,7 +2069,6 @@ struct rtl8125_private {
unsigned int esd_flag;
unsigned int pci_cfg_is_read;
unsigned int rtl8125_rx_config;
u16 rms;
u16 cp_cmd;
u32 intr_mask;
u32 timer_intr_mask;
@ -2174,14 +2091,13 @@ struct rtl8125_private {
u8 autoneg;
u8 duplex;
u32 speed;
u64 advertising;
u32 advertising;
enum rtl8125_fc_mode fcpause;
u32 HwSuppMaxPhyLinkSpeed;
u16 eeprom_len;
u16 cur_page;
u32 bios_setting;
int (*set_speed)(struct net_device *, u8 autoneg, u32 speed, u8 duplex, u64 adv);
int (*set_speed)(struct net_device *, u8 autoneg, u32 speed, u8 duplex, u32 adv);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
void (*get_settings)(struct net_device *, struct ethtool_cmd *);
#else
@ -2266,7 +2182,6 @@ struct rtl8125_private {
u32 HwPcieSNOffset;
u32 MaxTxDescPtrMask;
u8 HwSuppTxNoCloseVer;
u8 EnableTxNoClose;
@ -2482,7 +2397,6 @@ enum mcfg {
CFG_METHOD_5,
CFG_METHOD_6,
CFG_METHOD_7,
CFG_METHOD_8,
CFG_METHOD_DEFAULT,
CFG_METHOD_MAX
};
@ -2517,7 +2431,6 @@ enum mcfg {
#define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0b33)
#define NIC_RAMCODE_VERSION_CFG_METHOD_4 (0x0b17)
#define NIC_RAMCODE_VERSION_CFG_METHOD_5 (0x0b74)
#define NIC_RAMCODE_VERSION_CFG_METHOD_8 (0x0023)
//hwoptimize
#define HW_PATCH_SOC_LAN (BIT_0)
@ -2606,8 +2519,6 @@ int rtl8125_init_ring(struct net_device *dev);
void rtl8125_hw_set_rx_packet_filter(struct net_device *dev);
void rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp);
int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr);
void rtl8125_enable_napi(struct rtl8125_private *tp);
void _rtl8125_wait_for_quiescence(struct net_device *dev);
#ifndef ENABLE_LIB_SUPPORT
static inline void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { }
@ -2619,10 +2530,6 @@ static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { }
#define HW_SUPPORT_D0_SPEED_UP(_M) ((_M)->HwSuppD0SpeedUpVer > 0)
#define HW_SUPPORT_MAC_MCU(_M) ((_M)->HwSuppMacMcuVer > 0)
#define HW_SUPP_PHY_LINK_SPEED_GIGA(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 1000)
#define HW_SUPP_PHY_LINK_SPEED_2500M(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 2500)
#define HW_SUPP_PHY_LINK_SPEED_5000M(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 5000)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
#define netdev_mc_count(dev) ((dev)->mc_count)
#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)

File diff suppressed because it is too large Load Diff

View File

@ -88,7 +88,7 @@ int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
struct rtl8125_private *tp = netdev_priv(dev);
int ret = -EOPNOTSUPP;
netif_info(tp, drv, tp->dev, "rss get rxnfc\n");
//netif_info(tp, drv, tp->dev, "rss get rxnfc\n");
if (!(dev->features & NETIF_F_RXHASH))
return ret;
@ -153,7 +153,7 @@ static int rtl8125_set_rss_hash_opt(struct rtl8125_private *tp,
{
u32 rss_flags = tp->rss_flags;
netif_info(tp, drv, tp->dev, "rss set hash\n");
//netif_info(tp, drv, tp->dev, "rss set hash\n");
/*
* RSS does not support anything other than hashing
@ -261,7 +261,7 @@ int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
struct rtl8125_private *tp = netdev_priv(dev);
int ret = -EOPNOTSUPP;
netif_info(tp, drv, tp->dev, "rss set rxnfc\n");
//netif_info(tp, drv, tp->dev, "rss set rxnfc\n");
if (!(dev->features & NETIF_F_RXHASH))
return ret;
@ -286,7 +286,7 @@ u32 rtl8125_get_rxfh_key_size(struct net_device *dev)
{
struct rtl8125_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get key size\n");
//netif_info(tp, drv, tp->dev, "rss get key size\n");
if (!(dev->features & NETIF_F_RXHASH))
return 0;
@ -298,7 +298,7 @@ u32 rtl8125_rss_indir_size(struct net_device *dev)
{
struct rtl8125_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get indir tbl size\n");
//netif_info(tp, drv, tp->dev, "rss get indir tbl size\n");
if (!(dev->features & NETIF_F_RXHASH))
return 0;
@ -319,7 +319,7 @@ int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
{
struct rtl8125_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get rxfh\n");
//netif_info(tp, drv, tp->dev, "rss get rxfh\n");
if (!(dev->features & NETIF_F_RXHASH))
return -EOPNOTSUPP;
@ -383,7 +383,7 @@ int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir,
int i;
u32 reta_entries = rtl8125_rss_indir_tbl_entries(tp);
netif_info(tp, drv, tp->dev, "rss set rxfh\n");
//netif_info(tp, drv, tp->dev, "rss set rxfh\n");
/* We require at least one supported parameter to be changed and no
* change in any of the unsupported parameters

View File

@ -1,209 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
################################################################################
#
# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
################################################################################
# This product is covered by one or more of the following patents:
# US6,570,884, US6,115,776, and US6,327,625.
################################################################################
CONFIG_SOC_LAN = n
ENABLE_REALWOW_SUPPORT = n
ENABLE_DASH_SUPPORT = n
ENABLE_DASH_PRINTER_SUPPORT = n
CONFIG_DOWN_SPEED_100 = n
CONFIG_ASPM = y
ENABLE_S5WOL = y
ENABLE_S5_KEEP_CURR_MAC = n
ENABLE_EEE = y
ENABLE_S0_MAGIC_PACKET = n
ENABLE_TX_NO_CLOSE = y
ENABLE_MULTIPLE_TX_QUEUE = n
ENABLE_PTP_SUPPORT = n
ENABLE_PTP_MASTER_MODE = n
ENABLE_RSS_SUPPORT = n
ENABLE_LIB_SUPPORT = n
ENABLE_USE_FIRMWARE_FILE = n
DISABLE_PM_SUPPORT = n
DISABLE_MULTI_MSIX_VECTOR = n
ENABLE_DOUBLE_VLAN = n
ENABLE_PAGE_REUSE = n
ENABLE_RX_PACKET_FRAGMENT = n
ifneq ($(KERNELRELEASE),)
obj-m := r8125.o
r8125-objs := r8125_n.o rtl_eeprom.o rtltool.o
ifeq ($(CONFIG_SOC_LAN), y)
EXTRA_CFLAGS += -DCONFIG_SOC_LAN
endif
ifeq ($(ENABLE_REALWOW_SUPPORT), y)
r8125-objs += r8125_realwow.o
EXTRA_CFLAGS += -DENABLE_REALWOW_SUPPORT
endif
ifeq ($(ENABLE_DASH_SUPPORT), y)
r8125-objs += r8125_dash.o
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT
endif
ifeq ($(ENABLE_DASH_PRINTER_SUPPORT), y)
r8125-objs += r8125_dash.o
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT -DENABLE_DASH_PRINTER_SUPPORT
endif
EXTRA_CFLAGS += -DCONFIG_R8125_NAPI
EXTRA_CFLAGS += -DCONFIG_R8125_VLAN
ifeq ($(CONFIG_DOWN_SPEED_100), y)
EXTRA_CFLAGS += -DCONFIG_DOWN_SPEED_100
endif
ifeq ($(CONFIG_ASPM), y)
EXTRA_CFLAGS += -DCONFIG_ASPM
endif
ifeq ($(ENABLE_S5WOL), y)
EXTRA_CFLAGS += -DENABLE_S5WOL
endif
ifeq ($(ENABLE_S5_KEEP_CURR_MAC), y)
EXTRA_CFLAGS += -DENABLE_S5_KEEP_CURR_MAC
endif
ifeq ($(ENABLE_EEE), y)
EXTRA_CFLAGS += -DENABLE_EEE
endif
ifeq ($(ENABLE_S0_MAGIC_PACKET), y)
EXTRA_CFLAGS += -DENABLE_S0_MAGIC_PACKET
endif
ifeq ($(ENABLE_TX_NO_CLOSE), y)
EXTRA_CFLAGS += -DENABLE_TX_NO_CLOSE
endif
ifeq ($(ENABLE_MULTIPLE_TX_QUEUE), y)
EXTRA_CFLAGS += -DENABLE_MULTIPLE_TX_QUEUE
endif
ifeq ($(ENABLE_PTP_SUPPORT), y)
r8125-objs += r8125_ptp.o
EXTRA_CFLAGS += -DENABLE_PTP_SUPPORT
endif
ifeq ($(ENABLE_PTP_MASTER_MODE), y)
EXTRA_CFLAGS += -DENABLE_PTP_MASTER_MODE
endif
ifeq ($(ENABLE_RSS_SUPPORT), y)
r8125-objs += r8125_rss.o
EXTRA_CFLAGS += -DENABLE_RSS_SUPPORT
endif
ifeq ($(ENABLE_LIB_SUPPORT), y)
r8125-objs += r8125_lib.o
EXTRA_CFLAGS += -DENABLE_LIB_SUPPORT
endif
ifeq ($(ENABLE_USE_FIRMWARE_FILE), y)
r8125-objs += r8125_firmware.o
EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE
endif
ifeq ($(DISABLE_PM_SUPPORT), y)
EXTRA_CFLAGS += -DDISABLE_PM_SUPPORT
endif
ifeq ($(DISABLE_MULTI_MSIX_VECTOR), y)
EXTRA_CFLAGS += -DDISABLE_MULTI_MSIX_VECTOR
endif
ifeq ($(ENABLE_DOUBLE_VLAN), y)
EXTRA_CFLAGS += -DENABLE_DOUBLE_VLAN
endif
ifeq ($(ENABLE_PAGE_REUSE), y)
EXTRA_CFLAGS += -DENABLE_PAGE_REUSE
endif
ifeq ($(ENABLE_RX_PACKET_FRAGMENT), y)
EXTRA_CFLAGS += -DENABLE_RX_PACKET_FRAGMENT
endif
else
BASEDIR := /lib/modules/$(shell uname -r)
KERNELDIR ?= $(BASEDIR)/build
PWD :=$(shell pwd)
DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net/ethernet -name realtek -type d)
ifeq ($(DRIVERDIR),)
DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d)
endif
ifeq ($(DRIVERDIR),)
DRIVERDIR := $(BASEDIR)/kernel/drivers/net
endif
RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR))
KERNEL_GCC_VERSION := $(shell cat /proc/version | sed -n 's/.*gcc version \([[:digit:]]\.[[:digit:]]\.[[:digit:]]\).*/\1/p')
CCVERSION = $(shell $(CC) -dumpversion)
KVER = $(shell uname -r)
KMAJ = $(shell echo $(KVER) | \
sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')
KMIN = $(shell echo $(KVER) | \
sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')
KREV = $(shell echo $(KVER) | \
sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/')
kver_ge = $(shell \
echo test | awk '{if($(KMAJ) < $(1)) {print 0} else { \
if($(KMAJ) > $(1)) {print 1} else { \
if($(KMIN) < $(2)) {print 0} else { \
if($(KMIN) > $(2)) {print 1} else { \
if($(KREV) < $(3)) {print 0} else { print 1 } \
}}}}}' \
)
.PHONY: all
all: print_vars clean modules install
print_vars:
@echo
@echo "CC: " $(CC)
@echo "CCVERSION: " $(CCVERSION)
@echo "KERNEL_GCC_VERSION: " $(KERNEL_GCC_VERSION)
@echo "KVER: " $(KVER)
@echo "KMAJ: " $(KMAJ)
@echo "KMIN: " $(KMIN)
@echo "KREV: " $(KREV)
@echo "BASEDIR: " $(BASEDIR)
@echo "DRIVERDIR: " $(DRIVERDIR)
@echo "PWD: " $(PWD)
@echo "RTKDIR: " $(RTKDIR)
@echo
.PHONY:modules
modules:
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
#endif
.PHONY:clean
clean:
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean
#endif
.PHONY:install
install:
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
#endif
endif