Subject: Re: [2.6 patch] drivers/net/loopback.c: convert to module_init()

From: Adrian Bunk <[email-masked]>
Date: Wed, 13 Dec 2006 20:36:23 +0100

On Wed, Dec 13, 2006 at 11:08:01AM -0800, Stephen Hemminger wrote:
> On Tue, 12 Dec 2006 17:17:56 -0800 (PST)
> David Miller <[email-masked]> wrote:
> 
> > From: Adrian Bunk <[email-masked]>
> > Date: Tue, 12 Dec 2006 17:24:35 +0100
> > 
> > > This patch converts drivers/net/loopback.c to using module_init().
> > > 
> > > Signed-off-by: Adrian Bunk <[email-masked]>
> > 
> > I'm not %100 sure of this one, let's look at the comment you
> > are deleting:
> > 
> > > -/*
> > > - *	The loopback device is global so it can be directly referenced
> > > - *	by the network code. Also, it must be first on device list.
> > > - */
> > > -extern int loopback_init(void);
> > > -
> > 
> > in particular notice the part that says "it must be first on the
> > device list".
> > 
> > I'm not sure whether that is important any longer.  It probably isn't,
> > but we should verify it before applying such a patch.
> > 
> > Since module_init() effectively == device_initcall() for statically
> > built objects, which loopback always is, the Makefile ordering does
> > not seem to indicate to me that there is anything guarenteeing
> > this "first on the list" invariant.  At least not via object
> > file ordering.
> > 
> > So this gives some support to the idea that loopback_dev's position
> > on the device list no longer matters.
> 
> The dst code makes assumptions that loopback is ifindex 1 as well.
>...

But that assumption is already false for drivers not handled by Space.c:

E.g. on my computer [1], eth0 [2] has ifindex 1 and lo has ifindex 2.

cu
Adrian

[1] plain 2.6.16.36
[2] built-in e100 driver

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed