Skip to content

Commit b73ef0e

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum_nve: Add mlxsw_sp_nve_ops.fdb_clear_offload
If there are any offloaded FDB entries at an NVE device at the time that it's un-offloaded, their offloaded marks need to be cleared. How that is done depends on NVE device type, and therefore add a per-NVE-type operation. Implement the operation for the sole NVE device type currently supported by mlxsw, VXLAN. Signed-off-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a6ef5a4 commit b73ef0e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct mlxsw_sp_nve_ops {
4242
const struct mlxsw_sp_nve_config *config);
4343
void (*fini)(struct mlxsw_sp_nve *nve);
4444
int (*fdb_replay)(const struct net_device *nve_dev, __be32 vni);
45+
void (*fdb_clear_offload)(const struct net_device *nve_dev, __be32 vni);
4546
};
4647

4748
extern const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops;

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,22 @@ mlxsw_sp_nve_vxlan_fdb_replay(const struct net_device *nve_dev, __be32 vni)
219219
return vxlan_fdb_replay(nve_dev, vni, &mlxsw_sp_switchdev_notifier);
220220
}
221221

222+
static void
223+
mlxsw_sp_nve_vxlan_clear_offload(const struct net_device *nve_dev, __be32 vni)
224+
{
225+
if (WARN_ON(!netif_is_vxlan(nve_dev)))
226+
return;
227+
vxlan_fdb_clear_offload(nve_dev, vni);
228+
}
229+
222230
const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops = {
223231
.type = MLXSW_SP_NVE_TYPE_VXLAN,
224232
.can_offload = mlxsw_sp1_nve_vxlan_can_offload,
225233
.nve_config = mlxsw_sp_nve_vxlan_config,
226234
.init = mlxsw_sp1_nve_vxlan_init,
227235
.fini = mlxsw_sp1_nve_vxlan_fini,
228236
.fdb_replay = mlxsw_sp_nve_vxlan_fdb_replay,
237+
.fdb_clear_offload = mlxsw_sp_nve_vxlan_clear_offload,
229238
};
230239

231240
static bool mlxsw_sp2_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,
@@ -252,4 +261,5 @@ const struct mlxsw_sp_nve_ops mlxsw_sp2_nve_vxlan_ops = {
252261
.init = mlxsw_sp2_nve_vxlan_init,
253262
.fini = mlxsw_sp2_nve_vxlan_fini,
254263
.fdb_replay = mlxsw_sp_nve_vxlan_fdb_replay,
264+
.fdb_clear_offload = mlxsw_sp_nve_vxlan_clear_offload,
255265
};

0 commit comments

Comments
 (0)