File r8168-support-ethtool_keee.patch of Package r8168
120
1
From 94426e16197c244d03aad0434e3490acdaa830fe Mon Sep 17 00:00:00 2001
2
From: Masato TOYOSHIMA <phoepsilonix@phoepsilonix.love>
3
Date: Tue, 14 May 2024 14:52:58 +0900
4
Subject: [PATCH] Linux 6.9 compat: change to ethtool_keee from ethtool_eee
5
6
linux/include/linux/ethtool.h
7
8
struct ethtool_ops
9
int (*get_eee)(struct net_device *dev, struct ethtool_keee *eee);
10
int (*set_eee)(struct net_device *dev, struct ethtool_keee *eee);
11
12
change to ethtool_keee from ethtool_eee
13
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
14
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
15
---
16
src/r8168_n.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
17
1 file changed, 44 insertions(+)
18
19
diff --git a/src/r8168_n.c b/src/r8168_n.c
20
index ad63f42..3d67641 100755
21
--- a/src/r8168_n.c
22
+++ b/src/r8168_n.c
23
24
}
25
26
static int
27
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
28
+rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
29
+#else
30
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
31
+#endif
32
{
33
struct rtl8168_private *tp = netdev_priv(net);
34
struct ethtool_eee *eee = &tp->eee;
35
36
37
edata->eee_enabled = !!val;
38
edata->eee_active = !!(supported & adv & lp);
39
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
40
+ ethtool_convert_legacy_u32_to_link_mode(edata->supported, supported);
41
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
42
+ ethtool_convert_legacy_u32_to_link_mode(edata->lp_advertised, lp);
43
+#else
44
edata->supported = supported;
45
edata->advertised = adv;
46
edata->lp_advertised = lp;
47
+#endif
48
edata->tx_lpi_enabled = edata->eee_enabled;
49
edata->tx_lpi_timer = tx_lpi_timer;
50
51
52
}
53
54
static int
55
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
56
+rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
57
+#else
58
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
59
+#endif
60
{
61
struct rtl8168_private *tp = netdev_priv(net);
62
struct ethtool_eee *eee = &tp->eee;
63
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
64
+ u32 advertising, adv;
65
+#else
66
u32 advertising;
67
+#endif
68
int rc = 0;
69
70
if (!rtl8168_support_eee(tp))
71
72
}
73
74
advertising = tp->advertising;
75
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
76
+ ethtool_convert_link_mode_to_legacy_u32(&adv, edata->advertised);
77
+ if (linkmode_empty(edata->advertised)) {
78
+ adv = advertising & eee->supported;
79
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
80
+ } else if (!linkmode_empty(edata->advertised) & ~advertising) {
81
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
82
+ adv, advertising);
83
+ rc = -EINVAL;
84
+ goto out;
85
+ }
86
+#else
87
if (!edata->advertised) {
88
edata->advertised = advertising & eee->supported;
89
} else if (edata->advertised & ~advertising) {
90
91
rc = -EINVAL;
92
goto out;
93
}
94
+#endif
95
96
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
97
+ if (!linkmode_empty(edata->advertised) & ~eee->supported) {
98
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
99
+ adv, eee->supported);
100
+ rc = -EINVAL;
101
+ goto out;
102
+ }
103
+#else
104
if (edata->advertised & ~eee->supported) {
105
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
106
edata->advertised, eee->supported);
107
rc = -EINVAL;
108
goto out;
109
}
110
+#endif
111
112
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
113
+ ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, edata->advertised);
114
+#else
115
eee->advertised = edata->advertised;
116
+#endif
117
eee->eee_enabled = edata->eee_enabled;
118
119
if (eee->eee_enabled)
120