diff options
author | Arnd Bergmann <arnd@arndb.de> | 2006-10-08 18:08:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-10-17 17:46:32 -0400 |
commit | c41286fd42f3545513f8de9f61028120b6d38e89 (patch) | |
tree | 2dddcf5c7423c0db62a1f8752c002cf62080287b /drivers/usb/net/asix.c | |
parent | 2a36d7083438ccb607055abae633f39495a99947 (diff) |
usbnet: improve generic ethtool support
This adds generic support for the ethtool commands get_settings,
set_settings, get_link and nway_reset to usbnet. These are now
implemented using mii functions when a low-level driver supports
mdio_read/mdio_write and does not override the usbnet ethtool
commands with its own.
Currently, this applies to the asix and the mcs7830 drivers.
I have tested it on mcs7830.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: David Hollis <dhollis@davehollis.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/net/asix.c')
-rw-r--r-- | drivers/usb/net/asix.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index c73dd224aa76..5edd0534c7ab 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -700,32 +700,6 @@ static void asix_get_drvinfo (struct net_device *net, | |||
700 | info->eedump_len = data->eeprom_len; | 700 | info->eedump_len = data->eeprom_len; |
701 | } | 701 | } |
702 | 702 | ||
703 | static int asix_get_settings(struct net_device *net, struct ethtool_cmd *cmd) | ||
704 | { | ||
705 | struct usbnet *dev = netdev_priv(net); | ||
706 | |||
707 | return mii_ethtool_gset(&dev->mii,cmd); | ||
708 | } | ||
709 | |||
710 | static int asix_set_settings(struct net_device *net, struct ethtool_cmd *cmd) | ||
711 | { | ||
712 | struct usbnet *dev = netdev_priv(net); | ||
713 | int res = mii_ethtool_sset(&dev->mii,cmd); | ||
714 | |||
715 | /* link speed/duplex might have changed */ | ||
716 | if (dev->driver_info->link_reset) | ||
717 | dev->driver_info->link_reset(dev); | ||
718 | |||
719 | return res; | ||
720 | } | ||
721 | |||
722 | static int asix_nway_reset(struct net_device *net) | ||
723 | { | ||
724 | struct usbnet *dev = netdev_priv(net); | ||
725 | |||
726 | return mii_nway_restart(&dev->mii); | ||
727 | } | ||
728 | |||
729 | static u32 asix_get_link(struct net_device *net) | 703 | static u32 asix_get_link(struct net_device *net) |
730 | { | 704 | { |
731 | struct usbnet *dev = netdev_priv(net); | 705 | struct usbnet *dev = netdev_priv(net); |
@@ -746,15 +720,15 @@ static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd) | |||
746 | static struct ethtool_ops ax88172_ethtool_ops = { | 720 | static struct ethtool_ops ax88172_ethtool_ops = { |
747 | .get_drvinfo = asix_get_drvinfo, | 721 | .get_drvinfo = asix_get_drvinfo, |
748 | .get_link = asix_get_link, | 722 | .get_link = asix_get_link, |
749 | .nway_reset = asix_nway_reset, | ||
750 | .get_msglevel = usbnet_get_msglevel, | 723 | .get_msglevel = usbnet_get_msglevel, |
751 | .set_msglevel = usbnet_set_msglevel, | 724 | .set_msglevel = usbnet_set_msglevel, |
752 | .get_wol = asix_get_wol, | 725 | .get_wol = asix_get_wol, |
753 | .set_wol = asix_set_wol, | 726 | .set_wol = asix_set_wol, |
754 | .get_eeprom_len = asix_get_eeprom_len, | 727 | .get_eeprom_len = asix_get_eeprom_len, |
755 | .get_eeprom = asix_get_eeprom, | 728 | .get_eeprom = asix_get_eeprom, |
756 | .get_settings = asix_get_settings, | 729 | .get_settings = usbnet_get_settings, |
757 | .set_settings = asix_set_settings, | 730 | .set_settings = usbnet_set_settings, |
731 | .nway_reset = usbnet_nway_reset, | ||
758 | }; | 732 | }; |
759 | 733 | ||
760 | static void ax88172_set_multicast(struct net_device *net) | 734 | static void ax88172_set_multicast(struct net_device *net) |
@@ -885,15 +859,15 @@ out1: | |||
885 | static struct ethtool_ops ax88772_ethtool_ops = { | 859 | static struct ethtool_ops ax88772_ethtool_ops = { |
886 | .get_drvinfo = asix_get_drvinfo, | 860 | .get_drvinfo = asix_get_drvinfo, |
887 | .get_link = asix_get_link, | 861 | .get_link = asix_get_link, |
888 | .nway_reset = asix_nway_reset, | ||
889 | .get_msglevel = usbnet_get_msglevel, | 862 | .get_msglevel = usbnet_get_msglevel, |
890 | .set_msglevel = usbnet_set_msglevel, | 863 | .set_msglevel = usbnet_set_msglevel, |
891 | .get_wol = asix_get_wol, | 864 | .get_wol = asix_get_wol, |
892 | .set_wol = asix_set_wol, | 865 | .set_wol = asix_set_wol, |
893 | .get_eeprom_len = asix_get_eeprom_len, | 866 | .get_eeprom_len = asix_get_eeprom_len, |
894 | .get_eeprom = asix_get_eeprom, | 867 | .get_eeprom = asix_get_eeprom, |
895 | .get_settings = asix_get_settings, | 868 | .get_settings = usbnet_get_settings, |
896 | .set_settings = asix_set_settings, | 869 | .set_settings = usbnet_set_settings, |
870 | .nway_reset = usbnet_nway_reset, | ||
897 | }; | 871 | }; |
898 | 872 | ||
899 | static int ax88772_link_reset(struct usbnet *dev) | 873 | static int ax88772_link_reset(struct usbnet *dev) |
@@ -1046,15 +1020,15 @@ out1: | |||
1046 | static struct ethtool_ops ax88178_ethtool_ops = { | 1020 | static struct ethtool_ops ax88178_ethtool_ops = { |
1047 | .get_drvinfo = asix_get_drvinfo, | 1021 | .get_drvinfo = asix_get_drvinfo, |
1048 | .get_link = asix_get_link, | 1022 | .get_link = asix_get_link, |
1049 | .nway_reset = asix_nway_reset, | ||
1050 | .get_msglevel = usbnet_get_msglevel, | 1023 | .get_msglevel = usbnet_get_msglevel, |
1051 | .set_msglevel = usbnet_set_msglevel, | 1024 | .set_msglevel = usbnet_set_msglevel, |
1052 | .get_wol = asix_get_wol, | 1025 | .get_wol = asix_get_wol, |
1053 | .set_wol = asix_set_wol, | 1026 | .set_wol = asix_set_wol, |
1054 | .get_eeprom_len = asix_get_eeprom_len, | 1027 | .get_eeprom_len = asix_get_eeprom_len, |
1055 | .get_eeprom = asix_get_eeprom, | 1028 | .get_eeprom = asix_get_eeprom, |
1056 | .get_settings = asix_get_settings, | 1029 | .get_settings = usbnet_get_settings, |
1057 | .set_settings = asix_set_settings, | 1030 | .set_settings = usbnet_set_settings, |
1031 | .nway_reset = usbnet_nway_reset, | ||
1058 | }; | 1032 | }; |
1059 | 1033 | ||
1060 | static int marvell_phy_init(struct usbnet *dev) | 1034 | static int marvell_phy_init(struct usbnet *dev) |