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 <asm/uaccess.h>
23 * Some useful ethtool_ops methods that're device independent.
24 * If we find that all drivers want to do the same thing here,
25 * we can turn these into dev_() function calls.
28 u32
ethtool_op_get_link(struct net_device
*dev
)
30 return netif_carrier_ok(dev
) ? 1 : 0;
33 u32
ethtool_op_get_tx_csum(struct net_device
*dev
)
35 return (dev
->features
& NETIF_F_ALL_CSUM
) != 0;
38 int ethtool_op_set_tx_csum(struct net_device
*dev
, u32 data
)
41 dev
->features
|= NETIF_F_IP_CSUM
;
43 dev
->features
&= ~NETIF_F_IP_CSUM
;
48 int ethtool_op_set_tx_hw_csum(struct net_device
*dev
, u32 data
)
51 dev
->features
|= NETIF_F_HW_CSUM
;
53 dev
->features
&= ~NETIF_F_HW_CSUM
;
58 int ethtool_op_set_tx_ipv6_csum(struct net_device
*dev
, u32 data
)
61 dev
->features
|= NETIF_F_IP_CSUM
| NETIF_F_IPV6_CSUM
;
63 dev
->features
&= ~(NETIF_F_IP_CSUM
| NETIF_F_IPV6_CSUM
);
68 u32
ethtool_op_get_sg(struct net_device
*dev
)
70 return (dev
->features
& NETIF_F_SG
) != 0;
73 int ethtool_op_set_sg(struct net_device
*dev
, u32 data
)
76 dev
->features
|= NETIF_F_SG
;
78 dev
->features
&= ~NETIF_F_SG
;
83 u32
ethtool_op_get_tso(struct net_device
*dev
)
85 return (dev
->features
& NETIF_F_TSO
) != 0;
88 int ethtool_op_set_tso(struct net_device
*dev
, u32 data
)
91 dev
->features
|= NETIF_F_TSO
;
93 dev
->features
&= ~NETIF_F_TSO
;
98 u32
ethtool_op_get_ufo(struct net_device
*dev
)
100 return (dev
->features
& NETIF_F_UFO
) != 0;
103 int ethtool_op_set_ufo(struct net_device
*dev
, u32 data
)
106 dev
->features
|= NETIF_F_UFO
;
108 dev
->features
&= ~NETIF_F_UFO
;
112 /* the following list of flags are the same as their associated
113 * NETIF_F_xxx values in include/linux/netdevice.h
115 static const u32 flags_dup_features
=
118 u32
ethtool_op_get_flags(struct net_device
*dev
)
120 /* in the future, this function will probably contain additional
121 * handling for flags which are not so easily handled
122 * by a simple masking operation
125 return dev
->features
& flags_dup_features
;
128 int ethtool_op_set_flags(struct net_device
*dev
, u32 data
)
130 if (data
& ETH_FLAG_LRO
)
131 dev
->features
|= NETIF_F_LRO
;
133 dev
->features
&= ~NETIF_F_LRO
;
138 /* Handlers for each ethtool command */
140 static int ethtool_get_settings(struct net_device
*dev
, void __user
*useraddr
)
142 struct ethtool_cmd cmd
= { ETHTOOL_GSET
};
145 if (!dev
->ethtool_ops
->get_settings
)
148 err
= dev
->ethtool_ops
->get_settings(dev
, &cmd
);
152 if (copy_to_user(useraddr
, &cmd
, sizeof(cmd
)))
157 static int ethtool_set_settings(struct net_device
*dev
, void __user
*useraddr
)
159 struct ethtool_cmd cmd
;
161 if (!dev
->ethtool_ops
->set_settings
)
164 if (copy_from_user(&cmd
, useraddr
, sizeof(cmd
)))
167 return dev
->ethtool_ops
->set_settings(dev
, &cmd
);
170 static int ethtool_get_drvinfo(struct net_device
*dev
, void __user
*useraddr
)
172 struct ethtool_drvinfo info
;
173 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
175 if (!ops
->get_drvinfo
)
178 memset(&info
, 0, sizeof(info
));
179 info
.cmd
= ETHTOOL_GDRVINFO
;
180 ops
->get_drvinfo(dev
, &info
);
182 if (ops
->self_test_count
)
183 info
.testinfo_len
= ops
->self_test_count(dev
);
184 if (ops
->get_stats_count
)
185 info
.n_stats
= ops
->get_stats_count(dev
);
186 if (ops
->get_regs_len
)
187 info
.regdump_len
= ops
->get_regs_len(dev
);
188 if (ops
->get_eeprom_len
)
189 info
.eedump_len
= ops
->get_eeprom_len(dev
);
191 if (copy_to_user(useraddr
, &info
, sizeof(info
)))
196 static int ethtool_get_regs(struct net_device
*dev
, char __user
*useraddr
)
198 struct ethtool_regs regs
;
199 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
203 if (!ops
->get_regs
|| !ops
->get_regs_len
)
206 if (copy_from_user(®s
, useraddr
, sizeof(regs
)))
209 reglen
= ops
->get_regs_len(dev
);
210 if (regs
.len
> reglen
)
213 regbuf
= kmalloc(reglen
, GFP_USER
);
217 ops
->get_regs(dev
, ®s
, regbuf
);
220 if (copy_to_user(useraddr
, ®s
, sizeof(regs
)))
222 useraddr
+= offsetof(struct ethtool_regs
, data
);
223 if (copy_to_user(useraddr
, regbuf
, regs
.len
))
232 static int ethtool_get_wol(struct net_device
*dev
, char __user
*useraddr
)
234 struct ethtool_wolinfo wol
= { ETHTOOL_GWOL
};
236 if (!dev
->ethtool_ops
->get_wol
)
239 dev
->ethtool_ops
->get_wol(dev
, &wol
);
241 if (copy_to_user(useraddr
, &wol
, sizeof(wol
)))
246 static int ethtool_set_wol(struct net_device
*dev
, char __user
*useraddr
)
248 struct ethtool_wolinfo wol
;
250 if (!dev
->ethtool_ops
->set_wol
)
253 if (copy_from_user(&wol
, useraddr
, sizeof(wol
)))
256 return dev
->ethtool_ops
->set_wol(dev
, &wol
);
259 static int ethtool_get_msglevel(struct net_device
*dev
, char __user
*useraddr
)
261 struct ethtool_value edata
= { ETHTOOL_GMSGLVL
};
263 if (!dev
->ethtool_ops
->get_msglevel
)
266 edata
.data
= dev
->ethtool_ops
->get_msglevel(dev
);
268 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
273 static int ethtool_set_msglevel(struct net_device
*dev
, char __user
*useraddr
)
275 struct ethtool_value edata
;
277 if (!dev
->ethtool_ops
->set_msglevel
)
280 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
283 dev
->ethtool_ops
->set_msglevel(dev
, edata
.data
);
287 static int ethtool_nway_reset(struct net_device
*dev
)
289 if (!dev
->ethtool_ops
->nway_reset
)
292 return dev
->ethtool_ops
->nway_reset(dev
);
295 static int ethtool_get_link(struct net_device
*dev
, void __user
*useraddr
)
297 struct ethtool_value edata
= { ETHTOOL_GLINK
};
299 if (!dev
->ethtool_ops
->get_link
)
302 edata
.data
= dev
->ethtool_ops
->get_link(dev
);
304 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
309 static int ethtool_get_eeprom(struct net_device
*dev
, void __user
*useraddr
)
311 struct ethtool_eeprom eeprom
;
312 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
316 if (!ops
->get_eeprom
|| !ops
->get_eeprom_len
)
319 if (copy_from_user(&eeprom
, useraddr
, sizeof(eeprom
)))
322 /* Check for wrap and zero */
323 if (eeprom
.offset
+ eeprom
.len
<= eeprom
.offset
)
326 /* Check for exceeding total eeprom len */
327 if (eeprom
.offset
+ eeprom
.len
> ops
->get_eeprom_len(dev
))
330 data
= kmalloc(eeprom
.len
, GFP_USER
);
335 if (copy_from_user(data
, useraddr
+ sizeof(eeprom
), eeprom
.len
))
338 ret
= ops
->get_eeprom(dev
, &eeprom
, data
);
343 if (copy_to_user(useraddr
, &eeprom
, sizeof(eeprom
)))
345 if (copy_to_user(useraddr
+ sizeof(eeprom
), data
, eeprom
.len
))
354 static int ethtool_set_eeprom(struct net_device
*dev
, void __user
*useraddr
)
356 struct ethtool_eeprom eeprom
;
357 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
361 if (!ops
->set_eeprom
|| !ops
->get_eeprom_len
)
364 if (copy_from_user(&eeprom
, useraddr
, sizeof(eeprom
)))
367 /* Check for wrap and zero */
368 if (eeprom
.offset
+ eeprom
.len
<= eeprom
.offset
)
371 /* Check for exceeding total eeprom len */
372 if (eeprom
.offset
+ eeprom
.len
> ops
->get_eeprom_len(dev
))
375 data
= kmalloc(eeprom
.len
, GFP_USER
);
380 if (copy_from_user(data
, useraddr
+ sizeof(eeprom
), eeprom
.len
))
383 ret
= ops
->set_eeprom(dev
, &eeprom
, data
);
387 if (copy_to_user(useraddr
+ sizeof(eeprom
), data
, eeprom
.len
))
395 static int ethtool_get_coalesce(struct net_device
*dev
, void __user
*useraddr
)
397 struct ethtool_coalesce coalesce
= { ETHTOOL_GCOALESCE
};
399 if (!dev
->ethtool_ops
->get_coalesce
)
402 dev
->ethtool_ops
->get_coalesce(dev
, &coalesce
);
404 if (copy_to_user(useraddr
, &coalesce
, sizeof(coalesce
)))
409 static int ethtool_set_coalesce(struct net_device
*dev
, void __user
*useraddr
)
411 struct ethtool_coalesce coalesce
;
413 if (!dev
->ethtool_ops
->set_coalesce
)
416 if (copy_from_user(&coalesce
, useraddr
, sizeof(coalesce
)))
419 return dev
->ethtool_ops
->set_coalesce(dev
, &coalesce
);
422 static int ethtool_get_ringparam(struct net_device
*dev
, void __user
*useraddr
)
424 struct ethtool_ringparam ringparam
= { ETHTOOL_GRINGPARAM
};
426 if (!dev
->ethtool_ops
->get_ringparam
)
429 dev
->ethtool_ops
->get_ringparam(dev
, &ringparam
);
431 if (copy_to_user(useraddr
, &ringparam
, sizeof(ringparam
)))
436 static int ethtool_set_ringparam(struct net_device
*dev
, void __user
*useraddr
)
438 struct ethtool_ringparam ringparam
;
440 if (!dev
->ethtool_ops
->set_ringparam
)
443 if (copy_from_user(&ringparam
, useraddr
, sizeof(ringparam
)))
446 return dev
->ethtool_ops
->set_ringparam(dev
, &ringparam
);
449 static int ethtool_get_pauseparam(struct net_device
*dev
, void __user
*useraddr
)
451 struct ethtool_pauseparam pauseparam
= { ETHTOOL_GPAUSEPARAM
};
453 if (!dev
->ethtool_ops
->get_pauseparam
)
456 dev
->ethtool_ops
->get_pauseparam(dev
, &pauseparam
);
458 if (copy_to_user(useraddr
, &pauseparam
, sizeof(pauseparam
)))
463 static int ethtool_set_pauseparam(struct net_device
*dev
, void __user
*useraddr
)
465 struct ethtool_pauseparam pauseparam
;
467 if (!dev
->ethtool_ops
->set_pauseparam
)
470 if (copy_from_user(&pauseparam
, useraddr
, sizeof(pauseparam
)))
473 return dev
->ethtool_ops
->set_pauseparam(dev
, &pauseparam
);
476 static int ethtool_get_rx_csum(struct net_device
*dev
, char __user
*useraddr
)
478 struct ethtool_value edata
= { ETHTOOL_GRXCSUM
};
480 if (!dev
->ethtool_ops
->get_rx_csum
)
483 edata
.data
= dev
->ethtool_ops
->get_rx_csum(dev
);
485 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
490 static int ethtool_set_rx_csum(struct net_device
*dev
, char __user
*useraddr
)
492 struct ethtool_value edata
;
494 if (!dev
->ethtool_ops
->set_rx_csum
)
497 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
500 dev
->ethtool_ops
->set_rx_csum(dev
, edata
.data
);
504 static int ethtool_get_tx_csum(struct net_device
*dev
, char __user
*useraddr
)
506 struct ethtool_value edata
= { ETHTOOL_GTXCSUM
};
508 if (!dev
->ethtool_ops
->get_tx_csum
)
511 edata
.data
= dev
->ethtool_ops
->get_tx_csum(dev
);
513 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
518 static int __ethtool_set_sg(struct net_device
*dev
, u32 data
)
522 if (!data
&& dev
->ethtool_ops
->set_tso
) {
523 err
= dev
->ethtool_ops
->set_tso(dev
, 0);
528 if (!data
&& dev
->ethtool_ops
->set_ufo
) {
529 err
= dev
->ethtool_ops
->set_ufo(dev
, 0);
533 return dev
->ethtool_ops
->set_sg(dev
, data
);
536 static int ethtool_set_tx_csum(struct net_device
*dev
, char __user
*useraddr
)
538 struct ethtool_value edata
;
541 if (!dev
->ethtool_ops
->set_tx_csum
)
544 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
547 if (!edata
.data
&& dev
->ethtool_ops
->set_sg
) {
548 err
= __ethtool_set_sg(dev
, 0);
553 return dev
->ethtool_ops
->set_tx_csum(dev
, edata
.data
);
556 static int ethtool_get_sg(struct net_device
*dev
, char __user
*useraddr
)
558 struct ethtool_value edata
= { ETHTOOL_GSG
};
560 if (!dev
->ethtool_ops
->get_sg
)
563 edata
.data
= dev
->ethtool_ops
->get_sg(dev
);
565 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
570 static int ethtool_set_sg(struct net_device
*dev
, char __user
*useraddr
)
572 struct ethtool_value edata
;
574 if (!dev
->ethtool_ops
->set_sg
)
577 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
581 !(dev
->features
& NETIF_F_ALL_CSUM
))
584 return __ethtool_set_sg(dev
, edata
.data
);
587 static int ethtool_get_tso(struct net_device
*dev
, char __user
*useraddr
)
589 struct ethtool_value edata
= { ETHTOOL_GTSO
};
591 if (!dev
->ethtool_ops
->get_tso
)
594 edata
.data
= dev
->ethtool_ops
->get_tso(dev
);
596 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
601 static int ethtool_set_tso(struct net_device
*dev
, char __user
*useraddr
)
603 struct ethtool_value edata
;
605 if (!dev
->ethtool_ops
->set_tso
)
608 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
611 if (edata
.data
&& !(dev
->features
& NETIF_F_SG
))
614 return dev
->ethtool_ops
->set_tso(dev
, edata
.data
);
617 static int ethtool_get_ufo(struct net_device
*dev
, char __user
*useraddr
)
619 struct ethtool_value edata
= { ETHTOOL_GUFO
};
621 if (!dev
->ethtool_ops
->get_ufo
)
623 edata
.data
= dev
->ethtool_ops
->get_ufo(dev
);
624 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
629 static int ethtool_set_ufo(struct net_device
*dev
, char __user
*useraddr
)
631 struct ethtool_value edata
;
633 if (!dev
->ethtool_ops
->set_ufo
)
635 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
637 if (edata
.data
&& !(dev
->features
& NETIF_F_SG
))
639 if (edata
.data
&& !(dev
->features
& NETIF_F_HW_CSUM
))
641 return dev
->ethtool_ops
->set_ufo(dev
, edata
.data
);
644 static int ethtool_get_gso(struct net_device
*dev
, char __user
*useraddr
)
646 struct ethtool_value edata
= { ETHTOOL_GGSO
};
648 edata
.data
= dev
->features
& NETIF_F_GSO
;
649 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
654 static int ethtool_set_gso(struct net_device
*dev
, char __user
*useraddr
)
656 struct ethtool_value edata
;
658 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
661 dev
->features
|= NETIF_F_GSO
;
663 dev
->features
&= ~NETIF_F_GSO
;
667 static int ethtool_self_test(struct net_device
*dev
, char __user
*useraddr
)
669 struct ethtool_test test
;
670 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
674 if (!ops
->self_test
|| !ops
->self_test_count
)
677 if (copy_from_user(&test
, useraddr
, sizeof(test
)))
680 test
.len
= ops
->self_test_count(dev
);
681 data
= kmalloc(test
.len
* sizeof(u64
), GFP_USER
);
685 ops
->self_test(dev
, &test
, data
);
688 if (copy_to_user(useraddr
, &test
, sizeof(test
)))
690 useraddr
+= sizeof(test
);
691 if (copy_to_user(useraddr
, data
, test
.len
* sizeof(u64
)))
700 static int ethtool_get_strings(struct net_device
*dev
, void __user
*useraddr
)
702 struct ethtool_gstrings gstrings
;
703 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
707 if (!ops
->get_strings
)
710 if (copy_from_user(&gstrings
, useraddr
, sizeof(gstrings
)))
713 switch (gstrings
.string_set
) {
715 if (!ops
->self_test_count
)
717 gstrings
.len
= ops
->self_test_count(dev
);
720 if (!ops
->get_stats_count
)
722 gstrings
.len
= ops
->get_stats_count(dev
);
728 data
= kmalloc(gstrings
.len
* ETH_GSTRING_LEN
, GFP_USER
);
732 ops
->get_strings(dev
, gstrings
.string_set
, data
);
735 if (copy_to_user(useraddr
, &gstrings
, sizeof(gstrings
)))
737 useraddr
+= sizeof(gstrings
);
738 if (copy_to_user(useraddr
, data
, gstrings
.len
* ETH_GSTRING_LEN
))
747 static int ethtool_phys_id(struct net_device
*dev
, void __user
*useraddr
)
749 struct ethtool_value id
;
751 if (!dev
->ethtool_ops
->phys_id
)
754 if (copy_from_user(&id
, useraddr
, sizeof(id
)))
757 return dev
->ethtool_ops
->phys_id(dev
, id
.data
);
760 static int ethtool_get_stats(struct net_device
*dev
, void __user
*useraddr
)
762 struct ethtool_stats stats
;
763 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
767 if (!ops
->get_ethtool_stats
|| !ops
->get_stats_count
)
770 if (copy_from_user(&stats
, useraddr
, sizeof(stats
)))
773 stats
.n_stats
= ops
->get_stats_count(dev
);
774 data
= kmalloc(stats
.n_stats
* sizeof(u64
), GFP_USER
);
778 ops
->get_ethtool_stats(dev
, &stats
, data
);
781 if (copy_to_user(useraddr
, &stats
, sizeof(stats
)))
783 useraddr
+= sizeof(stats
);
784 if (copy_to_user(useraddr
, data
, stats
.n_stats
* sizeof(u64
)))
793 static int ethtool_get_perm_addr(struct net_device
*dev
, void __user
*useraddr
)
795 struct ethtool_perm_addr epaddr
;
797 if (copy_from_user(&epaddr
, useraddr
, sizeof(epaddr
)))
800 if (epaddr
.size
< dev
->addr_len
)
802 epaddr
.size
= dev
->addr_len
;
804 if (copy_to_user(useraddr
, &epaddr
, sizeof(epaddr
)))
806 useraddr
+= sizeof(epaddr
);
807 if (copy_to_user(useraddr
, dev
->perm_addr
, epaddr
.size
))
812 static int ethtool_get_flags(struct net_device
*dev
, char __user
*useraddr
)
814 struct ethtool_value edata
= { ETHTOOL_GFLAGS
};
816 if (!dev
->ethtool_ops
->get_flags
)
819 edata
.data
= dev
->ethtool_ops
->get_flags(dev
);
821 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
826 static int ethtool_set_flags(struct net_device
*dev
, char __user
*useraddr
)
828 struct ethtool_value edata
;
830 if (!dev
->ethtool_ops
->set_flags
)
833 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
836 return dev
->ethtool_ops
->set_flags(dev
, edata
.data
);
839 /* The main entry point in this file. Called from net/core/dev.c */
841 int dev_ethtool(struct ifreq
*ifr
)
843 struct net_device
*dev
= __dev_get_by_name(ifr
->ifr_name
);
844 void __user
*useraddr
= ifr
->ifr_data
;
847 unsigned long old_features
;
849 if (!dev
|| !netif_device_present(dev
))
852 if (!dev
->ethtool_ops
)
855 if (copy_from_user(ðcmd
, useraddr
, sizeof (ethcmd
)))
858 /* Allow some commands to be done by anyone */
860 case ETHTOOL_GDRVINFO
:
861 case ETHTOOL_GMSGLVL
:
862 case ETHTOOL_GCOALESCE
:
863 case ETHTOOL_GRINGPARAM
:
864 case ETHTOOL_GPAUSEPARAM
:
865 case ETHTOOL_GRXCSUM
:
866 case ETHTOOL_GTXCSUM
:
868 case ETHTOOL_GSTRINGS
:
870 case ETHTOOL_GPERMADDR
:
875 if (!capable(CAP_NET_ADMIN
))
879 if (dev
->ethtool_ops
->begin
)
880 if ((rc
= dev
->ethtool_ops
->begin(dev
)) < 0)
883 old_features
= dev
->features
;
887 rc
= ethtool_get_settings(dev
, useraddr
);
890 rc
= ethtool_set_settings(dev
, useraddr
);
892 case ETHTOOL_GDRVINFO
:
893 rc
= ethtool_get_drvinfo(dev
, useraddr
);
896 rc
= ethtool_get_regs(dev
, useraddr
);
899 rc
= ethtool_get_wol(dev
, useraddr
);
902 rc
= ethtool_set_wol(dev
, useraddr
);
904 case ETHTOOL_GMSGLVL
:
905 rc
= ethtool_get_msglevel(dev
, useraddr
);
907 case ETHTOOL_SMSGLVL
:
908 rc
= ethtool_set_msglevel(dev
, useraddr
);
910 case ETHTOOL_NWAY_RST
:
911 rc
= ethtool_nway_reset(dev
);
914 rc
= ethtool_get_link(dev
, useraddr
);
916 case ETHTOOL_GEEPROM
:
917 rc
= ethtool_get_eeprom(dev
, useraddr
);
919 case ETHTOOL_SEEPROM
:
920 rc
= ethtool_set_eeprom(dev
, useraddr
);
922 case ETHTOOL_GCOALESCE
:
923 rc
= ethtool_get_coalesce(dev
, useraddr
);
925 case ETHTOOL_SCOALESCE
:
926 rc
= ethtool_set_coalesce(dev
, useraddr
);
928 case ETHTOOL_GRINGPARAM
:
929 rc
= ethtool_get_ringparam(dev
, useraddr
);
931 case ETHTOOL_SRINGPARAM
:
932 rc
= ethtool_set_ringparam(dev
, useraddr
);
934 case ETHTOOL_GPAUSEPARAM
:
935 rc
= ethtool_get_pauseparam(dev
, useraddr
);
937 case ETHTOOL_SPAUSEPARAM
:
938 rc
= ethtool_set_pauseparam(dev
, useraddr
);
940 case ETHTOOL_GRXCSUM
:
941 rc
= ethtool_get_rx_csum(dev
, useraddr
);
943 case ETHTOOL_SRXCSUM
:
944 rc
= ethtool_set_rx_csum(dev
, useraddr
);
946 case ETHTOOL_GTXCSUM
:
947 rc
= ethtool_get_tx_csum(dev
, useraddr
);
949 case ETHTOOL_STXCSUM
:
950 rc
= ethtool_set_tx_csum(dev
, useraddr
);
953 rc
= ethtool_get_sg(dev
, useraddr
);
956 rc
= ethtool_set_sg(dev
, useraddr
);
959 rc
= ethtool_get_tso(dev
, useraddr
);
962 rc
= ethtool_set_tso(dev
, useraddr
);
965 rc
= ethtool_self_test(dev
, useraddr
);
967 case ETHTOOL_GSTRINGS
:
968 rc
= ethtool_get_strings(dev
, useraddr
);
970 case ETHTOOL_PHYS_ID
:
971 rc
= ethtool_phys_id(dev
, useraddr
);
974 rc
= ethtool_get_stats(dev
, useraddr
);
976 case ETHTOOL_GPERMADDR
:
977 rc
= ethtool_get_perm_addr(dev
, useraddr
);
980 rc
= ethtool_get_ufo(dev
, useraddr
);
983 rc
= ethtool_set_ufo(dev
, useraddr
);
986 rc
= ethtool_get_gso(dev
, useraddr
);
989 rc
= ethtool_set_gso(dev
, useraddr
);
992 rc
= ethtool_get_flags(dev
, useraddr
);
995 rc
= ethtool_set_flags(dev
, useraddr
);
1001 if (dev
->ethtool_ops
->complete
)
1002 dev
->ethtool_ops
->complete(dev
);
1004 if (old_features
!= dev
->features
)
1005 netdev_features_change(dev
);
1010 EXPORT_SYMBOL(ethtool_op_get_link
);
1011 EXPORT_SYMBOL(ethtool_op_get_sg
);
1012 EXPORT_SYMBOL(ethtool_op_get_tso
);
1013 EXPORT_SYMBOL(ethtool_op_get_tx_csum
);
1014 EXPORT_SYMBOL(ethtool_op_set_sg
);
1015 EXPORT_SYMBOL(ethtool_op_set_tso
);
1016 EXPORT_SYMBOL(ethtool_op_set_tx_csum
);
1017 EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum
);
1018 EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum
);
1019 EXPORT_SYMBOL(ethtool_op_set_ufo
);
1020 EXPORT_SYMBOL(ethtool_op_get_ufo
);
1021 EXPORT_SYMBOL(ethtool_op_set_flags
);
1022 EXPORT_SYMBOL(ethtool_op_get_flags
);