aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r--drivers/net/macvlan.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 860d75d81f82..efbc15567dd3 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -189,12 +189,20 @@ static int macvlan_open(struct net_device *dev)
189 189
190 err = dev_unicast_add(lowerdev, dev->dev_addr, ETH_ALEN); 190 err = dev_unicast_add(lowerdev, dev->dev_addr, ETH_ALEN);
191 if (err < 0) 191 if (err < 0)
192 return err; 192 goto out;
193 if (dev->flags & IFF_ALLMULTI) 193 if (dev->flags & IFF_ALLMULTI) {
194 dev_set_allmulti(lowerdev, 1); 194 err = dev_set_allmulti(lowerdev, 1);
195 if (err < 0)
196 goto del_unicast;
197 }
195 198
196 hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[dev->dev_addr[5]]); 199 hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[dev->dev_addr[5]]);
197 return 0; 200 return 0;
201
202del_unicast:
203 dev_unicast_delete(lowerdev, dev->dev_addr, ETH_ALEN);
204out:
205 return err;
198} 206}
199 207
200static int macvlan_stop(struct net_device *dev) 208static int macvlan_stop(struct net_device *dev)
@@ -277,6 +285,19 @@ static struct lock_class_key macvlan_netdev_xmit_lock_key;
277#define MACVLAN_STATE_MASK \ 285#define MACVLAN_STATE_MASK \
278 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) 286 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
279 287
288static void macvlan_set_lockdep_class_one(struct net_device *dev,
289 struct netdev_queue *txq,
290 void *_unused)
291{
292 lockdep_set_class(&txq->_xmit_lock,
293 &macvlan_netdev_xmit_lock_key);
294}
295
296static void macvlan_set_lockdep_class(struct net_device *dev)
297{
298 netdev_for_each_tx_queue(dev, macvlan_set_lockdep_class_one, NULL);
299}
300
280static int macvlan_init(struct net_device *dev) 301static int macvlan_init(struct net_device *dev)
281{ 302{
282 struct macvlan_dev *vlan = netdev_priv(dev); 303 struct macvlan_dev *vlan = netdev_priv(dev);
@@ -287,7 +308,8 @@ static int macvlan_init(struct net_device *dev)
287 dev->features = lowerdev->features & MACVLAN_FEATURES; 308 dev->features = lowerdev->features & MACVLAN_FEATURES;
288 dev->iflink = lowerdev->ifindex; 309 dev->iflink = lowerdev->ifindex;
289 310
290 lockdep_set_class(&dev->_xmit_lock, &macvlan_netdev_xmit_lock_key); 311 macvlan_set_lockdep_class(dev);
312
291 return 0; 313 return 0;
292} 314}
293 315