public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] usbnet: add a mutex around phy register access
       [not found] <200609170055.34565.arnd@arndb.de>
@ 2006-09-16 23:03 ` Arnd Bergmann
  2006-09-27 19:33   ` dhollis
       [not found] ` <200609170057.07460.arnd@arndb.de>
  1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2006-09-16 23:03 UTC (permalink / raw)
  To: David Brownell
  Cc: linux-usb-devel, David Hollis, support, dbrownell, linux-kernel,
	Michael Helmling

When working on the mcs7830, I noticed the need for a mutex in its
mdio_read/mdio_write functions. A related problem seems to be present
in the asix driver in the respective functions.

This introduces a mutex in the common usbnet driver and uses it
from the two hardware specific drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
Index: linux-cg/drivers/usb/net/asix.c
===================================================================
--- linux-cg.orig/drivers/usb/net/asix.c	2006-09-17 00:10:53.000000000 +0200
+++ linux-cg/drivers/usb/net/asix.c	2006-09-17 00:18:08.000000000 +0200
@@ -328,10 +328,12 @@
 	struct usbnet *dev = netdev_priv(netdev);
 	u16 res;
 
+	mutex_lock(&dev->phy_mutex);
 	asix_set_sw_mii(dev);
 	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
 				(__u16)loc, 2, (u16 *)&res);
 	asix_set_hw_mii(dev);
+	mutex_unlock(&dev->phy_mutex);
 
 	return res & 0xffff;
 }
@@ -348,10 +350,12 @@
 	struct usbnet *dev = netdev_priv(netdev);
 	u16 res = val;
 
+	mutex_lock(&dev->phy_mutex);
 	asix_set_sw_mii(dev);
 	asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id,
 				(__u16)loc, 2, (u16 *)&res);
 	asix_set_hw_mii(dev);
+	mutex_unlock(&dev->phy_mutex);
 }
 
 /* same as above, but converts new value to le16 byte order before writing */
Index: linux-cg/drivers/usb/net/usbnet.c
===================================================================
--- linux-cg.orig/drivers/usb/net/usbnet.c	2006-09-17 00:10:53.000000000 +0200
+++ linux-cg/drivers/usb/net/usbnet.c	2006-09-17 00:18:08.000000000 +0200
@@ -1112,6 +1112,7 @@
 	dev->delay.function = usbnet_bh;
 	dev->delay.data = (unsigned long) dev;
 	init_timer (&dev->delay);
+	mutex_init (&dev->phy_mutex);
 
 	SET_MODULE_OWNER (net);
 	dev->net = net;
Index: linux-cg/drivers/usb/net/usbnet.h
===================================================================
--- linux-cg.orig/drivers/usb/net/usbnet.h	2006-09-17 00:10:53.000000000 +0200
+++ linux-cg/drivers/usb/net/usbnet.h	2006-09-17 00:18:08.000000000 +0200
@@ -30,6 +30,7 @@
 	struct usb_device	*udev;
 	struct driver_info	*driver_info;
 	wait_queue_head_t	*wait;
+	struct mutex		phy_mutex;
 
 	/* i/o info: pipes etc */
 	unsigned		in, out;
Index: linux-cg/drivers/usb/net/mcs7830.c
===================================================================
--- linux-cg.orig/drivers/usb/net/mcs7830.c	2006-09-17 00:10:53.000000000 +0200
+++ linux-cg/drivers/usb/net/mcs7830.c	2006-09-17 00:18:08.000000000 +0200
@@ -184,6 +184,7 @@
 		HIF_REG_PHY_CMD2_PEND_FLAG_BIT | index,
 	};
 
+	mutex_lock(&dev->phy_mutex);
 	/* write the MII command */
 	ret = mcs7830_set_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
 	if (ret < 0)
@@ -208,6 +209,7 @@
 	dev_dbg(&dev->udev->dev, "read PHY reg %02x: %04x (%d tries)\n",
 		index, val, i);
 out:
+	mutex_unlock(&dev->phy_mutex);
 	return ret;
 }
 
@@ -222,6 +224,8 @@
 		HIF_REG_PHY_CMD2_PEND_FLAG_BIT | (index & 0x1F),
 	};
 
+	mutex_lock(&dev->phy_mutex);
+
 	/* write the new register contents */
 	le_val = cpu_to_le16(val);
 	ret = mcs7830_set_reg(dev, HIF_REG_PHY_DATA, 2, &le_val);
@@ -248,6 +252,7 @@
 	dev_dbg(&dev->udev->dev, "write PHY reg %02x: %04x (%d tries)\n",
 		index, val, i);
 out:
+	mutex_unlock(&dev->phy_mutex);
 	return ret;
 }
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] usbnet: improve generic ethtool support
       [not found] ` <200609170057.07460.arnd@arndb.de>
