Re: [PATCH] forcedeth: Additional ethtool support
From: David Hollis <hidden>
Date: 2005-07-13 12:39:21
Attachments
- signature.asc [application/pgp-signature] 189 bytes
From: David Hollis <hidden>
Date: 2005-07-13 12:39:21
On Sun, 2005-07-10 at 13:09 +0200, Manfred Spraul wrote:
+
+static int nv_nway_reset(struct net_device *dev)
+{
+ struct fe_priv *np = get_nvpriv(dev);
+ int ret;
+
+ spin_lock_irq(&np->lock);
+ if (np->autoneg) {
+ int bmcr;
+
+ bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
+ bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
+ mii_rw(dev, np->phyaddr, MII_BMCR, bmcr);
+
+ ret = 0;
+ } else {
+ ret = -EINVAL;
+ }
+ spin_unlock_irq(&np->lock);
+
+ return ret;
+}
+This seems almost completely generic-ified (except for the np->autoneg part) and should be able to operate on any NIC. Do you think there'd be some way to whip up a stock ethtool_nway_reset() type of function that drivers can use if they don't need to do anything fancy? Would help save a lot of code duplication. -- David Hollis [off-list ref]