Re: Off-topic : Network Driver Link Status

From: Urban Widmark (urban@svenskatest.se)
Date: Mon May 01 2000 - 18:05:41 EST


On Mon, 1 May 2000 kuznet@ms2.inr.ac.ru wrote:

> Well, add corresponding code to your lovely driver.
> netif_carrier_off()/netif_carrier_on(). Then status
> will appear as IFF_RUNNING flag.

Let's see if I understood this right ...

A few (many?) drivers have timers that run and check if the other end has
changed it's mind about full/half duplex using "mdio". For those something
like this could be put in the xxx_timer function:

        /* make IFF_RUNNING follow the MII status bit "Link established" */
        mii_reg1 = mdio_read(dev, np->phys[0], 1);
        if ( (mii_reg1 & 0x0004) != (np->mii_reg1 & 0x0004) ) {
                if (mii_reg1 & 0x0004)
                        netif_carrier_on(dev);
                else
                        netif_carrier_off(dev);
        }
        np->mii_reg1 = mii_reg1;
(apologies for the 0x0004's, imagine that it says MIILinkEstablished or
 some other nice name for a flag :)

Of course this timer may not run often enough for some people (60 seconds
in some drivers).

Any reasons for not doing this in a timer?

/Urban

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:09 EST