]> git.ipfire.org Git - thirdparty/linux.git/commit
net/mlx5: HWS, Shrink empty matchers
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Thu, 3 Jul 2025 18:54:30 +0000 (21:54 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 8 Jul 2025 02:12:17 +0000 (19:12 -0700)
commit96e4c4a1a5bc6b6bc1ba48c6dfd2246df24f2f63
treef1d98ce8212637c1d806d6bd9ecf7a727b03d69e
parent29063103f864fb63f7f7c436e670c5804df1b55b
net/mlx5: HWS, Shrink empty matchers

Matcher size is dynamic: it starts at initial size, and then it grows
through rehash as more and more rules are added to this matcher.
When rules are deleted, matcher's size is not decreased. Rehash
approach is greedy. The idea is: if the matcher got to a certain size
at some point, chances are - it will get to this size again, so it is
better to avoid costly rehash operations whenever possible.

However, when all the rules of the matcher are deleted, this should
be viewed as special case. If the matcher actually got to the point
where it has zero rules, it might be an indication that some usecase
from the past is no longer happening. This is where some ICM can be
freed.

This patch handles this case: when a number of rules in a matcher
goes down to zero, the matcher's tables are shrunk to the initial
size.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Vlad Dogaru <vdogaru@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250703185431.445571-10-mbloch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c