2 * net/core/ethtool.c - Ethtool ioctl handler
3 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
5 * This file is where we call all the ethtool_ops commands to get
6 * the information ethtool needs.
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.
14 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/capability.h>
17 #include <linux/errno.h>
18 #include <linux/ethtool.h>
19 #include <linux/netdevice.h>
20 #include <linux/bitops.h>
21 #include <linux/uaccess.h>
22 #include <linux/slab.h>
25 * Some useful ethtool_ops methods that're device independent.
26 * If we find that all drivers want to do the same thing here,
27 * we can turn these into dev_() function calls.
30 u32
ethtool_op_get_link(struct net_device
*dev
)
32 return netif_carrier_ok(dev
) ? 1 : 0;
34 EXPORT_SYMBOL(ethtool_op_get_link
);
36 u32
ethtool_op_get_rx_csum(struct net_device
*dev
)
38 return (dev
->features
& NETIF_F_ALL_CSUM
) != 0;
40 EXPORT_SYMBOL(ethtool_op_get_rx_csum
);
42 u32
ethtool_op_get_tx_csum(struct net_device
*dev
)
44 return (dev
->features
& NETIF_F_ALL_CSUM
) != 0;
46 EXPORT_SYMBOL(ethtool_op_get_tx_csum
);
48 int ethtool_op_set_tx_csum(struct net_device
*dev
, u32 data
)
51 dev
->features
|= NETIF_F_IP_CSUM
;
53 dev
->features
&= ~NETIF_F_IP_CSUM
;
58 int ethtool_op_set_tx_hw_csum(struct net_device
*dev
, u32 data
)
61 dev
->features
|= NETIF_F_HW_CSUM
;
63 dev
->features
&= ~NETIF_F_HW_CSUM
;
67 EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum
);
69 int ethtool_op_set_tx_ipv6_csum(struct net_device
*dev
, u32 data
)
72 dev
->features
|= NETIF_F_IP_CSUM
| NETIF_F_IPV6_CSUM
;
74 dev
->features
&= ~(NETIF_F_IP_CSUM
| NETIF_F_IPV6_CSUM
);
78 EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum
);
80 u32
ethtool_op_get_sg(struct net_device
*dev
)
82 return (dev
->features
& NETIF_F_SG
) != 0;
84 EXPORT_SYMBOL(ethtool_op_get_sg
);
86 int ethtool_op_set_sg(struct net_device
*dev
, u32 data
)
89 dev
->features
|= NETIF_F_SG
;
91 dev
->features
&= ~NETIF_F_SG
;
95 EXPORT_SYMBOL(ethtool_op_set_sg
);
97 u32
ethtool_op_get_tso(struct net_device
*dev
)
99 return (dev
->features
& NETIF_F_TSO
) != 0;
101 EXPORT_SYMBOL(ethtool_op_get_tso
);
103 int ethtool_op_set_tso(struct net_device
*dev
, u32 data
)
106 dev
->features
|= NETIF_F_TSO
;
108 dev
->features
&= ~NETIF_F_TSO
;
112 EXPORT_SYMBOL(ethtool_op_set_tso
);
114 u32
ethtool_op_get_ufo(struct net_device
*dev
)
116 return (dev
->features
& NETIF_F_UFO
) != 0;
118 EXPORT_SYMBOL(ethtool_op_get_ufo
);
120 int ethtool_op_set_ufo(struct net_device
*dev
, u32 data
)
123 dev
->features
|= NETIF_F_UFO
;
125 dev
->features
&= ~NETIF_F_UFO
;
128 EXPORT_SYMBOL(ethtool_op_set_ufo
);
130 /* the following list of flags are the same as their associated
131 * NETIF_F_xxx values in include/linux/netdevice.h
133 static const u32 flags_dup_features
=
134 (ETH_FLAG_LRO
| ETH_FLAG_NTUPLE
| ETH_FLAG_RXHASH
);
136 u32
ethtool_op_get_flags(struct net_device
*dev
)
138 /* in the future, this function will probably contain additional
139 * handling for flags which are not so easily handled
140 * by a simple masking operation
143 return dev
->features
& flags_dup_features
;
145 EXPORT_SYMBOL(ethtool_op_get_flags
);
147 int ethtool_op_set_flags(struct net_device
*dev
, u32 data
, u32 supported
)
149 if (data
& ~supported
)
152 dev
->features
= ((dev
->features
& ~flags_dup_features
) |
153 (data
& flags_dup_features
));
156 EXPORT_SYMBOL(ethtool_op_set_flags
);
158 void ethtool_ntuple_flush(struct net_device
*dev
)
160 struct ethtool_rx_ntuple_flow_spec_container
*fsc
, *f
;
162 list_for_each_entry_safe(fsc
, f
, &dev
->ethtool_ntuple_list
.list
, list
) {
163 list_del(&fsc
->list
);
166 dev
->ethtool_ntuple_list
.count
= 0;
168 EXPORT_SYMBOL(ethtool_ntuple_flush
);
170 /* Handlers for each ethtool command */
172 static int ethtool_get_settings(struct net_device
*dev
, void __user
*useraddr
)
174 struct ethtool_cmd cmd
= { .cmd
= ETHTOOL_GSET
};
177 if (!dev
->ethtool_ops
->get_settings
)
180 err
= dev
->ethtool_ops
->get_settings(dev
, &cmd
);
184 if (copy_to_user(useraddr
, &cmd
, sizeof(cmd
)))
189 static int ethtool_set_settings(struct net_device
*dev
, void __user
*useraddr
)
191 struct ethtool_cmd cmd
;
193 if (!dev
->ethtool_ops
->set_settings
)
196 if (copy_from_user(&cmd
, useraddr
, sizeof(cmd
)))
199 return dev
->ethtool_ops
->set_settings(dev
, &cmd
);
202 static noinline_for_stack
int ethtool_get_drvinfo(struct net_device
*dev
,
203 void __user
*useraddr
)
205 struct ethtool_drvinfo info
;
206 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
208 if (!ops
->get_drvinfo
)
211 memset(&info
, 0, sizeof(info
));
212 info
.cmd
= ETHTOOL_GDRVINFO
;
213 ops
->get_drvinfo(dev
, &info
);
216 * this method of obtaining string set info is deprecated;
217 * Use ETHTOOL_GSSET_INFO instead.
219 if (ops
->get_sset_count
) {
222 rc
= ops
->get_sset_count(dev
, ETH_SS_TEST
);
224 info
.testinfo_len
= rc
;
225 rc
= ops
->get_sset_count(dev
, ETH_SS_STATS
);
228 rc
= ops
->get_sset_count(dev
, ETH_SS_PRIV_FLAGS
);
230 info
.n_priv_flags
= rc
;
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
);
237 if (copy_to_user(useraddr
, &info
, sizeof(info
)))
242 static noinline_for_stack
int ethtool_get_sset_info(struct net_device
*dev
,
243 void __user
*useraddr
)
245 struct ethtool_sset_info info
;
246 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
248 int i
, idx
= 0, n_bits
= 0, ret
, rc
;
249 u32
*info_buf
= NULL
;
251 if (!ops
->get_sset_count
)
254 if (copy_from_user(&info
, useraddr
, sizeof(info
)))
257 /* store copy of mask, because we zero struct later on */
258 sset_mask
= info
.sset_mask
;
262 /* calculate size of return buffer */
263 n_bits
= hweight64(sset_mask
);
265 memset(&info
, 0, sizeof(info
));
266 info
.cmd
= ETHTOOL_GSSET_INFO
;
268 info_buf
= kzalloc(n_bits
* sizeof(u32
), GFP_USER
);
273 * fill return buffer based on input bitmask and successful
274 * get_sset_count return
276 for (i
= 0; i
< 64; i
++) {
277 if (!(sset_mask
& (1ULL << i
)))
280 rc
= ops
->get_sset_count(dev
, i
);
282 info
.sset_mask
|= (1ULL << i
);
283 info_buf
[idx
++] = rc
;
288 if (copy_to_user(useraddr
, &info
, sizeof(info
)))
291 useraddr
+= offsetof(struct ethtool_sset_info
, data
);
292 if (copy_to_user(useraddr
, info_buf
, idx
* sizeof(u32
)))
302 static noinline_for_stack
int ethtool_set_rxnfc(struct net_device
*dev
,
303 u32 cmd
, void __user
*useraddr
)
305 struct ethtool_rxnfc info
;
306 size_t info_size
= sizeof(info
);
308 if (!dev
->ethtool_ops
->set_rxnfc
)
311 /* struct ethtool_rxnfc was originally defined for
312 * ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
313 * members. User-space might still be using that
315 if (cmd
== ETHTOOL_SRXFH
)
316 info_size
= (offsetof(struct ethtool_rxnfc
, data
) +
319 if (copy_from_user(&info
, useraddr
, info_size
))
322 return dev
->ethtool_ops
->set_rxnfc(dev
, &info
);
325 static noinline_for_stack
int ethtool_get_rxnfc(struct net_device
*dev
,
326 u32 cmd
, void __user
*useraddr
)
328 struct ethtool_rxnfc info
;
329 size_t info_size
= sizeof(info
);
330 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
332 void *rule_buf
= NULL
;
337 /* struct ethtool_rxnfc was originally defined for
338 * ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
339 * members. User-space might still be using that
341 if (cmd
== ETHTOOL_GRXFH
)
342 info_size
= (offsetof(struct ethtool_rxnfc
, data
) +
345 if (copy_from_user(&info
, useraddr
, info_size
))
348 if (info
.cmd
== ETHTOOL_GRXCLSRLALL
) {
349 if (info
.rule_cnt
> 0) {
350 if (info
.rule_cnt
<= KMALLOC_MAX_SIZE
/ sizeof(u32
))
351 rule_buf
= kzalloc(info
.rule_cnt
* sizeof(u32
),
358 ret
= ops
->get_rxnfc(dev
, &info
, rule_buf
);
363 if (copy_to_user(useraddr
, &info
, info_size
))
367 useraddr
+= offsetof(struct ethtool_rxnfc
, rule_locs
);
368 if (copy_to_user(useraddr
, rule_buf
,
369 info
.rule_cnt
* sizeof(u32
)))
380 static noinline_for_stack
int ethtool_get_rxfh_indir(struct net_device
*dev
,
381 void __user
*useraddr
)
383 struct ethtool_rxfh_indir
*indir
;
388 if (!dev
->ethtool_ops
->get_rxfh_indir
)
391 if (copy_from_user(&table_size
,
392 useraddr
+ offsetof(struct ethtool_rxfh_indir
, size
),
397 (KMALLOC_MAX_SIZE
- sizeof(*indir
)) / sizeof(*indir
->ring_index
))
399 full_size
= sizeof(*indir
) + sizeof(*indir
->ring_index
) * table_size
;
400 indir
= kzalloc(full_size
, GFP_USER
);
404 indir
->cmd
= ETHTOOL_GRXFHINDIR
;
405 indir
->size
= table_size
;
406 ret
= dev
->ethtool_ops
->get_rxfh_indir(dev
, indir
);
410 if (copy_to_user(useraddr
, indir
, full_size
))
418 static noinline_for_stack
int ethtool_set_rxfh_indir(struct net_device
*dev
,
419 void __user
*useraddr
)
421 struct ethtool_rxfh_indir
*indir
;
426 if (!dev
->ethtool_ops
->set_rxfh_indir
)
429 if (copy_from_user(&table_size
,
430 useraddr
+ offsetof(struct ethtool_rxfh_indir
, size
),
435 (KMALLOC_MAX_SIZE
- sizeof(*indir
)) / sizeof(*indir
->ring_index
))
437 full_size
= sizeof(*indir
) + sizeof(*indir
->ring_index
) * table_size
;
438 indir
= kmalloc(full_size
, GFP_USER
);
442 if (copy_from_user(indir
, useraddr
, full_size
)) {
447 ret
= dev
->ethtool_ops
->set_rxfh_indir(dev
, indir
);
454 static void __rx_ntuple_filter_add(struct ethtool_rx_ntuple_list
*list
,
455 struct ethtool_rx_ntuple_flow_spec
*spec
,
456 struct ethtool_rx_ntuple_flow_spec_container
*fsc
)
459 /* don't add filters forever */
460 if (list
->count
>= ETHTOOL_MAX_NTUPLE_LIST_ENTRY
) {
461 /* free the container */
466 /* Copy the whole filter over */
467 fsc
->fs
.flow_type
= spec
->flow_type
;
468 memcpy(&fsc
->fs
.h_u
, &spec
->h_u
, sizeof(spec
->h_u
));
469 memcpy(&fsc
->fs
.m_u
, &spec
->m_u
, sizeof(spec
->m_u
));
471 fsc
->fs
.vlan_tag
= spec
->vlan_tag
;
472 fsc
->fs
.vlan_tag_mask
= spec
->vlan_tag_mask
;
473 fsc
->fs
.data
= spec
->data
;
474 fsc
->fs
.data_mask
= spec
->data_mask
;
475 fsc
->fs
.action
= spec
->action
;
477 /* add to the list */
478 list_add_tail_rcu(&fsc
->list
, &list
->list
);
482 static noinline_for_stack
int ethtool_set_rx_ntuple(struct net_device
*dev
,
483 void __user
*useraddr
)
485 struct ethtool_rx_ntuple cmd
;
486 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
487 struct ethtool_rx_ntuple_flow_spec_container
*fsc
= NULL
;
490 if (!(dev
->features
& NETIF_F_NTUPLE
))
493 if (copy_from_user(&cmd
, useraddr
, sizeof(cmd
)))
497 * Cache filter in dev struct for GET operation only if
498 * the underlying driver doesn't have its own GET operation, and
499 * only if the filter was added successfully. First make sure we
500 * can allocate the filter, then continue if successful.
502 if (!ops
->get_rx_ntuple
) {
503 fsc
= kmalloc(sizeof(*fsc
), GFP_ATOMIC
);
508 ret
= ops
->set_rx_ntuple(dev
, &cmd
);
514 if (!ops
->get_rx_ntuple
)
515 __rx_ntuple_filter_add(&dev
->ethtool_ntuple_list
, &cmd
.fs
, fsc
);
520 static int ethtool_get_rx_ntuple(struct net_device
*dev
, void __user
*useraddr
)
522 struct ethtool_gstrings gstrings
;
523 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
524 struct ethtool_rx_ntuple_flow_spec_container
*fsc
;
527 int ret
, i
, num_strings
= 0;
529 if (!ops
->get_sset_count
)
532 if (copy_from_user(&gstrings
, useraddr
, sizeof(gstrings
)))
535 ret
= ops
->get_sset_count(dev
, gstrings
.string_set
);
541 data
= kzalloc(gstrings
.len
* ETH_GSTRING_LEN
, GFP_USER
);
545 if (ops
->get_rx_ntuple
) {
546 /* driver-specific filter grab */
547 ret
= ops
->get_rx_ntuple(dev
, gstrings
.string_set
, data
);
551 /* default ethtool filter grab */
554 list_for_each_entry(fsc
, &dev
->ethtool_ntuple_list
.list
, list
) {
555 sprintf(p
, "Filter %d:\n", i
);
556 p
+= ETH_GSTRING_LEN
;
559 switch (fsc
->fs
.flow_type
) {
561 sprintf(p
, "\tFlow Type: TCP\n");
562 p
+= ETH_GSTRING_LEN
;
566 sprintf(p
, "\tFlow Type: UDP\n");
567 p
+= ETH_GSTRING_LEN
;
571 sprintf(p
, "\tFlow Type: SCTP\n");
572 p
+= ETH_GSTRING_LEN
;
576 sprintf(p
, "\tFlow Type: AH ESP\n");
577 p
+= ETH_GSTRING_LEN
;
581 sprintf(p
, "\tFlow Type: ESP\n");
582 p
+= ETH_GSTRING_LEN
;
586 sprintf(p
, "\tFlow Type: Raw IP\n");
587 p
+= ETH_GSTRING_LEN
;
591 sprintf(p
, "\tFlow Type: IPv4\n");
592 p
+= ETH_GSTRING_LEN
;
596 sprintf(p
, "\tFlow Type: Unknown\n");
597 p
+= ETH_GSTRING_LEN
;
602 /* now the rest of the filters */
603 switch (fsc
->fs
.flow_type
) {
607 sprintf(p
, "\tSrc IP addr: 0x%x\n",
608 fsc
->fs
.h_u
.tcp_ip4_spec
.ip4src
);
609 p
+= ETH_GSTRING_LEN
;
611 sprintf(p
, "\tSrc IP mask: 0x%x\n",
612 fsc
->fs
.m_u
.tcp_ip4_spec
.ip4src
);
613 p
+= ETH_GSTRING_LEN
;
615 sprintf(p
, "\tDest IP addr: 0x%x\n",
616 fsc
->fs
.h_u
.tcp_ip4_spec
.ip4dst
);
617 p
+= ETH_GSTRING_LEN
;
619 sprintf(p
, "\tDest IP mask: 0x%x\n",
620 fsc
->fs
.m_u
.tcp_ip4_spec
.ip4dst
);
621 p
+= ETH_GSTRING_LEN
;
623 sprintf(p
, "\tSrc Port: %d, mask: 0x%x\n",
624 fsc
->fs
.h_u
.tcp_ip4_spec
.psrc
,
625 fsc
->fs
.m_u
.tcp_ip4_spec
.psrc
);
626 p
+= ETH_GSTRING_LEN
;
628 sprintf(p
, "\tDest Port: %d, mask: 0x%x\n",
629 fsc
->fs
.h_u
.tcp_ip4_spec
.pdst
,
630 fsc
->fs
.m_u
.tcp_ip4_spec
.pdst
);
631 p
+= ETH_GSTRING_LEN
;
633 sprintf(p
, "\tTOS: %d, mask: 0x%x\n",
634 fsc
->fs
.h_u
.tcp_ip4_spec
.tos
,
635 fsc
->fs
.m_u
.tcp_ip4_spec
.tos
);
636 p
+= ETH_GSTRING_LEN
;
641 sprintf(p
, "\tSrc IP addr: 0x%x\n",
642 fsc
->fs
.h_u
.ah_ip4_spec
.ip4src
);
643 p
+= ETH_GSTRING_LEN
;
645 sprintf(p
, "\tSrc IP mask: 0x%x\n",
646 fsc
->fs
.m_u
.ah_ip4_spec
.ip4src
);
647 p
+= ETH_GSTRING_LEN
;
649 sprintf(p
, "\tDest IP addr: 0x%x\n",
650 fsc
->fs
.h_u
.ah_ip4_spec
.ip4dst
);
651 p
+= ETH_GSTRING_LEN
;
653 sprintf(p
, "\tDest IP mask: 0x%x\n",
654 fsc
->fs
.m_u
.ah_ip4_spec
.ip4dst
);
655 p
+= ETH_GSTRING_LEN
;
657 sprintf(p
, "\tSPI: %d, mask: 0x%x\n",
658 fsc
->fs
.h_u
.ah_ip4_spec
.spi
,
659 fsc
->fs
.m_u
.ah_ip4_spec
.spi
);
660 p
+= ETH_GSTRING_LEN
;
662 sprintf(p
, "\tTOS: %d, mask: 0x%x\n",
663 fsc
->fs
.h_u
.ah_ip4_spec
.tos
,
664 fsc
->fs
.m_u
.ah_ip4_spec
.tos
);
665 p
+= ETH_GSTRING_LEN
;
669 sprintf(p
, "\tSrc IP addr: 0x%x\n",
670 fsc
->fs
.h_u
.raw_ip4_spec
.ip4src
);
671 p
+= ETH_GSTRING_LEN
;
673 sprintf(p
, "\tSrc IP mask: 0x%x\n",
674 fsc
->fs
.m_u
.raw_ip4_spec
.ip4src
);
675 p
+= ETH_GSTRING_LEN
;
677 sprintf(p
, "\tDest IP addr: 0x%x\n",
678 fsc
->fs
.h_u
.raw_ip4_spec
.ip4dst
);
679 p
+= ETH_GSTRING_LEN
;
681 sprintf(p
, "\tDest IP mask: 0x%x\n",
682 fsc
->fs
.m_u
.raw_ip4_spec
.ip4dst
);
683 p
+= ETH_GSTRING_LEN
;
687 sprintf(p
, "\tSrc IP addr: 0x%x\n",
688 fsc
->fs
.h_u
.usr_ip4_spec
.ip4src
);
689 p
+= ETH_GSTRING_LEN
;
691 sprintf(p
, "\tSrc IP mask: 0x%x\n",
692 fsc
->fs
.m_u
.usr_ip4_spec
.ip4src
);
693 p
+= ETH_GSTRING_LEN
;
695 sprintf(p
, "\tDest IP addr: 0x%x\n",
696 fsc
->fs
.h_u
.usr_ip4_spec
.ip4dst
);
697 p
+= ETH_GSTRING_LEN
;
699 sprintf(p
, "\tDest IP mask: 0x%x\n",
700 fsc
->fs
.m_u
.usr_ip4_spec
.ip4dst
);
701 p
+= ETH_GSTRING_LEN
;
703 sprintf(p
, "\tL4 bytes: 0x%x, mask: 0x%x\n",
704 fsc
->fs
.h_u
.usr_ip4_spec
.l4_4_bytes
,
705 fsc
->fs
.m_u
.usr_ip4_spec
.l4_4_bytes
);
706 p
+= ETH_GSTRING_LEN
;
708 sprintf(p
, "\tTOS: %d, mask: 0x%x\n",
709 fsc
->fs
.h_u
.usr_ip4_spec
.tos
,
710 fsc
->fs
.m_u
.usr_ip4_spec
.tos
);
711 p
+= ETH_GSTRING_LEN
;
713 sprintf(p
, "\tIP Version: %d, mask: 0x%x\n",
714 fsc
->fs
.h_u
.usr_ip4_spec
.ip_ver
,
715 fsc
->fs
.m_u
.usr_ip4_spec
.ip_ver
);
716 p
+= ETH_GSTRING_LEN
;
718 sprintf(p
, "\tProtocol: %d, mask: 0x%x\n",
719 fsc
->fs
.h_u
.usr_ip4_spec
.proto
,
720 fsc
->fs
.m_u
.usr_ip4_spec
.proto
);
721 p
+= ETH_GSTRING_LEN
;
725 sprintf(p
, "\tVLAN: %d, mask: 0x%x\n",
726 fsc
->fs
.vlan_tag
, fsc
->fs
.vlan_tag_mask
);
727 p
+= ETH_GSTRING_LEN
;
729 sprintf(p
, "\tUser-defined: 0x%Lx\n", fsc
->fs
.data
);
730 p
+= ETH_GSTRING_LEN
;
732 sprintf(p
, "\tUser-defined mask: 0x%Lx\n", fsc
->fs
.data_mask
);
733 p
+= ETH_GSTRING_LEN
;
735 if (fsc
->fs
.action
== ETHTOOL_RXNTUPLE_ACTION_DROP
)
736 sprintf(p
, "\tAction: Drop\n");
738 sprintf(p
, "\tAction: Direct to queue %d\n",
740 p
+= ETH_GSTRING_LEN
;
746 /* indicate to userspace how many strings we actually have */
747 gstrings
.len
= num_strings
;
749 if (copy_to_user(useraddr
, &gstrings
, sizeof(gstrings
)))
751 useraddr
+= sizeof(gstrings
);
752 if (copy_to_user(useraddr
, data
, gstrings
.len
* ETH_GSTRING_LEN
))
761 static int ethtool_get_regs(struct net_device
*dev
, char __user
*useraddr
)
763 struct ethtool_regs regs
;
764 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
768 if (!ops
->get_regs
|| !ops
->get_regs_len
)
771 if (copy_from_user(®s
, useraddr
, sizeof(regs
)))
774 reglen
= ops
->get_regs_len(dev
);
775 if (regs
.len
> reglen
)
778 regbuf
= kzalloc(reglen
, GFP_USER
);
782 ops
->get_regs(dev
, ®s
, regbuf
);
785 if (copy_to_user(useraddr
, ®s
, sizeof(regs
)))
787 useraddr
+= offsetof(struct ethtool_regs
, data
);
788 if (copy_to_user(useraddr
, regbuf
, regs
.len
))
797 static int ethtool_reset(struct net_device
*dev
, char __user
*useraddr
)
799 struct ethtool_value reset
;
802 if (!dev
->ethtool_ops
->reset
)
805 if (copy_from_user(&reset
, useraddr
, sizeof(reset
)))
808 ret
= dev
->ethtool_ops
->reset(dev
, &reset
.data
);
812 if (copy_to_user(useraddr
, &reset
, sizeof(reset
)))
817 static int ethtool_get_wol(struct net_device
*dev
, char __user
*useraddr
)
819 struct ethtool_wolinfo wol
= { .cmd
= ETHTOOL_GWOL
};
821 if (!dev
->ethtool_ops
->get_wol
)
824 dev
->ethtool_ops
->get_wol(dev
, &wol
);
826 if (copy_to_user(useraddr
, &wol
, sizeof(wol
)))
831 static int ethtool_set_wol(struct net_device
*dev
, char __user
*useraddr
)
833 struct ethtool_wolinfo wol
;
835 if (!dev
->ethtool_ops
->set_wol
)
838 if (copy_from_user(&wol
, useraddr
, sizeof(wol
)))
841 return dev
->ethtool_ops
->set_wol(dev
, &wol
);
844 static int ethtool_nway_reset(struct net_device
*dev
)
846 if (!dev
->ethtool_ops
->nway_reset
)
849 return dev
->ethtool_ops
->nway_reset(dev
);
852 static int ethtool_get_eeprom(struct net_device
*dev
, void __user
*useraddr
)
854 struct ethtool_eeprom eeprom
;
855 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
856 void __user
*userbuf
= useraddr
+ sizeof(eeprom
);
861 if (!ops
->get_eeprom
|| !ops
->get_eeprom_len
)
864 if (copy_from_user(&eeprom
, useraddr
, sizeof(eeprom
)))
867 /* Check for wrap and zero */
868 if (eeprom
.offset
+ eeprom
.len
<= eeprom
.offset
)
871 /* Check for exceeding total eeprom len */
872 if (eeprom
.offset
+ eeprom
.len
> ops
->get_eeprom_len(dev
))
875 data
= kmalloc(PAGE_SIZE
, GFP_USER
);
879 bytes_remaining
= eeprom
.len
;
880 while (bytes_remaining
> 0) {
881 eeprom
.len
= min(bytes_remaining
, (u32
)PAGE_SIZE
);
883 ret
= ops
->get_eeprom(dev
, &eeprom
, data
);
886 if (copy_to_user(userbuf
, data
, eeprom
.len
)) {
890 userbuf
+= eeprom
.len
;
891 eeprom
.offset
+= eeprom
.len
;
892 bytes_remaining
-= eeprom
.len
;
895 eeprom
.len
= userbuf
- (useraddr
+ sizeof(eeprom
));
896 eeprom
.offset
-= eeprom
.len
;
897 if (copy_to_user(useraddr
, &eeprom
, sizeof(eeprom
)))
904 static int ethtool_set_eeprom(struct net_device
*dev
, void __user
*useraddr
)
906 struct ethtool_eeprom eeprom
;
907 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
908 void __user
*userbuf
= useraddr
+ sizeof(eeprom
);
913 if (!ops
->set_eeprom
|| !ops
->get_eeprom_len
)
916 if (copy_from_user(&eeprom
, useraddr
, sizeof(eeprom
)))
919 /* Check for wrap and zero */
920 if (eeprom
.offset
+ eeprom
.len
<= eeprom
.offset
)
923 /* Check for exceeding total eeprom len */
924 if (eeprom
.offset
+ eeprom
.len
> ops
->get_eeprom_len(dev
))
927 data
= kmalloc(PAGE_SIZE
, GFP_USER
);
931 bytes_remaining
= eeprom
.len
;
932 while (bytes_remaining
> 0) {
933 eeprom
.len
= min(bytes_remaining
, (u32
)PAGE_SIZE
);
935 if (copy_from_user(data
, userbuf
, eeprom
.len
)) {
939 ret
= ops
->set_eeprom(dev
, &eeprom
, data
);
942 userbuf
+= eeprom
.len
;
943 eeprom
.offset
+= eeprom
.len
;
944 bytes_remaining
-= eeprom
.len
;
951 static noinline_for_stack
int ethtool_get_coalesce(struct net_device
*dev
,
952 void __user
*useraddr
)
954 struct ethtool_coalesce coalesce
= { .cmd
= ETHTOOL_GCOALESCE
};
956 if (!dev
->ethtool_ops
->get_coalesce
)
959 dev
->ethtool_ops
->get_coalesce(dev
, &coalesce
);
961 if (copy_to_user(useraddr
, &coalesce
, sizeof(coalesce
)))
966 static noinline_for_stack
int ethtool_set_coalesce(struct net_device
*dev
,
967 void __user
*useraddr
)
969 struct ethtool_coalesce coalesce
;
971 if (!dev
->ethtool_ops
->set_coalesce
)
974 if (copy_from_user(&coalesce
, useraddr
, sizeof(coalesce
)))
977 return dev
->ethtool_ops
->set_coalesce(dev
, &coalesce
);
980 static int ethtool_get_ringparam(struct net_device
*dev
, void __user
*useraddr
)
982 struct ethtool_ringparam ringparam
= { .cmd
= ETHTOOL_GRINGPARAM
};
984 if (!dev
->ethtool_ops
->get_ringparam
)
987 dev
->ethtool_ops
->get_ringparam(dev
, &ringparam
);
989 if (copy_to_user(useraddr
, &ringparam
, sizeof(ringparam
)))
994 static int ethtool_set_ringparam(struct net_device
*dev
, void __user
*useraddr
)
996 struct ethtool_ringparam ringparam
;
998 if (!dev
->ethtool_ops
->set_ringparam
)
1001 if (copy_from_user(&ringparam
, useraddr
, sizeof(ringparam
)))
1004 return dev
->ethtool_ops
->set_ringparam(dev
, &ringparam
);
1007 static int ethtool_get_pauseparam(struct net_device
*dev
, void __user
*useraddr
)
1009 struct ethtool_pauseparam pauseparam
= { ETHTOOL_GPAUSEPARAM
};
1011 if (!dev
->ethtool_ops
->get_pauseparam
)
1014 dev
->ethtool_ops
->get_pauseparam(dev
, &pauseparam
);
1016 if (copy_to_user(useraddr
, &pauseparam
, sizeof(pauseparam
)))
1021 static int ethtool_set_pauseparam(struct net_device
*dev
, void __user
*useraddr
)
1023 struct ethtool_pauseparam pauseparam
;
1025 if (!dev
->ethtool_ops
->set_pauseparam
)
1028 if (copy_from_user(&pauseparam
, useraddr
, sizeof(pauseparam
)))
1031 return dev
->ethtool_ops
->set_pauseparam(dev
, &pauseparam
);
1034 static int __ethtool_set_sg(struct net_device
*dev
, u32 data
)
1038 if (!data
&& dev
->ethtool_ops
->set_tso
) {
1039 err
= dev
->ethtool_ops
->set_tso(dev
, 0);
1044 if (!data
&& dev
->ethtool_ops
->set_ufo
) {
1045 err
= dev
->ethtool_ops
->set_ufo(dev
, 0);
1049 return dev
->ethtool_ops
->set_sg(dev
, data
);
1052 static int ethtool_set_tx_csum(struct net_device
*dev
, char __user
*useraddr
)
1054 struct ethtool_value edata
;
1057 if (!dev
->ethtool_ops
->set_tx_csum
)
1060 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1063 if (!edata
.data
&& dev
->ethtool_ops
->set_sg
) {
1064 err
= __ethtool_set_sg(dev
, 0);
1069 return dev
->ethtool_ops
->set_tx_csum(dev
, edata
.data
);
1071 EXPORT_SYMBOL(ethtool_op_set_tx_csum
);
1073 static int ethtool_set_rx_csum(struct net_device
*dev
, char __user
*useraddr
)
1075 struct ethtool_value edata
;
1077 if (!dev
->ethtool_ops
->set_rx_csum
)
1080 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1083 if (!edata
.data
&& dev
->ethtool_ops
->set_sg
)
1084 dev
->features
&= ~NETIF_F_GRO
;
1086 return dev
->ethtool_ops
->set_rx_csum(dev
, edata
.data
);
1089 static int ethtool_set_sg(struct net_device
*dev
, char __user
*useraddr
)
1091 struct ethtool_value edata
;
1093 if (!dev
->ethtool_ops
->set_sg
)
1096 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1100 !(dev
->features
& NETIF_F_ALL_CSUM
))
1103 return __ethtool_set_sg(dev
, edata
.data
);
1106 static int ethtool_set_tso(struct net_device
*dev
, char __user
*useraddr
)
1108 struct ethtool_value edata
;
1110 if (!dev
->ethtool_ops
->set_tso
)
1113 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1116 if (edata
.data
&& !(dev
->features
& NETIF_F_SG
))
1119 return dev
->ethtool_ops
->set_tso(dev
, edata
.data
);
1122 static int ethtool_set_ufo(struct net_device
*dev
, char __user
*useraddr
)
1124 struct ethtool_value edata
;
1126 if (!dev
->ethtool_ops
->set_ufo
)
1128 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1130 if (edata
.data
&& !(dev
->features
& NETIF_F_SG
))
1132 if (edata
.data
&& !(dev
->features
& NETIF_F_HW_CSUM
))
1134 return dev
->ethtool_ops
->set_ufo(dev
, edata
.data
);
1137 static int ethtool_get_gso(struct net_device
*dev
, char __user
*useraddr
)
1139 struct ethtool_value edata
= { ETHTOOL_GGSO
};
1141 edata
.data
= dev
->features
& NETIF_F_GSO
;
1142 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
1147 static int ethtool_set_gso(struct net_device
*dev
, char __user
*useraddr
)
1149 struct ethtool_value edata
;
1151 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1154 dev
->features
|= NETIF_F_GSO
;
1156 dev
->features
&= ~NETIF_F_GSO
;
1160 static int ethtool_get_gro(struct net_device
*dev
, char __user
*useraddr
)
1162 struct ethtool_value edata
= { ETHTOOL_GGRO
};
1164 edata
.data
= dev
->features
& NETIF_F_GRO
;
1165 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
1170 static int ethtool_set_gro(struct net_device
*dev
, char __user
*useraddr
)
1172 struct ethtool_value edata
;
1174 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1178 if (!dev
->ethtool_ops
->get_rx_csum
||
1179 !dev
->ethtool_ops
->get_rx_csum(dev
))
1181 dev
->features
|= NETIF_F_GRO
;
1183 dev
->features
&= ~NETIF_F_GRO
;
1188 static int ethtool_self_test(struct net_device
*dev
, char __user
*useraddr
)
1190 struct ethtool_test test
;
1191 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
1195 if (!ops
->self_test
|| !ops
->get_sset_count
)
1198 test_len
= ops
->get_sset_count(dev
, ETH_SS_TEST
);
1201 WARN_ON(test_len
== 0);
1203 if (copy_from_user(&test
, useraddr
, sizeof(test
)))
1206 test
.len
= test_len
;
1207 data
= kmalloc(test_len
* sizeof(u64
), GFP_USER
);
1211 ops
->self_test(dev
, &test
, data
);
1214 if (copy_to_user(useraddr
, &test
, sizeof(test
)))
1216 useraddr
+= sizeof(test
);
1217 if (copy_to_user(useraddr
, data
, test
.len
* sizeof(u64
)))
1226 static int ethtool_get_strings(struct net_device
*dev
, void __user
*useraddr
)
1228 struct ethtool_gstrings gstrings
;
1229 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
1233 if (!ops
->get_strings
|| !ops
->get_sset_count
)
1236 if (copy_from_user(&gstrings
, useraddr
, sizeof(gstrings
)))
1239 ret
= ops
->get_sset_count(dev
, gstrings
.string_set
);
1245 data
= kmalloc(gstrings
.len
* ETH_GSTRING_LEN
, GFP_USER
);
1249 ops
->get_strings(dev
, gstrings
.string_set
, data
);
1252 if (copy_to_user(useraddr
, &gstrings
, sizeof(gstrings
)))
1254 useraddr
+= sizeof(gstrings
);
1255 if (copy_to_user(useraddr
, data
, gstrings
.len
* ETH_GSTRING_LEN
))
1264 static int ethtool_phys_id(struct net_device
*dev
, void __user
*useraddr
)
1266 struct ethtool_value id
;
1268 if (!dev
->ethtool_ops
->phys_id
)
1271 if (copy_from_user(&id
, useraddr
, sizeof(id
)))
1274 return dev
->ethtool_ops
->phys_id(dev
, id
.data
);
1277 static int ethtool_get_stats(struct net_device
*dev
, void __user
*useraddr
)
1279 struct ethtool_stats stats
;
1280 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
1284 if (!ops
->get_ethtool_stats
|| !ops
->get_sset_count
)
1287 n_stats
= ops
->get_sset_count(dev
, ETH_SS_STATS
);
1290 WARN_ON(n_stats
== 0);
1292 if (copy_from_user(&stats
, useraddr
, sizeof(stats
)))
1295 stats
.n_stats
= n_stats
;
1296 data
= kmalloc(n_stats
* sizeof(u64
), GFP_USER
);
1300 ops
->get_ethtool_stats(dev
, &stats
, data
);
1303 if (copy_to_user(useraddr
, &stats
, sizeof(stats
)))
1305 useraddr
+= sizeof(stats
);
1306 if (copy_to_user(useraddr
, data
, stats
.n_stats
* sizeof(u64
)))
1315 static int ethtool_get_perm_addr(struct net_device
*dev
, void __user
*useraddr
)
1317 struct ethtool_perm_addr epaddr
;
1319 if (copy_from_user(&epaddr
, useraddr
, sizeof(epaddr
)))
1322 if (epaddr
.size
< dev
->addr_len
)
1324 epaddr
.size
= dev
->addr_len
;
1326 if (copy_to_user(useraddr
, &epaddr
, sizeof(epaddr
)))
1328 useraddr
+= sizeof(epaddr
);
1329 if (copy_to_user(useraddr
, dev
->perm_addr
, epaddr
.size
))
1334 static int ethtool_get_value(struct net_device
*dev
, char __user
*useraddr
,
1335 u32 cmd
, u32 (*actor
)(struct net_device
*))
1337 struct ethtool_value edata
= { .cmd
= cmd
};
1342 edata
.data
= actor(dev
);
1344 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
1349 static int ethtool_set_value_void(struct net_device
*dev
, char __user
*useraddr
,
1350 void (*actor
)(struct net_device
*, u32
))
1352 struct ethtool_value edata
;
1357 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1360 actor(dev
, edata
.data
);
1364 static int ethtool_set_value(struct net_device
*dev
, char __user
*useraddr
,
1365 int (*actor
)(struct net_device
*, u32
))
1367 struct ethtool_value edata
;
1372 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
1375 return actor(dev
, edata
.data
);
1378 static noinline_for_stack
int ethtool_flash_device(struct net_device
*dev
,
1379 char __user
*useraddr
)
1381 struct ethtool_flash efl
;
1383 if (copy_from_user(&efl
, useraddr
, sizeof(efl
)))
1386 if (!dev
->ethtool_ops
->flash_device
)
1389 return dev
->ethtool_ops
->flash_device(dev
, &efl
);
1392 /* The main entry point in this file. Called from net/core/dev.c */
1394 int dev_ethtool(struct net
*net
, struct ifreq
*ifr
)
1396 struct net_device
*dev
= __dev_get_by_name(net
, ifr
->ifr_name
);
1397 void __user
*useraddr
= ifr
->ifr_data
;
1400 unsigned long old_features
;
1402 if (!dev
|| !netif_device_present(dev
))
1405 if (!dev
->ethtool_ops
)
1408 if (copy_from_user(ðcmd
, useraddr
, sizeof(ethcmd
)))
1411 /* Allow some commands to be done by anyone */
1413 case ETHTOOL_GDRVINFO
:
1414 case ETHTOOL_GMSGLVL
:
1415 case ETHTOOL_GCOALESCE
:
1416 case ETHTOOL_GRINGPARAM
:
1417 case ETHTOOL_GPAUSEPARAM
:
1418 case ETHTOOL_GRXCSUM
:
1419 case ETHTOOL_GTXCSUM
:
1421 case ETHTOOL_GSTRINGS
:
1423 case ETHTOOL_GPERMADDR
:
1427 case ETHTOOL_GFLAGS
:
1428 case ETHTOOL_GPFLAGS
:
1430 case ETHTOOL_GRXRINGS
:
1431 case ETHTOOL_GRXCLSRLCNT
:
1432 case ETHTOOL_GRXCLSRULE
:
1433 case ETHTOOL_GRXCLSRLALL
:
1436 if (!capable(CAP_NET_ADMIN
))
1440 if (dev
->ethtool_ops
->begin
) {
1441 rc
= dev
->ethtool_ops
->begin(dev
);
1445 old_features
= dev
->features
;
1449 rc
= ethtool_get_settings(dev
, useraddr
);
1452 rc
= ethtool_set_settings(dev
, useraddr
);
1454 case ETHTOOL_GDRVINFO
:
1455 rc
= ethtool_get_drvinfo(dev
, useraddr
);
1458 rc
= ethtool_get_regs(dev
, useraddr
);
1461 rc
= ethtool_get_wol(dev
, useraddr
);
1464 rc
= ethtool_set_wol(dev
, useraddr
);
1466 case ETHTOOL_GMSGLVL
:
1467 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1468 dev
->ethtool_ops
->get_msglevel
);
1470 case ETHTOOL_SMSGLVL
:
1471 rc
= ethtool_set_value_void(dev
, useraddr
,
1472 dev
->ethtool_ops
->set_msglevel
);
1474 case ETHTOOL_NWAY_RST
:
1475 rc
= ethtool_nway_reset(dev
);
1478 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1479 dev
->ethtool_ops
->get_link
);
1481 case ETHTOOL_GEEPROM
:
1482 rc
= ethtool_get_eeprom(dev
, useraddr
);
1484 case ETHTOOL_SEEPROM
:
1485 rc
= ethtool_set_eeprom(dev
, useraddr
);
1487 case ETHTOOL_GCOALESCE
:
1488 rc
= ethtool_get_coalesce(dev
, useraddr
);
1490 case ETHTOOL_SCOALESCE
:
1491 rc
= ethtool_set_coalesce(dev
, useraddr
);
1493 case ETHTOOL_GRINGPARAM
:
1494 rc
= ethtool_get_ringparam(dev
, useraddr
);
1496 case ETHTOOL_SRINGPARAM
:
1497 rc
= ethtool_set_ringparam(dev
, useraddr
);
1499 case ETHTOOL_GPAUSEPARAM
:
1500 rc
= ethtool_get_pauseparam(dev
, useraddr
);
1502 case ETHTOOL_SPAUSEPARAM
:
1503 rc
= ethtool_set_pauseparam(dev
, useraddr
);
1505 case ETHTOOL_GRXCSUM
:
1506 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1507 (dev
->ethtool_ops
->get_rx_csum
?
1508 dev
->ethtool_ops
->get_rx_csum
:
1509 ethtool_op_get_rx_csum
));
1511 case ETHTOOL_SRXCSUM
:
1512 rc
= ethtool_set_rx_csum(dev
, useraddr
);
1514 case ETHTOOL_GTXCSUM
:
1515 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1516 (dev
->ethtool_ops
->get_tx_csum
?
1517 dev
->ethtool_ops
->get_tx_csum
:
1518 ethtool_op_get_tx_csum
));
1520 case ETHTOOL_STXCSUM
:
1521 rc
= ethtool_set_tx_csum(dev
, useraddr
);
1524 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1525 (dev
->ethtool_ops
->get_sg
?
1526 dev
->ethtool_ops
->get_sg
:
1527 ethtool_op_get_sg
));
1530 rc
= ethtool_set_sg(dev
, useraddr
);
1533 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1534 (dev
->ethtool_ops
->get_tso
?
1535 dev
->ethtool_ops
->get_tso
:
1536 ethtool_op_get_tso
));
1539 rc
= ethtool_set_tso(dev
, useraddr
);
1542 rc
= ethtool_self_test(dev
, useraddr
);
1544 case ETHTOOL_GSTRINGS
:
1545 rc
= ethtool_get_strings(dev
, useraddr
);
1547 case ETHTOOL_PHYS_ID
:
1548 rc
= ethtool_phys_id(dev
, useraddr
);
1550 case ETHTOOL_GSTATS
:
1551 rc
= ethtool_get_stats(dev
, useraddr
);
1553 case ETHTOOL_GPERMADDR
:
1554 rc
= ethtool_get_perm_addr(dev
, useraddr
);
1557 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1558 (dev
->ethtool_ops
->get_ufo
?
1559 dev
->ethtool_ops
->get_ufo
:
1560 ethtool_op_get_ufo
));
1563 rc
= ethtool_set_ufo(dev
, useraddr
);
1566 rc
= ethtool_get_gso(dev
, useraddr
);
1569 rc
= ethtool_set_gso(dev
, useraddr
);
1571 case ETHTOOL_GFLAGS
:
1572 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1573 (dev
->ethtool_ops
->get_flags
?
1574 dev
->ethtool_ops
->get_flags
:
1575 ethtool_op_get_flags
));
1577 case ETHTOOL_SFLAGS
:
1578 rc
= ethtool_set_value(dev
, useraddr
,
1579 dev
->ethtool_ops
->set_flags
);
1581 case ETHTOOL_GPFLAGS
:
1582 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
1583 dev
->ethtool_ops
->get_priv_flags
);
1585 case ETHTOOL_SPFLAGS
:
1586 rc
= ethtool_set_value(dev
, useraddr
,
1587 dev
->ethtool_ops
->set_priv_flags
);
1590 case ETHTOOL_GRXRINGS
:
1591 case ETHTOOL_GRXCLSRLCNT
:
1592 case ETHTOOL_GRXCLSRULE
:
1593 case ETHTOOL_GRXCLSRLALL
:
1594 rc
= ethtool_get_rxnfc(dev
, ethcmd
, useraddr
);
1597 case ETHTOOL_SRXCLSRLDEL
:
1598 case ETHTOOL_SRXCLSRLINS
:
1599 rc
= ethtool_set_rxnfc(dev
, ethcmd
, useraddr
);
1602 rc
= ethtool_get_gro(dev
, useraddr
);
1605 rc
= ethtool_set_gro(dev
, useraddr
);
1607 case ETHTOOL_FLASHDEV
:
1608 rc
= ethtool_flash_device(dev
, useraddr
);
1611 rc
= ethtool_reset(dev
, useraddr
);
1613 case ETHTOOL_SRXNTUPLE
:
1614 rc
= ethtool_set_rx_ntuple(dev
, useraddr
);
1616 case ETHTOOL_GRXNTUPLE
:
1617 rc
= ethtool_get_rx_ntuple(dev
, useraddr
);
1619 case ETHTOOL_GSSET_INFO
:
1620 rc
= ethtool_get_sset_info(dev
, useraddr
);
1622 case ETHTOOL_GRXFHINDIR
:
1623 rc
= ethtool_get_rxfh_indir(dev
, useraddr
);
1625 case ETHTOOL_SRXFHINDIR
:
1626 rc
= ethtool_set_rxfh_indir(dev
, useraddr
);
1632 if (dev
->ethtool_ops
->complete
)
1633 dev
->ethtool_ops
->complete(dev
);
1635 if (old_features
!= dev
->features
)
1636 netdev_features_change(dev
);