link state transitions and IPv6 DAD

From: Tarr, Stephen F
Date: Thu Nov 13 2008 - 13:24:16 EST


I'm currently running 2.6.27.4 on a powerpc target with the gianfar
Ethernet
driver and an MII PHY, although I think some of these issues may affect
other
systems/drivers as well.

If I boot the system and bring the interface up (e.g. "ifconfig up")
with the
cable disconnected, wait a bit, then connect the cable, I don't see the
IPv6
DAD probe for the link-local address or the router solicitation
multicast.
A little investigation shows that the IPv6 addrconf module is assuming
"link
up" at initialization and is running DAD and RS while the cable is still
disconnected. When I connect the cable, the PHY and the gianfar driver
detect
"link up" but the addrconf module doesn't see the transition.

Adding the following to the gianfar driver seems to fix the problem, but
I
suspect there's a neater or better way to do this. In particular, I'd
expect
this to be an issue in some of the other Ethernet drivers as well.

--- linux-2.6.27.4/drivers/net/gianfar.c 2008-10-25
15:05:07.000000000 -0700
+++ linux-2.6.27.4-st/drivers/net/gianfar.c 2008-11-13
09:48:06.230573811 -0800
@@ -524,20 +524,21 @@
static int init_phy(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
uint gigabit_support =
priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT
?
SUPPORTED_1000baseT_Full : 0;
struct phy_device *phydev;
char phy_id[BUS_ID_SIZE];
phy_interface_t interface;

+ netif_carrier_off(dev); // assume NOCARRIER at startup
priv->oldlink = 0;
priv->oldspeed = 0;
priv->oldduplex = -1;

snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id,
priv->einfo->phy_id);

interface = gfar_get_interface(dev);

phydev = phy_connect(dev, phy_id, &adjust_link, 0, interface);


-Steve Tarr
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html