aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2020-05-26 02:05:51 +0300
committerDavid S. Miller <davem@davemloft.net>2020-05-26 20:33:58 -0700
commitb87bde80daf77649efba90ef0b1079b84be92d39 (patch)
treec3c6b78039ee39dd72f696954bf1349dab87bb9e /drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h
parentmlxsw: switchx2: Move SwitchX-2 trap groups out of main enum (diff)
downloadwireguard-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.h2
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 */
};