On Sun, 2003-12-21 at 18:53, David Brownell wrote: > Hi, > > I just noticed a minor goof, your docs say the right thing > but the code doesn't. Right now the ax8817x code patches > the ethool_ops structure used by _every_ chunk of hardware, > so it'll break if there's a non-ax8817x device connected... > instead, it should have its own ops vector. > > Could you fix that so ax8817x has its own ethtool_ops? > > - Dave > This patch should take care of it. Additionally, I had to fold one of my patches that's in the queue for 2.6.1 (ethtool link check fix) into this as the other would not apply due to changes.
I don't have any other usbnet devices unfortunately so I can't fully validate but it looks good to me ;) Let me know if you see any other problems.
--- /home/dhollis/kernel/src/usb-2.5/drivers/usb/net/usbnet.c 2003-11-14 09:10:39.000000000 -0500 +++ usbnet.c 2003-12-23 10:49:33.852782264 -0500 @@ -302,6 +302,9 @@ static struct ethtool_ops usbnet_ethtool_ops; static void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); +static u32 usbnet_get_link (struct net_device *); +static u32 usbnet_get_msglevel (struct net_device *); +static void usbnet_set_msglevel (struct net_device *, u32); /* mostly for PDA style devices, which are always connected if present */ static int always_connected (struct usbnet *dev) @@ -637,6 +640,26 @@ info->eedump_len = 0x3e; } +static u32 ax8817x_get_link (struct net_device *net) +{ + struct usbnet *dev = (struct usbnet *)net->priv; + + return mii_link_ok(&dev->mii); +} + +/* We need to override some ethtool_ops so we require our + own structure so we don't interfere with other usbnet + devices that may be connected at the same time. */ +static struct ethtool_ops ax8817x_ethtool_ops = { + .get_drvinfo = ax8817x_get_drvinfo, + .get_link = ax8817x_get_link, + .get_msglevel = usbnet_get_msglevel, + .set_msglevel = usbnet_set_msglevel, + .get_wol = ax8817x_get_wol, + .set_wol = ax8817x_set_wol, + .get_eeprom = ax8817x_get_eeprom, +}; + static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf) { int ret; @@ -733,11 +756,7 @@ } dev->net->set_multicast_list = ax8817x_set_multicast; - - usbnet_ethtool_ops.get_drvinfo = &ax8817x_get_drvinfo; - usbnet_ethtool_ops.get_wol = &ax8817x_get_wol; - usbnet_ethtool_ops.set_wol = &ax8817x_set_wol; - usbnet_ethtool_ops.get_eeprom = &ax8817x_get_eeprom; + dev->net->ethtool_ops = &ax8817x_ethtool_ops; return 0; }