You are not logged in.

#1 2023-11-13 02:32:27

hwallace
Member
Registered: 2021-08-30
Posts: 110

issue with r8101-dkms from AUR

Having trouble installing driver for this network device. Building r8101-dkms  from AUR

From lspci

01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet controller (rev 07)

From lshw

 *-network UNCLAIMED       
       description: Ethernet controller
       product: RTL810xE PCI Express Fast Ethernet controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:01:00.0
       version: 07
       width: 64 bits

I have tried to build r8101-dkms from AUR, but it seems to fail

stephen@dell:~/external/r8101-dkms]
:> makepkg -si
==> Making package: r8101-dkms 1.035.03-2 (Sun Nov 12 17:56:23 2023)
==> Checking runtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...

Packages (1) dkms-3.0.11-1

Total Download Size:   0.04 MiB
Total Installed Size:  0.11 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 dkms-3.0.11-1-any      38.7 KiB  24.5 KiB/s 00:02 [######################] 100%
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Processing package changes...
(1/1) installing dkms                              [######################] 100%
Optional dependencies for dkms
    linux-headers: build modules against the Arch kernel [installed]
    linux-lts-headers: build modules against the LTS kernel
    linux-zen-headers: build modules against the ZEN kernel
    linux-hardened-headers: build modules against the HARDENED kernel
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading r8101-1.035.03.tar.bz2...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 63455  100 63455    0     0  54085      0  0:00:01  0:00:01 --:--:-- 54096
  -> Found dkms.conf
==> Validating source files with sha512sums...
    r8101-1.035.03.tar.bz2 ... Passed
    dkms.conf ... Passed
==> Extracting sources...
  -> Extracting r8101-1.035.03.tar.bz2 with bsdtar
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "r8101-dkms"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: r8101-dkms 1.035.03-2 (Sun Nov 12 17:56:29 2023)
==> Installing package r8101-dkms with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) r8101-dkms-1.035.03-2/code]

       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:3000(size=256) memory:91500000-91500fff memory:91200000-91203fff

Total Installed Size:  0.58 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Processing package changes...
(1/1) installing r8101-dkms                        [######################] 100%
Optional dependencies for r8101-dkms
    ethtool: device configuration
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Install DKMS modules
==> dkms install --no-depmod r8101/1.035.03 -k 6.6.1-arch1-1
Error! Bad return status for module build on kernel: 6.6.1-arch1-1 (x86_64)
Consult /var/lib/dkms/r8101/1.035.03/build/make.log for more information.
==> WARNING: `dkms install --no-depmod r8101/1.035.03 -k 6.6.1-arch1-1' exited 10

Here is the make.log

DKMS make.log for r8101-1.035.03 for kernel 6.6.1-arch1-1 (x86_64)
Sun Nov 12 18:05:50 PST 2023
make -C src/ modules
make[1]: Entering directory '/var/lib/dkms/r8101/1.035.03/build/src'
make -C /usr/lib/modules/6.6.1-arch1-1/build M=/var/lib/dkms/r8101/1.035.03/build/src modules
make[2]: Entering directory '/usr/lib/modules/6.6.1-arch1-1/build'
  CC [M]  /var/lib/dkms/r8101/1.035.03/build/src/r8101_n.o
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_proc_open’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:1284:50: error: implicit declaration of function ‘PDE_DATA’; did you mean ‘NODE_DATA’? [-Werror=implicit-function-declaration]
 1284 |         int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
      |                                                  ^~~~~~~~
      |                                                  NODE_DATA
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:1284:50: warning: initialization of ‘int (*)(struct seq_file *, void *)’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_get_mac_address’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10029:34: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)i)’
10029 |                 dev->dev_addr[i] = RTL_R8(tp, MAC0 + i);
      |                                  ^
In file included from ./include/linux/string.h:254,
                 from ./include/linux/bitmap.h:11,
                 from ./include/linux/cpumask.h:12,
                 from ./arch/x86/include/asm/paravirt.h:17,
                 from ./arch/x86/include/asm/cpuid.h:62,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/timex.h:5,
                 from ./include/linux/timex.h:67,
                 from ./include/linux/time32.h:13,
                 from ./include/linux/time.h:60,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:13,
                 from /var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:38:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_set_mac_address’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10060:19: warning: passing argument 1 of ‘__builtin_memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
10060 |         memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |                ~~~^~~~~~~~~~
./include/linux/fortify-string.h:648:27: note: in definition of macro ‘__fortify_memcpy_chk’
  648 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10060:9: note: in expansion of macro ‘memcpy’
10060 |         memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |         ^~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10060:19: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
10060 |         memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |                ~~~^~~~~~~~~~
./include/linux/fortify-string.h:648:27: note: in definition of macro ‘__fortify_memcpy_chk’
  648 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10060:9: note: in expansion of macro ‘memcpy’
10060 |         memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |         ^~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10062:32: warning: passing argument 2 of ‘rtl8101_rar_set’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
10062 |         rtl8101_rar_set(tp, dev->dev_addr);
      |                             ~~~^~~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:269:59: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’
  269 | void rtl8101_rar_set(struct rtl8101_private *tp, uint8_t *addr);
      |                                                  ~~~~~~~~~^~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_init_board’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10945:14: error: implicit declaration of function ‘pci_set_dma_mask’ [-Werror=implicit-function-declaration]
10945 |             !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
      |              ^~~~~~~~~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10946:14: error: implicit declaration of function ‘pci_set_consistent_dma_mask’ [-Werror=implicit-function-declaration]
10946 |             !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {/code]

       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:3000(size=256) memory:91500000-91500fff memory:91200000-91203fff
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:74:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_init_one’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101.h:473:57: error: too many arguments to function ‘netif_napi_add’
  473 | #define RTL_NAPI_CONFIG(ndev, priv, function, weight)   netif_napi_add(ndev, &priv->napi, function, weight)
      |                                                         ^~~~~~~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:11355:9: note: in expansion of macro ‘RTL_NAPI_CONFIG’
11355 |         RTL_NAPI_CONFIG(dev, tp, rtl8101_poll, R8101_NAPI_WEIGHT);
      |         ^~~~~~~~~~~~~~~
In file included from /var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:41:
./include/linux/netdevice.h:2630:1: note: declared here
 2630 | netif_napi_add(struct net_device *dev, struct napi_struct *napi,
      | ^~~~~~~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:11386:25: error: implicit declaration of function ‘netif_set_gso_max_size’; did you mean ‘netif_set_tso_max_size’? [-Werror=implicit-function-declaration]
11386 |                         netif_set_gso_max_size(dev, LSO_32K);
      |                         ^~~~~~~~~~~~~~~~~~~~~~
      |                         netif_set_tso_max_size
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:11430:27: error: implicit declaration of function ‘pci_alloc_consistent’ [-Werror=implicit-function-declaration]
11430 |         tp->tally_vaddr = pci_alloc_consistent(pdev, sizeof(*tp->tally_vaddr), &tp->tally_paddr);
      |                           ^~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:11430:25: warning: assignment to ‘struct rtl8101_counters *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
11430 |         tp->tally_vaddr = pci_alloc_consistent(pdev, sizeof(*tp->tally_vaddr), &tp->tally_paddr);/code]

       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:3000(size=256) memory:91500000-91500fff memory:91200000-91203fff
      |                         ^
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:11464:17: error: implicit declaration of function ‘pci_free_consistent’ [-Werror=implicit-function-declaration]
11464 |                 pci_free_consistent(pdev, sizeof(*tp->tally_vaddr), tp->tally_vaddr,
      |                 ^~~~~~~~~~~~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_open’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:11545:25: warning: assignment to ‘struct TxDesc *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
11545 |         tp->TxDescArray = pci_alloc_consistent(pdev, R8101_TX_RING_BYTES,
      |                         ^
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:11550:25: warning: assignment to ‘struct RxDesc *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
11550 |         tp->RxDescArray = pci_alloc_consistent(pdev, R8101_RX_RING_BYTES,
      |                         ^
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘r8101_csum_workaround’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:12906:24: error: implicit declaration of function ‘skb_gso_segment’; did you mean ‘skb_gso_reset’? [-Werror=implicit-function-declaration]
12906 |                 segs = skb_gso_segment(skb, features);
      |                        ^~~~~~~~~~~~~~~
      |                        skb_gso_reset/code]

       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:3000(size=256) memory:91500000-91500fff memory:91200000-91203fff
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:12906:22: warning: assignment to ‘struct sk_buff *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
12906 |                 segs = skb_gso_segment(skb, features);
      |                      ^/var/lib/dkms/r8101/1.035.03/build/make.log
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_rx_interrupt’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:13295:57: warning: the comparison will always evaluate as ‘false’ for the address of ‘Rx_skbuff’ will never be NULL [-Waddress]
13295 |         if ((tp->RxDescArray == NULL) || (tp->Rx_skbuff == NULL))
      |                                                         ^~
/var/lib/dkms/r8101/1.035.03/build/src/r8101.h:1391:25: note: ‘Rx_skbuff’ declared here
 1391 |         struct sk_buff *Rx_skbuff[NUM_RX_DESC]; /* Rx data buffers */
      |                         ^~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c: In function ‘rtl8101_resume’:
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:13725:32: warning: passing argument 2 of ‘rtl8101_rar_set’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
13725 |         rtl8101_rar_set(tp, dev->dev_addr);
      |                             ~~~^~~~~~~~~~
/var/lib/dkms/r8101/1.035.03/build/src/r8101_n.c:10077:26: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’
10077 |                 uint8_t *addr)
      |                 ~~~~~~~~~^~~~
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:243: /var/lib/dkms/r8101/1.035.03/build/src/r8101_n.o] Error 1
make[3]: *** [/usr/lib/modules/6.6.1-arch1-1/build/Makefile:1913: /var/lib/dkms/r8101/1.035.03/build/src] Error 2
make[2]: *** [Makefile:234: __sub-make] Error 2
make[2]: Leaving directory '/usr/lib/modules/6.6.1-arch1-1/build'
make[1]: *** [Makefile:116: modules] Error 2
make[1]: Leaving directory '/var/lib/dkms/r8101/1.035.03/build/src'
make: *** [Makefile:40: modules] Error 2

Offline

#2 2023-11-13 17:58:20

snakeroot
Member
Registered: 2012-10-06
Posts: 175

Re: issue with r8101-dkms from AUR

The r8101-dkams  AUR comments show a number of patches, however they only update through kernel 5.18. (As an aside, it's always good to look at the AUR page comments since often people will post patches or other solutions.) There seems to have been no update on the package since 2021 and there is no maintainer.

The Realtek driver page shows that r8101 development stopped at kernel 5.19. I haven't found any patchsets to take it from there to 6.6.

Various random people on the internet claim that the R8169 driver (which is compiled as a module in the stock Arch kernel) supports R8101 (although not very well). Maybe try modprobing that driver and see what happens?

Regards,

Offline

#3 2023-11-13 19:32:09

loqs
Member
Registered: 2014-03-06
Posts: 18,732

Re: issue with r8101-dkms from AUR

What is the VID:PID of the device?  PDE_DATA was replaced in 5.17 https://github.com/torvalds/linux/commi … 207ece28aa and as snakeroot already noted there is a patch for it.

Last edited by loqs (2023-11-13 19:32:27)

Offline

#4 2024-01-25 16:49:08

Eirikr
Member
Registered: 2022-04-22
Posts: 7

Re: issue with r8101-dkms from AUR

loqs wrote:

What is the VID:PID of the device?  PDE_DATA was replaced in 5.17 https://github.com/torvalds/linux/commi … 207ece28aa and as snakeroot already noted there is a patch for it.

Is anyone around here good at patching the driver with this? Rather: what are the steps needed to get this 8101-dkms functional again. r8169 simply does not cut it with <40-80mb speeds. Oof. driver abandonment sucks if you (like me) do not know how to match manually.

Offline

#5 2024-01-25 17:02:04

loqs
Member
Registered: 2014-03-06
Posts: 18,732

Re: issue with r8101-dkms from AUR

Eirikr wrote:
loqs wrote:

What is the VID:PID of the device?  PDE_DATA was replaced in 5.17 https://github.com/torvalds/linux/commi … 207ece28aa and as snakeroot already noted there is a patch for it.

Is anyone around here good at patching the driver with this? Rather: what are the steps needed to get this 8101-dkms functional again. r8169 simply does not cut it with <40-80mb speeds. Oof. driver abandonment sucks if you (like me) do not know how to match manually.

You did not provide the VID:PID of your device or what you have tried so far with respect to patching r8101-dkms.

Offline

#6 2024-01-25 17:36:05

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,193
Website

Re: issue with r8101-dkms from AUR

Mod note: moving to AUR Issues


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2024-01-25 21:40:14

loqs
Member
Registered: 2014-03-06
Posts: 18,732

Re: issue with r8101-dkms from AUR

diff of changes to get r8101-dkms to compile:

diff --git a/PKGBUILD b/PKGBUILD
index 5f8669e..dc0ac14 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,13 +5,13 @@
 
 _pkgbase=r8101
 pkgname=r8101-dkms
-pkgver=1.035.03
-pkgrel=2
+pkgver=1.036.00
+pkgrel=1
 pkgdesc="RTL810xE Fast Ethernet Driver (DKMS)"
 arch=('x86_64')
-url="https://fichiers.touslesdrivers.com/64992/"
+url="https://fichiers.touslesdrivers.com/69477/"
 license=('GPL2')
-depends=('dkms' 'pahole')
+depends=('dkms')
 optdepends=('ethtool: device configuration')
 provides=("${_pkgbase}")
 conflicts=("${_pkgbase}")
@@ -19,9 +19,26 @@ conflicts=("${_pkgbase}")
 # Modify this array so that it points to the manually downloaded file
 # The current setting is NOT a valid URL
 source=("${url}/${_pkgbase}-${pkgver}.tar.bz2"
-        'dkms.conf')
-sha512sums=('5dcf16b86a6cf8c30443a222103b2ef707cb6c7eb76509854f3cf205fd6713cfae501494c2d1cd42416b3e395e0e498d13da50f40de3864a2a777a8726697581'
-            '7b70e04b83f7593e16c1fa2aa404b55a40bac40cc97a085e5713dc43b04b3b91f17da8b51e86000ce57fc1c7845ae1d375929929090d9ad050cf6bea3e18b4d3')
+        'dkms.conf'
+        'r8101-1.036.00-linux-5.17.0.patch'
+        'r8101-1.036.00-linux-5.18.0.patch'
+        'r8101-1.036.00-linux-6.1.0.patch'
+        'r8101-1.036.00-linux-6.5.0.patch')
+sha512sums=('eeb526965f6e2bef6a24f39097704d2f5c8eb0bf5707132898da40aa639c8c77fd89c9852067ab2446f3f51d55db978ed12b3033a1c9882572bbdab74db27dd2'
+            '7b70e04b83f7593e16c1fa2aa404b55a40bac40cc97a085e5713dc43b04b3b91f17da8b51e86000ce57fc1c7845ae1d375929929090d9ad050cf6bea3e18b4d3'
+            '2bab4ef6590735d118afc8244a6cb9e6d544d4e561d8ab14aa52696679e640cf41ba044146eebcabd7962ca7588c7f1a8ae7088f1c03c96b778b222b4509a4c4'
+            'c3ea96ec87b401b223e5160c77139bde6be0701b54d07ff148c513091d38ac2e329e01635444ba671f57da6f86eef7ccf6c2891f58c7f85935daf6093617528e'
+            'f7ac01ed52361371b7ee90933257af14c16d4107e14c8ec0fe2317480c61023bd601243744b7561b9ca69f96a61326c258080706b459d0eff2518428d5eb4c42'
+            '3b1e465d8db0089b1ecc59678451db99a63ce22c1a597877249ffdb933e770f24569a9cec7cd0d301817c3bfd5720ae30f47ba55f77108a4e741f6b47a08a857')
+
+
+prepare() {
+    cd ${_pkgbase}-${pkgver}
+    patch -Np1 -i ../r8101-1.036.00-linux-5.17.0.patch
+    patch -Np1 -i ../r8101-1.036.00-linux-5.18.0.patch
+    patch -Np1 -i ../r8101-1.036.00-linux-6.1.0.patch
+    patch -Np1 -i ../r8101-1.036.00-linux-6.5.0.patch
+}
 
 package() {
 
diff --git a/r8101-1.036.00-linux-5.17.0.patch b/r8101-1.036.00-linux-5.17.0.patch
new file mode 100644
index 0000000..7da12bd
--- /dev/null
+++ b/r8101-1.036.00-linux-5.17.0.patch
@@ -0,0 +1,33 @@
+diff --git a/src/r8101_n.c b/src/r8101_n.c
+index 10d32b3..3a4bb52 100755
+--- a/src/r8101_n.c
++++ b/src/r8101_n.c
+@@ -1291,7 +1291,7 @@ static void rtl8101_proc_module_init(void)
+ static int rtl8101_proc_open(struct inode *inode, struct file *file)
+ {
+         struct net_device *dev = proc_get_parent_data(inode);
+-        int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
++        int (*show)(struct seq_file *, void *) = pde_data(inode);
+ 
+         return single_open(file, show, dev);
+ }
+@@ -10000,6 +10000,7 @@ rtl8101_get_mac_address(struct net_device *dev)
+         struct rtl8101_private *tp = netdev_priv(dev);
+         int i;
+         u8 mac_addr[MAC_ADDR_LEN];
++        u8 addr[ETH_ALEN];
+ 
+         for (i = 0; i < MAC_ADDR_LEN; i++)
+                 mac_addr[i] = RTL_R8(tp, MAC0 + i);
+@@ -10031,9 +10032,10 @@ rtl8101_get_mac_address(struct net_device *dev)
+         rtl8101_rar_set(tp, mac_addr);
+ 
+         for (i = 0; i < MAC_ADDR_LEN; i++) {
+-                dev->dev_addr[i] = RTL_R8(tp, MAC0 + i);
++                addr[i] = RTL_R8(tp, MAC0 + i);
+                 tp->org_mac_addr[i] = dev->dev_addr[i]; /* keep the original MAC address */
+         }
++        eth_hw_addr_set(dev, addr);
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
+         memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
+ #endif
diff --git a/r8101-1.036.00-linux-5.18.0.patch b/r8101-1.036.00-linux-5.18.0.patch
new file mode 100644
index 0000000..ef9b27c
--- /dev/null
+++ b/r8101-1.036.00-linux-5.18.0.patch
@@ -0,0 +1,180 @@
+diff --git a/src/r8101_n.c b/src/r8101_n.c
+index 3a4bb52..073d804 100755
+--- a/src/r8101_n.c
++++ b/src/r8101_n.c
+@@ -267,7 +267,13 @@ static void rtl8101_down(struct net_device *dev);
+ 
+ static int rtl8101_set_speed(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, u32 adv);
+ static int rtl8101_set_mac_address(struct net_device *dev, void *p);
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0)
++void rtl8101_rar_set(struct rtl8101_private *tp, const u8 *addr);
++#else
+ void rtl8101_rar_set(struct rtl8101_private *tp, uint8_t *addr);
++#endif
++
+ static void rtl8101_desc_addr_fill(struct rtl8101_private *);
+ static void rtl8101_tx_desc_init(struct rtl8101_private *tp);
+ static void rtl8101_rx_desc_init(struct rtl8101_private *tp);
+@@ -10064,7 +10070,11 @@ rtl8101_set_mac_address(struct net_device *dev,
+ 
+         spin_lock_irqsave(&tp->lock, flags);
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)
++        eth_hw_addr_set(dev, addr->sa_data);
++#else
+         memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
++#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)
+ 
+         rtl8101_rar_set(tp, dev->dev_addr);
+ 
+@@ -10081,7 +10091,11 @@ rtl8101_set_mac_address(struct net_device *dev,
+  *****************************************************************************/
+ void
+ rtl8101_rar_set(struct rtl8101_private *tp,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0)
++                const u8 *addr)
++#else
+                 uint8_t *addr)
++#endif
+ {
+         uint32_t rar_low = 0;
+         uint32_t rar_high = 0;
+@@ -10952,11 +10966,20 @@ rtl8101_init_board(struct pci_dev *pdev,
+ 
+         if ((sizeof(dma_addr_t) > 4) &&
+             use_dac &&
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+             !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
+             !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
++#else
++            !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
++            !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
++#endif
+                 dev->features |= NETIF_F_HIGHDMA;
+         } else {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+                 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
++#else
++                rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
++#endif
+                 if (rc < 0) {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
+                         if (netif_msg_probe(tp))
+@@ -11310,6 +11333,16 @@ static const struct net_device_ops rtl8101_netdev_ops = {
+ };
+ #endif
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++static inline void netif_set_gso_max_size(struct net_device *dev,
++                                          unsigned int size)
++
++{
++        /* dev->gso_max_size is read locklessly from sk_setup_caps() */
++        WRITE_ONCE(dev->gso_max_size, size);
++}
++#endif
++
+ static int __devinit
+ rtl8101_init_one(struct pci_dev *pdev,
+                  const struct pci_device_id *ent)
+@@ -11431,7 +11464,11 @@ rtl8101_init_one(struct pci_dev *pdev,
+ 
+         rtl8101_get_mac_address(dev);
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+         tp->tally_vaddr = pci_alloc_consistent(pdev, sizeof(*tp->tally_vaddr), &tp->tally_paddr);
++#else
++        tp->tally_vaddr = dma_alloc_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), &tp->tally_paddr, GFP_KERNEL);
++#endif
+         if (!tp->tally_vaddr) {
+                 rc = -ENOMEM;
+                 goto err_out;
+@@ -11465,8 +11502,13 @@ out:
+ 
+ err_out:
+         if (tp->tally_vaddr != NULL) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+                 pci_free_consistent(pdev, sizeof(*tp->tally_vaddr), tp->tally_vaddr,
+                                     tp->tally_paddr);
++#else
++                dma_free_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), tp->tally_vaddr,
++                                    tp->tally_paddr);
++#endif
+ 
+                 tp->tally_vaddr = NULL;
+         }
+@@ -11499,7 +11541,11 @@ rtl8101_remove_one(struct pci_dev *pdev)
+         rtl8101_proc_remove(dev);
+ #endif
+         if (tp->tally_vaddr != NULL) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+                 pci_free_consistent(pdev, sizeof(*tp->tally_vaddr), tp->tally_vaddr, tp->tally_paddr);
++#else
++                dma_free_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), tp->tally_vaddr, tp->tally_paddr);
++#endif
+                 tp->tally_vaddr = NULL;
+         }
+ 
+@@ -11546,13 +11592,23 @@ static int rtl8101_open(struct net_device *dev)
+          * Rx and Tx descriptors needs 256 bytes alignment.
+          * pci_alloc_consistent provides more.
+          */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+         tp->TxDescArray = pci_alloc_consistent(pdev, R8101_TX_RING_BYTES,
+                                                &tp->TxPhyAddr);
++#else
++        tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8101_TX_RING_BYTES,
++                                               &tp->TxPhyAddr, GFP_KERNEL);
++#endif
+         if (!tp->TxDescArray)
+                 goto out;
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+         tp->RxDescArray = pci_alloc_consistent(pdev, R8101_RX_RING_BYTES,
+                                                &tp->RxPhyAddr);
++#else
++        tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8101_RX_RING_BYTES,
++                                               &tp->RxPhyAddr, GFP_KERNEL);
++#endif
+         if (!tp->RxDescArray)
+                 goto err_free_tx;
+ 
+@@ -11621,12 +11677,22 @@ out:
+         return retval;
+ 
+ err_free_rx:
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+         pci_free_consistent(pdev, R8101_RX_RING_BYTES, tp->RxDescArray,
+                             tp->RxPhyAddr);
++#else
++        dma_free_coherent(&pdev->dev, R8101_RX_RING_BYTES, tp->RxDescArray,
++                            tp->RxPhyAddr);
++#endif
+         tp->RxDescArray = NULL;
+ err_free_tx:
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+         pci_free_consistent(pdev, R8101_TX_RING_BYTES, tp->TxDescArray,
+                             tp->TxPhyAddr);
++#else
++        dma_free_coherent(&pdev->dev, R8101_TX_RING_BYTES, tp->TxDescArray,
++                            tp->TxPhyAddr);
++#endif
+         tp->TxDescArray = NULL;
+         goto out;
+ }
+@@ -13606,9 +13672,13 @@ static int rtl8101_close(struct net_device *dev)
+ 
+                 free_irq(dev->irq, dev);
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
+                 pci_free_consistent(pdev, R8101_RX_RING_BYTES, tp->RxDescArray, tp->RxPhyAddr);
+-
+                 pci_free_consistent(pdev, R8101_TX_RING_BYTES, tp->TxDescArray, tp->TxPhyAddr);
++#else
++                dma_free_coherent(&pdev->dev, R8101_RX_RING_BYTES, tp->RxDescArray, tp->RxPhyAddr);
++                dma_free_coherent(&pdev->dev, R8101_TX_RING_BYTES, tp->TxDescArray, tp->TxPhyAddr);
++#endif
+ 
+                 tp->TxDescArray = NULL;
+                 tp->RxDescArray = NULL;
diff --git a/r8101-1.036.00-linux-6.1.0.patch b/r8101-1.036.00-linux-6.1.0.patch
new file mode 100644
index 0000000..c5c0495
--- /dev/null
+++ b/r8101-1.036.00-linux-6.1.0.patch
@@ -0,0 +1,16 @@
+diff --git a/src/r8101.h b/src/r8101.h
+index 5ea2278..3978440 100755
+--- a/src/r8101.h
++++ b/src/r8101.h
+@@ -479,7 +479,11 @@ typedef int *napi_budget;
+ typedef struct napi_struct *napi_ptr;
+ typedef int napi_budget;
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
++#define RTL_NAPI_CONFIG(ndev, priv, function, weight)	netif_napi_add_weight(ndev, &priv->napi, function, weight)
++#else
+ #define RTL_NAPI_CONFIG(ndev, priv, function, weight)	netif_napi_add(ndev, &priv->napi, function, weight)
++#endif
+ #define RTL_NAPI_QUOTA(budget, ndev)			min(budget, budget)
+ #define RTL_GET_PRIV(stuct_ptr, priv_struct)		container_of(stuct_ptr, priv_struct, stuct_ptr)
+ #define RTL_GET_NETDEV(priv_ptr)			struct net_device *dev = priv_ptr->dev;
diff --git a/r8101-1.036.00-linux-6.5.0.patch b/r8101-1.036.00-linux-6.5.0.patch
new file mode 100644
index 0000000..54e7a4b
--- /dev/null
+++ b/r8101-1.036.00-linux-6.5.0.patch
@@ -0,0 +1,15 @@
+diff --git a/src/r8101_n.c b/src/r8101_n.c
+index 1825702..9169e8e 100755
+--- a/src/r8101_n.c
++++ b/src/r8101_n.c
+@@ -69,6 +69,10 @@ This driver is modified from r8169.c in Linux kernel 2.6.18
+ #include <linux/mdio.h>
+ #endif
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,5,0)
++#include <net/gso.h>
++#endif
++
+ #include <asm/io.h>
+ #include <asm/irq.h>
+ 

Offline

Board footer

Powered by FluxBB