netdev
[Top] [All Lists]

Re: [PATCH] eepro100 and IFF_RUNNING under 2.4

To: alex@xxxxxxxxxx
Subject: Re: [PATCH] eepro100 and IFF_RUNNING under 2.4
From: Andrew Morton <andrewm@xxxxxxxxxx>
Date: Sat, 21 Jul 2001 12:01:06 +1000
Cc: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, Andrey Savochkin <saw@xxxxxxxxxxxxx>
References: <20010720143247.A6596@xxxxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
alex@xxxxxxxxxx wrote:
> 
> Hiho..  While working on some code which tries to monitor physical link status
> for ethernet interfaces, I noticed that apparently under the 2.4 kernel, the
> eepro100 driver does not reflect link status with the IFF_RUNNING flag as it
> used to under 2.2.x.
> 
> It looks like a bit of the code in eepro100.c didn't get updated to reflect
> some interface changes that happened somewhere in 2.3, so here is a patch 
> which
> should fix things (It also adds a bit of code to set things properly on 
> startup as well, patch is against kernel 2.4.6).
> 
> (I'm not quite sure who to send this to, so I'm sending it to the list)

Interesting.  I don't think the driver should have been
manipulating IFF_RUNNING in response to link status changes
in the first place.

You were missing an `& 0x1f' when using the PHY index.  Not
sure it's necessary, but...


--- linux-2.4.7-pre6/drivers/net/eepro100.c     Wed Jul  4 18:21:26 2001
+++ lk-ext3/drivers/net/eepro100.c      Sat Jul 21 12:04:28 2001
@@ -976,6 +976,11 @@ speedo_open(struct net_device *dev)
        if ((sp->phy[0] & 0x8000) == 0)
                sp->advertising = mdio_read(ioaddr, sp->phy[0] & 0x1f, 4);
 
+       if (mdio_read(ioaddr, sp->phy[0] & 0x1f, 1) & 0x0004)
+               netif_carrier_on(dev);
+       else
+               netif_carrier_off(dev);
+
        if (speedo_debug > 2) {
                printk(KERN_DEBUG "%s: Done speedo_open(), status %8.8x.\n",
                           dev->name, inw(ioaddr + SCBStatus));
@@ -1088,9 +1093,9 @@ static void speedo_timer(unsigned long d
                        mdio_read(ioaddr, phy_num, 1);
                        /* If link beat has returned... */
                        if (mdio_read(ioaddr, phy_num, 1) & 0x0004)
-                               dev->flags |= IFF_RUNNING;
+                               netif_carrier_on(dev);
                        else
-                               dev->flags &= ~IFF_RUNNING;
+                               netif_carrier_off(dev);
                }
        }
        if (speedo_debug > 3) {

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH] eepro100 and IFF_RUNNING under 2.4, Andrew Morton <=