Skip to content

Commit 6dab408

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum_fid: Set NVE flood profile as part of FID configuration
The NVE flood profile is used for determining of offset applied to KVD address for NVE flood. We currently do not set it, leaving it at the default value of 0. That is not an issue: all the traffic-type-to-offset mappings (as configured by SFFP) default to offset of 0. This is what we need anyway, as mlxsw only allocates a single KVD entry for NVE underlay. The field is only relevant on Spectrum-2 and above. So to be fully consistent, we should split the existing controlled ops to Spectrum-1 and Spectrum>1 variants, with only the latter setting the field. But that seems like a lot of overhead for a single field whose meaning is "everything is the default". So instead pretend that the NVE flood profile does not exist in the controlled flood mode, like we have so far, and only set it when flood mode is CFF. Setting this at all serves dual purpose. First, it is now clear which profile belongs to NVE, because in the CFF mode, we have multiple users. This should prevent bugs in flood profile management. Second, using specifically non-zero value means there will be no valid uses of the profile 0, which we can therefore use as a sentinel. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Amit Cohen <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b2f5eb5 commit 6dab408

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ struct mlxsw_sp_fid_ops {
117117
enum mlxsw_sp_fid_flood_profile_id {
118118
MLXSW_SP_FID_FLOOD_PROFILE_ID_BRIDGE = 1,
119119
MLXSW_SP_FID_FLOOD_PROFILE_ID_RSP,
120+
MLXSW_SP_FID_FLOOD_PROFILE_ID_NVE,
120121
};
121122

122123
struct mlxsw_sp_fid_flood_profile {
@@ -560,6 +561,8 @@ static void mlxsw_sp_fid_fid_pack_cff(char *sfmr_pl,
560561
mlxsw_reg_sfmr_cff_mid_base_set(sfmr_pl, pgt_base);
561562
mlxsw_reg_sfmr_cff_prf_id_set(sfmr_pl,
562563
fid_family->flood_profile->profile_id);
564+
mlxsw_reg_sfmr_nve_flood_prf_id_set(sfmr_pl,
565+
MLXSW_SP_FID_FLOOD_PROFILE_ID_NVE);
563566
}
564567

565568
static u16 mlxsw_sp_fid_rfid_fid_offset_cff(struct mlxsw_sp *mlxsw_sp,
@@ -1321,6 +1324,20 @@ struct mlxsw_sp_fid_flood_profile mlxsw_sp_fid_rsp_flood_profile_cff = {
13211324
.profile_id = MLXSW_SP_FID_FLOOD_PROFILE_ID_RSP,
13221325
};
13231326

1327+
static const struct mlxsw_sp_flood_table mlxsw_sp_fid_nve_flood_tables_cff[] = {
1328+
{
1329+
.packet_type = MLXSW_SP_FLOOD_TYPE_ANY,
1330+
.table_index = 0,
1331+
},
1332+
};
1333+
1334+
static const
1335+
struct mlxsw_sp_fid_flood_profile mlxsw_sp_fid_nve_flood_profile_cff = {
1336+
.flood_tables = mlxsw_sp_fid_nve_flood_tables_cff,
1337+
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_nve_flood_tables_cff),
1338+
.profile_id = MLXSW_SP_FID_FLOOD_PROFILE_ID_NVE,
1339+
};
1340+
13241341
static bool
13251342
mlxsw_sp_fid_8021q_compare(const struct mlxsw_sp_fid *fid, const void *arg)
13261343
{
@@ -2422,6 +2439,7 @@ static const
24222439
struct mlxsw_sp_fid_flood_profile *mlxsw_sp_fid_flood_profiles[] = {
24232440
&mlxsw_sp_fid_8021d_flood_profile,
24242441
&mlxsw_sp_fid_rsp_flood_profile_cff,
2442+
&mlxsw_sp_fid_nve_flood_profile_cff,
24252443
};
24262444

24272445
static int

0 commit comments

Comments
 (0)