Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7263ab3 authored by Nir Dotan's avatar Nir Dotan Committed by David S. Miller
Browse files

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: default avatarNir Dotan <nird@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c20580c2
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -95,8 +95,9 @@ int mlxsw_sp_acl_tcam_priority_get(struct mlxsw_sp *mlxsw_sp,
	if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, KVD_SIZE))
	if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, KVD_SIZE))
		return -EIO;
		return -EIO;


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


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