diff mbox

[cumulus-4.1.y,4/5] vxlan: don't flush static fdb entries on admin down

Message ID 1484984410-3304-4-git-send-email-roopa@cumulusnetworks.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Roopa Prabhu Jan. 21, 2017, 7:40 a.m. UTC
From: Roopa Prabhu <roopa@cumulusnetworks.com>

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>
---
 drivers/net/vxlan.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

kernel test robot Jan. 21, 2017, 9:25 a.m. UTC | #1
Hi Roopa,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.10-rc4 next-20170120]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Roopa-Prabhu/vxlan-flush-fdb-entries-on-oper-down/20170121-163042
config: x86_64-randconfig-x017-201703 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/net/vxlan.c: In function 'vxlan_netdevice_event':
   drivers/net/vxlan.c:3295:27: error: 'vxlan_netdev_ops' undeclared (first use in this function)
      if (dev->netdev_ops == &vxlan_netdev_ops) {
                              ^~~~~~~~~~~~~~~~
   drivers/net/vxlan.c:3295:27: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/vxlan.c:3297:5: error: too few arguments to function 'vxlan_flush'
        vxlan_flush(netdev_priv(dev));
        ^~~~~~~~~~~
   drivers/net/vxlan.c:2368:13: note: declared here
    static void vxlan_flush(struct vxlan_dev *vxlan, int do_all)
                ^~~~~~~~~~~

vim +/vxlan_flush +3297 drivers/net/vxlan.c

acaf4e7099 Daniel Borkmann      2014-01-13  3289  
783c146335 Daniel Borkmann      2014-01-22  3290  	if (event == NETDEV_UNREGISTER)
acaf4e7099 Daniel Borkmann      2014-01-13  3291  		vxlan_handle_lowerdev_unregister(vn, dev);
7c46a640de Alexander Duyck      2016-06-16  3292  	else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)
b7aade1548 Hannes Frederic Sowa 2016-04-18  3293  		vxlan_push_rx_ports(dev);
d8ef10fd7d Balakrishnan Raman   2017-01-20  3294  	else if (event == NETDEV_CHANGE) {
d8ef10fd7d Balakrishnan Raman   2017-01-20 @3295  		if (dev->netdev_ops == &vxlan_netdev_ops) {
d8ef10fd7d Balakrishnan Raman   2017-01-20  3296  			if (netif_running(dev) && !netif_oper_up(dev))
d8ef10fd7d Balakrishnan Raman   2017-01-20 @3297  				vxlan_flush(netdev_priv(dev));
d8ef10fd7d Balakrishnan Raman   2017-01-20  3298  		}
d8ef10fd7d Balakrishnan Raman   2017-01-20  3299  	}
acaf4e7099 Daniel Borkmann      2014-01-13  3300  

:::::: The code at line 3297 was first introduced by commit
:::::: d8ef10fd7d083cc5551d83db6317a692fee076ba vxlan: flush fdb entries on oper down

:::::: TO: Balakrishnan Raman <ramanb@cumulusnetworks.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 7300586..3314090 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2365,7 +2365,7 @@  static int vxlan_open(struct net_device *dev)
 }
 
 /* Purge the forwarding table */
-static void vxlan_flush(struct vxlan_dev *vxlan)
+static void vxlan_flush(struct vxlan_dev *vxlan, int do_all)
 {
 	unsigned int h;
 
@@ -2375,6 +2375,8 @@  static void vxlan_flush(struct vxlan_dev *vxlan)
 		hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) {
 			struct vxlan_fdb *f
 				= container_of(p, struct vxlan_fdb, hlist);
+			if (!do_all && (f->state & (NUD_PERMANENT | NUD_NOARP)))
+				continue;
 			/* the all_zeros_mac entry is deleted at vxlan_uninit */
 			if (!is_zero_ether_addr(f->eth_addr))
 				vxlan_fdb_destroy(vxlan, f);
@@ -2396,7 +2398,7 @@  static int vxlan_stop(struct net_device *dev)
 
 	del_timer_sync(&vxlan->age_timer);
 
-	vxlan_flush(vxlan);
+	vxlan_flush(vxlan, 0);
 	vxlan_sock_release(vxlan);
 
 	return ret;
@@ -3069,6 +3071,8 @@  static void vxlan_dellink(struct net_device *dev, struct list_head *head)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
 
+	vxlan_flush(vxlan, 1);
+
 	spin_lock(&vn->sock_lock);
 	if (!hlist_unhashed(&vxlan->hlist))
 		hlist_del_rcu(&vxlan->hlist);