Skip to content

Commit 413e2c0

Browse files
Amit Cohenkuba-moo
authored andcommitted
mlxsw: spectrum_switchdev: Add an internal API for VXLAN leave
There is asymmetry in how the VXLAN join and leave functions are used. The join function (mlxsw_sp_bridge_vxlan_join()) is only called in response to netdev events (e.g., VXLAN device joining a bridge), but the leave function is also called in response to switchdev events (e.g., VLAN configuration on top of the VXLAN device) in order to invalidate VNI to FID mappings. This asymmetry will cause problems when the functions will be later extended to mark VXLAN bridge ports as offloaded or not. Therefore, create an internal function (__mlxsw_sp_bridge_vxlan_leave()) that is used to invalidate VNI to FID mappings and call it from mlxsw_sp_bridge_vxlan_leave() which will only be invoked in response to netdev events, like mlxsw_sp_bridge_vxlan_join(). No functional changes intended. Signed-off-by: Amit Cohen <[email protected]> Reviewed-by: Petr Machata <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/f3a32bd2d87a0b7ac4d2bb98a427dc6d95a01cd0.1742224300.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a13fc7e commit 413e2c0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,8 +2944,8 @@ int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp,
29442944
extack);
29452945
}
29462946

2947-
void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
2948-
const struct net_device *vxlan_dev)
2947+
static void __mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
2948+
const struct net_device *vxlan_dev)
29492949
{
29502950
struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
29512951
struct mlxsw_sp_fid *fid;
@@ -2963,6 +2963,12 @@ void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
29632963
mlxsw_sp_fid_put(fid);
29642964
}
29652965

2966+
void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
2967+
const struct net_device *vxlan_dev)
2968+
{
2969+
__mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, vxlan_dev);
2970+
}
2971+
29662972
static void
29672973
mlxsw_sp_switchdev_vxlan_addr_convert(const union vxlan_addr *vxlan_addr,
29682974
enum mlxsw_sp_l3proto *proto,
@@ -3867,7 +3873,7 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp,
38673873
mlxsw_sp_fid_put(fid);
38683874
return -EINVAL;
38693875
}
3870-
mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, vxlan_dev);
3876+
__mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, vxlan_dev);
38713877
mlxsw_sp_fid_put(fid);
38723878
return 0;
38733879
}
@@ -3883,7 +3889,7 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp,
38833889
/* Fourth case: Thew new VLAN is PVID, which means the VLAN currently
38843890
* mapped to the VNI should be unmapped
38853891
*/
3886-
mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, vxlan_dev);
3892+
__mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, vxlan_dev);
38873893
mlxsw_sp_fid_put(fid);
38883894

38893895
/* Fifth case: The new VLAN is also egress untagged, which means the
@@ -3923,7 +3929,7 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp,
39233929
if (mlxsw_sp_fid_8021q_vid(fid) != vid)
39243930
goto out;
39253931

3926-
mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, vxlan_dev);
3932+
__mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, vxlan_dev);
39273933

39283934
out:
39293935
mlxsw_sp_fid_put(fid);

0 commit comments

Comments
 (0)