Netdev Archive mirror
 help / color / mirror / Atom feed
* [PATCH] netdev: don't always reset iflink when registering
@ 2010-03-20  1:39 Tom Goff
  2010-03-22 17:42 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Goff @ 2010-03-20  1:39 UTC (permalink / raw
  To: netdev

Bound tunnel devices set their iflink to the ifindex of the underlying
network interface when created.  It shouldn't be reset by the
registration process.

Signed-off-by: Tom Goff <thomas.goff@boeing.com>
---
 net/core/dev.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 59d4394..c00d625 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5067,7 +5067,8 @@ int register_netdevice(struct net_device *dev)
 	netdev_set_addr_lockdep_class(dev);
 	netdev_init_queue_locks(dev);
 
-	dev->iflink = -1;
+	if (dev->iflink <= 0)
+		dev->iflink = -1;
 
 	/* Init, if this function is available */
 	if (dev->netdev_ops->ndo_init) {
-- 
1.6.3.3


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

* Re: [PATCH] netdev: don't always reset iflink when registering
  2010-03-20  1:39 [PATCH] netdev: don't always reset iflink when registering Tom Goff
@ 2010-03-22 17:42 ` Patrick McHardy
  2010-03-22 19:06   ` Goff, Thomas
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2010-03-22 17:42 UTC (permalink / raw
  To: Tom Goff; +Cc: netdev

Tom Goff wrote:
> Bound tunnel devices set their iflink to the ifindex of the underlying
> network interface when created.  It shouldn't be reset by the
> registration process.
>   

Which ones exactly? Usually they do this in ->setup() or later on.

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

* RE: [PATCH] netdev: don't always reset iflink when registering
  2010-03-22 17:42 ` Patrick McHardy
@ 2010-03-22 19:06   ` Goff, Thomas
  2010-03-23  3:20     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Goff, Thomas @ 2010-03-22 19:06 UTC (permalink / raw
  To: Patrick McHardy; +Cc: netdev@vger.kernel.org

From: Patrick McHardy <mailto:kaber@trash.net>
Sent: Monday, March 22, 2010 10:43 AM
> 
> Tom Goff wrote:
> > Bound tunnel devices set their iflink to the ifindex of the 
> underlying
> > network interface when created.  It shouldn't be reset by the
> > registration process.
> >   
> 
> Which ones exactly? Usually they do this in ->setup() or later on.

I observed the issue with a bound gre tunnel where:

	ipgre_newlink()
		...
		ipgre_tunnel_bind_dev()	/* set dev->iflink */
		...
		register_netdevice()	/* reset dev->iflink */

There's a similar pattern in ipv6/sit.c:

	ipip6_tunnel_locate()
		...
		ipip6_tunnel_init()
			...
			ipip6_tunnel_bind_dev()	/* set dev->iflink */
		...
		register_netdevice()		/* reset dev->iflink */

So maybe it makes more sense to change these if that's more consistent
with other cases.

Thanks for looking at this and the tc stuff.

  Tom

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

* Re: [PATCH] netdev: don't always reset iflink when registering
  2010-03-22 19:06   ` Goff, Thomas
@ 2010-03-23  3:20     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-03-23  3:20 UTC (permalink / raw
  To: Thomas.Goff; +Cc: kaber, netdev

From: "Goff, Thomas" <Thomas.Goff@boeing.com>
Date: Mon, 22 Mar 2010 12:06:46 -0700

> So maybe it makes more sense to change these if that's more consistent
> with other cases.

Yes, it does.  The canonical place to set ->iflink by hand
is the ->ndo_init() method of the device.

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

end of thread, other threads:[~2010-03-23  3:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-20  1:39 [PATCH] netdev: don't always reset iflink when registering Tom Goff
2010-03-22 17:42 ` Patrick McHardy
2010-03-22 19:06   ` Goff, Thomas
2010-03-23  3:20     ` David Miller

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 read-only IMAP folder(s) and NNTP newsgroup(s).