[uClinux-dev] fec driver - a question

Greg Ungerer gerg at snapgear.com
Wed Feb 27 01:02:22 EST 2008


Hi Wolf

Wolf-Rüdiger Jürgens wrote:
> 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.

Does your hardware have a separate mii_link interrupt?
Or does this rely on a timeout event calling to fec_timeout()
and then mii_relink()?

Either way this method seems ok.

Regards
Greg



------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     gerg at snapgear.com
Secure Computing Corporation                PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com


More information about the uClinux-dev mailing list