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 /drivers | |
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 'drivers')
-rw-r--r-- | drivers/net/macvlan.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 93c3e6edf702..21a9c9ab4b34 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -582,25 +582,6 @@ static void macvlan_port_destroy(struct net_device *dev) | |||
582 | kfree(port); | 582 | kfree(port); |
583 | } | 583 | } |
584 | 584 | ||
585 | static void macvlan_transfer_operstate(struct net_device *dev) | ||
586 | { | ||
587 | struct macvlan_dev *vlan = netdev_priv(dev); | ||
588 | const struct net_device *lowerdev = vlan->lowerdev; | ||
589 | |||
590 | if (lowerdev->operstate == IF_OPER_DORMANT) | ||
591 | netif_dormant_on(dev); | ||
592 | else | ||
593 | netif_dormant_off(dev); | ||
594 | |||
595 | if (netif_carrier_ok(lowerdev)) { | ||
596 | if (!netif_carrier_ok(dev)) | ||
597 | netif_carrier_on(dev); | ||
598 | } else { | ||
599 | if (netif_carrier_ok(dev)) | ||
600 | netif_carrier_off(dev); | ||
601 | } | ||
602 | } | ||
603 | |||
604 | static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[]) | 585 | static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[]) |
605 | { | 586 | { |
606 | if (tb[IFLA_ADDRESS]) { | 587 | if (tb[IFLA_ADDRESS]) { |
@@ -693,7 +674,7 @@ static int macvlan_newlink(struct net *src_net, struct net_device *dev, | |||
693 | return err; | 674 | return err; |
694 | 675 | ||
695 | list_add_tail(&vlan->list, &port->vlans); | 676 | list_add_tail(&vlan->list, &port->vlans); |
696 | macvlan_transfer_operstate(dev); | 677 | netif_stacked_transfer_operstate(lowerdev, dev); |
697 | return 0; | 678 | return 0; |
698 | } | 679 | } |
699 | 680 | ||
@@ -768,7 +749,8 @@ static int macvlan_device_event(struct notifier_block *unused, | |||
768 | switch (event) { | 749 | switch (event) { |
769 | case NETDEV_CHANGE: | 750 | case NETDEV_CHANGE: |
770 | list_for_each_entry(vlan, &port->vlans, list) | 751 | list_for_each_entry(vlan, &port->vlans, list) |
771 | macvlan_transfer_operstate(vlan->dev); | 752 | netif_stacked_transfer_operstate(vlan->lowerdev, |
753 | vlan->dev); | ||
772 | break; | 754 | break; |
773 | case NETDEV_FEAT_CHANGE: | 755 | case NETDEV_FEAT_CHANGE: |
774 | list_for_each_entry(vlan, &port->vlans, list) { | 756 | list_for_each_entry(vlan, &port->vlans, list) { |