mlxsw: spectrum: Delete RIF when VLAN device is removed
authorIdo Schimmel <idosch@mellanox.com>
Thu, 4 Oct 2018 15:48:03 +0000 (15:48 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Oct 2018 16:53:03 +0000 (09:53 -0700)
In commit 602b74eda813 ("mlxsw: spectrum_switchdev: Do not leak RIFs
when removing bridge") I handled the case where RIFs created for VLAN
devices were not properly cleaned up when their real device (a bridge)
was removed.

However, I forgot to handle the case of the VLAN device itself being
removed. Do so now when the VLAN device is being unlinked from its real
device.

Fixes: 99f44bb3527b ("mlxsw: spectrum: Enable L3 interfaces on top of bridge devices")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reported-by: Artem Shvorin <art@qrator.net>
Tested-by: Artem Shvorin <art@qrator.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c

index b492152c8881bdd41a56f0a2b361a4b6bb86e40d..30bb2c533cecc42c5c75b3f21b36d2150baac083 100644 (file)
@@ -4845,6 +4845,8 @@ static int mlxsw_sp_netdevice_bridge_event(struct net_device *br_dev,
                upper_dev = info->upper_dev;
                if (info->linking)
                        break;
+               if (is_vlan_dev(upper_dev))
+                       mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, upper_dev);
                if (netif_is_macvlan(upper_dev))
                        mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev);
                break;