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
->get_sset_count
) {
185 rc
= ops
->get_sset_count(dev
, ETH_SS_TEST
);
187 info
.testinfo_len
= rc
;
188 rc
= ops
->get_sset_count(dev
, ETH_SS_STATS
);
191 rc
= ops
->get_sset_count(dev
, ETH_SS_PRIV_FLAGS
);
193 info
.n_priv_flags
= rc
;
195 /* code path for obsolete hooks */
197 if (ops
->self_test_count
)
198 info
.testinfo_len
= ops
->self_test_count(dev
);
199 if (ops
->get_stats_count
)
200 info
.n_stats
= ops
->get_stats_count(dev
);
202 if (ops
->get_regs_len
)
203 info
.regdump_len
= ops
->get_regs_len(dev
);
204 if (ops
->get_eeprom_len
)
205 info
.eedump_len
= ops
->get_eeprom_len(dev
);
207 if (copy_to_user(useraddr
, &info
, sizeof(info
)))
212 static int ethtool_get_regs(struct net_device
*dev
, char __user
*useraddr
)
214 struct ethtool_regs regs
;
215 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
219 if (!ops
->get_regs
|| !ops
->get_regs_len
)
222 if (copy_from_user(®s
, useraddr
, sizeof(regs
)))
225 reglen
= ops
->get_regs_len(dev
);
226 if (regs
.len
> reglen
)
229 regbuf
= kmalloc(reglen
, GFP_USER
);
233 ops
->get_regs(dev
, ®s
, regbuf
);
236 if (copy_to_user(useraddr
, ®s
, sizeof(regs
)))
238 useraddr
+= offsetof(struct ethtool_regs
, data
);
239 if (copy_to_user(useraddr
, regbuf
, regs
.len
))
248 static int ethtool_get_wol(struct net_device
*dev
, char __user
*useraddr
)
250 struct ethtool_wolinfo wol
= { ETHTOOL_GWOL
};
252 if (!dev
->ethtool_ops
->get_wol
)
255 dev
->ethtool_ops
->get_wol(dev
, &wol
);
257 if (copy_to_user(useraddr
, &wol
, sizeof(wol
)))
262 static int ethtool_set_wol(struct net_device
*dev
, char __user
*useraddr
)
264 struct ethtool_wolinfo wol
;
266 if (!dev
->ethtool_ops
->set_wol
)
269 if (copy_from_user(&wol
, useraddr
, sizeof(wol
)))
272 return dev
->ethtool_ops
->set_wol(dev
, &wol
);
275 static int ethtool_nway_reset(struct net_device
*dev
)
277 if (!dev
->ethtool_ops
->nway_reset
)
280 return dev
->ethtool_ops
->nway_reset(dev
);
283 static int ethtool_get_eeprom(struct net_device
*dev
, void __user
*useraddr
)
285 struct ethtool_eeprom eeprom
;
286 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
287 void __user
*userbuf
= useraddr
+ sizeof(eeprom
);
292 if (!ops
->get_eeprom
|| !ops
->get_eeprom_len
)
295 if (copy_from_user(&eeprom
, useraddr
, sizeof(eeprom
)))
298 /* Check for wrap and zero */
299 if (eeprom
.offset
+ eeprom
.len
<= eeprom
.offset
)
302 /* Check for exceeding total eeprom len */
303 if (eeprom
.offset
+ eeprom
.len
> ops
->get_eeprom_len(dev
))
306 data
= kmalloc(PAGE_SIZE
, GFP_USER
);
310 bytes_remaining
= eeprom
.len
;
311 while (bytes_remaining
> 0) {
312 eeprom
.len
= min(bytes_remaining
, (u32
)PAGE_SIZE
);
314 ret
= ops
->get_eeprom(dev
, &eeprom
, data
);
317 if (copy_to_user(userbuf
, data
, eeprom
.len
)) {
321 userbuf
+= eeprom
.len
;
322 eeprom
.offset
+= eeprom
.len
;
323 bytes_remaining
-= eeprom
.len
;
326 eeprom
.len
= userbuf
- (useraddr
+ sizeof(eeprom
));
327 eeprom
.offset
-= eeprom
.len
;
328 if (copy_to_user(useraddr
, &eeprom
, sizeof(eeprom
)))
335 static int ethtool_set_eeprom(struct net_device
*dev
, void __user
*useraddr
)
337 struct ethtool_eeprom eeprom
;
338 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
339 void __user
*userbuf
= useraddr
+ sizeof(eeprom
);
344 if (!ops
->set_eeprom
|| !ops
->get_eeprom_len
)
347 if (copy_from_user(&eeprom
, useraddr
, sizeof(eeprom
)))
350 /* Check for wrap and zero */
351 if (eeprom
.offset
+ eeprom
.len
<= eeprom
.offset
)
354 /* Check for exceeding total eeprom len */
355 if (eeprom
.offset
+ eeprom
.len
> ops
->get_eeprom_len(dev
))
358 data
= kmalloc(PAGE_SIZE
, GFP_USER
);
362 bytes_remaining
= eeprom
.len
;
363 while (bytes_remaining
> 0) {
364 eeprom
.len
= min(bytes_remaining
, (u32
)PAGE_SIZE
);
366 if (copy_from_user(data
, userbuf
, eeprom
.len
)) {
370 ret
= ops
->set_eeprom(dev
, &eeprom
, data
);
373 userbuf
+= eeprom
.len
;
374 eeprom
.offset
+= eeprom
.len
;
375 bytes_remaining
-= eeprom
.len
;
382 static int ethtool_get_coalesce(struct net_device
*dev
, void __user
*useraddr
)
384 struct ethtool_coalesce coalesce
= { ETHTOOL_GCOALESCE
};
386 if (!dev
->ethtool_ops
->get_coalesce
)
389 dev
->ethtool_ops
->get_coalesce(dev
, &coalesce
);
391 if (copy_to_user(useraddr
, &coalesce
, sizeof(coalesce
)))
396 static int ethtool_set_coalesce(struct net_device
*dev
, void __user
*useraddr
)
398 struct ethtool_coalesce coalesce
;
400 if (!dev
->ethtool_ops
->set_coalesce
)
403 if (copy_from_user(&coalesce
, useraddr
, sizeof(coalesce
)))
406 return dev
->ethtool_ops
->set_coalesce(dev
, &coalesce
);
409 static int ethtool_get_ringparam(struct net_device
*dev
, void __user
*useraddr
)
411 struct ethtool_ringparam ringparam
= { ETHTOOL_GRINGPARAM
};
413 if (!dev
->ethtool_ops
->get_ringparam
)
416 dev
->ethtool_ops
->get_ringparam(dev
, &ringparam
);
418 if (copy_to_user(useraddr
, &ringparam
, sizeof(ringparam
)))
423 static int ethtool_set_ringparam(struct net_device
*dev
, void __user
*useraddr
)
425 struct ethtool_ringparam ringparam
;
427 if (!dev
->ethtool_ops
->set_ringparam
)
430 if (copy_from_user(&ringparam
, useraddr
, sizeof(ringparam
)))
433 return dev
->ethtool_ops
->set_ringparam(dev
, &ringparam
);
436 static int ethtool_get_pauseparam(struct net_device
*dev
, void __user
*useraddr
)
438 struct ethtool_pauseparam pauseparam
= { ETHTOOL_GPAUSEPARAM
};
440 if (!dev
->ethtool_ops
->get_pauseparam
)
443 dev
->ethtool_ops
->get_pauseparam(dev
, &pauseparam
);
445 if (copy_to_user(useraddr
, &pauseparam
, sizeof(pauseparam
)))
450 static int ethtool_set_pauseparam(struct net_device
*dev
, void __user
*useraddr
)
452 struct ethtool_pauseparam pauseparam
;
454 if (!dev
->ethtool_ops
->set_pauseparam
)
457 if (copy_from_user(&pauseparam
, useraddr
, sizeof(pauseparam
)))
460 return dev
->ethtool_ops
->set_pauseparam(dev
, &pauseparam
);
463 static int __ethtool_set_sg(struct net_device
*dev
, u32 data
)
467 if (!data
&& dev
->ethtool_ops
->set_tso
) {
468 err
= dev
->ethtool_ops
->set_tso(dev
, 0);
473 if (!data
&& dev
->ethtool_ops
->set_ufo
) {
474 err
= dev
->ethtool_ops
->set_ufo(dev
, 0);
478 return dev
->ethtool_ops
->set_sg(dev
, data
);
481 static int ethtool_set_tx_csum(struct net_device
*dev
, char __user
*useraddr
)
483 struct ethtool_value edata
;
486 if (!dev
->ethtool_ops
->set_tx_csum
)
489 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
492 if (!edata
.data
&& dev
->ethtool_ops
->set_sg
) {
493 err
= __ethtool_set_sg(dev
, 0);
498 return dev
->ethtool_ops
->set_tx_csum(dev
, edata
.data
);
501 static int ethtool_set_sg(struct net_device
*dev
, char __user
*useraddr
)
503 struct ethtool_value edata
;
505 if (!dev
->ethtool_ops
->set_sg
)
508 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
512 !(dev
->features
& NETIF_F_ALL_CSUM
))
515 return __ethtool_set_sg(dev
, edata
.data
);
518 static int ethtool_set_tso(struct net_device
*dev
, char __user
*useraddr
)
520 struct ethtool_value edata
;
522 if (!dev
->ethtool_ops
->set_tso
)
525 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
528 if (edata
.data
&& !(dev
->features
& NETIF_F_SG
))
531 return dev
->ethtool_ops
->set_tso(dev
, edata
.data
);
534 static int ethtool_set_ufo(struct net_device
*dev
, char __user
*useraddr
)
536 struct ethtool_value edata
;
538 if (!dev
->ethtool_ops
->set_ufo
)
540 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
542 if (edata
.data
&& !(dev
->features
& NETIF_F_SG
))
544 if (edata
.data
&& !(dev
->features
& NETIF_F_HW_CSUM
))
546 return dev
->ethtool_ops
->set_ufo(dev
, edata
.data
);
549 static int ethtool_get_gso(struct net_device
*dev
, char __user
*useraddr
)
551 struct ethtool_value edata
= { ETHTOOL_GGSO
};
553 edata
.data
= dev
->features
& NETIF_F_GSO
;
554 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
559 static int ethtool_set_gso(struct net_device
*dev
, char __user
*useraddr
)
561 struct ethtool_value edata
;
563 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
566 dev
->features
|= NETIF_F_GSO
;
568 dev
->features
&= ~NETIF_F_GSO
;
572 static int ethtool_self_test(struct net_device
*dev
, char __user
*useraddr
)
574 struct ethtool_test test
;
575 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
581 if (!ops
->get_sset_count
&& !ops
->self_test_count
)
584 if (ops
->get_sset_count
)
585 test_len
= ops
->get_sset_count(dev
, ETH_SS_TEST
);
587 /* code path for obsolete hook */
588 test_len
= ops
->self_test_count(dev
);
591 WARN_ON(test_len
== 0);
593 if (copy_from_user(&test
, useraddr
, sizeof(test
)))
597 data
= kmalloc(test_len
* sizeof(u64
), GFP_USER
);
601 ops
->self_test(dev
, &test
, data
);
604 if (copy_to_user(useraddr
, &test
, sizeof(test
)))
606 useraddr
+= sizeof(test
);
607 if (copy_to_user(useraddr
, data
, test
.len
* sizeof(u64
)))
616 static int ethtool_get_strings(struct net_device
*dev
, void __user
*useraddr
)
618 struct ethtool_gstrings gstrings
;
619 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
623 if (!ops
->get_strings
)
626 if (copy_from_user(&gstrings
, useraddr
, sizeof(gstrings
)))
629 if (ops
->get_sset_count
) {
630 ret
= ops
->get_sset_count(dev
, gstrings
.string_set
);
636 /* code path for obsolete hooks */
638 switch (gstrings
.string_set
) {
640 if (!ops
->self_test_count
)
642 gstrings
.len
= ops
->self_test_count(dev
);
645 if (!ops
->get_stats_count
)
647 gstrings
.len
= ops
->get_stats_count(dev
);
654 data
= kmalloc(gstrings
.len
* ETH_GSTRING_LEN
, GFP_USER
);
658 ops
->get_strings(dev
, gstrings
.string_set
, data
);
661 if (copy_to_user(useraddr
, &gstrings
, sizeof(gstrings
)))
663 useraddr
+= sizeof(gstrings
);
664 if (copy_to_user(useraddr
, data
, gstrings
.len
* ETH_GSTRING_LEN
))
673 static int ethtool_phys_id(struct net_device
*dev
, void __user
*useraddr
)
675 struct ethtool_value id
;
677 if (!dev
->ethtool_ops
->phys_id
)
680 if (copy_from_user(&id
, useraddr
, sizeof(id
)))
683 return dev
->ethtool_ops
->phys_id(dev
, id
.data
);
686 static int ethtool_get_stats(struct net_device
*dev
, void __user
*useraddr
)
688 struct ethtool_stats stats
;
689 const struct ethtool_ops
*ops
= dev
->ethtool_ops
;
693 if (!ops
->get_ethtool_stats
)
695 if (!ops
->get_sset_count
&& !ops
->get_stats_count
)
698 if (ops
->get_sset_count
)
699 n_stats
= ops
->get_sset_count(dev
, ETH_SS_STATS
);
701 /* code path for obsolete hook */
702 n_stats
= ops
->get_stats_count(dev
);
705 WARN_ON(n_stats
== 0);
707 if (copy_from_user(&stats
, useraddr
, sizeof(stats
)))
710 stats
.n_stats
= n_stats
;
711 data
= kmalloc(n_stats
* sizeof(u64
), GFP_USER
);
715 ops
->get_ethtool_stats(dev
, &stats
, data
);
718 if (copy_to_user(useraddr
, &stats
, sizeof(stats
)))
720 useraddr
+= sizeof(stats
);
721 if (copy_to_user(useraddr
, data
, stats
.n_stats
* sizeof(u64
)))
730 static int ethtool_get_perm_addr(struct net_device
*dev
, void __user
*useraddr
)
732 struct ethtool_perm_addr epaddr
;
734 if (copy_from_user(&epaddr
, useraddr
, sizeof(epaddr
)))
737 if (epaddr
.size
< dev
->addr_len
)
739 epaddr
.size
= dev
->addr_len
;
741 if (copy_to_user(useraddr
, &epaddr
, sizeof(epaddr
)))
743 useraddr
+= sizeof(epaddr
);
744 if (copy_to_user(useraddr
, dev
->perm_addr
, epaddr
.size
))
749 static int ethtool_get_value(struct net_device
*dev
, char __user
*useraddr
,
750 u32 cmd
, u32 (*actor
)(struct net_device
*))
752 struct ethtool_value edata
= { cmd
};
757 edata
.data
= actor(dev
);
759 if (copy_to_user(useraddr
, &edata
, sizeof(edata
)))
764 static int ethtool_set_value_void(struct net_device
*dev
, char __user
*useraddr
,
765 void (*actor
)(struct net_device
*, u32
))
767 struct ethtool_value edata
;
772 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
775 actor(dev
, edata
.data
);
779 static int ethtool_set_value(struct net_device
*dev
, char __user
*useraddr
,
780 int (*actor
)(struct net_device
*, u32
))
782 struct ethtool_value edata
;
787 if (copy_from_user(&edata
, useraddr
, sizeof(edata
)))
790 return actor(dev
, edata
.data
);
793 /* The main entry point in this file. Called from net/core/dev.c */
795 int dev_ethtool(struct net
*net
, struct ifreq
*ifr
)
797 struct net_device
*dev
= __dev_get_by_name(net
, ifr
->ifr_name
);
798 void __user
*useraddr
= ifr
->ifr_data
;
801 unsigned long old_features
;
803 if (!dev
|| !netif_device_present(dev
))
806 if (!dev
->ethtool_ops
)
809 if (copy_from_user(ðcmd
, useraddr
, sizeof (ethcmd
)))
812 /* Allow some commands to be done by anyone */
814 case ETHTOOL_GDRVINFO
:
815 case ETHTOOL_GMSGLVL
:
816 case ETHTOOL_GCOALESCE
:
817 case ETHTOOL_GRINGPARAM
:
818 case ETHTOOL_GPAUSEPARAM
:
819 case ETHTOOL_GRXCSUM
:
820 case ETHTOOL_GTXCSUM
:
822 case ETHTOOL_GSTRINGS
:
824 case ETHTOOL_GPERMADDR
:
828 case ETHTOOL_GPFLAGS
:
831 if (!capable(CAP_NET_ADMIN
))
835 if (dev
->ethtool_ops
->begin
)
836 if ((rc
= dev
->ethtool_ops
->begin(dev
)) < 0)
839 old_features
= dev
->features
;
843 rc
= ethtool_get_settings(dev
, useraddr
);
846 rc
= ethtool_set_settings(dev
, useraddr
);
848 case ETHTOOL_GDRVINFO
:
849 rc
= ethtool_get_drvinfo(dev
, useraddr
);
852 rc
= ethtool_get_regs(dev
, useraddr
);
855 rc
= ethtool_get_wol(dev
, useraddr
);
858 rc
= ethtool_set_wol(dev
, useraddr
);
860 case ETHTOOL_GMSGLVL
:
861 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
862 dev
->ethtool_ops
->get_msglevel
);
864 case ETHTOOL_SMSGLVL
:
865 rc
= ethtool_set_value_void(dev
, useraddr
,
866 dev
->ethtool_ops
->set_msglevel
);
868 case ETHTOOL_NWAY_RST
:
869 rc
= ethtool_nway_reset(dev
);
872 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
873 dev
->ethtool_ops
->get_link
);
875 case ETHTOOL_GEEPROM
:
876 rc
= ethtool_get_eeprom(dev
, useraddr
);
878 case ETHTOOL_SEEPROM
:
879 rc
= ethtool_set_eeprom(dev
, useraddr
);
881 case ETHTOOL_GCOALESCE
:
882 rc
= ethtool_get_coalesce(dev
, useraddr
);
884 case ETHTOOL_SCOALESCE
:
885 rc
= ethtool_set_coalesce(dev
, useraddr
);
887 case ETHTOOL_GRINGPARAM
:
888 rc
= ethtool_get_ringparam(dev
, useraddr
);
890 case ETHTOOL_SRINGPARAM
:
891 rc
= ethtool_set_ringparam(dev
, useraddr
);
893 case ETHTOOL_GPAUSEPARAM
:
894 rc
= ethtool_get_pauseparam(dev
, useraddr
);
896 case ETHTOOL_SPAUSEPARAM
:
897 rc
= ethtool_set_pauseparam(dev
, useraddr
);
899 case ETHTOOL_GRXCSUM
:
900 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
901 dev
->ethtool_ops
->get_rx_csum
);
903 case ETHTOOL_SRXCSUM
:
904 rc
= ethtool_set_value(dev
, useraddr
,
905 dev
->ethtool_ops
->set_rx_csum
);
907 case ETHTOOL_GTXCSUM
:
908 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
909 (dev
->ethtool_ops
->get_tx_csum
?
910 dev
->ethtool_ops
->get_tx_csum
:
911 ethtool_op_get_tx_csum
));
913 case ETHTOOL_STXCSUM
:
914 rc
= ethtool_set_tx_csum(dev
, useraddr
);
917 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
918 (dev
->ethtool_ops
->get_sg
?
919 dev
->ethtool_ops
->get_sg
:
923 rc
= ethtool_set_sg(dev
, useraddr
);
926 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
927 (dev
->ethtool_ops
->get_tso
?
928 dev
->ethtool_ops
->get_tso
:
929 ethtool_op_get_tso
));
932 rc
= ethtool_set_tso(dev
, useraddr
);
935 rc
= ethtool_self_test(dev
, useraddr
);
937 case ETHTOOL_GSTRINGS
:
938 rc
= ethtool_get_strings(dev
, useraddr
);
940 case ETHTOOL_PHYS_ID
:
941 rc
= ethtool_phys_id(dev
, useraddr
);
944 rc
= ethtool_get_stats(dev
, useraddr
);
946 case ETHTOOL_GPERMADDR
:
947 rc
= ethtool_get_perm_addr(dev
, useraddr
);
950 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
951 (dev
->ethtool_ops
->get_ufo
?
952 dev
->ethtool_ops
->get_ufo
:
953 ethtool_op_get_ufo
));
956 rc
= ethtool_set_ufo(dev
, useraddr
);
959 rc
= ethtool_get_gso(dev
, useraddr
);
962 rc
= ethtool_set_gso(dev
, useraddr
);
965 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
966 dev
->ethtool_ops
->get_flags
);
969 rc
= ethtool_set_value(dev
, useraddr
,
970 dev
->ethtool_ops
->set_flags
);
972 case ETHTOOL_GPFLAGS
:
973 rc
= ethtool_get_value(dev
, useraddr
, ethcmd
,
974 dev
->ethtool_ops
->get_priv_flags
);
976 case ETHTOOL_SPFLAGS
:
977 rc
= ethtool_set_value(dev
, useraddr
,
978 dev
->ethtool_ops
->set_priv_flags
);
984 if (dev
->ethtool_ops
->complete
)
985 dev
->ethtool_ops
->complete(dev
);
987 if (old_features
!= dev
->features
)
988 netdev_features_change(dev
);
993 EXPORT_SYMBOL(ethtool_op_get_link
);
994 EXPORT_SYMBOL(ethtool_op_get_sg
);
995 EXPORT_SYMBOL(ethtool_op_get_tso
);
996 EXPORT_SYMBOL(ethtool_op_get_tx_csum
);
997 EXPORT_SYMBOL(ethtool_op_set_sg
);
998 EXPORT_SYMBOL(ethtool_op_set_tso
);
999 EXPORT_SYMBOL(ethtool_op_set_tx_csum
);
1000 EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum
);
1001 EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum
);
1002 EXPORT_SYMBOL(ethtool_op_set_ufo
);
1003 EXPORT_SYMBOL(ethtool_op_get_ufo
);
1004 EXPORT_SYMBOL(ethtool_op_set_flags
);
1005 EXPORT_SYMBOL(ethtool_op_get_flags
);