net/mlx5: DR, Fix the threshold that defines when pool sync is initiated
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Wed, 29 Dec 2021 20:22:05 +0000 (22:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2022 10:48:00 +0000 (11:48 +0100)
commitd4d188487ddc257fc16821380fbd6fc42d28944a
tree6592386c8683498025ad9de9dc81cf4f030899fd
parent9703a9e2f968a4527519836e20b1698e6ac23b71
net/mlx5: DR, Fix the threshold that defines when pool sync is initiated

commit ecd9c5cd46e013659e2fad433057bad1ba66888e upstream.

When deciding whether to start syncing and actually free all the "hot"
ICM chunks, we need to consider the type of the ICM chunks that we're
dealing with. For instance, the amount of available ICM for MODIFY_ACTION
is significantly lower than the usual STE ICM, so the threshold should
account for that - otherwise we can deplete MODIFY_ACTION memory just by
creating and deleting the same modify header action in a continuous loop.

This patch replaces the hard-coded threshold with a dynamic value.

Fixes: 1c58651412bb ("net/mlx5: DR, ICM memory pools sync optimization")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c