mlx5en: Share DEK objects with TLS RX.

The TLS RX support also needs to be able to allocate DEK objects.
Share the available objects 1:1.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2022-02-01 16:20:08 +01:00
parent fad4b7d1f2
commit 75767cb889

View File

@ -150,7 +150,8 @@ mlx5e_tls_init(struct mlx5e_priv *priv)
struct sysctl_oid *node;
uint32_t x;
if (MLX5_CAP_GEN(priv->mdev, tls_tx) == 0)
if (MLX5_CAP_GEN(priv->mdev, tls_tx) == 0 ||
MLX5_CAP_GEN(priv->mdev, log_max_dek) == 0)
return (0);
ptls->wq = create_singlethread_workqueue("mlx5-tls-wq");
@ -166,7 +167,8 @@ mlx5e_tls_init(struct mlx5e_priv *priv)
sizeof(struct mlx5e_tls_tag), NULL, NULL, NULL, NULL,
mlx5e_tls_tag_import, mlx5e_tls_tag_release, priv->mdev, 0);
ptls->max_resources = 1U << MLX5_CAP_GEN(priv->mdev, log_max_dek);
/* shared between RX and TX TLS */
ptls->max_resources = 1U << (MLX5_CAP_GEN(priv->mdev, log_max_dek) - 1);
for (x = 0; x != MLX5E_TLS_STATS_NUM; x++)
ptls->stats.arg[x] = counter_u64_alloc(M_WAITOK);
@ -193,7 +195,7 @@ mlx5e_tls_cleanup(struct mlx5e_priv *priv)
struct mlx5e_tls *ptls = &priv->tls;
uint32_t x;
if (MLX5_CAP_GEN(priv->mdev, tls_tx) == 0)
if (ptls->init == 0)
return;
ptls->init = 0;