Skip to content

Commit a6ef5a4

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum_nve: Add mlxsw_sp_nve_ops.fdb_replay
A replay of FDB needs to be performed so that the FDB entries existing at the NVE device are offloaded. How the replay 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 34139ed commit a6ef5a4

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
@@ -41,6 +41,7 @@ struct mlxsw_sp_nve_ops {
4141
int (*init)(struct mlxsw_sp_nve *nve,
4242
const struct mlxsw_sp_nve_config *config);
4343
void (*fini)(struct mlxsw_sp_nve *nve);
44+
int (*fdb_replay)(const struct net_device *nve_dev, __be32 vni);
4445
};
4546

4647
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
@@ -211,12 +211,21 @@ static void mlxsw_sp1_nve_vxlan_fini(struct mlxsw_sp_nve *nve)
211211
config->udp_dport);
212212
}
213213

214+
static int
215+
mlxsw_sp_nve_vxlan_fdb_replay(const struct net_device *nve_dev, __be32 vni)
216+
{
217+
if (WARN_ON(!netif_is_vxlan(nve_dev)))
218+
return -EINVAL;
219+
return vxlan_fdb_replay(nve_dev, vni, &mlxsw_sp_switchdev_notifier);
220+
}
221+
214222
const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops = {
215223
.type = MLXSW_SP_NVE_TYPE_VXLAN,
216224
.can_offload = mlxsw_sp1_nve_vxlan_can_offload,
217225
.nve_config = mlxsw_sp_nve_vxlan_config,
218226
.init = mlxsw_sp1_nve_vxlan_init,
219227
.fini = mlxsw_sp1_nve_vxlan_fini,
228+
.fdb_replay = mlxsw_sp_nve_vxlan_fdb_replay,
220229
};
221230

222231
static bool mlxsw_sp2_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,
@@ -242,4 +251,5 @@ const struct mlxsw_sp_nve_ops mlxsw_sp2_nve_vxlan_ops = {
242251
.nve_config = mlxsw_sp_nve_vxlan_config,
243252
.init = mlxsw_sp2_nve_vxlan_init,
244253
.fini = mlxsw_sp2_nve_vxlan_fini,
254+
.fdb_replay = mlxsw_sp_nve_vxlan_fdb_replay,
245255
};

0 commit comments

Comments
 (0)