bridge: Add SWITCHDEV_FDB_FLUSH_TO_BRIDGE notifier
authorAlexandra Winter <wintera@linux.ibm.com>
Thu, 10 Sep 2020 17:23:48 +0000 (19:23 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Sep 2020 20:21:47 +0000 (13:21 -0700)
so the switchdev can notifiy the bridge to flush non-permanent fdb entries
for this port. This is useful whenever the hardware fdb of the switchdev
is reset, but the netdev and the bridgeport are not deleted.

Note that this has the same effect as the IFLA_BRPORT_FLUSH attribute.

CC: Jiri Pirko <jiri@resnulli.us>
CC: Ivan Vecera <ivecera@redhat.com>
CC: Roopa Prabhu <roopa@nvidia.com>
CC: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Acked-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/switchdev.h
net/bridge/br.c

index ff22469143013c288cd2b902a1374b4e5d2d76c5..53e8b4994296d5badfaeb6ce12728ba5ea11b30a 100644 (file)
@@ -203,6 +203,7 @@ enum switchdev_notifier_type {
        SWITCHDEV_FDB_ADD_TO_DEVICE,
        SWITCHDEV_FDB_DEL_TO_DEVICE,
        SWITCHDEV_FDB_OFFLOADED,
+       SWITCHDEV_FDB_FLUSH_TO_BRIDGE,
 
        SWITCHDEV_PORT_OBJ_ADD, /* Blocking. */
        SWITCHDEV_PORT_OBJ_DEL, /* Blocking. */
index b6fe30e3768f8a6d212cd1a3e92f63cf582a47a7..401eeb9142eb614f10fb489fafbf1a4f5ba11c34 100644 (file)
@@ -183,6 +183,11 @@ static int br_switchdev_event(struct notifier_block *unused,
                br_fdb_offloaded_set(br, p, fdb_info->addr,
                                     fdb_info->vid, fdb_info->offloaded);
                break;
+       case SWITCHDEV_FDB_FLUSH_TO_BRIDGE:
+               fdb_info = ptr;
+               /* Don't delete static entries */
+               br_fdb_delete_by_port(br, p, fdb_info->vid, 0);
+               break;
        }
 
 out: