netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Ensure IF_READY is unset when link is not ready
@ 2007-03-05  8:59 Mitsuru Chinen
  2007-03-07 23:47 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Mitsuru Chinen @ 2007-03-05  8:59 UTC (permalink / raw)
  To: netdev; +Cc: usagi-core

Hi there,

On linux-2.6.21-rc2 or later, IPv6 link-local address is not assigned to
some kind of interfaces during system start-up. (I found this issue
occures with e100, e1000 and tg3.)

This issue comes from the change that inet6_dev is allocated when
NETDEV_REGISTER event occurs. The allocation code is at ipv6_add_dev()
in net/ipv6/addrinfo.c. At the code, IF_READY bit would be set when the
link is ready. The link readyness is verified by netif_caeeir_ok().
However as the drivers don't call netif_carrier_off() prior to calling
register_netdev(), netif_caeeir_ok() returns true in spite of the
actual link state.

Here's a work around patch. This make IF_READY unset when NETDEV_UP
event occurs and the link is not ready. This patch may not be an
fundamental fix. But I don't have any other idea now.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
 net/ipv6/addrconf.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e16f1bb..1593cd1 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2196,6 +2196,7 @@ static int addrconf_notify(struct notifi
 					"ADDRCONF(NETDEV_UP): %s: "
 					"link is not ready\n",
 					dev->name);
+				idev->if_flags &= ~IF_READY;
 				break;
 			}
 
-- 
1.4.3.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Ensure IF_READY is unset when link is not ready
  2007-03-05  8:59 [PATCH] Ensure IF_READY is unset when link is not ready Mitsuru Chinen
@ 2007-03-07 23:47 ` Herbert Xu
  2007-03-07 23:54   ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2007-03-07 23:47 UTC (permalink / raw)
  To: Mitsuru Chinen, davem, yoshfuji; +Cc: netdev, usagi-core

Mitsuru Chinen <mitch@linux.vnet.ibm.com> wrote:
> 
> On linux-2.6.21-rc2 or later, IPv6 link-local address is not assigned to
> some kind of interfaces during system start-up. (I found this issue
> occures with e100, e1000 and tg3.)

Here is an alternative fix.

[IPV6]: Do not set IF_READY if device is down

Now that we add the IPv6 device at registration time we don't need
to set IF_READY in ipv6_add_dev anymore because we will always get
a NETDEV_UP event later on should the device ever become ready.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e16f1bb..a7fee6b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -342,10 +342,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
 	}
 #endif
 
-	if (netif_carrier_ok(dev))
-		ndev->if_flags |= IF_READY;
-
-
 	ipv6_mc_init_dev(ndev);
 	ndev->tstamp = jiffies;
 #ifdef CONFIG_SYSCTL

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Ensure IF_READY is unset when link is not ready
  2007-03-07 23:47 ` Herbert Xu
@ 2007-03-07 23:54   ` David Miller
  2007-03-08  2:01     ` Mitsuru Chinen
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2007-03-07 23:54 UTC (permalink / raw)
  To: herbert; +Cc: mitch, yoshfuji, netdev, usagi-core

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu, 08 Mar 2007 10:47:56 +1100

> Mitsuru Chinen <mitch@linux.vnet.ibm.com> wrote:
> > 
> > On linux-2.6.21-rc2 or later, IPv6 link-local address is not assigned to
> > some kind of interfaces during system start-up. (I found this issue
> > occures with e100, e1000 and tg3.)
> 
> Here is an alternative fix.
> 
> [IPV6]: Do not set IF_READY if device is down
> 
> Now that we add the IPv6 device at registration time we don't need
> to set IF_READY in ipv6_add_dev anymore because we will always get
> a NETDEV_UP event later on should the device ever become ready.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Indeed, this looks like it will do the right thing.

And if you look into the history of the code in this area
I think you'll find that this snippet being removed existed
exactly because inet6_dev creation happened long after the
device was registered.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Ensure IF_READY is unset when link is not ready
  2007-03-07 23:54   ` David Miller
@ 2007-03-08  2:01     ` Mitsuru Chinen
  0 siblings, 0 replies; 4+ messages in thread
From: Mitsuru Chinen @ 2007-03-08  2:01 UTC (permalink / raw)
  To: David Miller, herbert; +Cc: yoshfuji, netdev, usagi-core

On Wed, 07 Mar 2007 15:54:38 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Thu, 08 Mar 2007 10:47:56 +1100
> 
> > Mitsuru Chinen <mitch@linux.vnet.ibm.com> wrote:
> > > 
> > > On linux-2.6.21-rc2 or later, IPv6 link-local address is not assigned to
> > > some kind of interfaces during system start-up. (I found this issue
> > > occures with e100, e1000 and tg3.)
> > 
> > Here is an alternative fix.
> > 
> > [IPV6]: Do not set IF_READY if device is down
> > 
> > Now that we add the IPv6 device at registration time we don't need
> > to set IF_READY in ipv6_add_dev anymore because we will always get
> > a NETDEV_UP event later on should the device ever become ready.
> > 
> > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> Indeed, this looks like it will do the right thing.
> 
> And if you look into the history of the code in this area
> I think you'll find that this snippet being removed existed
> exactly because inet6_dev creation happened long after the
> device was registered.

I understand. Thanks.
And I thank Herbert to provide suitable fix.

Best Regards,
----
Mitsuru Chinen <mitch@linux.vnet.ibm.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-08  2:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-05  8:59 [PATCH] Ensure IF_READY is unset when link is not ready Mitsuru Chinen
2007-03-07 23:47 ` Herbert Xu
2007-03-07 23:54   ` David Miller
2007-03-08  2:01     ` Mitsuru Chinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).