net/tls: Multi-threaded calls to TX tls_dev_del
authorTariq Toukan <tariqt@nvidia.com>
Wed, 27 Jul 2022 09:43:42 +0000 (12:43 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 Jul 2022 04:50:54 +0000 (21:50 -0700)
commit7adc91e0c93901a0eeeea10665d0feb48ffde2d4
treeef573dc17f1c5fbc6842a2b42f7cb2223615bc06
parent113671b255ee3b9f5585a6d496ef0e675e698698
net/tls: Multi-threaded calls to TX tls_dev_del

Multiple TLS device-offloaded contexts can be added in parallel via
concurrent calls to .tls_dev_add, while calls to .tls_dev_del are
sequential in tls_device_gc_task.

This is not a sustainable behavior. This creates a rate gap between add
and del operations (addition rate outperforms the deletion rate).  When
running for enough time, the TLS device resources could get exhausted,
failing to offload new connections.

Replace the single-threaded garbage collector work with a per-context
alternative, so they can be handled on several cores in parallel. Use
a new dedicated destruct workqueue for this.

Tested with mlx5 device:
Before: 22141 add/sec,   103 del/sec
After:  11684 add/sec, 11684 del/sec

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/tls.h
net/tls/tls_device.c