On Sun, 9 Jul 2006 10:49:31 +0200
Stefan Rompf <[EMAIL PROTECTED]> wrote:

> Am Freitag, 7. Juli 2006 23:33 schrieb Stephen Hemminger:
> 
> > Not really. The flag code last major change was to do the dormant
> > stuff that HDLC wanted.
> 
> ... and where the maintainer doesn't seem to care to use it now that the 
> infrastructure is there. Sigh.
> 
> > IMHO VLAN device's should mirror the state of the underlying physical
> > device.
> >
> > I can't really follow the thread well. What is broken?
> 
> The thread is still quite short and describes the problem, look at 
> http://marc.theaimsgroup.com/?t=115200782600004&r=1&w=2
> 
> Stefan


Okay, going back to the original problem, before the current round
of name calling. This bug shows a lot of problems with the existing
VLAN device state management.

1. I think vlan code should never be using the state bits directly at all.
It makes the code error prone if the bits ever change, and it means
that the proper callbacks are not being done. The existing 
vlan_transfer_operstate
does what you want. VLAN_LINK_STATE_MASK etc, should go.

2. The vlan device should not be marked as up when it
is registered.  Couldn't it wait for the user to bring it up?
If you want to automagically bring the device up, you need to call
dev_open() so that all the proper notifier's get called.

3. All checks for IFF_UP should be using netif_running instead.
IFF_UP is a leftover BSDism.

Instead of:

int vlan_dev_open(struct net_device *dev)
{
        if (!(VLAN_DEV_INFO(dev)->real_dev->flags & IFF_UP))
                return -ENETDOWN;

        return 0;
}

Use:
int vlan_dev_open(struct net_device *dev)
{
        return netif_running(VLAN_DEV_INFO(dev)->real_dev) ? 0 : -ENETDOWN;
}

-- 
Stephen Hemminger <[EMAIL PROTECTED]>
Quis custodiet ipsos custodes?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to