Lines Matching refs:dev

25 u32 ethtool_op_get_link(struct net_device *dev)  in ethtool_op_get_link()  argument
27 return netif_carrier_ok(dev) ? 1 : 0; in ethtool_op_get_link()
30 u32 ethtool_op_get_tx_csum(struct net_device *dev) in ethtool_op_get_tx_csum() argument
32 return (dev->features & NETIF_F_IP_CSUM) != 0; in ethtool_op_get_tx_csum()
35 int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) in ethtool_op_set_tx_csum() argument
38 dev->features |= NETIF_F_IP_CSUM; in ethtool_op_set_tx_csum()
40 dev->features &= ~NETIF_F_IP_CSUM; in ethtool_op_set_tx_csum()
45 u32 ethtool_op_get_sg(struct net_device *dev) in ethtool_op_get_sg() argument
47 return (dev->features & NETIF_F_SG) != 0; in ethtool_op_get_sg()
50 int ethtool_op_set_sg(struct net_device *dev, u32 data) in ethtool_op_set_sg() argument
53 dev->features |= NETIF_F_SG; in ethtool_op_set_sg()
55 dev->features &= ~NETIF_F_SG; in ethtool_op_set_sg()
61 u32 ethtool_op_get_tso(struct net_device *dev) in ethtool_op_get_tso() argument
63 return (dev->features & NETIF_F_TSO) != 0; in ethtool_op_get_tso()
66 int ethtool_op_set_tso(struct net_device *dev, u32 data) in ethtool_op_set_tso() argument
69 dev->features |= NETIF_F_TSO; in ethtool_op_set_tso()
71 dev->features &= ~NETIF_F_TSO; in ethtool_op_set_tso()
79 static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) in ethtool_get_settings() argument
84 if (!dev->ethtool_ops->get_settings) in ethtool_get_settings()
87 err = dev->ethtool_ops->get_settings(dev, &cmd); in ethtool_get_settings()
96 static int ethtool_set_settings(struct net_device *dev, void __user *useraddr) in ethtool_set_settings() argument
100 if (!dev->ethtool_ops->set_settings) in ethtool_set_settings()
106 return dev->ethtool_ops->set_settings(dev, &cmd); in ethtool_set_settings()
109 static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr) in ethtool_get_drvinfo() argument
112 struct ethtool_ops *ops = dev->ethtool_ops; in ethtool_get_drvinfo()
119 ops->get_drvinfo(dev, &info); in ethtool_get_drvinfo()
122 info.testinfo_len = ops->self_test_count(dev); in ethtool_get_drvinfo()
124 info.n_stats = ops->get_stats_count(dev); in ethtool_get_drvinfo()
126 info.regdump_len = ops->get_regs_len(dev); in ethtool_get_drvinfo()
128 info.eedump_len = ops->get_eeprom_len(dev); in ethtool_get_drvinfo()
135 static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) in ethtool_get_regs() argument
138 struct ethtool_ops *ops = dev->ethtool_ops; in ethtool_get_regs()
148 reglen = ops->get_regs_len(dev); in ethtool_get_regs()
156 ops->get_regs(dev, &regs, regbuf); in ethtool_get_regs()
171 static int ethtool_get_wol(struct net_device *dev, char __user *useraddr) in ethtool_get_wol() argument
175 if (!dev->ethtool_ops->get_wol) in ethtool_get_wol()
178 dev->ethtool_ops->get_wol(dev, &wol); in ethtool_get_wol()
185 static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) in ethtool_set_wol() argument
189 if (!dev->ethtool_ops->set_wol) in ethtool_set_wol()
195 return dev->ethtool_ops->set_wol(dev, &wol); in ethtool_set_wol()
198 static int ethtool_get_msglevel(struct net_device *dev, char __user *useraddr) in ethtool_get_msglevel() argument
202 if (!dev->ethtool_ops->get_msglevel) in ethtool_get_msglevel()
205 edata.data = dev->ethtool_ops->get_msglevel(dev); in ethtool_get_msglevel()
212 static int ethtool_set_msglevel(struct net_device *dev, char __user *useraddr) in ethtool_set_msglevel() argument
216 if (!dev->ethtool_ops->set_msglevel) in ethtool_set_msglevel()
222 dev->ethtool_ops->set_msglevel(dev, edata.data); in ethtool_set_msglevel()
226 static int ethtool_nway_reset(struct net_device *dev) in ethtool_nway_reset() argument
228 if (!dev->ethtool_ops->nway_reset) in ethtool_nway_reset()
231 return dev->ethtool_ops->nway_reset(dev); in ethtool_nway_reset()
234 static int ethtool_get_link(struct net_device *dev, void __user *useraddr) in ethtool_get_link() argument
238 if (!dev->ethtool_ops->get_link) in ethtool_get_link()
241 edata.data = dev->ethtool_ops->get_link(dev); in ethtool_get_link()
248 static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) in ethtool_get_eeprom() argument
251 struct ethtool_ops *ops = dev->ethtool_ops; in ethtool_get_eeprom()
266 if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) in ethtool_get_eeprom()
277 ret = ops->get_eeprom(dev, &eeprom, data); in ethtool_get_eeprom()
293 static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) in ethtool_set_eeprom() argument
296 struct ethtool_ops *ops = dev->ethtool_ops; in ethtool_set_eeprom()
311 if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) in ethtool_set_eeprom()
322 ret = ops->set_eeprom(dev, &eeprom, data); in ethtool_set_eeprom()
334 static int ethtool_get_coalesce(struct net_device *dev, void __user *useraddr) in ethtool_get_coalesce() argument
338 if (!dev->ethtool_ops->get_coalesce) in ethtool_get_coalesce()
341 dev->ethtool_ops->get_coalesce(dev, &coalesce); in ethtool_get_coalesce()
348 static int ethtool_set_coalesce(struct net_device *dev, void __user *useraddr) in ethtool_set_coalesce() argument
352 if (!dev->ethtool_ops->set_coalesce) in ethtool_set_coalesce()
358 return dev->ethtool_ops->set_coalesce(dev, &coalesce); in ethtool_set_coalesce()
361 static int ethtool_get_ringparam(struct net_device *dev, void __user *useraddr) in ethtool_get_ringparam() argument
365 if (!dev->ethtool_ops->get_ringparam) in ethtool_get_ringparam()
368 dev->ethtool_ops->get_ringparam(dev, &ringparam); in ethtool_get_ringparam()
375 static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr) in ethtool_set_ringparam() argument
379 if (!dev->ethtool_ops->set_ringparam) in ethtool_set_ringparam()
385 return dev->ethtool_ops->set_ringparam(dev, &ringparam); in ethtool_set_ringparam()
388 static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) in ethtool_get_pauseparam() argument
392 if (!dev->ethtool_ops->get_pauseparam) in ethtool_get_pauseparam()
395 dev->ethtool_ops->get_pauseparam(dev, &pauseparam); in ethtool_get_pauseparam()
402 static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) in ethtool_set_pauseparam() argument
406 if (!dev->ethtool_ops->set_pauseparam) in ethtool_set_pauseparam()
412 return dev->ethtool_ops->set_pauseparam(dev, &pauseparam); in ethtool_set_pauseparam()
415 static int ethtool_get_rx_csum(struct net_device *dev, char __user *useraddr) in ethtool_get_rx_csum() argument
419 if (!dev->ethtool_ops->get_rx_csum) in ethtool_get_rx_csum()
422 edata.data = dev->ethtool_ops->get_rx_csum(dev); in ethtool_get_rx_csum()
429 static int ethtool_set_rx_csum(struct net_device *dev, char __user *useraddr) in ethtool_set_rx_csum() argument
433 if (!dev->ethtool_ops->set_rx_csum) in ethtool_set_rx_csum()
439 dev->ethtool_ops->set_rx_csum(dev, edata.data); in ethtool_set_rx_csum()
443 static int ethtool_get_tx_csum(struct net_device *dev, char __user *useraddr) in ethtool_get_tx_csum() argument
447 if (!dev->ethtool_ops->get_tx_csum) in ethtool_get_tx_csum()
450 edata.data = dev->ethtool_ops->get_tx_csum(dev); in ethtool_get_tx_csum()
457 static int ethtool_set_tx_csum(struct net_device *dev, char __user *useraddr) in ethtool_set_tx_csum() argument
461 if (!dev->ethtool_ops->set_tx_csum) in ethtool_set_tx_csum()
467 return dev->ethtool_ops->set_tx_csum(dev, edata.data); in ethtool_set_tx_csum()
470 static int ethtool_get_sg(struct net_device *dev, char __user *useraddr) in ethtool_get_sg() argument
474 if (!dev->ethtool_ops->get_sg) in ethtool_get_sg()
477 edata.data = dev->ethtool_ops->get_sg(dev); in ethtool_get_sg()
484 static int ethtool_set_sg(struct net_device *dev, char __user *useraddr) in ethtool_set_sg() argument
488 if (!dev->ethtool_ops->set_sg) in ethtool_set_sg()
494 return dev->ethtool_ops->set_sg(dev, edata.data); in ethtool_set_sg()
498 static int ethtool_get_tso(struct net_device *dev, char __user *useraddr) in ethtool_get_tso() argument
502 if (!dev->ethtool_ops->get_tso) in ethtool_get_tso()
505 edata.data = dev->ethtool_ops->get_tso(dev); in ethtool_get_tso()
512 static int ethtool_set_tso(struct net_device *dev, char __user *useraddr) in ethtool_set_tso() argument
516 if (!dev->ethtool_ops->set_tso) in ethtool_set_tso()
522 return dev->ethtool_ops->set_tso(dev, edata.data); in ethtool_set_tso()
529 static int ethtool_self_test(struct net_device *dev, char __user *useraddr) in ethtool_self_test() argument
532 struct ethtool_ops *ops = dev->ethtool_ops; in ethtool_self_test()
542 test.len = ops->self_test_count(dev); in ethtool_self_test()
547 ops->self_test(dev, &test, data); in ethtool_self_test()
562 static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) in ethtool_get_strings() argument
565 struct ethtool_ops *ops = dev->ethtool_ops; in ethtool_get_strings()
579 gstrings.len = ops->self_test_count(dev); in ethtool_get_strings()
584 gstrings.len = ops->get_stats_count(dev); in ethtool_get_strings()
594 ops->get_strings(dev, gstrings.string_set, data); in ethtool_get_strings()
609 static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) in ethtool_phys_id() argument
613 if (!dev->ethtool_ops->phys_id) in ethtool_phys_id()
619 return dev->ethtool_ops->phys_id(dev, id.data); in ethtool_phys_id()
622 static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) in ethtool_get_stats() argument
625 struct ethtool_ops *ops = dev->ethtool_ops; in ethtool_get_stats()
635 stats.n_stats = ops->get_stats_count(dev); in ethtool_get_stats()
640 ops->get_ethtool_stats(dev, &stats, data); in ethtool_get_stats()
659 struct net_device *dev = __dev_get_by_name(ifr->ifr_name); in dev_ethtool() local
671 if (!dev || !netif_device_present(dev)) in dev_ethtool()
674 if (!dev->ethtool_ops) in dev_ethtool()
680 if(dev->ethtool_ops->begin) in dev_ethtool()
681 if ((rc = dev->ethtool_ops->begin(dev)) < 0) in dev_ethtool()
686 rc = ethtool_get_settings(dev, useraddr); in dev_ethtool()
689 rc = ethtool_set_settings(dev, useraddr); in dev_ethtool()
692 rc = ethtool_get_drvinfo(dev, useraddr); in dev_ethtool()
696 rc = ethtool_get_regs(dev, useraddr); in dev_ethtool()
699 rc = ethtool_get_wol(dev, useraddr); in dev_ethtool()
702 rc = ethtool_set_wol(dev, useraddr); in dev_ethtool()
705 rc = ethtool_get_msglevel(dev, useraddr); in dev_ethtool()
708 rc = ethtool_set_msglevel(dev, useraddr); in dev_ethtool()
711 rc = ethtool_nway_reset(dev); in dev_ethtool()
714 rc = ethtool_get_link(dev, useraddr); in dev_ethtool()
717 rc = ethtool_get_eeprom(dev, useraddr); in dev_ethtool()
720 rc = ethtool_set_eeprom(dev, useraddr); in dev_ethtool()
723 rc = ethtool_get_coalesce(dev, useraddr); in dev_ethtool()
726 rc = ethtool_set_coalesce(dev, useraddr); in dev_ethtool()
729 rc = ethtool_get_ringparam(dev, useraddr); in dev_ethtool()
732 rc = ethtool_set_ringparam(dev, useraddr); in dev_ethtool()
735 rc = ethtool_get_pauseparam(dev, useraddr); in dev_ethtool()
738 rc = ethtool_set_pauseparam(dev, useraddr); in dev_ethtool()
741 rc = ethtool_get_rx_csum(dev, useraddr); in dev_ethtool()
744 rc = ethtool_set_rx_csum(dev, useraddr); in dev_ethtool()
747 rc = ethtool_get_tx_csum(dev, useraddr); in dev_ethtool()
750 rc = ethtool_set_tx_csum(dev, useraddr); in dev_ethtool()
753 rc = ethtool_get_sg(dev, useraddr); in dev_ethtool()
756 rc = ethtool_set_sg(dev, useraddr); in dev_ethtool()
760 rc = ethtool_get_tso(dev, useraddr); in dev_ethtool()
763 rc = ethtool_set_tso(dev, useraddr); in dev_ethtool()
767 rc = ethtool_self_test(dev, useraddr); in dev_ethtool()
770 rc = ethtool_get_strings(dev, useraddr); in dev_ethtool()
773 rc = ethtool_phys_id(dev, useraddr); in dev_ethtool()
776 rc = ethtool_get_stats(dev, useraddr); in dev_ethtool()
782 if(dev->ethtool_ops->complete) in dev_ethtool()
783 dev->ethtool_ops->complete(dev); in dev_ethtool()
787 if (dev->do_ioctl) in dev_ethtool()
788 return dev->do_ioctl(dev, ifr, SIOCETHTOOL); in dev_ethtool()