]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * net/core/ethtool.c - Ethtool ioctl handler | |
3 | * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx> | |
4 | * | |
5 | * This file is where we call all the ethtool_ops commands to get | |
61a44b9c | 6 | * the information ethtool needs. |
1da177e4 | 7 | * |
61a44b9c MW |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
1da177e4 LT |
12 | */ |
13 | ||
14 | #include <linux/module.h> | |
15 | #include <linux/types.h> | |
4fc268d2 | 16 | #include <linux/capability.h> |
1da177e4 LT |
17 | #include <linux/errno.h> |
18 | #include <linux/ethtool.h> | |
19 | #include <linux/netdevice.h> | |
d17792eb | 20 | #include <linux/bitops.h> |
1da177e4 LT |
21 | #include <asm/uaccess.h> |
22 | ||
4ec93edb | 23 | /* |
1da177e4 LT |
24 | * Some useful ethtool_ops methods that're device independent. |
25 | * If we find that all drivers want to do the same thing here, | |
26 | * we can turn these into dev_() function calls. | |
27 | */ | |
28 | ||
29 | u32 ethtool_op_get_link(struct net_device *dev) | |
30 | { | |
31 | return netif_carrier_ok(dev) ? 1 : 0; | |
32 | } | |
33 | ||
1896e61f SS |
34 | u32 ethtool_op_get_rx_csum(struct net_device *dev) |
35 | { | |
36 | return (dev->features & NETIF_F_ALL_CSUM) != 0; | |
37 | } | |
8a729fce | 38 | EXPORT_SYMBOL(ethtool_op_get_rx_csum); |
1896e61f | 39 | |
1da177e4 LT |
40 | u32 ethtool_op_get_tx_csum(struct net_device *dev) |
41 | { | |
8648b305 | 42 | return (dev->features & NETIF_F_ALL_CSUM) != 0; |
1da177e4 | 43 | } |
8a729fce | 44 | EXPORT_SYMBOL(ethtool_op_get_tx_csum); |
1da177e4 LT |
45 | |
46 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) | |
47 | { | |
48 | if (data) | |
49 | dev->features |= NETIF_F_IP_CSUM; | |
50 | else | |
51 | dev->features &= ~NETIF_F_IP_CSUM; | |
52 | ||
53 | return 0; | |
54 | } | |
55 | ||
69f6a0fa JM |
56 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data) |
57 | { | |
58 | if (data) | |
59 | dev->features |= NETIF_F_HW_CSUM; | |
60 | else | |
61 | dev->features &= ~NETIF_F_HW_CSUM; | |
62 | ||
63 | return 0; | |
64 | } | |
6460d948 MC |
65 | |
66 | int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data) | |
67 | { | |
68 | if (data) | |
69 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | |
70 | else | |
71 | dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | |
72 | ||
73 | return 0; | |
74 | } | |
75 | ||
1da177e4 LT |
76 | u32 ethtool_op_get_sg(struct net_device *dev) |
77 | { | |
78 | return (dev->features & NETIF_F_SG) != 0; | |
79 | } | |
80 | ||
81 | int ethtool_op_set_sg(struct net_device *dev, u32 data) | |
82 | { | |
83 | if (data) | |
84 | dev->features |= NETIF_F_SG; | |
85 | else | |
86 | dev->features &= ~NETIF_F_SG; | |
87 | ||
88 | return 0; | |
89 | } | |
90 | ||
91 | u32 ethtool_op_get_tso(struct net_device *dev) | |
92 | { | |
93 | return (dev->features & NETIF_F_TSO) != 0; | |
94 | } | |
95 | ||
96 | int ethtool_op_set_tso(struct net_device *dev, u32 data) | |
97 | { | |
98 | if (data) | |
99 | dev->features |= NETIF_F_TSO; | |
100 | else | |
101 | dev->features &= ~NETIF_F_TSO; | |
102 | ||
103 | return 0; | |
104 | } | |
105 | ||
e89e9cf5 AR |
106 | u32 ethtool_op_get_ufo(struct net_device *dev) |
107 | { | |
108 | return (dev->features & NETIF_F_UFO) != 0; | |
109 | } | |
110 | ||
111 | int ethtool_op_set_ufo(struct net_device *dev, u32 data) | |
112 | { | |
113 | if (data) | |
114 | dev->features |= NETIF_F_UFO; | |
115 | else | |
116 | dev->features &= ~NETIF_F_UFO; | |
117 | return 0; | |
118 | } | |
119 | ||
3ae7c0b2 JG |
120 | /* the following list of flags are the same as their associated |
121 | * NETIF_F_xxx values in include/linux/netdevice.h | |
122 | */ | |
123 | static const u32 flags_dup_features = | |
15682bc4 | 124 | (ETH_FLAG_LRO | ETH_FLAG_NTUPLE); |
3ae7c0b2 JG |
125 | |
126 | u32 ethtool_op_get_flags(struct net_device *dev) | |
127 | { | |
128 | /* in the future, this function will probably contain additional | |
129 | * handling for flags which are not so easily handled | |
130 | * by a simple masking operation | |
131 | */ | |
132 | ||
133 | return dev->features & flags_dup_features; | |
134 | } | |
135 | ||
136 | int ethtool_op_set_flags(struct net_device *dev, u32 data) | |
137 | { | |
0d643e1f | 138 | const struct ethtool_ops *ops = dev->ethtool_ops; |
9675478b | 139 | unsigned long features = dev->features; |
0d643e1f | 140 | |
3ae7c0b2 | 141 | if (data & ETH_FLAG_LRO) |
9675478b | 142 | features |= NETIF_F_LRO; |
3ae7c0b2 | 143 | else |
9675478b | 144 | features &= ~NETIF_F_LRO; |
3ae7c0b2 | 145 | |
0d643e1f PW |
146 | if (data & ETH_FLAG_NTUPLE) { |
147 | if (!ops->set_rx_ntuple) | |
148 | return -EOPNOTSUPP; | |
9675478b | 149 | features |= NETIF_F_NTUPLE; |
0d643e1f PW |
150 | } else { |
151 | /* safe to clear regardless */ | |
9675478b | 152 | features &= ~NETIF_F_NTUPLE; |
0d643e1f | 153 | } |
15682bc4 | 154 | |
9675478b | 155 | dev->features = features; |
3ae7c0b2 JG |
156 | return 0; |
157 | } | |
158 | ||
15682bc4 PWJ |
159 | void ethtool_ntuple_flush(struct net_device *dev) |
160 | { | |
161 | struct ethtool_rx_ntuple_flow_spec_container *fsc, *f; | |
162 | ||
163 | list_for_each_entry_safe(fsc, f, &dev->ethtool_ntuple_list.list, list) { | |
164 | list_del(&fsc->list); | |
165 | kfree(fsc); | |
166 | } | |
167 | dev->ethtool_ntuple_list.count = 0; | |
168 | } | |
169 | EXPORT_SYMBOL(ethtool_ntuple_flush); | |
170 | ||
1da177e4 LT |
171 | /* Handlers for each ethtool command */ |
172 | ||
173 | static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) | |
174 | { | |
8e557421 | 175 | struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET }; |
1da177e4 LT |
176 | int err; |
177 | ||
178 | if (!dev->ethtool_ops->get_settings) | |
179 | return -EOPNOTSUPP; | |
180 | ||
181 | err = dev->ethtool_ops->get_settings(dev, &cmd); | |
182 | if (err < 0) | |
183 | return err; | |
184 | ||
185 | if (copy_to_user(useraddr, &cmd, sizeof(cmd))) | |
186 | return -EFAULT; | |
187 | return 0; | |
188 | } | |
189 | ||
190 | static int ethtool_set_settings(struct net_device *dev, void __user *useraddr) | |
191 | { | |
192 | struct ethtool_cmd cmd; | |
193 | ||
194 | if (!dev->ethtool_ops->set_settings) | |
195 | return -EOPNOTSUPP; | |
196 | ||
197 | if (copy_from_user(&cmd, useraddr, sizeof(cmd))) | |
198 | return -EFAULT; | |
199 | ||
200 | return dev->ethtool_ops->set_settings(dev, &cmd); | |
201 | } | |
202 | ||
f5c445ed | 203 | static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr) |
1da177e4 LT |
204 | { |
205 | struct ethtool_drvinfo info; | |
76fd8593 | 206 | const struct ethtool_ops *ops = dev->ethtool_ops; |
1da177e4 LT |
207 | |
208 | if (!ops->get_drvinfo) | |
209 | return -EOPNOTSUPP; | |
210 | ||
211 | memset(&info, 0, sizeof(info)); | |
212 | info.cmd = ETHTOOL_GDRVINFO; | |
213 | ops->get_drvinfo(dev, &info); | |
214 | ||
723b2f57 JG |
215 | /* |
216 | * this method of obtaining string set info is deprecated; | |
d17792eb | 217 | * Use ETHTOOL_GSSET_INFO instead. |
723b2f57 | 218 | */ |
ff03d49f JG |
219 | if (ops->get_sset_count) { |
220 | int rc; | |
221 | ||
222 | rc = ops->get_sset_count(dev, ETH_SS_TEST); | |
223 | if (rc >= 0) | |
224 | info.testinfo_len = rc; | |
225 | rc = ops->get_sset_count(dev, ETH_SS_STATS); | |
226 | if (rc >= 0) | |
227 | info.n_stats = rc; | |
339bf024 JG |
228 | rc = ops->get_sset_count(dev, ETH_SS_PRIV_FLAGS); |
229 | if (rc >= 0) | |
230 | info.n_priv_flags = rc; | |
ff03d49f | 231 | } |
1da177e4 LT |
232 | if (ops->get_regs_len) |
233 | info.regdump_len = ops->get_regs_len(dev); | |
234 | if (ops->get_eeprom_len) | |
235 | info.eedump_len = ops->get_eeprom_len(dev); | |
236 | ||
237 | if (copy_to_user(useraddr, &info, sizeof(info))) | |
238 | return -EFAULT; | |
239 | return 0; | |
240 | } | |
241 | ||
f5c445ed | 242 | static noinline_for_stack int ethtool_get_sset_info(struct net_device *dev, |
723b2f57 JG |
243 | void __user *useraddr) |
244 | { | |
245 | struct ethtool_sset_info info; | |
246 | const struct ethtool_ops *ops = dev->ethtool_ops; | |
247 | u64 sset_mask; | |
248 | int i, idx = 0, n_bits = 0, ret, rc; | |
249 | u32 *info_buf = NULL; | |
250 | ||
251 | if (!ops->get_sset_count) | |
252 | return -EOPNOTSUPP; | |
253 | ||
254 | if (copy_from_user(&info, useraddr, sizeof(info))) | |
255 | return -EFAULT; | |
256 | ||
257 | /* store copy of mask, because we zero struct later on */ | |
258 | sset_mask = info.sset_mask; | |
259 | if (!sset_mask) | |
260 | return 0; | |
261 | ||
262 | /* calculate size of return buffer */ | |
d17792eb | 263 | n_bits = hweight64(sset_mask); |
723b2f57 JG |
264 | |
265 | memset(&info, 0, sizeof(info)); | |
266 | info.cmd = ETHTOOL_GSSET_INFO; | |
267 | ||
268 | info_buf = kzalloc(n_bits * sizeof(u32), GFP_USER); | |
269 | if (!info_buf) | |
270 | return -ENOMEM; | |
271 | ||
272 | /* | |
273 | * fill return buffer based on input bitmask and successful | |
274 | * get_sset_count return | |
275 | */ | |
276 | for (i = 0; i < 64; i++) { | |
277 | if (!(sset_mask & (1ULL << i))) | |
278 | continue; | |
279 | ||
280 | rc = ops->get_sset_count(dev, i); | |
281 | if (rc >= 0) { | |
282 | info.sset_mask |= (1ULL << i); | |
283 | info_buf[idx++] = rc; | |
284 | } | |
285 | } | |
286 | ||
287 | ret = -EFAULT; | |
288 | if (copy_to_user(useraddr, &info, sizeof(info))) | |
289 | goto out; | |
290 | ||
291 | useraddr += offsetof(struct ethtool_sset_info, data); | |
292 | if (copy_to_user(useraddr, info_buf, idx * sizeof(u32))) | |
293 | goto out; | |
294 | ||
295 | ret = 0; | |
296 | ||
297 | out: | |
298 | kfree(info_buf); | |
299 | return ret; | |
300 | } | |
301 | ||
f5c445ed | 302 | static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, void __user *useraddr) |
0853ad66 SB |
303 | { |
304 | struct ethtool_rxnfc cmd; | |
305 | ||
59089d8d | 306 | if (!dev->ethtool_ops->set_rxnfc) |
0853ad66 SB |
307 | return -EOPNOTSUPP; |
308 | ||
309 | if (copy_from_user(&cmd, useraddr, sizeof(cmd))) | |
310 | return -EFAULT; | |
311 | ||
59089d8d | 312 | return dev->ethtool_ops->set_rxnfc(dev, &cmd); |
0853ad66 SB |
313 | } |
314 | ||
f5c445ed | 315 | static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, void __user *useraddr) |
0853ad66 SB |
316 | { |
317 | struct ethtool_rxnfc info; | |
59089d8d SB |
318 | const struct ethtool_ops *ops = dev->ethtool_ops; |
319 | int ret; | |
320 | void *rule_buf = NULL; | |
0853ad66 | 321 | |
59089d8d | 322 | if (!ops->get_rxnfc) |
0853ad66 SB |
323 | return -EOPNOTSUPP; |
324 | ||
325 | if (copy_from_user(&info, useraddr, sizeof(info))) | |
326 | return -EFAULT; | |
327 | ||
59089d8d SB |
328 | if (info.cmd == ETHTOOL_GRXCLSRLALL) { |
329 | if (info.rule_cnt > 0) { | |
330 | rule_buf = kmalloc(info.rule_cnt * sizeof(u32), | |
331 | GFP_USER); | |
332 | if (!rule_buf) | |
333 | return -ENOMEM; | |
334 | } | |
335 | } | |
0853ad66 | 336 | |
59089d8d SB |
337 | ret = ops->get_rxnfc(dev, &info, rule_buf); |
338 | if (ret < 0) | |
339 | goto err_out; | |
340 | ||
341 | ret = -EFAULT; | |
0853ad66 | 342 | if (copy_to_user(useraddr, &info, sizeof(info))) |
59089d8d SB |
343 | goto err_out; |
344 | ||
345 | if (rule_buf) { | |
346 | useraddr += offsetof(struct ethtool_rxnfc, rule_locs); | |
347 | if (copy_to_user(useraddr, rule_buf, | |
348 | info.rule_cnt * sizeof(u32))) | |
349 | goto err_out; | |
350 | } | |
351 | ret = 0; | |
352 | ||
353 | err_out: | |
c9caceca | 354 | kfree(rule_buf); |
59089d8d SB |
355 | |
356 | return ret; | |
0853ad66 SB |
357 | } |
358 | ||
e8589118 PW |
359 | static void __rx_ntuple_filter_add(struct ethtool_rx_ntuple_list *list, |
360 | struct ethtool_rx_ntuple_flow_spec *spec, | |
361 | struct ethtool_rx_ntuple_flow_spec_container *fsc) | |
15682bc4 | 362 | { |
15682bc4 PWJ |
363 | |
364 | /* don't add filters forever */ | |
e8589118 PW |
365 | if (list->count >= ETHTOOL_MAX_NTUPLE_LIST_ENTRY) { |
366 | /* free the container */ | |
367 | kfree(fsc); | |
368 | return; | |
369 | } | |
15682bc4 PWJ |
370 | |
371 | /* Copy the whole filter over */ | |
372 | fsc->fs.flow_type = spec->flow_type; | |
373 | memcpy(&fsc->fs.h_u, &spec->h_u, sizeof(spec->h_u)); | |
374 | memcpy(&fsc->fs.m_u, &spec->m_u, sizeof(spec->m_u)); | |
375 | ||
376 | fsc->fs.vlan_tag = spec->vlan_tag; | |
377 | fsc->fs.vlan_tag_mask = spec->vlan_tag_mask; | |
378 | fsc->fs.data = spec->data; | |
379 | fsc->fs.data_mask = spec->data_mask; | |
380 | fsc->fs.action = spec->action; | |
381 | ||
382 | /* add to the list */ | |
383 | list_add_tail_rcu(&fsc->list, &list->list); | |
384 | list->count++; | |
15682bc4 PWJ |
385 | } |
386 | ||
f5c445ed | 387 | static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev, void __user *useraddr) |
15682bc4 PWJ |
388 | { |
389 | struct ethtool_rx_ntuple cmd; | |
390 | const struct ethtool_ops *ops = dev->ethtool_ops; | |
e8589118 | 391 | struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL; |
15682bc4 PWJ |
392 | int ret; |
393 | ||
15682bc4 PWJ |
394 | if (!(dev->features & NETIF_F_NTUPLE)) |
395 | return -EINVAL; | |
396 | ||
397 | if (copy_from_user(&cmd, useraddr, sizeof(cmd))) | |
398 | return -EFAULT; | |
399 | ||
15682bc4 PWJ |
400 | /* |
401 | * Cache filter in dev struct for GET operation only if | |
402 | * the underlying driver doesn't have its own GET operation, and | |
e8589118 PW |
403 | * only if the filter was added successfully. First make sure we |
404 | * can allocate the filter, then continue if successful. | |
15682bc4 | 405 | */ |
e8589118 PW |
406 | if (!ops->get_rx_ntuple) { |
407 | fsc = kmalloc(sizeof(*fsc), GFP_ATOMIC); | |
408 | if (!fsc) | |
15682bc4 | 409 | return -ENOMEM; |
e8589118 PW |
410 | } |
411 | ||
412 | ret = ops->set_rx_ntuple(dev, &cmd); | |
413 | if (ret) { | |
414 | kfree(fsc); | |
415 | return ret; | |
416 | } | |
417 | ||
418 | if (!ops->get_rx_ntuple) | |
419 | __rx_ntuple_filter_add(&dev->ethtool_ntuple_list, &cmd.fs, fsc); | |
15682bc4 PWJ |
420 | |
421 | return ret; | |
422 | } | |
423 | ||
424 | static int ethtool_get_rx_ntuple(struct net_device *dev, void __user *useraddr) | |
425 | { | |
426 | struct ethtool_gstrings gstrings; | |
427 | const struct ethtool_ops *ops = dev->ethtool_ops; | |
428 | struct ethtool_rx_ntuple_flow_spec_container *fsc; | |
429 | u8 *data; | |
430 | char *p; | |
431 | int ret, i, num_strings = 0; | |
432 | ||
433 | if (!ops->get_sset_count) | |
434 | return -EOPNOTSUPP; | |
435 | ||
436 | if (copy_from_user(&gstrings, useraddr, sizeof(gstrings))) | |
437 | return -EFAULT; | |
438 | ||
439 | ret = ops->get_sset_count(dev, gstrings.string_set); | |
440 | if (ret < 0) | |
441 | return ret; | |
442 | ||
443 | gstrings.len = ret; | |
444 | ||
445 | data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); | |
446 | if (!data) | |
447 | return -ENOMEM; | |
448 | ||
449 | if (ops->get_rx_ntuple) { | |
450 | /* driver-specific filter grab */ | |
451 | ret = ops->get_rx_ntuple(dev, gstrings.string_set, data); | |
452 | goto copy; | |
453 | } | |
454 | ||
455 | /* default ethtool filter grab */ | |
456 | i = 0; | |
457 | p = (char *)data; | |
458 | list_for_each_entry(fsc, &dev->ethtool_ntuple_list.list, list) { | |
459 | sprintf(p, "Filter %d:\n", i); | |
460 | p += ETH_GSTRING_LEN; | |
461 | num_strings++; | |
462 | ||
463 | switch (fsc->fs.flow_type) { | |
464 | case TCP_V4_FLOW: | |
465 | sprintf(p, "\tFlow Type: TCP\n"); | |
466 | p += ETH_GSTRING_LEN; | |
467 | num_strings++; | |
468 | break; | |
469 | case UDP_V4_FLOW: | |
470 | sprintf(p, "\tFlow Type: UDP\n"); | |
471 | p += ETH_GSTRING_LEN; | |
472 | num_strings++; | |
473 | break; | |
474 | case SCTP_V4_FLOW: | |
475 | sprintf(p, "\tFlow Type: SCTP\n"); | |
476 | p += ETH_GSTRING_LEN; | |
477 | num_strings++; | |
478 | break; | |
479 | case AH_ESP_V4_FLOW: | |
480 | sprintf(p, "\tFlow Type: AH ESP\n"); | |
481 | p += ETH_GSTRING_LEN; | |
482 | num_strings++; | |
483 | break; | |
484 | case ESP_V4_FLOW: | |
485 | sprintf(p, "\tFlow Type: ESP\n"); | |
486 | p += ETH_GSTRING_LEN; | |
487 | num_strings++; | |
488 | break; | |
489 | case IP_USER_FLOW: | |
490 | sprintf(p, "\tFlow Type: Raw IP\n"); | |
491 | p += ETH_GSTRING_LEN; | |
492 | num_strings++; | |
493 | break; | |
494 | case IPV4_FLOW: | |
495 | sprintf(p, "\tFlow Type: IPv4\n"); | |
496 | p += ETH_GSTRING_LEN; | |
497 | num_strings++; | |
498 | break; | |
499 | default: | |
500 | sprintf(p, "\tFlow Type: Unknown\n"); | |
501 | p += ETH_GSTRING_LEN; | |
502 | num_strings++; | |
503 | goto unknown_filter; | |
504 | }; | |
505 | ||
506 | /* now the rest of the filters */ | |
507 | switch (fsc->fs.flow_type) { | |
508 | case TCP_V4_FLOW: | |
509 | case UDP_V4_FLOW: | |
510 | case SCTP_V4_FLOW: | |
511 | sprintf(p, "\tSrc IP addr: 0x%x\n", | |
512 | fsc->fs.h_u.tcp_ip4_spec.ip4src); | |
513 | p += ETH_GSTRING_LEN; | |
514 | num_strings++; | |
515 | sprintf(p, "\tSrc IP mask: 0x%x\n", | |
516 | fsc->fs.m_u.tcp_ip4_spec.ip4src); | |
517 | p += ETH_GSTRING_LEN; | |
518 | num_strings++; | |
519 | sprintf(p, "\tDest IP addr: 0x%x\n", | |
520 | fsc->fs.h_u.tcp_ip4_spec.ip4dst); | |
521 | p += ETH_GSTRING_LEN; | |
522 | num_strings++; | |
523 | sprintf(p, "\tDest IP mask: 0x%x\n", | |
524 | fsc->fs.m_u.tcp_ip4_spec.ip4dst); | |
525 | p += ETH_GSTRING_LEN; | |
526 | num_strings++; | |
527 | sprintf(p, "\tSrc Port: %d, mask: 0x%x\n", | |
528 | fsc->fs.h_u.tcp_ip4_spec.psrc, | |
529 | fsc->fs.m_u.tcp_ip4_spec.psrc); | |
530 | p += ETH_GSTRING_LEN; | |
531 | num_strings++; | |
532 | sprintf(p, "\tDest Port: %d, mask: 0x%x\n", | |
533 | fsc->fs.h_u.tcp_ip4_spec.pdst, | |
534 | fsc->fs.m_u.tcp_ip4_spec.pdst); | |
535 | p += ETH_GSTRING_LEN; | |
536 | num_strings++; | |
537 | sprintf(p, "\tTOS: %d, mask: 0x%x\n", | |
538 | fsc->fs.h_u.tcp_ip4_spec.tos, | |
539 | fsc->fs.m_u.tcp_ip4_spec.tos); | |
540 | p += ETH_GSTRING_LEN; | |
541 | num_strings++; | |
542 | break; | |
543 | case AH_ESP_V4_FLOW: | |
544 | case ESP_V4_FLOW: | |
545 | sprintf(p, "\tSrc IP addr: 0x%x\n", | |
546 | fsc->fs.h_u.ah_ip4_spec.ip4src); | |
547 | p += ETH_GSTRING_LEN; | |
548 | num_strings++; | |
549 | sprintf(p, "\tSrc IP mask: 0x%x\n", | |
550 | fsc->fs.m_u.ah_ip4_spec.ip4src); | |
551 | p += ETH_GSTRING_LEN; | |
552 | num_strings++; | |
553 | sprintf(p, "\tDest IP addr: 0x%x\n", | |
554 | fsc->fs.h_u.ah_ip4_spec.ip4dst); | |
555 | p += ETH_GSTRING_LEN; | |
556 | num_strings++; | |
557 | sprintf(p, "\tDest IP mask: 0x%x\n", | |
558 | fsc->fs.m_u.ah_ip4_spec.ip4dst); | |
559 | p += ETH_GSTRING_LEN; | |
560 | num_strings++; | |
561 | sprintf(p, "\tSPI: %d, mask: 0x%x\n", | |
562 | fsc->fs.h_u.ah_ip4_spec.spi, | |
563 | fsc->fs.m_u.ah_ip4_spec.spi); | |
564 | p += ETH_GSTRING_LEN; | |
565 | num_strings++; | |
566 | sprintf(p, "\tTOS: %d, mask: 0x%x\n", | |
567 | fsc->fs.h_u.ah_ip4_spec.tos, | |
568 | fsc->fs.m_u.ah_ip4_spec.tos); | |
569 | p += ETH_GSTRING_LEN; | |
570 | num_strings++; | |
571 | break; | |
572 | case IP_USER_FLOW: | |
573 | sprintf(p, "\tSrc IP addr: 0x%x\n", | |
574 | fsc->fs.h_u.raw_ip4_spec.ip4src); | |
575 | p += ETH_GSTRING_LEN; | |
576 | num_strings++; | |
577 | sprintf(p, "\tSrc IP mask: 0x%x\n", | |
578 | fsc->fs.m_u.raw_ip4_spec.ip4src); | |
579 | p += ETH_GSTRING_LEN; | |
580 | num_strings++; | |
581 | sprintf(p, "\tDest IP addr: 0x%x\n", | |
582 | fsc->fs.h_u.raw_ip4_spec.ip4dst); | |
583 | p += ETH_GSTRING_LEN; | |
584 | num_strings++; | |
585 | sprintf(p, "\tDest IP mask: 0x%x\n", | |
586 | fsc->fs.m_u.raw_ip4_spec.ip4dst); | |
587 | p += ETH_GSTRING_LEN; | |
588 | num_strings++; | |
589 | break; | |
590 | case IPV4_FLOW: | |
591 | sprintf(p, "\tSrc IP addr: 0x%x\n", | |
592 | fsc->fs.h_u.usr_ip4_spec.ip4src); | |
593 | p += ETH_GSTRING_LEN; | |
594 | num_strings++; | |
595 | sprintf(p, "\tSrc IP mask: 0x%x\n", | |
596 | fsc->fs.m_u.usr_ip4_spec.ip4src); | |
597 | p += ETH_GSTRING_LEN; | |
598 | num_strings++; | |
599 | sprintf(p, "\tDest IP addr: 0x%x\n", | |
600 | fsc->fs.h_u.usr_ip4_spec.ip4dst); | |
601 | p += ETH_GSTRING_LEN; | |
602 | num_strings++; | |
603 | sprintf(p, "\tDest IP mask: 0x%x\n", | |
604 | fsc->fs.m_u.usr_ip4_spec.ip4dst); | |
605 | p += ETH_GSTRING_LEN; | |
606 | num_strings++; | |
607 | sprintf(p, "\tL4 bytes: 0x%x, mask: 0x%x\n", | |
608 | fsc->fs.h_u.usr_ip4_spec.l4_4_bytes, | |
609 | fsc->fs.m_u.usr_ip4_spec.l4_4_bytes); | |
610 | p += ETH_GSTRING_LEN; | |
611 | num_strings++; | |
612 | sprintf(p, "\tTOS: %d, mask: 0x%x\n", | |
613 | fsc->fs.h_u.usr_ip4_spec.tos, | |
614 | fsc->fs.m_u.usr_ip4_spec.tos); | |
615 | p += ETH_GSTRING_LEN; | |
616 | num_strings++; | |
617 | sprintf(p, "\tIP Version: %d, mask: 0x%x\n", | |
618 | fsc->fs.h_u.usr_ip4_spec.ip_ver, | |
619 | fsc->fs.m_u.usr_ip4_spec.ip_ver); | |
620 | p += ETH_GSTRING_LEN; | |
621 | num_strings++; | |
622 | sprintf(p, "\tProtocol: %d, mask: 0x%x\n", | |
623 | fsc->fs.h_u.usr_ip4_spec.proto, | |
624 | fsc->fs.m_u.usr_ip4_spec.proto); | |
625 | p += ETH_GSTRING_LEN; | |
626 | num_strings++; | |
627 | break; | |
628 | }; | |
629 | sprintf(p, "\tVLAN: %d, mask: 0x%x\n", | |
630 | fsc->fs.vlan_tag, fsc->fs.vlan_tag_mask); | |
631 | p += ETH_GSTRING_LEN; | |
632 | num_strings++; | |
633 | sprintf(p, "\tUser-defined: 0x%Lx\n", fsc->fs.data); | |
634 | p += ETH_GSTRING_LEN; | |
635 | num_strings++; | |
636 | sprintf(p, "\tUser-defined mask: 0x%Lx\n", fsc->fs.data_mask); | |
637 | p += ETH_GSTRING_LEN; | |
638 | num_strings++; | |
639 | if (fsc->fs.action == ETHTOOL_RXNTUPLE_ACTION_DROP) | |
640 | sprintf(p, "\tAction: Drop\n"); | |
641 | else | |
642 | sprintf(p, "\tAction: Direct to queue %d\n", | |
643 | fsc->fs.action); | |
644 | p += ETH_GSTRING_LEN; | |
645 | num_strings++; | |
646 | unknown_filter: | |
647 | i++; | |
648 | } | |
649 | copy: | |
650 | /* indicate to userspace how many strings we actually have */ | |
651 | gstrings.len = num_strings; | |
652 | ret = -EFAULT; | |
653 | if (copy_to_user(useraddr, &gstrings, sizeof(gstrings))) | |
654 | goto out; | |
655 | useraddr += sizeof(gstrings); | |
656 | if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN)) | |
657 | goto out; | |
658 | ret = 0; | |
659 | ||
660 | out: | |
661 | kfree(data); | |
662 | return ret; | |
663 | } | |
664 | ||
1da177e4 LT |
665 | static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) |
666 | { | |
667 | struct ethtool_regs regs; | |
76fd8593 | 668 | const struct ethtool_ops *ops = dev->ethtool_ops; |
1da177e4 LT |
669 | void *regbuf; |
670 | int reglen, ret; | |
671 | ||
672 | if (!ops->get_regs || !ops->get_regs_len) | |
673 | return -EOPNOTSUPP; | |
674 | ||
675 | if (copy_from_user(®s, useraddr, sizeof(regs))) | |
676 | return -EFAULT; | |
677 | ||
678 | reglen = ops->get_regs_len(dev); | |
679 | if (regs.len > reglen) | |
680 | regs.len = reglen; | |
681 | ||
682 | regbuf = kmalloc(reglen, GFP_USER); | |
683 | if (!regbuf) | |
684 | return -ENOMEM; | |
685 | ||
686 | ops->get_regs(dev, ®s, regbuf); | |
687 | ||
688 | ret = -EFAULT; | |
689 | if (copy_to_user(useraddr, ®s, sizeof(regs))) | |
690 | goto out; | |
691 | useraddr += offsetof(struct ethtool_regs, data); | |
692 | if (copy_to_user(useraddr, regbuf, regs.len)) | |
693 | goto out; | |
694 | ret = 0; | |
695 | ||
696 | out: | |
697 | kfree(regbuf); | |
698 | return ret; | |
699 | } | |
700 | ||
d73d3a8c BH |
701 | static int ethtool_reset(struct net_device *dev, char __user *useraddr) |
702 | { | |
703 | struct ethtool_value reset; | |
704 | int ret; | |
705 | ||
706 | if (!dev->ethtool_ops->reset) | |
707 | return -EOPNOTSUPP; | |
708 | ||
709 | if (copy_from_user(&reset, useraddr, sizeof(reset))) | |
710 | return -EFAULT; | |
711 | ||
712 | ret = dev->ethtool_ops->reset(dev, &reset.data); | |
713 | if (ret) | |
714 | return ret; | |
715 | ||
716 | if (copy_to_user(useraddr, &reset, sizeof(reset))) | |
717 | return -EFAULT; | |
718 | return 0; | |
719 | } | |
720 | ||
1da177e4 LT |
721 | static int ethtool_get_wol(struct net_device *dev, char __user *useraddr) |
722 | { | |
8e557421 | 723 | struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; |
1da177e4 LT |
724 | |
725 | if (!dev->ethtool_ops->get_wol) | |
726 | return -EOPNOTSUPP; | |
727 | ||
728 | dev->ethtool_ops->get_wol(dev, &wol); | |
729 | ||
730 | if (copy_to_user(useraddr, &wol, sizeof(wol))) | |
731 | return -EFAULT; | |
732 | return 0; | |
733 | } | |
734 | ||
735 | static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) | |
736 | { | |
737 | struct ethtool_wolinfo wol; | |
738 | ||
739 | if (!dev->ethtool_ops->set_wol) | |
740 | return -EOPNOTSUPP; | |
741 | ||
742 | if (copy_from_user(&wol, useraddr, sizeof(wol))) | |
743 | return -EFAULT; | |
744 | ||
745 | return dev->ethtool_ops->set_wol(dev, &wol); | |
746 | } | |
747 | ||
1da177e4 LT |
748 | static int ethtool_nway_reset(struct net_device *dev) |
749 | { | |
750 | if (!dev->ethtool_ops->nway_reset) | |
751 | return -EOPNOTSUPP; | |
752 | ||
753 | return dev->ethtool_ops->nway_reset(dev); | |
754 | } | |
755 | ||
1da177e4 LT |
756 | static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) |
757 | { | |
758 | struct ethtool_eeprom eeprom; | |
76fd8593 | 759 | const struct ethtool_ops *ops = dev->ethtool_ops; |
b131dd5d MSB |
760 | void __user *userbuf = useraddr + sizeof(eeprom); |
761 | u32 bytes_remaining; | |
1da177e4 | 762 | u8 *data; |
b131dd5d | 763 | int ret = 0; |
1da177e4 LT |
764 | |
765 | if (!ops->get_eeprom || !ops->get_eeprom_len) | |
766 | return -EOPNOTSUPP; | |
767 | ||
768 | if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) | |
769 | return -EFAULT; | |
770 | ||
771 | /* Check for wrap and zero */ | |
772 | if (eeprom.offset + eeprom.len <= eeprom.offset) | |
773 | return -EINVAL; | |
774 | ||
775 | /* Check for exceeding total eeprom len */ | |
776 | if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) | |
777 | return -EINVAL; | |
778 | ||
b131dd5d | 779 | data = kmalloc(PAGE_SIZE, GFP_USER); |
1da177e4 LT |
780 | if (!data) |
781 | return -ENOMEM; | |
782 | ||
b131dd5d MSB |
783 | bytes_remaining = eeprom.len; |
784 | while (bytes_remaining > 0) { | |
785 | eeprom.len = min(bytes_remaining, (u32)PAGE_SIZE); | |
786 | ||
787 | ret = ops->get_eeprom(dev, &eeprom, data); | |
788 | if (ret) | |
789 | break; | |
790 | if (copy_to_user(userbuf, data, eeprom.len)) { | |
791 | ret = -EFAULT; | |
792 | break; | |
793 | } | |
794 | userbuf += eeprom.len; | |
795 | eeprom.offset += eeprom.len; | |
796 | bytes_remaining -= eeprom.len; | |
797 | } | |
1da177e4 | 798 | |
c5835df9 MSB |
799 | eeprom.len = userbuf - (useraddr + sizeof(eeprom)); |
800 | eeprom.offset -= eeprom.len; | |
801 | if (copy_to_user(useraddr, &eeprom, sizeof(eeprom))) | |
802 | ret = -EFAULT; | |
803 | ||
1da177e4 LT |
804 | kfree(data); |
805 | return ret; | |
806 | } | |
807 | ||
808 | static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) | |
809 | { | |
810 | struct ethtool_eeprom eeprom; | |
76fd8593 | 811 | const struct ethtool_ops *ops = dev->ethtool_ops; |
b131dd5d MSB |
812 | void __user *userbuf = useraddr + sizeof(eeprom); |
813 | u32 bytes_remaining; | |
1da177e4 | 814 | u8 *data; |
b131dd5d | 815 | int ret = 0; |
1da177e4 LT |
816 | |
817 | if (!ops->set_eeprom || !ops->get_eeprom_len) | |
818 | return -EOPNOTSUPP; | |
819 | ||
820 | if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) | |
821 | return -EFAULT; | |
822 | ||
823 | /* Check for wrap and zero */ | |
824 | if (eeprom.offset + eeprom.len <= eeprom.offset) | |
825 | return -EINVAL; | |
826 | ||
827 | /* Check for exceeding total eeprom len */ | |
828 | if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) | |
829 | return -EINVAL; | |
830 | ||
b131dd5d | 831 | data = kmalloc(PAGE_SIZE, GFP_USER); |
1da177e4 LT |
832 | if (!data) |
833 | return -ENOMEM; | |
834 | ||
b131dd5d MSB |
835 | bytes_remaining = eeprom.len; |
836 | while (bytes_remaining > 0) { | |
837 | eeprom.len = min(bytes_remaining, (u32)PAGE_SIZE); | |
838 | ||
839 | if (copy_from_user(data, userbuf, eeprom.len)) { | |
840 | ret = -EFAULT; | |
841 | break; | |
842 | } | |
843 | ret = ops->set_eeprom(dev, &eeprom, data); | |
844 | if (ret) | |
845 | break; | |
846 | userbuf += eeprom.len; | |
847 | eeprom.offset += eeprom.len; | |
848 | bytes_remaining -= eeprom.len; | |
849 | } | |
1da177e4 | 850 | |
1da177e4 LT |
851 | kfree(data); |
852 | return ret; | |
853 | } | |
854 | ||
f5c445ed | 855 | static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev, void __user *useraddr) |
1da177e4 | 856 | { |
8e557421 | 857 | struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE }; |
1da177e4 LT |
858 | |
859 | if (!dev->ethtool_ops->get_coalesce) | |
860 | return -EOPNOTSUPP; | |
861 | ||
862 | dev->ethtool_ops->get_coalesce(dev, &coalesce); | |
863 | ||
864 | if (copy_to_user(useraddr, &coalesce, sizeof(coalesce))) | |
865 | return -EFAULT; | |
866 | return 0; | |
867 | } | |
868 | ||
f5c445ed | 869 | static noinline_for_stack int ethtool_set_coalesce(struct net_device *dev, void __user *useraddr) |
1da177e4 LT |
870 | { |
871 | struct ethtool_coalesce coalesce; | |
872 | ||
fa04ae5c | 873 | if (!dev->ethtool_ops->set_coalesce) |
1da177e4 LT |
874 | return -EOPNOTSUPP; |
875 | ||
876 | if (copy_from_user(&coalesce, useraddr, sizeof(coalesce))) | |
877 | return -EFAULT; | |
878 | ||
879 | return dev->ethtool_ops->set_coalesce(dev, &coalesce); | |
880 | } | |
881 | ||
882 | static int ethtool_get_ringparam(struct net_device *dev, void __user *useraddr) | |
883 | { | |
8e557421 | 884 | struct ethtool_ringparam ringparam = { .cmd = ETHTOOL_GRINGPARAM }; |
1da177e4 LT |
885 | |
886 | if (!dev->ethtool_ops->get_ringparam) | |
887 | return -EOPNOTSUPP; | |
888 | ||
889 | dev->ethtool_ops->get_ringparam(dev, &ringparam); | |
890 | ||
891 | if (copy_to_user(useraddr, &ringparam, sizeof(ringparam))) | |
892 | return -EFAULT; | |
893 | return 0; | |
894 | } | |
895 | ||
896 | static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr) | |
897 | { | |
898 | struct ethtool_ringparam ringparam; | |
899 | ||
900 | if (!dev->ethtool_ops->set_ringparam) | |
901 | return -EOPNOTSUPP; | |
902 | ||
903 | if (copy_from_user(&ringparam, useraddr, sizeof(ringparam))) | |
904 | return -EFAULT; | |
905 | ||
906 | return dev->ethtool_ops->set_ringparam(dev, &ringparam); | |
907 | } | |
908 | ||
909 | static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) | |
910 | { | |
911 | struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; | |
912 | ||
913 | if (!dev->ethtool_ops->get_pauseparam) | |
914 | return -EOPNOTSUPP; | |
915 | ||
916 | dev->ethtool_ops->get_pauseparam(dev, &pauseparam); | |
917 | ||
918 | if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam))) | |
919 | return -EFAULT; | |
920 | return 0; | |
921 | } | |
922 | ||
923 | static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) | |
924 | { | |
925 | struct ethtool_pauseparam pauseparam; | |
926 | ||
e1b90c41 | 927 | if (!dev->ethtool_ops->set_pauseparam) |
1da177e4 LT |
928 | return -EOPNOTSUPP; |
929 | ||
930 | if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam))) | |
931 | return -EFAULT; | |
932 | ||
933 | return dev->ethtool_ops->set_pauseparam(dev, &pauseparam); | |
934 | } | |
935 | ||
1da177e4 LT |
936 | static int __ethtool_set_sg(struct net_device *dev, u32 data) |
937 | { | |
938 | int err; | |
939 | ||
940 | if (!data && dev->ethtool_ops->set_tso) { | |
941 | err = dev->ethtool_ops->set_tso(dev, 0); | |
942 | if (err) | |
943 | return err; | |
944 | } | |
945 | ||
e89e9cf5 AR |
946 | if (!data && dev->ethtool_ops->set_ufo) { |
947 | err = dev->ethtool_ops->set_ufo(dev, 0); | |
948 | if (err) | |
949 | return err; | |
950 | } | |
1da177e4 LT |
951 | return dev->ethtool_ops->set_sg(dev, data); |
952 | } | |
953 | ||
954 | static int ethtool_set_tx_csum(struct net_device *dev, char __user *useraddr) | |
955 | { | |
956 | struct ethtool_value edata; | |
957 | int err; | |
958 | ||
959 | if (!dev->ethtool_ops->set_tx_csum) | |
960 | return -EOPNOTSUPP; | |
961 | ||
962 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
963 | return -EFAULT; | |
964 | ||
965 | if (!edata.data && dev->ethtool_ops->set_sg) { | |
966 | err = __ethtool_set_sg(dev, 0); | |
967 | if (err) | |
968 | return err; | |
969 | } | |
970 | ||
971 | return dev->ethtool_ops->set_tx_csum(dev, edata.data); | |
972 | } | |
973 | ||
b240a0e5 HX |
974 | static int ethtool_set_rx_csum(struct net_device *dev, char __user *useraddr) |
975 | { | |
976 | struct ethtool_value edata; | |
977 | ||
978 | if (!dev->ethtool_ops->set_rx_csum) | |
979 | return -EOPNOTSUPP; | |
980 | ||
981 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
982 | return -EFAULT; | |
983 | ||
984 | if (!edata.data && dev->ethtool_ops->set_sg) | |
985 | dev->features &= ~NETIF_F_GRO; | |
986 | ||
987 | return dev->ethtool_ops->set_rx_csum(dev, edata.data); | |
988 | } | |
989 | ||
1da177e4 LT |
990 | static int ethtool_set_sg(struct net_device *dev, char __user *useraddr) |
991 | { | |
992 | struct ethtool_value edata; | |
993 | ||
994 | if (!dev->ethtool_ops->set_sg) | |
995 | return -EOPNOTSUPP; | |
996 | ||
997 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
998 | return -EFAULT; | |
999 | ||
4ec93edb | 1000 | if (edata.data && |
8648b305 | 1001 | !(dev->features & NETIF_F_ALL_CSUM)) |
1da177e4 LT |
1002 | return -EINVAL; |
1003 | ||
1004 | return __ethtool_set_sg(dev, edata.data); | |
1005 | } | |
1006 | ||
1da177e4 LT |
1007 | static int ethtool_set_tso(struct net_device *dev, char __user *useraddr) |
1008 | { | |
1009 | struct ethtool_value edata; | |
1010 | ||
1011 | if (!dev->ethtool_ops->set_tso) | |
1012 | return -EOPNOTSUPP; | |
1013 | ||
1014 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
1015 | return -EFAULT; | |
1016 | ||
1017 | if (edata.data && !(dev->features & NETIF_F_SG)) | |
1018 | return -EINVAL; | |
1019 | ||
1020 | return dev->ethtool_ops->set_tso(dev, edata.data); | |
1021 | } | |
1022 | ||
e89e9cf5 AR |
1023 | static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr) |
1024 | { | |
1025 | struct ethtool_value edata; | |
1026 | ||
1027 | if (!dev->ethtool_ops->set_ufo) | |
1028 | return -EOPNOTSUPP; | |
1029 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
1030 | return -EFAULT; | |
1031 | if (edata.data && !(dev->features & NETIF_F_SG)) | |
1032 | return -EINVAL; | |
1033 | if (edata.data && !(dev->features & NETIF_F_HW_CSUM)) | |
1034 | return -EINVAL; | |
1035 | return dev->ethtool_ops->set_ufo(dev, edata.data); | |
1036 | } | |
1037 | ||
37c3185a HX |
1038 | static int ethtool_get_gso(struct net_device *dev, char __user *useraddr) |
1039 | { | |
1040 | struct ethtool_value edata = { ETHTOOL_GGSO }; | |
1041 | ||
1042 | edata.data = dev->features & NETIF_F_GSO; | |
1043 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | |
1044 | return -EFAULT; | |
1045 | return 0; | |
1046 | } | |
1047 | ||
1048 | static int ethtool_set_gso(struct net_device *dev, char __user *useraddr) | |
1049 | { | |
1050 | struct ethtool_value edata; | |
1051 | ||
1052 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
1053 | return -EFAULT; | |
1054 | if (edata.data) | |
1055 | dev->features |= NETIF_F_GSO; | |
1056 | else | |
1057 | dev->features &= ~NETIF_F_GSO; | |
1058 | return 0; | |
1059 | } | |
1060 | ||
b240a0e5 HX |
1061 | static int ethtool_get_gro(struct net_device *dev, char __user *useraddr) |
1062 | { | |
1063 | struct ethtool_value edata = { ETHTOOL_GGRO }; | |
1064 | ||
1065 | edata.data = dev->features & NETIF_F_GRO; | |
1066 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | |
1067 | return -EFAULT; | |
1068 | return 0; | |
1069 | } | |
1070 | ||
1071 | static int ethtool_set_gro(struct net_device *dev, char __user *useraddr) | |
1072 | { | |
1073 | struct ethtool_value edata; | |
1074 | ||
1075 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
1076 | return -EFAULT; | |
1077 | ||
1078 | if (edata.data) { | |
1079 | if (!dev->ethtool_ops->get_rx_csum || | |
1080 | !dev->ethtool_ops->get_rx_csum(dev)) | |
1081 | return -EINVAL; | |
1082 | dev->features |= NETIF_F_GRO; | |
1083 | } else | |
1084 | dev->features &= ~NETIF_F_GRO; | |
1085 | ||
1086 | return 0; | |
1087 | } | |
1088 | ||
1da177e4 LT |
1089 | static int ethtool_self_test(struct net_device *dev, char __user *useraddr) |
1090 | { | |
1091 | struct ethtool_test test; | |
76fd8593 | 1092 | const struct ethtool_ops *ops = dev->ethtool_ops; |
1da177e4 | 1093 | u64 *data; |
ff03d49f | 1094 | int ret, test_len; |
1da177e4 | 1095 | |
a9828ec6 | 1096 | if (!ops->self_test || !ops->get_sset_count) |
1da177e4 LT |
1097 | return -EOPNOTSUPP; |
1098 | ||
a9828ec6 | 1099 | test_len = ops->get_sset_count(dev, ETH_SS_TEST); |
ff03d49f JG |
1100 | if (test_len < 0) |
1101 | return test_len; | |
1102 | WARN_ON(test_len == 0); | |
1103 | ||
1da177e4 LT |
1104 | if (copy_from_user(&test, useraddr, sizeof(test))) |
1105 | return -EFAULT; | |
1106 | ||
ff03d49f JG |
1107 | test.len = test_len; |
1108 | data = kmalloc(test_len * sizeof(u64), GFP_USER); | |
1da177e4 LT |
1109 | if (!data) |
1110 | return -ENOMEM; | |
1111 | ||
1112 | ops->self_test(dev, &test, data); | |
1113 | ||
1114 | ret = -EFAULT; | |
1115 | if (copy_to_user(useraddr, &test, sizeof(test))) | |
1116 | goto out; | |
1117 | useraddr += sizeof(test); | |
1118 | if (copy_to_user(useraddr, data, test.len * sizeof(u64))) | |
1119 | goto out; | |
1120 | ret = 0; | |
1121 | ||
1122 | out: | |
1123 | kfree(data); | |
1124 | return ret; | |
1125 | } | |
1126 | ||
1127 | static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) | |
1128 | { | |
1129 | struct ethtool_gstrings gstrings; | |
76fd8593 | 1130 | const struct ethtool_ops *ops = dev->ethtool_ops; |
1da177e4 LT |
1131 | u8 *data; |
1132 | int ret; | |
1133 | ||
a9828ec6 | 1134 | if (!ops->get_strings || !ops->get_sset_count) |
1da177e4 LT |
1135 | return -EOPNOTSUPP; |
1136 | ||
1137 | if (copy_from_user(&gstrings, useraddr, sizeof(gstrings))) | |
1138 | return -EFAULT; | |
1139 | ||
a9828ec6 BH |
1140 | ret = ops->get_sset_count(dev, gstrings.string_set); |
1141 | if (ret < 0) | |
1142 | return ret; | |
1143 | ||
1144 | gstrings.len = ret; | |
1da177e4 LT |
1145 | |
1146 | data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); | |
1147 | if (!data) | |
1148 | return -ENOMEM; | |
1149 | ||
1150 | ops->get_strings(dev, gstrings.string_set, data); | |
1151 | ||
1152 | ret = -EFAULT; | |
1153 | if (copy_to_user(useraddr, &gstrings, sizeof(gstrings))) | |
1154 | goto out; | |
1155 | useraddr += sizeof(gstrings); | |
1156 | if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN)) | |
1157 | goto out; | |
1158 | ret = 0; | |
1159 | ||
1160 | out: | |
1161 | kfree(data); | |
1162 | return ret; | |
1163 | } | |
1164 | ||
1165 | static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) | |
1166 | { | |
1167 | struct ethtool_value id; | |
1168 | ||
1169 | if (!dev->ethtool_ops->phys_id) | |
1170 | return -EOPNOTSUPP; | |
1171 | ||
1172 | if (copy_from_user(&id, useraddr, sizeof(id))) | |
1173 | return -EFAULT; | |
1174 | ||
1175 | return dev->ethtool_ops->phys_id(dev, id.data); | |
1176 | } | |
1177 | ||
1178 | static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) | |
1179 | { | |
1180 | struct ethtool_stats stats; | |
76fd8593 | 1181 | const struct ethtool_ops *ops = dev->ethtool_ops; |
1da177e4 | 1182 | u64 *data; |
ff03d49f | 1183 | int ret, n_stats; |
1da177e4 | 1184 | |
a9828ec6 | 1185 | if (!ops->get_ethtool_stats || !ops->get_sset_count) |
1da177e4 LT |
1186 | return -EOPNOTSUPP; |
1187 | ||
a9828ec6 | 1188 | n_stats = ops->get_sset_count(dev, ETH_SS_STATS); |
ff03d49f JG |
1189 | if (n_stats < 0) |
1190 | return n_stats; | |
1191 | WARN_ON(n_stats == 0); | |
1192 | ||
1da177e4 LT |
1193 | if (copy_from_user(&stats, useraddr, sizeof(stats))) |
1194 | return -EFAULT; | |
1195 | ||
ff03d49f JG |
1196 | stats.n_stats = n_stats; |
1197 | data = kmalloc(n_stats * sizeof(u64), GFP_USER); | |
1da177e4 LT |
1198 | if (!data) |
1199 | return -ENOMEM; | |
1200 | ||
1201 | ops->get_ethtool_stats(dev, &stats, data); | |
1202 | ||
1203 | ret = -EFAULT; | |
1204 | if (copy_to_user(useraddr, &stats, sizeof(stats))) | |
1205 | goto out; | |
1206 | useraddr += sizeof(stats); | |
1207 | if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64))) | |
1208 | goto out; | |
1209 | ret = 0; | |
1210 | ||
1211 | out: | |
1212 | kfree(data); | |
1213 | return ret; | |
1214 | } | |
1215 | ||
0bf0519d | 1216 | static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr) |
a6f9a705 JW |
1217 | { |
1218 | struct ethtool_perm_addr epaddr; | |
a6f9a705 | 1219 | |
313674af | 1220 | if (copy_from_user(&epaddr, useraddr, sizeof(epaddr))) |
a6f9a705 JW |
1221 | return -EFAULT; |
1222 | ||
313674af MW |
1223 | if (epaddr.size < dev->addr_len) |
1224 | return -ETOOSMALL; | |
1225 | epaddr.size = dev->addr_len; | |
a6f9a705 | 1226 | |
a6f9a705 | 1227 | if (copy_to_user(useraddr, &epaddr, sizeof(epaddr))) |
313674af | 1228 | return -EFAULT; |
a6f9a705 | 1229 | useraddr += sizeof(epaddr); |
313674af MW |
1230 | if (copy_to_user(useraddr, dev->perm_addr, epaddr.size)) |
1231 | return -EFAULT; | |
1232 | return 0; | |
a6f9a705 JW |
1233 | } |
1234 | ||
13c99b24 JG |
1235 | static int ethtool_get_value(struct net_device *dev, char __user *useraddr, |
1236 | u32 cmd, u32 (*actor)(struct net_device *)) | |
3ae7c0b2 | 1237 | { |
8e557421 | 1238 | struct ethtool_value edata = { .cmd = cmd }; |
3ae7c0b2 | 1239 | |
13c99b24 | 1240 | if (!actor) |
3ae7c0b2 JG |
1241 | return -EOPNOTSUPP; |
1242 | ||
13c99b24 | 1243 | edata.data = actor(dev); |
3ae7c0b2 JG |
1244 | |
1245 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | |
1246 | return -EFAULT; | |
1247 | return 0; | |
1248 | } | |
1249 | ||
13c99b24 JG |
1250 | static int ethtool_set_value_void(struct net_device *dev, char __user *useraddr, |
1251 | void (*actor)(struct net_device *, u32)) | |
3ae7c0b2 JG |
1252 | { |
1253 | struct ethtool_value edata; | |
1254 | ||
13c99b24 | 1255 | if (!actor) |
3ae7c0b2 JG |
1256 | return -EOPNOTSUPP; |
1257 | ||
1258 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
1259 | return -EFAULT; | |
1260 | ||
13c99b24 | 1261 | actor(dev, edata.data); |
339bf024 JG |
1262 | return 0; |
1263 | } | |
1264 | ||
13c99b24 JG |
1265 | static int ethtool_set_value(struct net_device *dev, char __user *useraddr, |
1266 | int (*actor)(struct net_device *, u32)) | |
339bf024 JG |
1267 | { |
1268 | struct ethtool_value edata; | |
1269 | ||
13c99b24 | 1270 | if (!actor) |
339bf024 JG |
1271 | return -EOPNOTSUPP; |
1272 | ||
1273 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | |
1274 | return -EFAULT; | |
1275 | ||
13c99b24 | 1276 | return actor(dev, edata.data); |
339bf024 JG |
1277 | } |
1278 | ||
f5c445ed | 1279 | static noinline_for_stack int ethtool_flash_device(struct net_device *dev, char __user *useraddr) |
05c6a8d7 AK |
1280 | { |
1281 | struct ethtool_flash efl; | |
1282 | ||
1283 | if (copy_from_user(&efl, useraddr, sizeof(efl))) | |
1284 | return -EFAULT; | |
1285 | ||
1286 | if (!dev->ethtool_ops->flash_device) | |
1287 | return -EOPNOTSUPP; | |
1288 | ||
1289 | return dev->ethtool_ops->flash_device(dev, &efl); | |
1290 | } | |
1291 | ||
1da177e4 LT |
1292 | /* The main entry point in this file. Called from net/core/dev.c */ |
1293 | ||
881d966b | 1294 | int dev_ethtool(struct net *net, struct ifreq *ifr) |
1da177e4 | 1295 | { |
881d966b | 1296 | struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); |
1da177e4 LT |
1297 | void __user *useraddr = ifr->ifr_data; |
1298 | u32 ethcmd; | |
1299 | int rc; | |
81e81575 | 1300 | unsigned long old_features; |
1da177e4 | 1301 | |
1da177e4 LT |
1302 | if (!dev || !netif_device_present(dev)) |
1303 | return -ENODEV; | |
1304 | ||
1305 | if (!dev->ethtool_ops) | |
61a44b9c | 1306 | return -EOPNOTSUPP; |
1da177e4 LT |
1307 | |
1308 | if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) | |
1309 | return -EFAULT; | |
1310 | ||
75f3123c SH |
1311 | /* Allow some commands to be done by anyone */ |
1312 | switch(ethcmd) { | |
75f3123c | 1313 | case ETHTOOL_GDRVINFO: |
75f3123c | 1314 | case ETHTOOL_GMSGLVL: |
75f3123c SH |
1315 | case ETHTOOL_GCOALESCE: |
1316 | case ETHTOOL_GRINGPARAM: | |
1317 | case ETHTOOL_GPAUSEPARAM: | |
1318 | case ETHTOOL_GRXCSUM: | |
1319 | case ETHTOOL_GTXCSUM: | |
1320 | case ETHTOOL_GSG: | |
1321 | case ETHTOOL_GSTRINGS: | |
75f3123c SH |
1322 | case ETHTOOL_GTSO: |
1323 | case ETHTOOL_GPERMADDR: | |
1324 | case ETHTOOL_GUFO: | |
1325 | case ETHTOOL_GGSO: | |
1cab819b | 1326 | case ETHTOOL_GGRO: |
339bf024 JG |
1327 | case ETHTOOL_GFLAGS: |
1328 | case ETHTOOL_GPFLAGS: | |
0853ad66 | 1329 | case ETHTOOL_GRXFH: |
59089d8d SB |
1330 | case ETHTOOL_GRXRINGS: |
1331 | case ETHTOOL_GRXCLSRLCNT: | |
1332 | case ETHTOOL_GRXCLSRULE: | |
1333 | case ETHTOOL_GRXCLSRLALL: | |
75f3123c SH |
1334 | break; |
1335 | default: | |
1336 | if (!capable(CAP_NET_ADMIN)) | |
1337 | return -EPERM; | |
1338 | } | |
1339 | ||
e71a4783 | 1340 | if (dev->ethtool_ops->begin) |
1da177e4 LT |
1341 | if ((rc = dev->ethtool_ops->begin(dev)) < 0) |
1342 | return rc; | |
1343 | ||
d8a33ac4 SH |
1344 | old_features = dev->features; |
1345 | ||
1da177e4 LT |
1346 | switch (ethcmd) { |
1347 | case ETHTOOL_GSET: | |
1348 | rc = ethtool_get_settings(dev, useraddr); | |
1349 | break; | |
1350 | case ETHTOOL_SSET: | |
1351 | rc = ethtool_set_settings(dev, useraddr); | |
1352 | break; | |
1353 | case ETHTOOL_GDRVINFO: | |
1354 | rc = ethtool_get_drvinfo(dev, useraddr); | |
1da177e4 LT |
1355 | break; |
1356 | case ETHTOOL_GREGS: | |
1357 | rc = ethtool_get_regs(dev, useraddr); | |
1358 | break; | |
1359 | case ETHTOOL_GWOL: | |
1360 | rc = ethtool_get_wol(dev, useraddr); | |
1361 | break; | |
1362 | case ETHTOOL_SWOL: | |
1363 | rc = ethtool_set_wol(dev, useraddr); | |
1364 | break; | |
1365 | case ETHTOOL_GMSGLVL: | |
13c99b24 JG |
1366 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
1367 | dev->ethtool_ops->get_msglevel); | |
1da177e4 LT |
1368 | break; |
1369 | case ETHTOOL_SMSGLVL: | |
13c99b24 JG |
1370 | rc = ethtool_set_value_void(dev, useraddr, |
1371 | dev->ethtool_ops->set_msglevel); | |
1da177e4 LT |
1372 | break; |
1373 | case ETHTOOL_NWAY_RST: | |
1374 | rc = ethtool_nway_reset(dev); | |
1375 | break; | |
1376 | case ETHTOOL_GLINK: | |
13c99b24 JG |
1377 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
1378 | dev->ethtool_ops->get_link); | |
1da177e4 LT |
1379 | break; |
1380 | case ETHTOOL_GEEPROM: | |
1381 | rc = ethtool_get_eeprom(dev, useraddr); | |
1382 | break; | |
1383 | case ETHTOOL_SEEPROM: | |
1384 | rc = ethtool_set_eeprom(dev, useraddr); | |
1385 | break; | |
1386 | case ETHTOOL_GCOALESCE: | |
1387 | rc = ethtool_get_coalesce(dev, useraddr); | |
1388 | break; | |
1389 | case ETHTOOL_SCOALESCE: | |
1390 | rc = ethtool_set_coalesce(dev, useraddr); | |
1391 | break; | |
1392 | case ETHTOOL_GRINGPARAM: | |
1393 | rc = ethtool_get_ringparam(dev, useraddr); | |
1394 | break; | |
1395 | case ETHTOOL_SRINGPARAM: | |
1396 | rc = ethtool_set_ringparam(dev, useraddr); | |
1397 | break; | |
1398 | case ETHTOOL_GPAUSEPARAM: | |
1399 | rc = ethtool_get_pauseparam(dev, useraddr); | |
1400 | break; | |
1401 | case ETHTOOL_SPAUSEPARAM: | |
1402 | rc = ethtool_set_pauseparam(dev, useraddr); | |
1403 | break; | |
1404 | case ETHTOOL_GRXCSUM: | |
13c99b24 | 1405 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
1896e61f SS |
1406 | (dev->ethtool_ops->get_rx_csum ? |
1407 | dev->ethtool_ops->get_rx_csum : | |
1408 | ethtool_op_get_rx_csum)); | |
1da177e4 LT |
1409 | break; |
1410 | case ETHTOOL_SRXCSUM: | |
b240a0e5 | 1411 | rc = ethtool_set_rx_csum(dev, useraddr); |
1da177e4 LT |
1412 | break; |
1413 | case ETHTOOL_GTXCSUM: | |
13c99b24 | 1414 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
88d3aafd JG |
1415 | (dev->ethtool_ops->get_tx_csum ? |
1416 | dev->ethtool_ops->get_tx_csum : | |
1417 | ethtool_op_get_tx_csum)); | |
1da177e4 LT |
1418 | break; |
1419 | case ETHTOOL_STXCSUM: | |
1420 | rc = ethtool_set_tx_csum(dev, useraddr); | |
1421 | break; | |
1422 | case ETHTOOL_GSG: | |
13c99b24 | 1423 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
88d3aafd JG |
1424 | (dev->ethtool_ops->get_sg ? |
1425 | dev->ethtool_ops->get_sg : | |
1426 | ethtool_op_get_sg)); | |
1da177e4 LT |
1427 | break; |
1428 | case ETHTOOL_SSG: | |
1429 | rc = ethtool_set_sg(dev, useraddr); | |
1430 | break; | |
1431 | case ETHTOOL_GTSO: | |
13c99b24 | 1432 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
88d3aafd JG |
1433 | (dev->ethtool_ops->get_tso ? |
1434 | dev->ethtool_ops->get_tso : | |
1435 | ethtool_op_get_tso)); | |
1da177e4 LT |
1436 | break; |
1437 | case ETHTOOL_STSO: | |
1438 | rc = ethtool_set_tso(dev, useraddr); | |
1439 | break; | |
1440 | case ETHTOOL_TEST: | |
1441 | rc = ethtool_self_test(dev, useraddr); | |
1442 | break; | |
1443 | case ETHTOOL_GSTRINGS: | |
1444 | rc = ethtool_get_strings(dev, useraddr); | |
1445 | break; | |
1446 | case ETHTOOL_PHYS_ID: | |
1447 | rc = ethtool_phys_id(dev, useraddr); | |
1448 | break; | |
1449 | case ETHTOOL_GSTATS: | |
1450 | rc = ethtool_get_stats(dev, useraddr); | |
1451 | break; | |
a6f9a705 JW |
1452 | case ETHTOOL_GPERMADDR: |
1453 | rc = ethtool_get_perm_addr(dev, useraddr); | |
1454 | break; | |
e89e9cf5 | 1455 | case ETHTOOL_GUFO: |
13c99b24 | 1456 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
88d3aafd JG |
1457 | (dev->ethtool_ops->get_ufo ? |
1458 | dev->ethtool_ops->get_ufo : | |
1459 | ethtool_op_get_ufo)); | |
e89e9cf5 AR |
1460 | break; |
1461 | case ETHTOOL_SUFO: | |
1462 | rc = ethtool_set_ufo(dev, useraddr); | |
1463 | break; | |
37c3185a HX |
1464 | case ETHTOOL_GGSO: |
1465 | rc = ethtool_get_gso(dev, useraddr); | |
1466 | break; | |
1467 | case ETHTOOL_SGSO: | |
1468 | rc = ethtool_set_gso(dev, useraddr); | |
1469 | break; | |
3ae7c0b2 | 1470 | case ETHTOOL_GFLAGS: |
13c99b24 | 1471 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
1896e61f SS |
1472 | (dev->ethtool_ops->get_flags ? |
1473 | dev->ethtool_ops->get_flags : | |
1474 | ethtool_op_get_flags)); | |
3ae7c0b2 JG |
1475 | break; |
1476 | case ETHTOOL_SFLAGS: | |
13c99b24 JG |
1477 | rc = ethtool_set_value(dev, useraddr, |
1478 | dev->ethtool_ops->set_flags); | |
3ae7c0b2 | 1479 | break; |
339bf024 | 1480 | case ETHTOOL_GPFLAGS: |
13c99b24 JG |
1481 | rc = ethtool_get_value(dev, useraddr, ethcmd, |
1482 | dev->ethtool_ops->get_priv_flags); | |
339bf024 JG |
1483 | break; |
1484 | case ETHTOOL_SPFLAGS: | |
13c99b24 JG |
1485 | rc = ethtool_set_value(dev, useraddr, |
1486 | dev->ethtool_ops->set_priv_flags); | |
339bf024 | 1487 | break; |
0853ad66 | 1488 | case ETHTOOL_GRXFH: |
59089d8d SB |
1489 | case ETHTOOL_GRXRINGS: |
1490 | case ETHTOOL_GRXCLSRLCNT: | |
1491 | case ETHTOOL_GRXCLSRULE: | |
1492 | case ETHTOOL_GRXCLSRLALL: | |
1493 | rc = ethtool_get_rxnfc(dev, useraddr); | |
0853ad66 SB |
1494 | break; |
1495 | case ETHTOOL_SRXFH: | |
59089d8d SB |
1496 | case ETHTOOL_SRXCLSRLDEL: |
1497 | case ETHTOOL_SRXCLSRLINS: | |
1498 | rc = ethtool_set_rxnfc(dev, useraddr); | |
0853ad66 | 1499 | break; |
b240a0e5 HX |
1500 | case ETHTOOL_GGRO: |
1501 | rc = ethtool_get_gro(dev, useraddr); | |
1502 | break; | |
1503 | case ETHTOOL_SGRO: | |
1504 | rc = ethtool_set_gro(dev, useraddr); | |
1505 | break; | |
05c6a8d7 AK |
1506 | case ETHTOOL_FLASHDEV: |
1507 | rc = ethtool_flash_device(dev, useraddr); | |
1508 | break; | |
d73d3a8c BH |
1509 | case ETHTOOL_RESET: |
1510 | rc = ethtool_reset(dev, useraddr); | |
1511 | break; | |
15682bc4 PWJ |
1512 | case ETHTOOL_SRXNTUPLE: |
1513 | rc = ethtool_set_rx_ntuple(dev, useraddr); | |
1514 | break; | |
1515 | case ETHTOOL_GRXNTUPLE: | |
1516 | rc = ethtool_get_rx_ntuple(dev, useraddr); | |
1517 | break; | |
723b2f57 JG |
1518 | case ETHTOOL_GSSET_INFO: |
1519 | rc = ethtool_get_sset_info(dev, useraddr); | |
1520 | break; | |
1da177e4 | 1521 | default: |
61a44b9c | 1522 | rc = -EOPNOTSUPP; |
1da177e4 | 1523 | } |
4ec93edb | 1524 | |
e71a4783 | 1525 | if (dev->ethtool_ops->complete) |
1da177e4 | 1526 | dev->ethtool_ops->complete(dev); |
d8a33ac4 SH |
1527 | |
1528 | if (old_features != dev->features) | |
1529 | netdev_features_change(dev); | |
1530 | ||
1da177e4 | 1531 | return rc; |
1da177e4 LT |
1532 | } |
1533 | ||
1da177e4 LT |
1534 | EXPORT_SYMBOL(ethtool_op_get_link); |
1535 | EXPORT_SYMBOL(ethtool_op_get_sg); | |
1536 | EXPORT_SYMBOL(ethtool_op_get_tso); | |
1da177e4 LT |
1537 | EXPORT_SYMBOL(ethtool_op_set_sg); |
1538 | EXPORT_SYMBOL(ethtool_op_set_tso); | |
1539 | EXPORT_SYMBOL(ethtool_op_set_tx_csum); | |
69f6a0fa | 1540 | EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum); |
6460d948 | 1541 | EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum); |
e89e9cf5 AR |
1542 | EXPORT_SYMBOL(ethtool_op_set_ufo); |
1543 | EXPORT_SYMBOL(ethtool_op_get_ufo); | |
3ae7c0b2 JG |
1544 | EXPORT_SYMBOL(ethtool_op_set_flags); |
1545 | EXPORT_SYMBOL(ethtool_op_get_flags); |