netdev
[Top] [All Lists]

Re: [PATCH] forcedeth: Additional ethtool support

To: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] forcedeth: Additional ethtool support
From: David Hollis <dhollis@xxxxxxxxxxxxxx>
Date: Wed, 13 Jul 2005 08:39:21 -0400
Cc: Jeff Garzik <jgarzik@xxxxxxxxx>, Netdev <netdev@xxxxxxxxxxx>, renaud.lienhart@xxxxxxx
In-reply-to: <42D101EC.6000608@xxxxxxxxxxxxxxxx>
References: <42D101EC.6000608@xxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
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 <dhollis@xxxxxxxxxxxxxx>

Attachment: signature.asc
Description: This is a digitally signed message part

<Prev in Thread] Current Thread [Next in Thread>