diff options
author | Ido Schimmel <idosch@mellanox.com> | 2020-05-26 02:05:51 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-05-26 20:33:58 -0700 |
commit | b87bde80daf77649efba90ef0b1079b84be92d39 (patch) | |
tree | c3c6b78039ee39dd72f696954bf1349dab87bb9e /drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h | |
parent | mlxsw: switchx2: Move SwitchX-2 trap groups out of main enum (diff) | |
download | wireguard-linux-b87bde80daf77649efba90ef0b1079b84be92d39.tar.xz wireguard-linux-b87bde80daf77649efba90ef0b1079b84be92d39.zip |
mlxsw: spectrum_trap: Do not hard code "thin" policer identifier
As explained in commit e612523041ab ("mlxsw: spectrum_trap: Introduce
dummy group with thin policer"), the purpose of the "thin" policer is to
pass as less packets as possible to the CPU.
The identifier of this policer is currently set according to the maximum
number of used trap groups, but this is fragile: On Spectrum-1 the
maximum number of policers is less than the maximum number of trap
groups, which might result in an invalid policer identifier in case the
number of used trap groups grows beyond the policer limit.
Solve this by dynamically allocating the policer identifier.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h index 759146897b3a..13ac412f4d53 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h @@ -17,6 +17,8 @@ struct mlxsw_sp_trap { struct mlxsw_sp_trap_item *trap_items_arr; u64 traps_count; /* Number of registered traps */ + u16 thin_policer_hw_id; + u64 max_policers; unsigned long policers_usage[]; /* Usage bitmap */ }; |