summaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-01-03 23:48:50 +0100
committerDavid S. Miller <davem@davemloft.net>2013-01-04 22:31:49 +0100
commit7cd43db77eed83ce9c2086edb402748256e05f14 (patch)
tree3deef53e843a46181bd9042ca336445826c3c3b3 /drivers/net/macvlan.c
parentnet: introduce upper device lists (diff)
downloadlinux-7cd43db77eed83ce9c2086edb402748256e05f14.tar.xz
linux-7cd43db77eed83ce9c2086edb402748256e05f14.zip
macvlan: add link to upper device
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r--drivers/net/macvlan.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 80c6f927a7b4..0ae45182f40d 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -764,16 +764,22 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN);
}
+ err = netdev_upper_dev_link(lowerdev, dev);
+ if (err)
+ goto destroy_port;
+
port->count += 1;
err = register_netdevice(dev);
if (err < 0)
- goto destroy_port;
+ goto upper_dev_unlink;
list_add_tail(&vlan->list, &port->vlans);
netif_stacked_transfer_operstate(lowerdev, dev);
return 0;
+upper_dev_unlink:
+ netdev_upper_dev_unlink(lowerdev, dev);
destroy_port:
port->count -= 1;
if (!port->count)
@@ -797,6 +803,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head)
list_del(&vlan->list);
unregister_netdevice_queue(dev, head);
+ netdev_upper_dev_unlink(vlan->lowerdev, dev);
}
EXPORT_SYMBOL_GPL(macvlan_dellink);