@ 2006-09-16 23:03   ` Arnd Bergmann
  2006-09-27 19:33     ` dhollis
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2006-09-16 23:03 UTC (permalink / raw)
  To: David Brownell
  Cc: linux-usb-devel, David Hollis, support, dbrownell, linux-kernel,
	Michael Helmling

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>

---

Index: linux-cg/drivers/usb/net/asix.c
===================================================================
--- linux-cg.orig/drivers/usb/net/asix.c	2006-09-17 00:05:53.000000000 +0200
+++ linux-cg/drivers/usb/net/asix.c	2006-09-17 00:09:43.000000000 +0200
@@ -458,20 +458,6 @@
 	info->eedump_len = 0x3e;
 }
 
-static int asix_get_settings(struct net_device *net, struct ethtool_cmd *cmd)
-{
-	struct usbnet *dev = netdev_priv(net);
-
-	return mii_ethtool_gset(&dev->mii,cmd);
-}
-
-static int asix_set_settings(struct net_device *net, struct ethtool_cmd *cmd)
-{
-	struct usbnet *dev = netdev_priv(net);
-
-	return mii_ethtool_sset(&dev->mii,cmd);
-}
-
 /* 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. */
@@ -484,8 +470,9 @@
 	.set_wol		= asix_set_wol,
 	.get_eeprom_len		= asix_get_eeprom_len,
 	.get_eeprom		= asix_get_eeprom,
-	.get_settings		= asix_get_settings,
-	.set_settings		= asix_set_settings,
+	.get_settings		= usbnet_get_settings,
+	.set_settings		= usbnet_set_settings,
+	.nway_reset		= usbnet_nway_reset,
 };
 
 static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
@@ -564,8 +551,9 @@
 	.set_wol		= asix_set_wol,
 	.get_eeprom_len		= asix_get_eeprom_len,
 	.get_eeprom		= asix_get_eeprom,
-	.get_settings		= asix_get_settings,
-	.set_settings		= asix_set_settings,
+	.get_settings		= usbnet_get_settings,
+	.set_settings		= usbnet_set_settings,
+	.nway_reset		= usbnet_nway_reset,
 };
 
 static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
Index: linux-cg/drivers/usb/net/mcs7830.c
===================================================================
--- linux-cg.orig/drivers/usb/net/mcs7830.c	2006-09-17 00:05:53.000000000 +0200
+++ linux-cg/drivers/usb/net/mcs7830.c	2006-09-17 00:06:21.000000000 +0200
@@ -430,8 +430,12 @@
 	.get_regs		= mcs7830_get_regs,
 
 	/* common usbnet calls */
+	.get_link		= usbnet_get_link,
 	.get_msglevel		= usbnet_get_msglevel,
 	.set_msglevel		= usbnet_set_msglevel,
+	.get_settings		= usbnet_get_settings,
+	.set_settings		= usbnet_set_settings,
+	.nway_reset		= usbnet_nway_reset,
 };
 
 static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
