aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopa Prabhu <roopa@cumulusnetworks.com>2017-01-23 23:44:32 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-24 15:01:57 -0500
commit8b3f9337e17aaf710c79e65fd0a3c572a075f498 (patch)
treeecdd22bb295bc745f806446d9636c5d4bcc474d1
parenta824d0b83109eb3e3ad44c489543831bc15f7166 (diff)
vxlan: don't flush static fdb entries on admin down
This patch skips flushing static fdb entries in ndo_stop, but flushes all fdb entries during vxlan device delete. This is consistent with the bridge driver fdb Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/vxlan.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8a79cfcac889..746a819f0a41 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2354,7 +2354,7 @@ static int vxlan_open(struct net_device *dev)
2354} 2354}
2355 2355
2356/* Purge the forwarding table */ 2356/* Purge the forwarding table */
2357static void vxlan_flush(struct vxlan_dev *vxlan) 2357static void vxlan_flush(struct vxlan_dev *vxlan, bool do_all)
2358{ 2358{
2359 unsigned int h; 2359 unsigned int h;
2360 2360
@@ -2364,6 +2364,8 @@ static void vxlan_flush(struct vxlan_dev *vxlan)
2364 hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) { 2364 hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) {
2365 struct vxlan_fdb *f 2365 struct vxlan_fdb *f
2366 = container_of(p, struct vxlan_fdb, hlist); 2366 = container_of(p, struct vxlan_fdb, hlist);
2367 if (!do_all && (f->state & (NUD_PERMANENT | NUD_NOARP)))
2368 continue;
2367 /* the all_zeros_mac entry is deleted at vxlan_uninit */ 2369 /* the all_zeros_mac entry is deleted at vxlan_uninit */
2368 if (!is_zero_ether_addr(f->eth_addr)) 2370 if (!is_zero_ether_addr(f->eth_addr))
2369 vxlan_fdb_destroy(vxlan, f); 2371 vxlan_fdb_destroy(vxlan, f);
@@ -2385,7 +2387,7 @@ static int vxlan_stop(struct net_device *dev)
2385 2387
2386 del_timer_sync(&vxlan->age_timer); 2388 del_timer_sync(&vxlan->age_timer);
2387 2389
2388 vxlan_flush(vxlan); 2390 vxlan_flush(vxlan, false);
2389 vxlan_sock_release(vxlan); 2391 vxlan_sock_release(vxlan);
2390 2392
2391 return ret; 2393 return ret;
@@ -3058,6 +3060,8 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head)
3058 struct vxlan_dev *vxlan = netdev_priv(dev); 3060 struct vxlan_dev *vxlan = netdev_priv(dev);
3059 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); 3061 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
3060 3062
3063 vxlan_flush(vxlan, true);
3064
3061 spin_lock(&vn->sock_lock); 3065 spin_lock(&vn->sock_lock);
3062 if (!hlist_unhashed(&vxlan->hlist)) 3066 if (!hlist_unhashed(&vxlan->hlist))
3063 hlist_del_rcu(&vxlan->hlist); 3067 hlist_del_rcu(&vxlan->hlist);