1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
--- a/r8126_n.c
+++ b/r8126_n.c
@@ -6929,7 +6929,11 @@ rtl8126_device_lpi_t_to_ethtool_lpi_t(st
}
static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
+#else
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
+#endif
{
struct rtl8126_private *tp = netdev_priv(net);
struct ethtool_eee *eee = &tp->eee;
@@ -6962,9 +6966,15 @@ rtl_ethtool_get_eee(struct net_device *n
edata->eee_enabled = !!val;
edata->eee_active = !!(supported & adv & lp);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ ethtool_convert_legacy_u32_to_link_mode(edata->supported, supported);
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
+ ethtool_convert_legacy_u32_to_link_mode(edata->lp_advertised, lp);
+#else
edata->supported = supported;
edata->advertised = adv;
edata->lp_advertised = lp;
+#endif
edata->tx_lpi_enabled = edata->eee_enabled;
edata->tx_lpi_timer = tx_lpi_timer;
@@ -6972,11 +6982,19 @@ rtl_ethtool_get_eee(struct net_device *n
}
static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
+#else
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
+#endif
{
struct rtl8126_private *tp = netdev_priv(net);
struct ethtool_eee *eee = &tp->eee;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ u32 advertising, adv;
+#else
u32 advertising;
+#endif
int rc = 0;
if (!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) ||
@@ -7008,6 +7026,18 @@ rtl_ethtool_set_eee(struct net_device *n
*/
advertising = tp->advertising;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ ethtool_convert_link_mode_to_legacy_u32(&adv, edata->advertised);
+ if (linkmode_empty(edata->advertised)) {
+ adv = advertising & eee->supported;
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
+ } else if (!linkmode_empty(edata->advertised) & ~advertising) {
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
+ adv, advertising);
+ rc = -EINVAL;
+ goto out;
+ }
+#else
if (!edata->advertised) {
edata->advertised = advertising & eee->supported;
} else if (edata->advertised & ~advertising) {
@@ -7016,13 +7046,23 @@ rtl_ethtool_set_eee(struct net_device *n
rc = -EINVAL;
goto out;
}
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ if (!linkmode_empty(edata->advertised) & ~eee->supported) {
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
+ adv, eee->supported);
+ rc = -EINVAL;
+ goto out;
+ }
+#else
if (edata->advertised & ~eee->supported) {
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
edata->advertised, eee->supported);
rc = -EINVAL;
goto out;
}
+#endif
//tp->eee.eee_enabled = edata->eee_enabled;
//tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(edata->advertised);
@@ -7030,7 +7070,11 @@ rtl_ethtool_set_eee(struct net_device *n
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE tx_lpi_timer %x must be a subset of support %x\n",
edata->tx_lpi_timer, eee->tx_lpi_timer);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, edata->advertised);
+#else
eee->advertised = edata->advertised;
+#endif
//eee->tx_lpi_enabled = edata->tx_lpi_enabled;
//eee->tx_lpi_timer = edata->tx_lpi_timer;
eee->eee_enabled = edata->eee_enabled;
@@ -7106,8 +7150,10 @@ static const struct ethtool_ops rtl8126_
.set_rxnfc = rtl8126_set_rxnfc,
.get_rxfh_indir_size = rtl8126_rss_indir_size,
.get_rxfh_key_size = rtl8126_get_rxfh_key_size,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0)
.get_rxfh = rtl8126_get_rxfh,
.set_rxfh = rtl8126_set_rxfh,
+#endif
#endif //ENABLE_RSS_SUPPORT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
#ifdef ENABLE_PTP_SUPPORT
|