Index: linux-cg/drivers/usb/net/usbnet.c
===================================================================
--- linux-cg.orig/drivers/usb/net/usbnet.c	2006-09-17 00:05:53.000000000 +0200
+++ linux-cg/drivers/usb/net/usbnet.c	2006-09-17 00:07:45.000000000 +0200
@@ -645,6 +645,29 @@
  * they'll probably want to use this base set.
  */
 
+int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
+{
+	struct usbnet *dev = netdev_priv(net);
+
+	if (!dev->mii.mdio_read)
+		return -EOPNOTSUPP;
+
+	return mii_ethtool_gset(&dev->mii, cmd);
+}
+EXPORT_SYMBOL_GPL(usbnet_get_settings);
+
+int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd)
+{
+	struct usbnet *dev = netdev_priv(net);
+
+	if (!dev->mii.mdio_write)
+		return -EOPNOTSUPP;
+
+	return mii_ethtool_sset(&dev->mii, cmd);
+}
+EXPORT_SYMBOL_GPL(usbnet_set_settings);
+
+
 void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
 {
 	struct usbnet *dev = netdev_priv(net);
@@ -658,7 +681,7 @@
 }
 EXPORT_SYMBOL_GPL(usbnet_get_drvinfo);
 
-static u32 usbnet_get_link (struct net_device *net)
+u32 usbnet_get_link (struct net_device *net)
 {
 	struct usbnet *dev = netdev_priv(net);
 
@@ -666,9 +689,14 @@
 	if (dev->driver_info->check_connect)
 		return dev->driver_info->check_connect (dev) == 0;
 
+	/* if the device has mii operations, use those */
+	if (dev->mii.mdio_read)
+		return mii_link_ok(&dev->mii);
+
 	/* Otherwise, say we're up (to avoid breaking scripts) */
 	return 1;
 }
+EXPORT_SYMBOL_GPL(usbnet_get_link);
 
 u32 usbnet_get_msglevel (struct net_device *net)
 {
@@ -686,10 +714,24 @@
 }
 EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
 
+int usbnet_nway_reset(struct net_device *net)
+{
+	struct usbnet *dev = netdev_priv(net);
+
+	if (!dev->mii.mdio_write)
+		return -EOPNOTSUPP;
+
+	return mii_nway_restart(&dev->mii);
+}
+EXPORT_SYMBOL_GPL(usbnet_nway_reset);
+
 /* drivers may override default ethtool_ops in their bind() routine */
 static struct ethtool_ops usbnet_ethtool_ops = {
+	.get_settings		= usbnet_get_settings,
+	.set_settings		= usbnet_set_settings,
 	.get_drvinfo		= usbnet_get_drvinfo,
 	.get_link		= usbnet_get_link,
+	.nway_reset		= usbnet_nway_reset,
 	.get_msglevel		= usbnet_get_msglevel,
 	.set_msglevel		= usbnet_set_msglevel,
 };
Index: linux-cg/drivers/usb/net/usbnet.h
===================================================================
--- linux-cg.orig/drivers/usb/net/usbnet.h	2006-09-17 00:05:53.000000000 +0200
+++ linux-cg/drivers/usb/net/usbnet.h	2006-09-17 00:07:53.000000000 +0200
@@ -167,9 +167,13 @@
 extern void usbnet_defer_kevent (struct usbnet *, int);
 extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
 
+extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd);
+extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd);
+extern u32 usbnet_get_link (struct net_device *net);
 extern u32 usbnet_get_msglevel (struct net_device *);
 extern void usbnet_set_msglevel (struct net_device *, u32);
 extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
