aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-05-19 12:24:16 +0000
committerDavid S. Miller <davem@davemloft.net>2011-05-20 00:33:18 -0400
commit449f4544267e73d5db372971da63634707c32299 (patch)
treeacee6de13f34c179ec46ef7f8a49e66b229f4460 /drivers
parent034cfe48d0efc248ba4b725e3a94b95e76fbc5d3 (diff)
macvlan: remove one synchronize_rcu() call
When one macvlan device is dismantled, we can avoid one synchronize_rcu() call done after deletion from hash list, since caller will perform a synchronize_net() call after its ndo_stop() call. Add a new netdev->dismantle field to signal this dismantle intent. Reduces RTNL hold time. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Patrick McHardy <kaber@trash.net> CC: Ben Greear <greearb@candelatech.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/macvlan.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index d7c0bc62da7..07bcb8084d7 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -70,16 +70,17 @@ static void macvlan_hash_add(struct macvlan_dev *vlan)
hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[addr[5]]);
}
-static void macvlan_hash_del(struct macvlan_dev *vlan)
+static void macvlan_hash_del(struct macvlan_dev *vlan, bool sync)
{
hlist_del_rcu(&vlan->hlist);
- synchronize_rcu();
+ if (sync)
+ synchronize_rcu();
}
static void macvlan_hash_change_addr(struct macvlan_dev *vlan,
const unsigned char *addr)
{
- macvlan_hash_del(vlan);
+ macvlan_hash_del(vlan, true);
/* Now that we are unhashed it is safe to change the device
* address without confusing packet delivery.
*/
@@ -345,7 +346,7 @@ static int macvlan_stop(struct net_device *dev)
dev_uc_del(lowerdev, dev->dev_addr);
hash_del:
- macvlan_hash_del(vlan);
+ macvlan_hash_del(vlan, !dev->dismantle);
return 0;
}