public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech•com>
To: Stephen Hemminger <shemminger@osdl•org>
Cc: Stefan Rompf <stefan@loplof•de>,
	Patrick McHardy <kaber@trash•net>,
	Linux Netdev List <netdev@vger•kernel.org>
Subject: Re: [RFC] vlan handling of up/down
Date: Tue, 11 Jul 2006 14:47:49 -0700	[thread overview]
Message-ID: <44B41C85.3040305@candelatech.com> (raw)
In-Reply-To: <20060711142808.1a6a47bb@dxpl.pdx.osdl.net>

Stephen Hemminger wrote:
> Untested, but here is the basic idea of how I think up/down should be
> handled.  Basically, rather than changing the flags directly the VLAN code
> should call dev_open/dev_close.  The notifier end's up recursively calling
> but this is okay.
> 
> 
> --- vlan.orig/net/8021q/vlan.c
> +++ vlan/net/8021q/vlan.c
> @@ -427,7 +427,7 @@ static struct net_device *register_vlan_
>  	/* The real device must be up and operating in order to
>  	 * assosciate a VLAN device with it.
>  	 */
> -	if (!(real_dev->flags & IFF_UP))
> +	if (!netif_running(real_dev))
>  		goto out_unlock;

I can't remember why I thought this check was a good idea..but is there
any reason to keep it in?  I mean, why not allow attaching VLANs to a
'down' device?

>  	if (__find_vlan_dev(real_dev, VLAN_ID) != NULL) {
> @@ -476,10 +476,7 @@ static struct net_device *register_vlan_
>  	printk(VLAN_DBG "Allocated new name -:%s:-\n", new_dev->name);
>  #endif
>  	/* IFF_BROADCAST|IFF_MULTICAST; ??? */
> -	new_dev->flags = real_dev->flags;
> -	new_dev->flags &= ~IFF_UP;
> -
> -	new_dev->state = real_dev->state & ~(1<<__LINK_STATE_START);
> +	new_dev->flags = real_dev->flags & ~IFF_UP;
>  
>  	/* need 4 bytes for extra VLAN header info,
>  	 * hope the underlying device can handle it.
> @@ -566,6 +563,9 @@ static struct net_device *register_vlan_
>  	if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
>  		real_dev->vlan_rx_add_vid(real_dev, VLAN_ID);
>  
> +	/* Real device is up so bring up the vlan */
> +	dev_open(new_dev);
> +
>  	rtnl_unlock();

Assuming we take out the 'is-up' check above, this would need
a check added here (if real-dev is up, then bring up vlan, else leave it down.)

> @@ -624,11 +624,7 @@ static int vlan_device_event(struct noti
>  			if (!vlandev)
>  				continue;
>  
> -			flgs = vlandev->flags;
> -			if (!(flgs & IFF_UP))
> -				continue;
> -
> -			dev_change_flags(vlandev, flgs & ~IFF_UP);
> +			dev_close(vlandev);
>  		}
>  		break;
>  
> @@ -638,12 +634,8 @@ static int vlan_device_event(struct noti
>  			vlandev = grp->vlan_devices[i];
>  			if (!vlandev)
>  				continue;
> -				
> -			flgs = vlandev->flags;
> -			if (flgs & IFF_UP)
> -				continue;
>  
> -			dev_change_flags(vlandev, flgs | IFF_UP);
> +			dev_open(vlandev);
>  		}
>  		break;

Although it may be too late to change this (don't want to change
user-visible behaviour), I don't really like that bouncing the
real-dev could cause the VLANs to come up, even if previously
user-space had forced them down.

Perhaps a piece of state in the vlan dev could be added to remember
the 'desired state', and then only bring back up interfaces that are
desired-up when the real-dev comes back online....

Ben

-- 
Ben Greear <greearb@candelatech•com>
Candela Technologies Inc  http://www.candelatech.com


  reply	other threads:[~2006-07-11 21:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200603211829.k2LITMNR029085@hera.kernel.org>
2006-07-04 10:07 ` [VLAN]: translate IF_OPER_DORMANT to netif_dormant_on() Patrick McHardy
2006-07-05 18:57   ` Stefan Rompf
2006-07-05 21:00     ` Patrick McHardy
2006-07-05 21:17       ` Ben Greear
2006-07-06  7:42         ` Patrick McHardy
2006-07-07  9:45           ` Stefan Rompf
2006-07-07  9:56             ` Patrick McHardy
2006-07-07 21:33               ` Stephen Hemminger
2006-07-09  8:49                 ` Stefan Rompf
2006-07-09 18:48                   ` David Miller
2006-07-09 20:05                     ` Krzysztof Halasa
2006-07-10  0:29                       ` David Miller
2006-07-10 11:39                         ` Krzysztof Halasa
2006-07-10  6:17                       ` Stefan Rompf
2006-07-10 12:01                         ` Krzysztof Halasa
2006-07-10 21:58                           ` Stefan Rompf
2006-07-10 16:56                   ` Stephen Hemminger
2006-07-10 17:02                     ` Ben Greear
2006-07-10 22:01                     ` Stefan Rompf
2006-07-11 21:28                       ` [RFC] vlan handling of up/down Stephen Hemminger
2006-07-11 21:47                         ` Ben Greear [this message]
2006-07-11 22:19                         ` Stefan Rompf
2006-07-11 22:07               ` [VLAN]: translate IF_OPER_DORMANT to netif_dormant_on() Stefan Rompf
2006-07-11 22:15               ` Repost: " Stefan Rompf
2006-07-12  6:50                 ` Patrick McHardy
2006-07-19 12:42                 ` Patrick McHardy
2006-07-24 20:52                   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44B41C85.3040305@candelatech.com \
    --to=greearb@candelatech$(echo .)com \
    --cc=kaber@trash$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=shemminger@osdl$(echo .)org \
    --cc=stefan@loplof$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox