Skip to content

Commit d7263ab

Browse files
nirdotandavem330
authored andcommitted
mlxsw: spectrum_acl: Limit priority value
In Spectrum-2, higher priority value wins and priority valid values are in the range of {1,cap_kvd_size-1}. mlxsw_sp_acl_tcam_priority_get converts from lower-bound priorities alike tc flower to Spectrum-2 HW range. Up until now tc flower did not provide priority 0 or reached the maximal value, however multicast routing does provide priority 0. Therefore, Change mlxsw_sp_acl_tcam_priority_get to verify priority is in the correct range. Make sure priority is never set to zero and never exceeds the maximal allowed value. Signed-off-by: Nir Dotan <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c20580c commit d7263ab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ int mlxsw_sp_acl_tcam_priority_get(struct mlxsw_sp *mlxsw_sp,
9595
if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, KVD_SIZE))
9696
return -EIO;
9797

98-
max_priority = MLXSW_CORE_RES_GET(mlxsw_sp->core, KVD_SIZE);
99-
if (rulei->priority > max_priority)
98+
/* Priority range is 1..cap_kvd_size-1. */
99+
max_priority = MLXSW_CORE_RES_GET(mlxsw_sp->core, KVD_SIZE) - 1;
100+
if (rulei->priority >= max_priority)
100101
return -EINVAL;
101102

102103
/* Unlike in TC, in HW, higher number means higher priority. */

0 commit comments

Comments
 (0)