bridge: defer switchdev fdb del call in fdb_del_external_learn
authorJiri Pirko <jiri@mellanox.com>
Wed, 14 Oct 2015 17:40:53 +0000 (19:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 Oct 2015 13:09:50 +0000 (06:09 -0700)
Since spinlock is held here, defer the switchdev operation. Also, ensure
that defered switchdev ops are processed before port master device
is unlinked.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_fdb.c
net/bridge/br_if.c

index f5e7da0fe93b549d2a9c249f18498b5f9ca353ec..c88bd8e8937eac5c23c6fb0b6f8e807c337c2596 100644 (file)
@@ -134,7 +134,10 @@ static void fdb_del_hw_addr(struct net_bridge *br, const unsigned char *addr)
 static void fdb_del_external_learn(struct net_bridge_fdb_entry *f)
 {
        struct switchdev_obj_port_fdb fdb = {
-               .obj.id = SWITCHDEV_OBJ_ID_PORT_FDB,
+               .obj = {
+                       .id = SWITCHDEV_OBJ_ID_PORT_FDB,
+                       .flags = SWITCHDEV_F_DEFER,
+               },
                .vid = f->vlan_id,
        };
 
index 45e4757c6fd25ed05a14e24e2d026204c3e79506..ec02f5869a780246dd22030dfe66efa6d5e5f8da 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <net/sock.h>
 #include <linux/if_vlan.h>
+#include <net/switchdev.h>
 
 #include "br_private.h"
 
@@ -250,6 +251,8 @@ static void del_nbp(struct net_bridge_port *p)
 
        nbp_vlan_flush(p);
        br_fdb_delete_by_port(br, p, 0, 1);
+       switchdev_deferred_process();
+
        nbp_update_port_count(br);
 
        netdev_upper_dev_unlink(dev, br->dev);