* ax8817x_set_multicast - need address of dev->data, not the contents
* ax8817x_write_cmd_async - free the request structure if urb submit fails
* Add ethtool get_link, get_settings, and set_settings
* ax8817x_bind - remove IPG read/write bit as it is not needed with GPIO fiddling


If the bugs fixed with this patch should be sent seperate so they can be included sooner, I can certainly do that. The ethtool bits just finalize the ethtool support for the device so that most things that can be accessible are accessible.
--- a/drivers/usb/net/usbnet.c  2003-10-20 23:43:22.895564912 -0400
+++ b/drivers/usb/net/usbnet.c  2003-10-21 07:30:01.086192968 -0400
@@ -493,8 +493,11 @@
                             (void *)req, data, size,
                             ax8817x_async_cmd_callback, req);
 
-       if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0)
+       if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
                deverr(dev, "Error submitting the control message: status=%d", status);
+               kfree(req);
+               usb_free_urb(urb);
+       }
 }
 
 static void ax8817x_set_multicast(struct net_device *net)
@@ -510,11 +513,7 @@
        } else if (net->mc_count == 0) {
                /* just broadcast and directed */
        } else {
-               /* We use the 20 byte dev->data
-                * for our 8 byte filter buffer
-                * to avoid allocating memory that
-                * is tricky to free later */
-               u8 *multi_filter = (u8 *)dev->data;
+               u8 *multi_filter = (u8 *)&dev->data;
                struct dev_mc_list *mc_list = net->mc_list;
                u32 crc_bits;
                int i;
@@ -564,6 +563,27 @@
        ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf);
 }
 
+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);
+}
+
 void ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
 {
        struct usbnet *dev = (struct usbnet *)net->priv;
@@ -667,16 +687,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 +742,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;
 }

Reply via email to