smc91x and ifplugd

From: tike64
Date: Mon Oct 12 2009 - 06:13:58 EST


Dear linux-kernel,

I am configuring 2.6.27 kernel for a custom board with a LAN91C111 ethernet interface. I tried to manage the interface with ifplugd but encountered a problem: ifplugd works fine through the first event pair, one up event and then one down event but after that the interface is dead. In the driver the carrier presence knowledge is updated in the interrupt handler and, when the interface is brought down, no one updates the fact that the carrier is again present.

I implemented a driver specific 'get_link' method and commented out
smc_phy_powerdown call from smc_close. Now it seems to work for me but I'm far too uneducated to judge if this is a correct way to solve the problem or if there is going to be ill effects.

Right away I can say that I'm not comfortable with not powering down the PHY on interface down. Secondly this seems not to solve the problem if there is an external PHY, right?

So, what might be the correct solution which would have a chance to be included into the mainline?

My get_link implementation:

static u32 smc_get_link(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
void __iomem *ioaddr = lp->base;
u32 carrier;
static u32 old = -1;

spin_lock_irq(&lp->lock);
SMC_SELECT_BANK(lp, 0);
carrier = mii_link_ok(&lp->mii);
SMC_SELECT_BANK(lp, 2);
spin_unlock_irq(&lp->lock);
if (old != carrier) {
old = carrier;
printk("smc_get_link carrier: %i\n", carrier); }
return carrier;
}

--

Timo

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