+extern int usbnet_nway_reset(struct net_device *net);
 
 /* messaging support includes the interface name, so it must not be
  * used before it has one ... notably, in minidriver bind() calls.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] usbnet: add a mutex around phy register access
  2006-09-16 23:03 ` [PATCH 2/3] usbnet: add a mutex around phy register access Arnd Bergmann
@ 2006-09-27 19:33   ` dhollis
  0 siblings, 0 replies; 4+ messages in thread
From: dhollis @ 2006-09-27 19:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Brownell, linux-usb-devel, support, dbrownell, linux-kernel,
	Michael Helmling

Quoting Arnd Bergmann <arnd@arndb.de>:

> When working on the mcs7830, I noticed the need for a mutex in its
> mdio_read/mdio_write functions. A related problem seems to be present
> in the asix driver in the respective functions.
>
> This introduces a mutex in the common usbnet driver and uses it
> from the two hardware specific drivers.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>

Acked-by: David Hollis <dhollis@davehollis.com>


> ---
> Index: linux-cg/drivers/usb/net/asix.c
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/asix.c	2006-09-17 00:10:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/asix.c	2006-09-17 00:18:08.000000000 +0200
> @@ -328,10 +328,12 @@
>  	struct usbnet *dev = netdev_priv(netdev);
>  	u16 res;
>
> +	mutex_lock(&dev->phy_mutex);
>  	asix_set_sw_mii(dev);
>  	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
>  				(__u16)loc, 2, (u16 *)&res);
>  	asix_set_hw_mii(dev);
> +	mutex_unlock(&dev->phy_mutex);
>
>  	return res & 0xffff;
>  }
> @@ -348,10 +350,12 @@
>  	struct usbnet *dev = netdev_priv(netdev);
>  	u16 res = val;
>
> +	mutex_lock(&dev->phy_mutex);
>  	asix_set_sw_mii(dev);
>  	asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id,
>  				(__u16)loc, 2, (u16 *)&res);
>  	asix_set_hw_mii(dev);
> +	mutex_unlock(&dev->phy_mutex);
>  }
>
>  /* same as above, but converts new value to le16 byte order before   
> writing */
> Index: linux-cg/drivers/usb/net/usbnet.c
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/usbnet.c	2006-09-17   
> 00:10:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/usbnet.c	2006-09-17 00:18:08.000000000 +0200
> @@ -1112,6 +1112,7 @@
>  	dev->delay.function = usbnet_bh;
>  	dev->delay.data = (unsigned long) dev;
>  	init_timer (&dev->delay);
> +	mutex_init (&dev->phy_mutex);
>
>  	SET_MODULE_OWNER (net);
>  	dev->net = net;
> Index: linux-cg/drivers/usb/net/usbnet.h
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/usbnet.h	2006-09-17   
> 00:10:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/usbnet.h	2006-09-17 00:18:08.000000000 +0200
> @@ -30,6 +30,7 @@
>  	struct usb_device	*udev;
>  	struct driver_info	*driver_info;
>  	wait_queue_head_t	*wait;
> +	struct mutex		phy_mutex;
>
>  	/* i/o info: pipes etc */
>  	unsigned		in, out;
> Index: linux-cg/drivers/usb/net/mcs7830.c
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/mcs7830.c	2006-09-17   
> 00:10:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/mcs7830.c	2006-09-17 00:18:08.000000000 +0200
> @@ -184,6 +184,7 @@
>  		HIF_REG_PHY_CMD2_PEND_FLAG_BIT | index,
>  	};
>
> +	mutex_lock(&dev->phy_mutex);
>  	/* write the MII command */
>  	ret = mcs7830_set_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
>  	if (ret < 0)
> @@ -208,6 +209,7 @@
>  	dev_dbg(&dev->udev->dev, "read PHY reg %02x: %04x (%d tries)\n",
>  		index, val, i);
>  out:
> +	mutex_unlock(&dev->phy_mutex);
>  	return ret;
>  }
>
> @@ -222,6 +224,8 @@
>  		HIF_REG_PHY_CMD2_PEND_FLAG_BIT | (index & 0x1F),
>  	};
>
> +	mutex_lock(&dev->phy_mutex);
> +
>  	/* write the new register contents */
>  	le_val = cpu_to_le16(val);
>  	ret = mcs7830_set_reg(dev, HIF_REG_PHY_DATA, 2, &le_val);
> @@ -248,6 +252,7 @@
>  	dev_dbg(&dev->udev->dev, "write PHY reg %02x: %04x (%d tries)\n",
>  		index, val, i);
>  out:
> +	mutex_unlock(&dev->phy_mutex);
>  	return ret;
>  }
>
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] usbnet: improve generic ethtool support
  2006-09-16 23:03   ` [PATCH 3/3] usbnet: improve generic ethtool support Arnd Bergmann
@ 2006-09-27 19:33     ` dhollis
  0 siblings, 0 replies; 4+ messages in thread
