diff options
author | Patrick Mullaney <pmullaney@novell.com> | 2009-12-03 18:59:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-03 18:59:22 -0500 |
commit | fc4a7489663250360cd40d5adf06a08d1c5d54df (patch) | |
tree | ce8fed0a2dfc175b03834bb94717f5f2970c9146 /net/8021q | |
parent | 012093f6d5d89e6ed6e89c55c383f84b1cff7a78 (diff) |
netdevice: provide common routine for macvlan and vlan operstate management
Provide common routine for the transition of operational state for a leaf
device during a root device transition.
Signed-off-by: Patrick Mullaney <pmullaney@novell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r-- | net/8021q/vlan.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index ec3769295dac..33f90e7362cc 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -184,27 +184,6 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head) | |||
184 | dev_put(real_dev); | 184 | dev_put(real_dev); |
185 | } | 185 | } |
186 | 186 | ||
187 | static void vlan_transfer_operstate(const struct net_device *dev, | ||
188 | struct net_device *vlandev) | ||
189 | { | ||
190 | /* Have to respect userspace enforced dormant state | ||
191 | * of real device, also must allow supplicant running | ||
192 | * on VLAN device | ||
193 | */ | ||
194 | if (dev->operstate == IF_OPER_DORMANT) | ||
195 | netif_dormant_on(vlandev); | ||
196 | else | ||
197 | netif_dormant_off(vlandev); | ||
198 | |||
199 | if (netif_carrier_ok(dev)) { | ||
200 | if (!netif_carrier_ok(vlandev)) | ||
201 | netif_carrier_on(vlandev); | ||
202 | } else { | ||
203 | if (netif_carrier_ok(vlandev)) | ||
204 | netif_carrier_off(vlandev); | ||
205 | } | ||
206 | } | ||
207 | |||
208 | int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id) | 187 | int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id) |
209 | { | 188 | { |
210 | const char *name = real_dev->name; | 189 | const char *name = real_dev->name; |
@@ -262,7 +241,7 @@ int register_vlan_dev(struct net_device *dev) | |||
262 | /* Account for reference in struct vlan_dev_info */ | 241 | /* Account for reference in struct vlan_dev_info */ |
263 | dev_hold(real_dev); | 242 | dev_hold(real_dev); |
264 | 243 | ||
265 | vlan_transfer_operstate(real_dev, dev); | 244 | netif_stacked_transfer_operstate(real_dev, dev); |
266 | linkwatch_fire_event(dev); /* _MUST_ call rfc2863_policy() */ | 245 | linkwatch_fire_event(dev); /* _MUST_ call rfc2863_policy() */ |
267 | 246 | ||
268 | /* So, got the sucker initialized, now lets place | 247 | /* So, got the sucker initialized, now lets place |
@@ -453,7 +432,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
453 | if (!vlandev) | 432 | if (!vlandev) |
454 | continue; | 433 | continue; |
455 | 434 | ||
456 | vlan_transfer_operstate(dev, vlandev); | 435 | netif_stacked_transfer_operstate(dev, vlandev); |
457 | } | 436 | } |
458 | break; | 437 | break; |
459 | 438 | ||
@@ -511,7 +490,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
511 | vlan = vlan_dev_info(vlandev); | 490 | vlan = vlan_dev_info(vlandev); |
512 | if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING)) | 491 | if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING)) |
513 | dev_change_flags(vlandev, flgs & ~IFF_UP); | 492 | dev_change_flags(vlandev, flgs & ~IFF_UP); |
514 | vlan_transfer_operstate(dev, vlandev); | 493 | netif_stacked_transfer_operstate(dev, vlandev); |
515 | } | 494 | } |
516 | break; | 495 | break; |
517 | 496 | ||
@@ -529,7 +508,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
529 | vlan = vlan_dev_info(vlandev); | 508 | vlan = vlan_dev_info(vlandev); |
530 | if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING)) | 509 | if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING)) |
531 | dev_change_flags(vlandev, flgs | IFF_UP); | 510 | dev_change_flags(vlandev, flgs | IFF_UP); |
532 | vlan_transfer_operstate(dev, vlandev); | 511 | netif_stacked_transfer_operstate(dev, vlandev); |
533 | } | 512 | } |
534 | break; | 513 | break; |
535 | 514 | ||