Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/r8168/files/, net-misc/r8168/
Date: Sun, 27 Mar 2022 09:31:02
Message-Id: 1648373447.13afe46537e99157756939d331bebed49169dfc6.pacho@gentoo
1 commit: 13afe46537e99157756939d331bebed49169dfc6
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 27 09:29:07 2022 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 27 09:30:47 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13afe465
7
8 net-misc/r8168: Fix build with kernel 5.17
9
10 Thanks-to: Peter Levine
11 Closes: https://bugs.gentoo.org/836129
12
13 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
14
15 net-misc/r8168/files/r8168-8.049.02-5.17-fix.patch | 70 ++++++++++++++++++++++
16 net-misc/r8168/r8168-8.049.02-r1.ebuild | 7 ++-
17 2 files changed, 75 insertions(+), 2 deletions(-)
18
19 diff --git a/net-misc/r8168/files/r8168-8.049.02-5.17-fix.patch b/net-misc/r8168/files/r8168-8.049.02-5.17-fix.patch
20 new file mode 100644
21 index 000000000000..9e4e77615458
22 --- /dev/null
23 +++ b/net-misc/r8168/files/r8168-8.049.02-5.17-fix.patch
24 @@ -0,0 +1,70 @@
25 +PDE_DATA has been replaced with pde_data
26 +netdev->dev_addr is now const and uses assignment helpers like eth_hw_addr_set
27 +
28 +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=359745d
29 +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=48eab83
30 +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=adeef3e
31 +
32 +--- a/src/r8168_n.c
33 ++++ b/src/r8168_n.c
34 +@@ -95,6 +95,10 @@
35 + #include <linux/seq_file.h>
36 + #endif
37 +
38 ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)
39 ++#define PDE_DATA pde_data
40 ++#endif
41 ++
42 + #define FIRMWARE_8168D_1 "rtl_nic/rtl8168d-1.fw"
43 + #define FIRMWARE_8168D_2 "rtl_nic/rtl8168d-2.fw"
44 + #define FIRMWARE_8168E_1 "rtl_nic/rtl8168e-1.fw"
45 +@@ -563,7 +567,7 @@
46 + static void rtl8168_down(struct net_device *dev);
47 +
48 + static int rtl8168_set_mac_address(struct net_device *dev, void *p);
49 +-void rtl8168_rar_set(struct rtl8168_private *tp, uint8_t *addr);
50 ++void rtl8168_rar_set(struct rtl8168_private *tp, const uint8_t *addr);
51 + static void rtl8168_desc_addr_fill(struct rtl8168_private *);
52 + static void rtl8168_tx_desc_init(struct rtl8168_private *tp);
53 + static void rtl8168_rx_desc_init(struct rtl8168_private *tp);
54 +@@ -24129,9 +24133,17 @@
55 + rtl8168_rar_set(tp, mac_addr);
56 +
57 + for (i = 0; i < MAC_ADDR_LEN; i++) {
58 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,17,0)
59 + dev->dev_addr[i] = RTL_R8(tp, MAC0 + i);
60 + tp->org_mac_addr[i] = dev->dev_addr[i]; /* keep the original MAC address */
61 ++#else
62 ++ mac_addr[i] = RTL_R8(tp, MAC0 + i);
63 ++ tp->org_mac_addr[i] = mac_addr[i]; /* keep the original MAC address */
64 ++#endif
65 + }
66 ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)
67 ++ eth_hw_addr_set(dev, mac_addr);
68 ++#endif
69 + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
70 + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
71 + #endif
72 +@@ -24159,9 +24171,11 @@
73 + return -EADDRNOTAVAIL;
74 +
75 + spin_lock_irqsave(&tp->lock, flags);
76 +-
77 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,17,0)
78 + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
79 +-
80 ++#else
81 ++ eth_hw_addr_set(dev, addr->sa_data);
82 ++#endif
83 + rtl8168_rar_set(tp, dev->dev_addr);
84 +
85 + spin_unlock_irqrestore(&tp->lock, flags);
86 +@@ -24177,7 +24191,7 @@
87 + *****************************************************************************/
88 + void
89 + rtl8168_rar_set(struct rtl8168_private *tp,
90 +- uint8_t *addr)
91 ++ const uint8_t *addr)
92 + {
93 + uint32_t rar_low = 0;
94 + uint32_t rar_high = 0;
95
96 diff --git a/net-misc/r8168/r8168-8.049.02-r1.ebuild b/net-misc/r8168/r8168-8.049.02-r1.ebuild
97 index 2f271eb31f74..6686979b10d9 100644
98 --- a/net-misc/r8168/r8168-8.049.02-r1.ebuild
99 +++ b/net-misc/r8168/r8168-8.049.02-r1.ebuild
100 @@ -1,7 +1,7 @@
101 -# Copyright 1999-2021 Gentoo Authors
102 +# Copyright 1999-2022 Gentoo Authors
103 # Distributed under the terms of the GNU General Public License v2
104
105 -EAPI=7
106 +EAPI=8
107
108 inherit linux-info linux-mod
109
110 @@ -24,6 +24,9 @@ IUSE="use-firmware"
111 CONFIG_CHECK="~!R8169"
112 WARNING_R8169="CONFIG_R8169 is enabled. ${P} will not be loaded unless kernel driver Realtek 8169 PCI Gigabit Ethernet (CONFIG_R8169) is DISABLED."
113
114 +PATCHES=(
115 + "${FILESDIR}/r8168-8.049.02-5.17-fix.patch"
116 +)
117 pkg_setup() {
118 linux-mod_pkg_setup
119 BUILD_PARAMS="KERNELDIR=${KV_DIR}"