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