From: dhollis @ 2006-09-27 19:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Brownell, linux-usb-devel, support, dbrownell, linux-kernel,
	Michael Helmling

Quoting Arnd Bergmann <arnd@arndb.de>:

> 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>


>
> Index: linux-cg/drivers/usb/net/asix.c
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/asix.c	2006-09-17 00:05:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/asix.c	2006-09-17 00:09:43.000000000 +0200
> @@ -458,20 +458,6 @@
>  	info->eedump_len = 0x3e;
>  }
>
> -static int asix_get_settings(struct net_device *net, struct   
> ethtool_cmd *cmd)
> -{
> -	struct usbnet *dev = netdev_priv(net);
> -
> -	return mii_ethtool_gset(&dev->mii,cmd);
> -}
> -
> -static int asix_set_settings(struct net_device *net, struct   
> ethtool_cmd *cmd)
> -{
> -	struct usbnet *dev = netdev_priv(net);
> -
> -	return mii_ethtool_sset(&dev->mii,cmd);
> -}
> -
>  /* 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. */
> @@ -484,8 +470,9 @@
>  	.set_wol		= asix_set_wol,
>  	.get_eeprom_len		= asix_get_eeprom_len,
>  	.get_eeprom		= asix_get_eeprom,
> -	.get_settings		= asix_get_settings,
> -	.set_settings		= asix_set_settings,
> +	.get_settings		= usbnet_get_settings,
> +	.set_settings		= usbnet_set_settings,
> +	.nway_reset		= usbnet_nway_reset,
>  };
>
>  static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
> @@ -564,8 +551,9 @@
>  	.set_wol		= asix_set_wol,
>  	.get_eeprom_len		= asix_get_eeprom_len,
>  	.get_eeprom		= asix_get_eeprom,
> -	.get_settings		= asix_get_settings,
> -	.set_settings		= asix_set_settings,
> +	.get_settings		= usbnet_get_settings,
> +	.set_settings		= usbnet_set_settings,
> +	.nway_reset		= usbnet_nway_reset,
>  };
>
>  static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
> Index: linux-cg/drivers/usb/net/mcs7830.c
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/mcs7830.c	2006-09-17   
> 00:05:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/mcs7830.c	2006-09-17 00:06:21.000000000 +0200
> @@ -430,8 +430,12 @@
>  	.get_regs		= mcs7830_get_regs,
>
>  	/* common usbnet calls */
> +	.get_link		= usbnet_get_link,
>  	.get_msglevel		= usbnet_get_msglevel,
>  	.set_msglevel		= usbnet_set_msglevel,
> +	.get_settings		= usbnet_get_settings,
> +	.set_settings		= usbnet_set_settings,
> +	.nway_reset		= usbnet_nway_reset,
>  };
>
>  static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
> Index: linux-cg/drivers/usb/net/usbnet.c
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/usbnet.c	2006-09-17   
> 00:05:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/usbnet.c	2006-09-17 00:07:45.000000000 +0200
> @@ -645,6 +645,29 @@
>   * they'll probably want to use this base set.
>   */
>
> +int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
> +{
> +	struct usbnet *dev = netdev_priv(net);
> +
> +	if (!dev->mii.mdio_read)
> +		return -EOPNOTSUPP;
> +
> +	return mii_ethtool_gset(&dev->mii, cmd);
> +}
> +EXPORT_SYMBOL_GPL(usbnet_get_settings);
> +
> +int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd)
> +{
> +	struct usbnet *dev = netdev_priv(net);
> +
> +	if (!dev->mii.mdio_write)
> +		return -EOPNOTSUPP;
> +
> +	return mii_ethtool_sset(&dev->mii, cmd);
> +}
> +EXPORT_SYMBOL_GPL(usbnet_set_settings);
> +
> +
>  void usbnet_get_drvinfo (struct net_device *net, struct   
> ethtool_drvinfo *info)
>  {
>  	struct usbnet *dev = netdev_priv(net);
> @@ -658,7 +681,7 @@
>  }
>  EXPORT_SYMBOL_GPL(usbnet_get_drvinfo);
>
> -static u32 usbnet_get_link (struct net_device *net)
> +u32 usbnet_get_link (struct net_device *net)
>  {
>  	struct usbnet *dev = netdev_priv(net);
>
> @@ -666,9 +689,14 @@
>  	if (dev->driver_info->check_connect)
>  		return dev->driver_info->check_connect (dev) == 0;
>
> +	/* if the device has mii operations, use those */
> +	if (dev->mii.mdio_read)
> +		return mii_link_ok(&dev->mii);
> +
>  	/* Otherwise, say we're up (to avoid breaking scripts) */
>  	return 1;
>  }
> +EXPORT_SYMBOL_GPL(usbnet_get_link);
>
>  u32 usbnet_get_msglevel (struct net_device *net)
>  {
> @@ -686,10 +714,24 @@
>  }
>  EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
>
> +int usbnet_nway_reset(struct net_device *net)
> +{
> +	struct usbnet *dev = netdev_priv(net);
> +
> +	if (!dev->mii.mdio_write)
> +		return -EOPNOTSUPP;
> +
> +	return mii_nway_restart(&dev->mii);
> +}
> +EXPORT_SYMBOL_GPL(usbnet_nway_reset);
> +
>  /* drivers may override default ethtool_ops in their bind() routine */
>  static struct ethtool_ops usbnet_ethtool_ops = {
> +	.get_settings		= usbnet_get_settings,
> +	.set_settings		= usbnet_set_settings,
>  	.get_drvinfo		= usbnet_get_drvinfo,
>  	.get_link		= usbnet_get_link,
> +	.nway_reset		= usbnet_nway_reset,
>  	.get_msglevel		= usbnet_get_msglevel,
>  	.set_msglevel		= usbnet_set_msglevel,
>  };
> Index: linux-cg/drivers/usb/net/usbnet.h
> ===================================================================
> --- linux-cg.orig/drivers/usb/net/usbnet.h	2006-09-17   
> 00:05:53.000000000 +0200
> +++ linux-cg/drivers/usb/net/usbnet.h	2006-09-17 00:07:53.000000000 +0200
> @@ -167,9 +167,13 @@
>  extern void usbnet_defer_kevent (struct usbnet *, int);
>  extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
>
> +extern int usbnet_get_settings (struct net_device *net, struct   
> ethtool_cmd *cmd);
> +extern int usbnet_set_settings (struct net_device *net, struct   
> ethtool_cmd *cmd);
> +extern u32 usbnet_get_link (struct net_device *net);
>  extern u32 usbnet_get_msglevel (struct net_device *);
>  extern void usbnet_set_msglevel (struct net_device *, u32);
>  extern void usbnet_get_drvinfo (struct net_device *, struct   
> ethtool_drvinfo *);
> +extern int usbnet_nway_reset(struct net_device *net);
>
>  /* messaging support includes the interface name, so it must not be
>   * used before it has one ... notably, in minidriver bind() calls.
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-27 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200609170055.34565.arnd@arndb.de>
2006-09-16 23:03 ` [PATCH 2/3] usbnet: add a mutex around phy register access Arnd Bergmann
2006-09-27 19:33   ` dhollis
     [not found] ` <200609170057.07460.arnd@arndb.de>
2006-09-16 23:03   ` [PATCH 3/3] usbnet: improve generic ethtool support Arnd Bergmann
2006-09-27 19:33     ` dhollis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox