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_get_msglevel(struct net_device *dev, char __user *useraddr)
277 struct ethtool_value edata = { ETHTOOL_GMSGLVL };
279 if (!dev->ethtool_ops->get_msglevel)
282 edata.data = dev->ethtool_ops->get_msglevel(dev);
284 if (copy_to_user(useraddr, &edata, sizeof(edata)))
289 static int ethtool_set_msglevel(struct net_device *dev, char __user *useraddr)
291 struct ethtool_value edata;
293 if (!dev->ethtool_ops->set_msglevel)
296 if (copy_from_user(&edata, useraddr, sizeof(edata)))
299 dev->ethtool_ops->set_msglevel(dev, edata.data);
303 static int ethtool_nway_reset(struct net_device *dev)
305 if (!dev->ethtool_ops->nway_reset)
308 return dev->ethtool_ops->nway_reset(dev);
311 static int ethtool_get_link(struct net_device *dev, void __user *useraddr)
313 struct ethtool_value edata = { ETHTOOL_GLINK };
315 if (!dev->ethtool_ops->get_link)
318 edata.data = dev->ethtool_ops->get_link(dev);
320 if (copy_to_user(useraddr, &edata, sizeof(edata)))
325 static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
327 struct ethtool_eeprom eeprom;
328 const struct ethtool_ops *ops = dev->ethtool_ops;
332 if (!ops->get_eeprom || !ops->get_eeprom_len)
335 if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
338 /* Check for wrap and zero */
339 if (eeprom.offset + eeprom.len <= eeprom.offset)
342 /* Check for exceeding total eeprom len */
343 if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
346 data = kmalloc(eeprom.len, GFP_USER);
351 if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
354 ret = ops->get_eeprom(dev, &eeprom, data);
359 if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
361 if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
370 static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr)
372 struct ethtool_eeprom eeprom;
373 const struct ethtool_ops *ops = dev->ethtool_ops;
377 if (!ops->set_eeprom || !ops->get_eeprom_len)
380 if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
383 /* Check for wrap and zero */
384 if (eeprom.offset + eeprom.len <= eeprom.offset)
387 /* Check for exceeding total eeprom len */
388 if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
391 data = kmalloc(eeprom.len, GFP_USER);
396 if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
399 ret = ops->set_eeprom(dev, &eeprom, data);
403 if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
411 static int ethtool_get_coalesce(struct net_device *dev, void __user *useraddr)
413 struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE };
415 if (!dev->ethtool_ops->get_coalesce)
418 dev->ethtool_ops->get_coalesce(dev, &coalesce);
420 if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
425 static int ethtool_set_coalesce(struct net_device *dev, void __user *useraddr)
427 struct ethtool_coalesce coalesce;
429 if (!dev->ethtool_ops->set_coalesce)
432 if (copy_from_user(&coalesce, useraddr, sizeof(coalesce)))
435 return dev->ethtool_ops->set_coalesce(dev, &coalesce);
438 static int ethtool_get_ringparam(struct net_device *dev, void __user *useraddr)
440 struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM };
442 if (!dev->ethtool_ops->get_ringparam)
445 dev->ethtool_ops->get_ringparam(dev, &ringparam);
447 if (copy_to_user(useraddr, &ringparam, sizeof(ringparam)))
452 static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr)
454 struct ethtool_ringparam ringparam;
456 if (!dev->ethtool_ops->set_ringparam)
459 if (copy_from_user(&ringparam, useraddr, sizeof(ringparam)))
462 return dev->ethtool_ops->set_ringparam(dev, &ringparam);
465 static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr)
467 struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM };
469 if (!dev->ethtool_ops->get_pauseparam)
472 dev->ethtool_ops->get_pauseparam(dev, &pauseparam);
474 if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam)))
479 static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr)
481 struct ethtool_pauseparam pauseparam;
483 if (!dev->ethtool_ops->set_pauseparam)
486 if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam)))
489 return dev->ethtool_ops->set_pauseparam(dev, &pauseparam);
492 static int ethtool_get_rx_csum(struct net_device *dev, char __user *useraddr)
494 struct ethtool_value edata = { ETHTOOL_GRXCSUM };
496 if (!dev->ethtool_ops->get_rx_csum)
499 edata.data = dev->ethtool_ops->get_rx_csum(dev);
501 if (copy_to_user(useraddr, &edata, sizeof(edata)))
506 static int ethtool_set_rx_csum(struct net_device *dev, char __user *useraddr)
508 struct ethtool_value edata;
510 if (!dev->ethtool_ops->set_rx_csum)
513 if (copy_from_user(&edata, useraddr, sizeof(edata)))
516 dev->ethtool_ops->set_rx_csum(dev, edata.data);
520 static int ethtool_get_tx_csum(struct net_device *dev, char __user *useraddr)
522 struct ethtool_value edata = { ETHTOOL_GTXCSUM };
524 if (!dev->ethtool_ops->get_tx_csum)
527 edata.data = dev->ethtool_ops->get_tx_csum(dev);
529 if (copy_to_user(useraddr, &edata, sizeof(edata)))
534 static int __ethtool_set_sg(struct net_device *dev, u32 data)
538 if (!data && dev->ethtool_ops->set_tso) {
539 err = dev->ethtool_ops->set_tso(dev, 0);
544 if (!data && dev->ethtool_ops->set_ufo) {
545 err = dev->ethtool_ops->set_ufo(dev, 0);
549 return dev->ethtool_ops->set_sg(dev, data);
552 static int ethtool_set_tx_csum(struct net_device *dev, char __user *useraddr)
554 struct ethtool_value edata;
557 if (!dev->ethtool_ops->set_tx_csum)
560 if (copy_from_user(&edata, useraddr, sizeof(edata)))
563 if (!edata.data && dev->ethtool_ops->set_sg) {
564 err = __ethtool_set_sg(dev, 0);
569 return dev->ethtool_ops->set_tx_csum(dev, edata.data);
572 static int ethtool_get_sg(struct net_device *dev, char __user *useraddr)
574 struct ethtool_value edata = { ETHTOOL_GSG };
576 if (!dev->ethtool_ops->get_sg)
579 edata.data = dev->ethtool_ops->get_sg(dev);
581 if (copy_to_user(useraddr, &edata, sizeof(edata)))
586 static int ethtool_set_sg(struct net_device *dev, char __user *useraddr)
588 struct ethtool_value edata;
590 if (!dev->ethtool_ops->set_sg)
593 if (copy_from_user(&edata, useraddr, sizeof(edata)))
597 !(dev->features & NETIF_F_ALL_CSUM))
600 return __ethtool_set_sg(dev, edata.data);
603 static int ethtool_get_tso(struct net_device *dev, char __user *useraddr)
605 struct ethtool_value edata = { ETHTOOL_GTSO };
607 if (!dev->ethtool_ops->get_tso)
610 edata.data = dev->ethtool_ops->get_tso(dev);
612 if (copy_to_user(useraddr, &edata, sizeof(edata)))
617 static int ethtool_set_tso(struct net_device *dev, char __user *useraddr)
619 struct ethtool_value edata;
621 if (!dev->ethtool_ops->set_tso)
624 if (copy_from_user(&edata, useraddr, sizeof(edata)))
627 if (edata.data && !(dev->features & NETIF_F_SG))
630 return dev->ethtool_ops->set_tso(dev, edata.data);
633 static int ethtool_get_ufo(struct net_device *dev, char __user *useraddr)
635 struct ethtool_value edata = { ETHTOOL_GUFO };
637 if (!dev->ethtool_ops->get_ufo)
639 edata.data = dev->ethtool_ops->get_ufo(dev);
640 if (copy_to_user(useraddr, &edata, sizeof(edata)))
645 static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr)
647 struct ethtool_value edata;
649 if (!dev->ethtool_ops->set_ufo)
651 if (copy_from_user(&edata, useraddr, sizeof(edata)))
653 if (edata.data && !(dev->features & NETIF_F_SG))
655 if (edata.data && !(dev->features & NETIF_F_HW_CSUM))
657 return dev->ethtool_ops->set_ufo(dev, edata.data);
660 static int ethtool_get_gso(struct net_device *dev, char __user *useraddr)
662 struct ethtool_value edata = { ETHTOOL_GGSO };
664 edata.data = dev->features & NETIF_F_GSO;
665 if (copy_to_user(useraddr, &edata, sizeof(edata)))
670 static int ethtool_set_gso(struct net_device *dev, char __user *useraddr)
672 struct ethtool_value edata;
674 if (copy_from_user(&edata, useraddr, sizeof(edata)))
677 dev->features |= NETIF_F_GSO;
679 dev->features &= ~NETIF_F_GSO;
683 static int ethtool_self_test(struct net_device *dev, char __user *useraddr)
685 struct ethtool_test test;
686 const struct ethtool_ops *ops = dev->ethtool_ops;
692 if (!ops->get_sset_count && !ops->self_test_count)
695 if (ops->get_sset_count)
696 test_len = ops->get_sset_count(dev, ETH_SS_TEST);
698 /* code path for obsolete hook */
699 test_len = ops->self_test_count(dev);
702 WARN_ON(test_len == 0);
704 if (copy_from_user(&test, useraddr, sizeof(test)))
708 data = kmalloc(test_len * sizeof(u64), GFP_USER);
712 ops->self_test(dev, &test, data);
715 if (copy_to_user(useraddr, &test, sizeof(test)))
717 useraddr += sizeof(test);
718 if (copy_to_user(useraddr, data, test.len * sizeof(u64)))
727 static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
729 struct ethtool_gstrings gstrings;
730 const struct ethtool_ops *ops = dev->ethtool_ops;
734 if (!ops->get_strings)
737 if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
740 if (ops->get_sset_count) {
741 ret = ops->get_sset_count(dev, gstrings.string_set);
747 /* code path for obsolete hooks */
749 switch (gstrings.string_set) {
751 if (!ops->self_test_count)
753 gstrings.len = ops->self_test_count(dev);
756 if (!ops->get_stats_count)
758 gstrings.len = ops->get_stats_count(dev);
765 data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
769 ops->get_strings(dev, gstrings.string_set, data);
772 if (copy_to_user(useraddr, &gstrings, sizeof(gstrings)))
774 useraddr += sizeof(gstrings);
775 if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
784 static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
786 struct ethtool_value id;
788 if (!dev->ethtool_ops->phys_id)
791 if (copy_from_user(&id, useraddr, sizeof(id)))
794 return dev->ethtool_ops->phys_id(dev, id.data);
797 static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
799 struct ethtool_stats stats;
800 const struct ethtool_ops *ops = dev->ethtool_ops;
804 if (!ops->get_ethtool_stats)
806 if (!ops->get_sset_count && !ops->get_stats_count)
809 if (ops->get_sset_count)
810 n_stats = ops->get_sset_count(dev, ETH_SS_STATS);
812 /* code path for obsolete hook */
813 n_stats = ops->get_stats_count(dev);
816 WARN_ON(n_stats == 0);
818 if (copy_from_user(&stats, useraddr, sizeof(stats)))
821 stats.n_stats = n_stats;
822 data = kmalloc(n_stats * sizeof(u64), GFP_USER);
826 ops->get_ethtool_stats(dev, &stats, data);
829 if (copy_to_user(useraddr, &stats, sizeof(stats)))
831 useraddr += sizeof(stats);
832 if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64)))
841 static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr)
843 struct ethtool_perm_addr epaddr;
845 if (copy_from_user(&epaddr, useraddr, sizeof(epaddr)))
848 if (epaddr.size < dev->addr_len)
850 epaddr.size = dev->addr_len;
852 if (copy_to_user(useraddr, &epaddr, sizeof(epaddr)))
854 useraddr += sizeof(epaddr);
855 if (copy_to_user(useraddr, dev->perm_addr, epaddr.size))
860 static int ethtool_get_flags(struct net_device *dev, char __user *useraddr)
862 struct ethtool_value edata = { ETHTOOL_GFLAGS };
864 if (!dev->ethtool_ops->get_flags)
867 edata.data = dev->ethtool_ops->get_flags(dev);
869 if (copy_to_user(useraddr, &edata, sizeof(edata)))
874 static int ethtool_set_flags(struct net_device *dev, char __user *useraddr)
876 struct ethtool_value edata;
878 if (!dev->ethtool_ops->set_flags)
881 if (copy_from_user(&edata, useraddr, sizeof(edata)))
884 return dev->ethtool_ops->set_flags(dev, edata.data);
887 static int ethtool_get_priv_flags(struct net_device *dev, char __user *useraddr)
889 struct ethtool_value edata = { ETHTOOL_GPFLAGS };
891 if (!dev->ethtool_ops->get_priv_flags)
894 edata.data = dev->ethtool_ops->get_priv_flags(dev);
896 if (copy_to_user(useraddr, &edata, sizeof(edata)))
901 static int ethtool_set_priv_flags(struct net_device *dev, char __user *useraddr)
903 struct ethtool_value edata;
905 if (!dev->ethtool_ops->set_priv_flags)
908 if (copy_from_user(&edata, useraddr, sizeof(edata)))
911 return dev->ethtool_ops->set_priv_flags(dev, edata.data);
914 /* The main entry point in this file. Called from net/core/dev.c */
916 int dev_ethtool(struct ifreq *ifr)
918 struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
919 void __user *useraddr = ifr->ifr_data;
922 unsigned long old_features;
924 if (!dev || !netif_device_present(dev))
927 if (!dev->ethtool_ops)
930 if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd)))
933 /* Allow some commands to be done by anyone */
935 case ETHTOOL_GDRVINFO:
936 case ETHTOOL_GMSGLVL:
937 case ETHTOOL_GCOALESCE:
938 case ETHTOOL_GRINGPARAM:
939 case ETHTOOL_GPAUSEPARAM:
940 case ETHTOOL_GRXCSUM:
941 case ETHTOOL_GTXCSUM:
943 case ETHTOOL_GSTRINGS:
945 case ETHTOOL_GPERMADDR:
949 case ETHTOOL_GPFLAGS:
952 if (!capable(CAP_NET_ADMIN))
956 if (dev->ethtool_ops->begin)
957 if ((rc = dev->ethtool_ops->begin(dev)) < 0)
960 old_features = dev->features;
964 rc = ethtool_get_settings(dev, useraddr);
967 rc = ethtool_set_settings(dev, useraddr);
969 case ETHTOOL_GDRVINFO:
970 rc = ethtool_get_drvinfo(dev, useraddr);
973 rc = ethtool_get_regs(dev, useraddr);
976 rc = ethtool_get_wol(dev, useraddr);
979 rc = ethtool_set_wol(dev, useraddr);
981 case ETHTOOL_GMSGLVL:
982 rc = ethtool_get_msglevel(dev, useraddr);
984 case ETHTOOL_SMSGLVL:
985 rc = ethtool_set_msglevel(dev, useraddr);
987 case ETHTOOL_NWAY_RST:
988 rc = ethtool_nway_reset(dev);
991 rc = ethtool_get_link(dev, useraddr);
993 case ETHTOOL_GEEPROM:
994 rc = ethtool_get_eeprom(dev, useraddr);
996 case ETHTOOL_SEEPROM:
997 rc = ethtool_set_eeprom(dev, useraddr);
999 case ETHTOOL_GCOALESCE:
1000 rc = ethtool_get_coalesce(dev, useraddr);
1002 case ETHTOOL_SCOALESCE:
1003 rc = ethtool_set_coalesce(dev, useraddr);
1005 case ETHTOOL_GRINGPARAM:
1006 rc = ethtool_get_ringparam(dev, useraddr);
1008 case ETHTOOL_SRINGPARAM:
1009 rc = ethtool_set_ringparam(dev, useraddr);
1011 case ETHTOOL_GPAUSEPARAM:
1012 rc = ethtool_get_pauseparam(dev, useraddr);
1014 case ETHTOOL_SPAUSEPARAM:
1015 rc = ethtool_set_pauseparam(dev, useraddr);
1017 case ETHTOOL_GRXCSUM:
1018 rc = ethtool_get_rx_csum(dev, useraddr);
1020 case ETHTOOL_SRXCSUM:
1021 rc = ethtool_set_rx_csum(dev, useraddr);
1023 case ETHTOOL_GTXCSUM:
1024 rc = ethtool_get_tx_csum(dev, useraddr);
1026 case ETHTOOL_STXCSUM:
1027 rc = ethtool_set_tx_csum(dev, useraddr);
1030 rc = ethtool_get_sg(dev, useraddr);
1033 rc = ethtool_set_sg(dev, useraddr);
1036 rc = ethtool_get_tso(dev, useraddr);
1039 rc = ethtool_set_tso(dev, useraddr);
1042 rc = ethtool_self_test(dev, useraddr);
1044 case ETHTOOL_GSTRINGS:
1045 rc = ethtool_get_strings(dev, useraddr);
1047 case ETHTOOL_PHYS_ID:
1048 rc = ethtool_phys_id(dev, useraddr);
1050 case ETHTOOL_GSTATS:
1051 rc = ethtool_get_stats(dev, useraddr);
1053 case ETHTOOL_GPERMADDR:
1054 rc = ethtool_get_perm_addr(dev, useraddr);
1057 rc = ethtool_get_ufo(dev, useraddr);
1060 rc = ethtool_set_ufo(dev, useraddr);
1063 rc = ethtool_get_gso(dev, useraddr);
1066 rc = ethtool_set_gso(dev, useraddr);
1068 case ETHTOOL_GFLAGS:
1069 rc = ethtool_get_flags(dev, useraddr);
1071 case ETHTOOL_SFLAGS:
1072 rc = ethtool_set_flags(dev, useraddr);
1074 case ETHTOOL_GPFLAGS:
1075 rc = ethtool_get_priv_flags(dev, useraddr);
1077 case ETHTOOL_SPFLAGS:
1078 rc = ethtool_set_priv_flags(dev, useraddr);
1084 if (dev->ethtool_ops->complete)
1085 dev->ethtool_ops->complete(dev);
1087 if (old_features != dev->features)
1088 netdev_features_change(dev);
1093 EXPORT_SYMBOL(ethtool_op_get_link);
1094 EXPORT_SYMBOL(ethtool_op_get_sg);
1095 EXPORT_SYMBOL(ethtool_op_get_tso);
1096 EXPORT_SYMBOL(ethtool_op_get_tx_csum);
1097 EXPORT_SYMBOL(ethtool_op_set_sg);
1098 EXPORT_SYMBOL(ethtool_op_set_tso);
1099 EXPORT_SYMBOL(ethtool_op_set_tx_csum);
1100 EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum);
1101 EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum);
1102 EXPORT_SYMBOL(ethtool_op_set_ufo);
1103 EXPORT_SYMBOL(ethtool_op_get_ufo);
1104 EXPORT_SYMBOL(ethtool_op_set_flags);
1105 EXPORT_SYMBOL(ethtool_op_get_flags);