[uClinux-dev] fec driver - a question

Wolf-Rüdiger Jürgens wjuergens at t-online.de
Thu Feb 7 10:50:38 EST 2008


Hi,
this is output of ifconfig on my coldfire (2.4.27-uc1)router:

eth0      Link encap:Ethernet  HWaddr 00:15:7E:02:0C:CB
          inet addr:192.168.40.100  Bcast:192.168.40.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:539923 errors:0 dropped:0 overruns:0 frame:0
          TX packets:533898 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:51108031 (48.7 MiB)  TX bytes:55179739 (52.6 MiB)
          Base address:0x840

If I remove the ethernet cable the RUNNING is furthermore displayed. Is 
this a bug in the ethernet driver?
How can I have the correct status displayed?
I tried the following:

from the fec.c

snip----->

static void mii_relink(struct net_device *dev)
{
    struct fec_enet_private *fep = dev->priv;
    int duplex;

    fep->link = (fep->phy_status & PHY_STAT_LINK) ? 1 : 0;
    mii_display_status(dev);
    fep->old_link = fep->link;

    if (fep->link) {
        netif_carrier_on(dev); // is this ok?
        duplex = 0;
        if (fep->phy_status & (PHY_STAT_100FDX | PHY_STAT_10FDX))
            duplex = 1;
        fec_restart(dev, duplex);
        if (netif_queue_stopped(dev))
            netif_wake_queue(dev);

    } else {
        netif_carrier_off(dev); // is this ok?
        fec_stop(dev);
    }
}

<----- snap

With the modifications above the RUNNING flag is correctly displayed, 
but I'm unsure about possible side effects in the network stack.

Regards
Wolf
-- 

Tradition heißt, das Feuer weiterzutragen und nicht die Asche anzubeten - Gustav Mahler




More information about the uClinux-dev mailing list