ChangeSet 1.1337.3.7, 2003/10/23 17:03:54-07:00, dhollis@davehollis.com [PATCH] USB: ax8817x additional ethtool support in usbnet * Provide operational link testing via ethtool * Provide get/set features via ethtool. drivers/usb/net/usbnet.c | 34 ++++++++++++++++++++++++---------- 1 files changed, 24 insertions(+), 10 deletions(-) diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c --- a/drivers/usb/net/usbnet.c Mon Dec 29 14:27:30 2003 +++ b/drivers/usb/net/usbnet.c Mon Dec 29 14:27:30 2003 @@ -634,6 +634,27 @@ info->eedump_len = 0x3e; } +static u32 ax8817x_get_link (struct net_device *net) +{ + struct usbnet *dev = (struct usbnet *)net->priv; + + return (u32)mii_link_ok(&dev->mii); +} + +static int ax8817x_get_settings(struct net_device *net, struct ethtool_cmd *cmd) +{ + struct usbnet *dev = (struct usbnet *)net->priv; + + return mii_ethtool_gset(&dev->mii,cmd); +} + +static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd) +{ + struct usbnet *dev = (struct usbnet *)net->priv; + + return mii_ethtool_sset(&dev->mii,cmd); +} + static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf) { int ret; @@ -667,16 +688,6 @@ } memcpy(dev->net->dev_addr, buf, ETH_ALEN); - /* Get IPG values */ - if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_IPG012, 0, 0, 3, buf)) < 0) { - dbg("Error reading IPG values: %d", ret); - return ret; - } - - for(i = 0;i < 3;i++) { - ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0 + i, 0, 0, 1, &buf[i]); - } - /* Get the PHY id */ if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf)) < 0) { dbg("error on read AX_CMD_READ_PHY_ID: %02x", ret); @@ -732,9 +743,12 @@ dev->net->set_multicast_list = ax8817x_set_multicast; usbnet_ethtool_ops.get_drvinfo = &ax8817x_get_drvinfo; + usbnet_ethtool_ops.get_link = &ax8817x_get_link; usbnet_ethtool_ops.get_wol = &ax8817x_get_wol; usbnet_ethtool_ops.set_wol = &ax8817x_set_wol; usbnet_ethtool_ops.get_eeprom = &ax8817x_get_eeprom; + usbnet_ethtool_ops.get_settings = &ax8817x_get_settings; + usbnet_ethtool_ops.set_settings = &ax8817x_set_settings; return 0; }