Commit 26432001 authored by Tariq Toukan's avatar Tariq Toukan Committed by Saeed Mahameed

net/mlx5e: kTLS, Improve TLS RX workqueue scope

The TLS RX workqueue is needed only when kTLS RX device offload
is supported.

Move its creation from the general TLS init function to the
kTLS RX init.
Create it once at init time if supported, avoid creation/destroy
everytime the feature bit is toggled.
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 1d3a3f3b
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Copyright (c) 2019 Mellanox Technologies. // Copyright (c) 2019 Mellanox Technologies.
#include "en.h" #include "en.h"
#include "en_accel/tls.h"
#include "en_accel/ktls.h" #include "en_accel/ktls.h"
#include "en_accel/ktls_utils.h" #include "en_accel/ktls_utils.h"
#include "en_accel/fs_tcp.h" #include "en_accel/fs_tcp.h"
...@@ -86,16 +87,33 @@ int mlx5e_ktls_set_feature_rx(struct net_device *netdev, bool enable) ...@@ -86,16 +87,33 @@ int mlx5e_ktls_set_feature_rx(struct net_device *netdev, bool enable)
int mlx5e_ktls_init_rx(struct mlx5e_priv *priv) int mlx5e_ktls_init_rx(struct mlx5e_priv *priv)
{ {
int err = 0; int err;
if (priv->netdev->features & NETIF_F_HW_TLS_RX) if (!mlx5_accel_is_ktls_rx(priv->mdev))
return 0;
priv->tls->rx_wq = create_singlethread_workqueue("mlx5e_tls_rx");
if (!priv->tls->rx_wq)
return -ENOMEM;
if (priv->netdev->features & NETIF_F_HW_TLS_RX) {
err = mlx5e_accel_fs_tcp_create(priv); err = mlx5e_accel_fs_tcp_create(priv);
if (err) {
destroy_workqueue(priv->tls->rx_wq);
return err;
}
}
return err; return 0;
} }
void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv) void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv)
{ {
if (!mlx5_accel_is_ktls_rx(priv->mdev))
return;
if (priv->netdev->features & NETIF_F_HW_TLS_RX) if (priv->netdev->features & NETIF_F_HW_TLS_RX)
mlx5e_accel_fs_tcp_destroy(priv); mlx5e_accel_fs_tcp_destroy(priv);
destroy_workqueue(priv->tls->rx_wq);
} }
...@@ -231,12 +231,6 @@ int mlx5e_tls_init(struct mlx5e_priv *priv) ...@@ -231,12 +231,6 @@ int mlx5e_tls_init(struct mlx5e_priv *priv)
if (!tls) if (!tls)
return -ENOMEM; return -ENOMEM;
tls->rx_wq = create_singlethread_workqueue("mlx5e_tls_rx");
if (!tls->rx_wq) {
kfree(tls);
return -ENOMEM;
}
priv->tls = tls; priv->tls = tls;
return 0; return 0;
} }
...@@ -248,7 +242,6 @@ void mlx5e_tls_cleanup(struct mlx5e_priv *priv) ...@@ -248,7 +242,6 @@ void mlx5e_tls_cleanup(struct mlx5e_priv *priv)
if (!tls) if (!tls)
return; return;
destroy_workqueue(tls->rx_wq);
kfree(tls); kfree(tls);
priv->tls = NULL; priv->tls = NULL;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment