mlxsw: spectrum_router: Prepare function for router lock introduction
authorIdo Schimmel <idosch@mellanox.com>
Thu, 20 Feb 2020 07:07:56 +0000 (09:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Feb 2020 18:04:34 +0000 (10:04 -0800)
The function removes the FDB entry that directs the macvlan's MAC to the
router port. It is called from both the netdev notifier block and the
inetaddr notifier block that will soon hold the router lock.

Make sure that only the netdev notifier calls the exported version, so
that is will take the router lock, which will already be held by the
inetaddr notifier.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 000aa68e7e316b2935c340b86612c9c3f2e5b356..e18d54ad6d8782d1c9259a5a44279d501b9665d3 100644 (file)
@@ -6873,8 +6873,8 @@ err_rif_vrrp_add:
        return err;
 }
 
-void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp,
-                             const struct net_device *macvlan_dev)
+static void __mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp,
+                                      const struct net_device *macvlan_dev)
 {
        struct macvlan_dev *vlan = netdev_priv(macvlan_dev);
        struct mlxsw_sp_rif *rif;
@@ -6891,6 +6891,12 @@ void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp,
                            mlxsw_sp_fid_index(rif->fid), false);
 }
 
+void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp,
+                             const struct net_device *macvlan_dev)
+{
+       __mlxsw_sp_rif_macvlan_del(mlxsw_sp, macvlan_dev);
+}
+
 static int mlxsw_sp_inetaddr_macvlan_event(struct mlxsw_sp *mlxsw_sp,
                                           struct net_device *macvlan_dev,
                                           unsigned long event,
@@ -6900,7 +6906,7 @@ static int mlxsw_sp_inetaddr_macvlan_event(struct mlxsw_sp *mlxsw_sp,
        case NETDEV_UP:
                return mlxsw_sp_rif_macvlan_add(mlxsw_sp, macvlan_dev, extack);
        case NETDEV_DOWN:
-               mlxsw_sp_rif_macvlan_del(mlxsw_sp, macvlan_dev);
+               __mlxsw_sp_rif_macvlan_del(mlxsw_sp, macvlan_dev);
                break;
        }