1
This reverts the commits that deal with hw_features and
2
set_features, fix_features for kernels < 2.6.39.
4
Below is one example commit being reverted, but we also do
5
this for ath6kl and any driver that uses this in this file.
7
commit 782d640afd15af7a1faf01cfe566ca4ac511319d
8
Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
9
Date: Thu Apr 7 07:32:18 2011 +0000
11
net: atl*: convert to hw_features
13
Things left as they were:
14
- atl1: is RX checksum really enabled?
15
- atl2: copy-paste from atl1, with-errors-on-modify I presume
16
- atl1c: there's a bug: MTU can't be changed if device is not up
18
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
19
Signed-off-by: David S. Miller <davem@davemloft.net>
21
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c
22
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c
23
@@ -114,6 +114,13 @@ static int atl1c_set_settings(struct net
27
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
28
+static u32 atl1c_get_tx_csum(struct net_device *netdev)
30
+ return (netdev->features & NETIF_F_HW_CSUM) != 0;
32
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
34
static u32 atl1c_get_msglevel(struct net_device *netdev)
36
struct atl1c_adapter *adapter = netdev_priv(netdev);
37
@@ -301,6 +308,11 @@ static const struct ethtool_ops atl1c_et
38
.get_link = ethtool_op_get_link,
39
.get_eeprom_len = atl1c_get_eeprom_len,
40
.get_eeprom = atl1c_get_eeprom,
41
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
42
+ .get_tx_csum = atl1c_get_tx_csum,
43
+ .get_sg = ethtool_op_get_sg,
44
+ .set_sg = ethtool_op_set_sg,
45
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
48
void atl1c_set_ethtool_ops(struct net_device *netdev)
49
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
50
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
51
@@ -492,6 +492,7 @@ static void atl1c_set_rxbufsize(struct a
52
roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
55
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
56
static netdev_features_t atl1c_fix_features(struct net_device *netdev,
57
netdev_features_t features)
59
@@ -520,6 +521,7 @@ static int atl1c_set_features(struct net
63
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
66
* atl1c_change_mtu - Change the Maximum Transfer Unit
67
@@ -552,8 +554,19 @@ static int atl1c_change_mtu(struct net_d
68
netdev->mtu = new_mtu;
69
adapter->hw.max_frame_size = new_mtu;
70
atl1c_set_rxbufsize(adapter, netdev);
71
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
72
+ if (new_mtu > MAX_TSO_FRAME_SIZE) {
73
+ adapter->netdev->features &= ~NETIF_F_TSO;
74
+ adapter->netdev->features &= ~NETIF_F_TSO6;
76
+ adapter->netdev->features |= NETIF_F_TSO;
77
+ adapter->netdev->features |= NETIF_F_TSO6;
79
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
81
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
82
netdev_update_features(netdev);
83
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
85
clear_bit(__AT_RESETTING, &adapter->flags);
87
@@ -2405,8 +2418,10 @@ static const struct net_device_ops atl1c
88
.ndo_set_mac_address = atl1c_set_mac_addr,
89
.ndo_set_rx_mode = atl1c_set_multi,
90
.ndo_change_mtu = atl1c_change_mtu,
91
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
92
.ndo_fix_features = atl1c_fix_features,
93
.ndo_set_features = atl1c_set_features,
94
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
95
.ndo_do_ioctl = atl1c_ioctl,
96
.ndo_tx_timeout = atl1c_tx_timeout,
97
.ndo_get_stats = atl1c_get_stats,
98
@@ -2425,6 +2440,7 @@ static int atl1c_init_netdev(struct net_
99
atl1c_set_ethtool_ops(netdev);
101
/* TODO: add when ready */
102
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
103
netdev->hw_features = NETIF_F_SG |
106
@@ -2432,6 +2448,14 @@ static int atl1c_init_netdev(struct net_
108
netdev->features = netdev->hw_features |
111
+ netdev->features = NETIF_F_SG |
113
+ NETIF_F_HW_VLAN_TX |
114
+ NETIF_F_HW_VLAN_RX |
117
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
121
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
122
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
123
@@ -384,6 +384,11 @@ static const struct ethtool_ops atl1e_et
124
.get_eeprom_len = atl1e_get_eeprom_len,
125
.get_eeprom = atl1e_get_eeprom,
126
.set_eeprom = atl1e_set_eeprom,
127
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
128
+ .set_tx_csum = ethtool_op_set_tx_hw_csum,
129
+ .set_sg = ethtool_op_set_sg,
130
+ .set_tso = ethtool_op_set_tso,
131
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
134
void atl1e_set_ethtool_ops(struct net_device *netdev)
135
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
136
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
137
@@ -375,6 +375,7 @@ static int atl1e_set_mac_addr(struct net
141
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
142
static netdev_features_t atl1e_fix_features(struct net_device *netdev,
143
netdev_features_t features)
145
@@ -400,6 +401,7 @@ static int atl1e_set_features(struct net
149
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
152
* atl1e_change_mtu - Change the Maximum Transfer Unit
153
@@ -1929,7 +1931,11 @@ void atl1e_down(struct atl1e_adapter *ad
154
* reschedule our watchdog timer */
155
set_bit(__AT_DOWN, &adapter->flags);
157
+#if defined(NETIF_F_LLTX) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
158
netif_stop_queue(netdev);
160
+ netif_tx_disable(netdev);
163
/* reset MAC to disable all RX/TX */
164
atl1e_reset_hw(&adapter->hw);
165
@@ -2199,8 +2205,10 @@ static const struct net_device_ops atl1e
166
.ndo_set_rx_mode = atl1e_set_multi,
167
.ndo_validate_addr = eth_validate_addr,
168
.ndo_set_mac_address = atl1e_set_mac_addr,
169
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
170
.ndo_fix_features = atl1e_fix_features,
171
.ndo_set_features = atl1e_set_features,
172
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
173
.ndo_change_mtu = atl1e_change_mtu,
174
.ndo_do_ioctl = atl1e_ioctl,
175
.ndo_tx_timeout = atl1e_tx_timeout,
176
@@ -2220,10 +2228,15 @@ static int atl1e_init_netdev(struct net_
177
netdev->watchdog_timeo = AT_TX_WATCHDOG;
178
atl1e_set_ethtool_ops(netdev);
180
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
181
netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
183
netdev->features = netdev->hw_features | NETIF_F_LLTX |
186
+ netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
187
+ NETIF_F_HW_VLAN_RX | NETIF_F_LLTX | NETIF_F_HW_VLAN_TX;
188
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
192
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
193
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
194
@@ -2917,8 +2917,10 @@ static const struct net_device_ops atl1_
195
.ndo_validate_addr = eth_validate_addr,
196
.ndo_set_mac_address = atl1_set_mac,
197
.ndo_change_mtu = atl1_change_mtu,
198
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
199
.ndo_fix_features = atlx_fix_features,
200
.ndo_set_features = atlx_set_features,
201
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
202
.ndo_do_ioctl = atlx_ioctl,
203
.ndo_tx_timeout = atlx_tx_timeout,
204
#ifdef CONFIG_NET_POLL_CONTROLLER
205
@@ -3029,11 +3031,13 @@ static int __devinit atl1_probe(struct p
206
netdev->features |= NETIF_F_SG;
207
netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
209
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
210
netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO |
213
/* is this valid? see atl1_setup_mac_ctrl() */
214
netdev->features |= NETIF_F_RXCSUM;
215
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
218
* patch for some L1 of old version,
219
@@ -3646,6 +3650,14 @@ static int atl1_set_pauseparam(struct ne
223
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
224
+/* FIXME: is this right? -- CHS */
225
+static u32 atl1_get_rx_csum(struct net_device *netdev)
229
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
231
static void atl1_get_strings(struct net_device *netdev, u32 stringset,
234
@@ -3718,4 +3730,10 @@ static const struct ethtool_ops atl1_eth
235
.nway_reset = atl1_nway_reset,
236
.get_ethtool_stats = atl1_get_ethtool_stats,
237
.get_sset_count = atl1_get_sset_count,
238
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
239
+ .get_rx_csum = atl1_get_rx_csum,
240
+ .set_tx_csum = ethtool_op_set_tx_hw_csum,
241
+ .set_sg = ethtool_op_set_sg,
242
+ .set_tso = ethtool_op_set_tso,
243
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
245
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
246
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
247
@@ -396,6 +396,7 @@ static void atl2_restore_vlan(struct atl
248
atl2_vlan_mode(adapter->netdev, adapter->netdev->features);
251
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
252
static netdev_features_t atl2_fix_features(struct net_device *netdev,
253
netdev_features_t features)
255
@@ -421,6 +422,7 @@ static int atl2_set_features(struct net_
259
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
261
static void atl2_intr_rx(struct atl2_adapter *adapter)
263
@@ -1322,8 +1324,10 @@ static const struct net_device_ops atl2_
264
.ndo_validate_addr = eth_validate_addr,
265
.ndo_set_mac_address = atl2_set_mac,
266
.ndo_change_mtu = atl2_change_mtu,
267
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
268
.ndo_fix_features = atl2_fix_features,
269
.ndo_set_features = atl2_set_features,
270
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
271
.ndo_do_ioctl = atl2_ioctl,
272
.ndo_tx_timeout = atl2_tx_timeout,
273
#ifdef CONFIG_NET_POLL_CONTROLLER
274
@@ -1421,8 +1425,12 @@ static int __devinit atl2_probe(struct p
278
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
279
netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_RX;
281
+#if defined(NETIF_F_HW_VLAN_TX) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
282
netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
285
/* Init PHY as early as possible due to power saving issue */
286
atl2_phy_init(&adapter->hw);
287
@@ -1849,6 +1857,13 @@ static int atl2_set_settings(struct net_
291
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
292
+static u32 atl2_get_tx_csum(struct net_device *netdev)
294
+ return (netdev->features & NETIF_F_HW_CSUM) != 0;
296
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
298
static u32 atl2_get_msglevel(struct net_device *netdev)
301
@@ -2118,6 +2133,14 @@ static const struct ethtool_ops atl2_eth
302
.get_eeprom_len = atl2_get_eeprom_len,
303
.get_eeprom = atl2_get_eeprom,
304
.set_eeprom = atl2_set_eeprom,
305
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
306
+ .get_tx_csum = atl2_get_tx_csum,
307
+ .get_sg = ethtool_op_get_sg,
308
+ .set_sg = ethtool_op_set_sg,
310
+ .get_tso = ethtool_op_get_tso,
312
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
315
static void atl2_set_ethtool_ops(struct net_device *netdev)
316
--- a/drivers/net/ethernet/atheros/atlx/atlx.c
317
+++ b/drivers/net/ethernet/atheros/atlx/atlx.c
318
@@ -255,6 +255,7 @@ static void atlx_restore_vlan(struct atl
319
atlx_vlan_mode(adapter->netdev, adapter->netdev->features);
322
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
323
static netdev_features_t atlx_fix_features(struct net_device *netdev,
324
netdev_features_t features)
326
@@ -280,5 +281,6 @@ static int atlx_set_features(struct net_
330
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
333
--- a/drivers/net/wireless/ath/ath6kl/main.c
334
+++ b/drivers/net/wireless/ath/ath6kl/main.c
335
@@ -1112,6 +1112,7 @@ static struct net_device_stats *ath6kl_g
336
return &vif->net_stats;
339
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
340
static int ath6kl_set_features(struct net_device *dev,
341
netdev_features_t features)
343
@@ -1144,6 +1145,7 @@ static int ath6kl_set_features(struct ne
349
static void ath6kl_set_multicast_list(struct net_device *ndev)
351
@@ -1291,7 +1293,9 @@ static const struct net_device_ops ath6k
352
.ndo_stop = ath6kl_close,
353
.ndo_start_xmit = ath6kl_data_tx,
354
.ndo_get_stats = ath6kl_get_stats,
355
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
356
.ndo_set_features = ath6kl_set_features,
358
.ndo_set_rx_mode = ath6kl_set_multicast_list,
361
@@ -1306,7 +1310,11 @@ void init_netdev(struct net_device *dev)
362
sizeof(struct wmi_data_hdr) + HTC_HDR_LENGTH
363
+ WMI_MAX_TX_META_SZ + ATH6KL_HTC_ALIGN_BYTES;
365
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
366
dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
368
+ dev->features |= NETIF_F_IP_CSUM;