net/mlx5e: kTLS, Dynamically re-size TX recycling pool
authorTariq Toukan <tariqt@nvidia.com>
Wed, 27 Jul 2022 09:43:46 +0000 (12:43 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 Jul 2022 04:50:55 +0000 (21:50 -0700)
commit624bf09921338f977ca81e70817ff2fd3aa9216d
treedca8f26d531e759b125eea4a54224398942e9bda
parentc4dfe704f53fb530e2a198c8d68e489cb68ebd70
net/mlx5e: kTLS, Dynamically re-size TX recycling pool

Let the TLS TX recycle pool be more flexible in size, by continuously
and dynamically allocating and releasing HW resources in response to
changes in the connections rate and load.

Allocate and release pool entries in bulks (16). Use a workqueue to
release/allocate in the background. Allocate a new bulk when the pool
size goes lower than the low threshold (1K). Symmetric operation is done
when the pool size gets greater than the upper threshold (4K).

Every idle pool entry holds: 1 TIS, 1 DEK (HW resources), in addition to
~100 bytes in host memory.

Start with an empty pool to minimize memory and HW resources waste for
non-TLS users that have the device-offload TLS enabled.

Upon a new request, in case the pool is empty, do not wait for a whole bulk
allocation to complete.  Instead, trigger an instant allocation of a single
resource to reduce latency.

Performance tests:
Before: 11,684 CPS
After:  16,556 CPS

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c