Drop Mellanox FPGA TLS support from the kernel
Subsystems (7)
cover Drop Mellanox FPGA TLS support from the kernel
From: Leon Romanovsky <[email protected]>
Mellanox INNOVA TLS cards are EOL in May, 2018 [1]. As such, the code is unmaintained, untested and not in-use by any upstream/distro oriented customers. In order to reduce code complexity, drop the kernel code, clean build config options and delete useless kTLS vs. TLS separation.
[1] https://network.nvidia.com/related-docs/eol/LCR-000286.pdf
Thanks
BTW, the target of this series is mlx5-next, as other series removes FPGA IPsec together with relevant cleanup in RDMA side.
Leon Romanovsky (5):
net/mlx5_fpga: Drop INNOVA TLS support
net/mlx5: Reliably return TLS device capabilities net/mlx5: Remove indirection in TLS build net/mlx5: Remove tls vs. ktls separation as it is the same net/mlx5: Cleanup kTLS function names and their exposure
.../net/ethernet/mellanox/mlx5/core/Kconfig | 25 +-
.../net/ethernet/mellanox/mlx5/core/Makefile | 5 +-
.../ethernet/mellanox/mlx5/core/accel/tls.c | 125 ----
.../ethernet/mellanox/mlx5/core/accel/tls.h | 156 -----
drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 -
.../ethernet/mellanox/mlx5/core/en/params.c | 6 +-
.../mellanox/mlx5/core/en_accel/en_accel.h | 11 +-
.../mellanox/mlx5/core/en_accel/ktls.c | 71 +-
.../mellanox/mlx5/core/en_accel/ktls.h | 86 ++-
.../mellanox/mlx5/core/en_accel/ktls_rx.c | 2 +-
.../en_accel/{tls_stats.c => ktls_stats.c} | 51 +-
.../mellanox/mlx5/core/en_accel/ktls_tx.c | 20 +-
.../mellanox/mlx5/core/en_accel/ktls_txrx.h | 28 +-
.../mellanox/mlx5/core/en_accel/ktls_utils.h | 1 -
.../mellanox/mlx5/core/en_accel/tls.c | 247 -------
.../mellanox/mlx5/core/en_accel/tls.h | 132 ----
.../mellanox/mlx5/core/en_accel/tls_rxtx.c | 390 -----------
.../mellanox/mlx5/core/en_accel/tls_rxtx.h | 91 ---
.../net/ethernet/mellanox/mlx5/core/en_main.c | 12 +-
.../net/ethernet/mellanox/mlx5/core/en_rx.c | 5 +-
.../ethernet/mellanox/mlx5/core/en_stats.c | 8 +-
.../ethernet/mellanox/mlx5/core/fpga/core.h | 1 -
.../ethernet/mellanox/mlx5/core/fpga/tls.c | 622 ------------------
.../ethernet/mellanox/mlx5/core/fpga/tls.h | 74 ---
drivers/net/ethernet/mellanox/mlx5/core/fw.c | 3 +-
.../net/ethernet/mellanox/mlx5/core/main.c | 10 -
include/linux/mlx5/mlx5_ifc_fpga.h | 63 --
27 files changed, 221 insertions(+), 2025 deletions(-)
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/tls.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/tls.h
rename drivers/net/ethernet/mellanox/mlx5/core/en_accel/{tls_stats.c => ktls_stats.c} (63%)
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.h
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.hSignature · 1 line
2.35.1
PATCH 1/5 net/mlx5_fpga: Drop INNOVA TLS support
From: Leon Romanovsky <[email protected]>
Mellanox INNOVA TLS cards are EOL in May, 2018 [1]. As such, the code is unmaintained, untested and not in-use by any upstream/distro oriented customers. In order to reduce code complexity, drop the kernel code.
[1] https://network.nvidia.com/related-docs/eol/LCR-000286.pdf
--- .../net/ethernet/mellanox/mlx5/core/Kconfig | 14 - .../net/ethernet/mellanox/mlx5/core/Makefile | 1 - .../ethernet/mellanox/mlx5/core/accel/tls.c | 47 -- .../ethernet/mellanox/mlx5/core/accel/tls.h | 56 -- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 - .../mellanox/mlx5/core/en_accel/tls.c | 180 +---- .../mellanox/mlx5/core/en_accel/tls.h | 48 +- .../mellanox/mlx5/core/en_accel/tls_rxtx.c | 324 +-------- .../mellanox/mlx5/core/en_accel/tls_rxtx.h | 8 +- .../mellanox/mlx5/core/en_accel/tls_stats.c | 17 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 3 - .../ethernet/mellanox/mlx5/core/fpga/core.h | 1 - .../ethernet/mellanox/mlx5/core/fpga/tls.c | 622 ------------------ .../ethernet/mellanox/mlx5/core/fpga/tls.h | 74 --- .../net/ethernet/mellanox/mlx5/core/main.c | 10 - include/linux/mlx5/mlx5_ifc_fpga.h | 63 -- 16 files changed, 10 insertions(+), 1459 deletions(-) delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.h
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +0 -14
@@ -177,20 +177,6 @@ config MLX5_EN_IPSEC Note: Support for hardware with this capability needs to be selected for this option to become available. -config MLX5_FPGA_TLS - bool "Mellanox Technologies TLS Innova support" - depends on TLS_DEVICE - depends on TLS=y || MLX5_CORE=m - depends on MLX5_CORE_EN - depends on MLX5_FPGA - select MLX5_EN_TLS - help - Build TLS support for the Innova family of network cards by Mellanox - Technologies. Innova network cards are comprised of a ConnectX chip - and an FPGA chip on one board. If you select this option, the - mlx5_core driver will include the Innova FPGA core and allow building - sandbox-specific client drivers. - config MLX5_TLS bool "Mellanox Technologies TLS Connect-X support" depends on TLS_DEVICE
drivers/net/ethernet/mellanox/mlx5/core/Makefile +0 -1
@@ -90,7 +90,6 @@ mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib # mlx5_core-$(CONFIG_MLX5_IPSEC) += accel/ipsec_offload.o mlx5_core-$(CONFIG_MLX5_FPGA_IPSEC) += fpga/ipsec.o -mlx5_core-$(CONFIG_MLX5_FPGA_TLS) += fpga/tls.o mlx5_core-$(CONFIG_MLX5_ACCEL) += lib/crypto.o accel/tls.o accel/ipsec.o mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o
drivers/net/ethernet/mellanox/mlx5/core/accel/tls.c +0 -47
53 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/accel/tls.h +0 -56
60 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en.h +0 -1
@@ -354,7 +354,6 @@ enum {MLX5E_RQ_STATE_AM ,MLX5E_RQ_STATE_NO_CSUM_COMPLETE ,MLX5E_RQ_STATE_CSUM_FULL ,/* cqe_csum_full hw bit is set */ -MLX5E_RQ_STATE_FPGA_TLS ,/* FPGA TLS enabled */ MLX5E_RQ_STATE_MINI_CQE_HW_STRIDX ,/* set when mini_cqe_resp_stride_index cap is used */ MLX5E_RQ_STATE_SHAMPO, /* set when SHAMPO cap is used */ };
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c +2 -178
190 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h +1 -47
74 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c +2 -322
350 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.h +1 -7
@@ -60,18 +60,12 @@ mlx5e_tls_handle_tx_wqe(struct mlx5_wqe_ctrl_seg *cseg, cseg->tis_tir_num = cpu_to_be32(state->tls_tisn << 8); } -void mlx5e_tls_handle_rx_skb_metadata (struct mlx5e_rq *rq,struct sk_buff *skb, -u32 *cqe_bcnt); -static inline void mlx5e_tls_handle_rx_skb (struct mlx5e_rq *rq,struct sk_buff *skb,struct mlx5_cqe64 *cqe,u32 *cqe_bcnt) {if (unlikely (get_cqe_tls_offload (cqe)))/* cqe bit indicates a TLS device */ -return mlx5e_ktls_handle_rx_skb (rq, skb, cqe, cqe_bcnt); - -if (unlikely (test_bit (MLX5E_RQ_STATE_FPGA_TLS , &rq->state) &&is_metadata_hdr_valid (skb))) -return mlx5e_tls_handle_rx_skb_metadata (rq, skb, cqe_bcnt); +mlx5e_ktls_handle_rx_skb (rq, skb, cqe, cqe_bcnt); }#else
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_stats.c +4 -13
@@ -38,13 +38,6 @@#include "fpga/sdk.h" #include "en_accel/tls.h" -static const struct counter_desc mlx5e_tls_sw_stats_desc[] = { - { MLX5E_DECLARE_STAT(struct mlx5e_tls_sw_stats, tx_tls_drop_metadata) }, - { MLX5E_DECLARE_STAT(struct mlx5e_tls_sw_stats, tx_tls_drop_resync_alloc) }, - { MLX5E_DECLARE_STAT(struct mlx5e_tls_sw_stats, tx_tls_drop_no_sync_data) }, - { MLX5E_DECLARE_STAT(struct mlx5e_tls_sw_stats, tx_tls_drop_bypass_required) }, -}; -static const struct counter_desc mlx5e_ktls_sw_stats_desc[] = { { MLX5E_DECLARE_STAT(struct mlx5e_tls_sw_stats, tx_tls_ctx) }, { MLX5E_DECLARE_STAT(struct mlx5e_tls_sw_stats, tx_tls_del) },
@@ -59,18 +52,16 @@ static const struct counter_desc *get_tls_atomic_stats(struct mlx5e_priv *priv) {if (!priv->tls)return NULL ; -if (mlx5e_accel_is_ktls_device (priv->mdev)) -return mlx5e_ktls_sw_stats_desc; -return mlx5e_tls_sw_stats_desc; + +return mlx5e_ktls_sw_stats_desc; }int mlx5e_tls_get_count (struct mlx5e_priv *priv) {if (!priv->tls)return 0 ; -if (mlx5e_accel_is_ktls_device (priv->mdev)) -return ARRAY_SIZE (mlx5e_ktls_sw_stats_desc); -return ARRAY_SIZE (mlx5e_tls_sw_stats_desc); + +return ARRAY_SIZE (mlx5e_ktls_sw_stats_desc); }int mlx5e_tls_get_strings (struct mlx5e_priv *priv,uint8_t *data)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -3
@@ -1036,9 +1036,6 @@ int mlx5e_open_rq(struct mlx5e_params *params, struct mlx5e_rq_param *param,if (err) goto err_destroy_rq; -if (mlx5e_is_tls_on (rq->priv) && !mlx5e_accel_is_ktls_device (mdev)) -__set_bit (MLX5E_RQ_STATE_FPGA_TLS , &rq->state);/* must be FPGA */ -if (MLX5_CAP_ETH (mdev, cqe_checksum_full))__set_bit (MLX5E_RQ_STATE_CSUM_FULL , &rq->state);
drivers/net/ethernet/mellanox/mlx5/core/fpga/core.h +0 -1
@@ -59,7 +59,6 @@ struct mlx5_fpga_device { } conn_res;struct mlx5_fpga_ipsec *ipsec; -struct mlx5_fpga_tls *tls; };#define mlx5_fpga_dbg (__adev, format, ...) \
drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c deleted +0 -622
622 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.h deleted +0 -74
74 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -10
@@ -64,7 +64,6 @@#include "fpga/core.h" #include "fpga/ipsec.h" #include "accel/ipsec.h" -#include "accel/tls.h" #include "lib/clock.h" #include "lib/vxlan.h" #include "lib/geneve.h"
@@ -1185,12 +1184,6 @@ static int mlx5_load(struct mlx5_core_dev *dev)mlx5_accel_ipsec_init (dev); - err =mlx5_accel_tls_init (dev); -if (err) { -mlx5_core_err (dev,"TLS device start failed %d\n" , err); - goto err_tls_start; - } - err =mlx5_init_fs (dev);if (err) {mlx5_core_err (dev,"Failed to init flow steering\n" );
@@ -1238,8 +1231,6 @@ static int mlx5_load(struct mlx5_core_dev *dev) err_set_hca:mlx5_cleanup_fs (dev); err_fs: -mlx5_accel_tls_cleanup (dev); -err_tls_start:mlx5_accel_ipsec_cleanup (dev);mlx5_fpga_device_stop (dev); err_fpga_start:
@@ -1267,7 +1258,6 @@ static void mlx5_unload(struct mlx5_core_dev *dev)mlx5_vhca_event_stop (dev);mlx5_cleanup_fs (dev);mlx5_accel_ipsec_cleanup (dev); -mlx5_accel_tls_cleanup (dev);mlx5_fpga_device_stop (dev);mlx5_rsc_dump_cleanup (dev);mlx5_hv_vhca_cleanup (dev->hv_vhca);
include/linux/mlx5/mlx5_ifc_fpga.h +0 -63
79 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 2/5 net/mlx5: Reliably return TLS device capabilities
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The capabilities returned from the FW are independent to the compiled kernel and traditionally rely on the relevant CAPs bit only.
The mlx5_accel_is_ktls_*() functions are compiled out if CONFIG_MLX5_TLS is not set, which "hides" from the user the information that TLS can be enabled on this device.
--- drivers/net/ethernet/mellanox/mlx5/core/fw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fw.c +1 -2
@@ -35,7 +35,6 @@#include "mlx5_core.h" #include "../../mlxfw/mlxfw.h" #include "lib/tout.h" -#include "accel/tls.h" enum {MCQS_IDENTIFIER_BOOT_IMG =0x1 ,
@@ -249,7 +248,7 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)return err; } -if (mlx5_accel_is_ktls_tx (dev) ||mlx5_accel_is_ktls_rx (dev)) { +if (MLX5_CAP_GEN (dev, tls_tx) ||MLX5_CAP_GEN (dev, tls_rx)) { err =mlx5_core_get_caps (dev,MLX5_CAP_TLS );if (err)return err;
Signature · 1 line
2.35.1
PATCH 3/5 net/mlx5: Remove indirection in TLS build
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The dream described in the commit 1ae173228489 ("net/mlx5: Accel, Add TLS tx offload interface") never came true, even an opposite happened when FPGA TLS support was dropped. Such removal revealed the problematic flow in the build process: build of unrelated files in case of TLS or IPsec are enabled.
In both cases, the MLX5_ACCEL is enabled, which built both TLS and IPsec. As a solution, simply merge MLX5_TLS and MLX5_EN_TLS options and move TLS related files to the eth part of the mlx5_core.
--- .../net/ethernet/mellanox/mlx5/core/Kconfig | 11 +- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../ethernet/mellanox/mlx5/core/accel/tls.c | 78 -------------- .../ethernet/mellanox/mlx5/core/accel/tls.h | 100 ------------------ .../mellanox/mlx5/core/en_accel/ktls.c | 39 +++++++ .../mellanox/mlx5/core/en_accel/ktls.h | 47 +++++++- .../mellanox/mlx5/core/en_accel/ktls_utils.h | 1 - .../mellanox/mlx5/core/en_accel/tls.c | 1 - .../mellanox/mlx5/core/en_accel/tls.h | 1 - .../net/ethernet/mellanox/mlx5/core/en_main.c | 1 - 10 files changed, 84 insertions(+), 197 deletions(-) delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/tls.c delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/tls.h
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -10
@@ -177,23 +177,14 @@ config MLX5_EN_IPSEC Note: Support for hardware with this capability needs to be selected for this option to become available. -config MLX5_TLS +config MLX5_EN_TLS bool "Mellanox Technologies TLS Connect-X support" depends on TLS_DEVICE depends on TLS=y || MLX5_CORE=m depends on MLX5_CORE_EN select MLX5_ACCEL - select MLX5_EN_TLS - help - Build TLS support for the Connect-X family of network cards by Mellanox - Technologies. - -config MLX5_EN_TLS - bool help Build support for TLS cryptography-offload acceleration in the NIC. - Note: Support for hardware with this capability needs to be selected - for this option to become available. config MLX5_SW_STEERING bool "Mellanox Technologies software-managed steering"
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -90,7 +90,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib # mlx5_core-$(CONFIG_MLX5_IPSEC) += accel/ipsec_offload.o mlx5_core-$(CONFIG_MLX5_FPGA_IPSEC) += fpga/ipsec.o -mlx5_core-$(CONFIG_MLX5_ACCEL) += lib/crypto.o accel/tls.o accel/ipsec.o +mlx5_core-$(CONFIG_MLX5_ACCEL) += lib/crypto.o accel/ipsec.o mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o
drivers/net/ethernet/mellanox/mlx5/core/accel/tls.c deleted +0 -78
78 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/accel/tls.h deleted +0 -100
100 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +39 -0
@@ -2,11 +2,50 @@// Copyright (c) 2019 Mellanox Technologies. #include "en.h" +#include "lib/mlx5.h" #include "en_accel/tls.h" #include "en_accel/ktls.h" #include "en_accel/ktls_utils.h" #include "en_accel/fs_tcp.h" +int mlx5_ktls_create_key (struct mlx5_core_dev *mdev, +struct tls_crypto_info *crypto_info, +u32 *p_key_id) +{ +u32 sz_bytes; +void *key; + +switch (crypto_info->cipher_type) { +case TLS_CIPHER_AES_GCM_128 : { +struct tls12_crypto_info_aes_gcm_128 *info = + (struct tls12_crypto_info_aes_gcm_128 *)crypto_info; + + key = info->key; + sz_bytes =sizeof (info->key); +break ; + } +case TLS_CIPHER_AES_GCM_256 : { +struct tls12_crypto_info_aes_gcm_256 *info = + (struct tls12_crypto_info_aes_gcm_256 *)crypto_info; + + key = info->key; + sz_bytes =sizeof (info->key); +break ; + } +default : +return -EINVAL ; + } + +return mlx5_create_encryption_key (mdev, key, sz_bytes, +MLX5_ACCEL_OBJ_TLS_KEY , + p_key_id); +} + +void mlx5_ktls_destroy_key (struct mlx5_core_dev *mdev,u32 key_id) +{ +mlx5_destroy_encryption_key (mdev, key_id); +} + static int mlx5e_ktls_add(struct net_device *netdev, struct sock *sk, enum tls_offload_ctx_dir direction, struct tls_crypto_info *crypto_info,
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h +43 -4
72 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_utils.h +0 -1
@@ -6,7 +6,6 @@#include <net/tls.h> #include "en.h" -#include "accel/tls.h" enum {MLX5E_TLS_PROGRESS_PARAMS_AUTH_STATE_NO_OFFLOAD =0 ,
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c +0 -1
@@ -34,7 +34,6 @@#include <linux/netdevice.h> #include <net/ipv6.h> #include "en_accel/tls.h" -#include "accel/tls.h" void mlx5e_tls_build_netdev (struct mlx5e_priv *priv) {
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h +0 -1
@@ -33,7 +33,6 @@#ifndef __MLX5E_TLS_H__#define __MLX5E_TLS_H__ -#include "accel/tls.h" #include "en_accel/ktls.h" #ifdef CONFIG_MLX5_EN_TLS
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -1
@@ -49,7 +49,6 @@#include "en_accel/en_accel.h" #include "en_accel/tls.h" #include "accel/ipsec.h" -#include "accel/tls.h" #include "lib/vxlan.h" #include "lib/clock.h" #include "en/port.h"
Signature · 1 line
2.35.1
PATCH 4/5 net/mlx5: Remove tls vs. ktls separation as it is the same
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
After removal FPGA TLS, we can remove tls->ktls indirection too, as it is the same thing.
---
.../net/ethernet/mellanox/mlx5/core/Makefile | 2 +-
.../ethernet/mellanox/mlx5/core/en/params.c | 2 +-
.../mellanox/mlx5/core/en_accel/en_accel.h | 11 +--
.../mellanox/mlx5/core/en_accel/ktls.c | 22 ++++-
.../mellanox/mlx5/core/en_accel/ktls.h | 32 +++++++
.../mellanox/mlx5/core/en_accel/ktls_rx.c | 2 +-
.../en_accel/{tls_stats.c => ktls_stats.c} | 38 ++++-----
.../mellanox/mlx5/core/en_accel/ktls_tx.c | 18 +++-
.../mellanox/mlx5/core/en_accel/ktls_txrx.h | 28 +++++-
.../mellanox/mlx5/core/en_accel/tls.c | 70 ---------------
.../mellanox/mlx5/core/en_accel/tls.h | 85 -------------------
.../mellanox/mlx5/core/en_accel/tls_rxtx.c | 70 ---------------
.../mellanox/mlx5/core/en_accel/tls_rxtx.h | 85 -------------------
.../net/ethernet/mellanox/mlx5/core/en_main.c | 8 +-
.../net/ethernet/mellanox/mlx5/core/en_rx.c | 5 +-
.../ethernet/mellanox/mlx5/core/en_stats.c | 8 +-
16 files changed, 130 insertions(+), 356 deletions(-)
rename drivers/net/ethernet/mellanox/mlx5/core/en_accel/{tls_stats.c => ktls_stats.c} (76%)
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.hdrivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -97,7 +97,7 @@ mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o mlx5_core-$(CONFIG_MLX5_EN_IPSEC) += en_accel/ipsec.o en_accel/ipsec_rxtx.o \ en_accel/ipsec_stats.o en_accel/ipsec_fs.o -mlx5_core-$(CONFIG_MLX5_EN_TLS) += en_accel/tls.o en_accel/tls_rxtx.o en_accel/tls_stats.o \ +mlx5_core-$(CONFIG_MLX5_EN_TLS) += en_accel/ktls_stats.o \ en_accel/fs_tcp.o en_accel/ktls.o en_accel/ktls_txrx.o \ en_accel/ktls_tx.o en_accel/ktls_rx.o
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +1 -1
@@ -207,7 +207,7 @@ u16 mlx5e_calc_sq_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *parbool is_mpwqe =MLX5E_GET_PFLAG (params,MLX5E_PFLAG_SKB_TX_MPWQE );u16 stop_room; - stop_room =mlx5e_tls_get_stop_room (mdev, params); + stop_room =mlx5e_ktls_get_stop_room (mdev, params); stop_room +=mlx5e_stop_room_for_max_wqe (mdev);if (is_mpwqe)/* A MPWQE can take up to the maximum-sized WQE + all the normal
drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h +6 -5
@@ -37,8 +37,8 @@#include <linux/skbuff.h> #include <linux/netdevice.h> #include "en_accel/ipsec_rxtx.h" -#include "en_accel/tls.h" -#include "en_accel/tls_rxtx.h" +#include "en_accel/ktls.h" +#include "en_accel/ktls_txrx.h" #include "en.h" #include "en/txrx.h"
@@ -124,8 +124,9 @@ static inline bool mlx5e_accel_tx_begin(struct net_device *dev,#ifdef CONFIG_MLX5_EN_TLS /* May send SKBs and WQEs. */ -if (mlx5e_tls_skb_offloaded (skb)) -if (unlikely (!mlx5e_tls_handle_tx_skb (dev, sq, skb, &state->tls))) +if (mlx5e_ktls_skb_offloaded (skb)) +if (unlikely (!mlx5e_ktls_handle_tx_skb (dev, sq, skb, + &state->tls)))return false;#endif
@@ -174,7 +175,7 @@ static inline void mlx5e_accel_tx_finish(struct mlx5e_txqsq *sq, struct mlx5_wqe_inline_seg *inlseg) {#ifdef CONFIG_MLX5_EN_TLS -mlx5e_tls_handle_tx_wqe (&wqe->ctrl, &state->tls); +mlx5e_ktls_handle_tx_wqe (&wqe->ctrl, &state->tls);#endif #ifdef CONFIG_MLX5_EN_IPSEC
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +21 -1
@@ -3,7 +3,6 @@#include "en.h" #include "lib/mlx5.h" -#include "en_accel/tls.h" #include "en_accel/ktls.h" #include "en_accel/ktls_utils.h" #include "en_accel/fs_tcp.h"
@@ -159,3 +158,24 @@ void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv)destroy_workqueue (priv->tls->rx_wq); } + +int mlx5e_ktls_init (struct mlx5e_priv *priv) +{ +struct mlx5e_tls *tls; + +if (!mlx5e_accel_is_ktls_device (priv->mdev)) +return 0 ; + + tls =kzalloc (sizeof (*tls),GFP_KERNEL ); +if (!tls) +return -ENOMEM ; + + priv->tls = tls; +return 0 ; +} + +void mlx5e_ktls_cleanup (struct mlx5e_priv *priv) +{ +kfree (priv->tls); + priv->tls =NULL ; +}
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h +32 -0
@@ -5,6 +5,7 @@#define __MLX5E_KTLS_H__#include <linux/tls.h> +#include <net/tls.h> #include "en.h" #ifdef CONFIG_MLX5_EN_TLS
@@ -61,6 +62,25 @@ static inline bool mlx5e_accel_is_ktls_device(struct mlx5_core_dev *mdev)mlx5_accel_is_ktls_device (mdev); } +struct mlx5e_tls_sw_stats { +atomic64_t tx_tls_ctx; +atomic64_t tx_tls_del; +atomic64_t rx_tls_ctx; +atomic64_t rx_tls_del; +}; + +struct mlx5e_tls { +struct mlx5e_tls_sw_stats sw_stats; +struct workqueue_struct *rx_wq; +}; + +int mlx5e_ktls_init (struct mlx5e_priv *priv); +void mlx5e_ktls_cleanup (struct mlx5e_priv *priv); + +int mlx5e_ktls_get_count (struct mlx5e_priv *priv); +int mlx5e_ktls_get_strings (struct mlx5e_priv *priv,uint8_t *data); +int mlx5e_ktls_get_stats (struct mlx5e_priv *priv,u64 *data); +#else static inline int mlx5_ktls_create_key(struct mlx5_core_dev *mdev,
@@ -107,6 +127,18 @@ static inline bool mlx5e_accel_is_ktls_tx(struct mlx5_core_dev *mdev) { return fstatic inline bool mlx5e_accel_is_ktls_rx (struct mlx5_core_dev *mdev) {return false; }static inline bool mlx5e_accel_is_ktls_device (struct mlx5_core_dev *mdev) {return false; } +static inline int mlx5e_ktls_init (struct mlx5e_priv *priv) {return 0 ; } +static inline void mlx5e_ktls_cleanup (struct mlx5e_priv *priv) { } +static inline int mlx5e_ktls_get_count (struct mlx5e_priv *priv) {return 0 ; } +static inline int mlx5e_ktls_get_strings (struct mlx5e_priv *priv,uint8_t *data) +{ +return 0 ; +} + +static inline int mlx5e_ktls_get_stats (struct mlx5e_priv *priv,u64 *data) +{ +return 0 ; +}#endif #endif /* __MLX5E_TLS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +1 -1
@@ -3,7 +3,7 @@#include <net/inet6_hashtables.h> #include "en_accel/en_accel.h" -#include "en_accel/tls.h" +#include "en_accel/ktls.h" #include "en_accel/ktls_txrx.h" #include "en_accel/ktls_utils.h" #include "en_accel/fs_tcp.h"
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_stats.c renamed from drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_stats.c +16 -22
@@ -36,7 +36,7 @@#include "en.h" #include "fpga/sdk.h" -#include "en_accel/tls.h" +#include "en_accel/ktls.h" static const struct counter_desc mlx5e_ktls_sw_stats_desc[] = { { MLX5E_DECLARE_STAT(struct mlx5e_tls_sw_stats, tx_tls_ctx) },
@@ -48,15 +48,7 @@ static const struct counter_desc mlx5e_ktls_sw_stats_desc[] = {#define MLX5E_READ_CTR_ATOMIC64 (ptr, dsc, i) \ atomic64_read((atomic64_t *)((char *)(ptr) + (dsc)[i].offset)) -static const struct counter_desc *get_tls_atomic_stats (struct mlx5e_priv *priv) -{ -if (!priv->tls) -return NULL ; - -return mlx5e_ktls_sw_stats_desc; -} - -int mlx5e_tls_get_count (struct mlx5e_priv *priv) +int mlx5e_ktls_get_count (struct mlx5e_priv *priv) {if (!priv->tls)return 0 ;
@@ -64,33 +56,35 @@ int mlx5e_tls_get_count(struct mlx5e_priv *priv)return ARRAY_SIZE (mlx5e_ktls_sw_stats_desc); } -int mlx5e_tls_get_strings (struct mlx5e_priv *priv,uint8_t *data) +int mlx5e_ktls_get_strings (struct mlx5e_priv *priv,uint8_t *data) { -const struct counter_desc *stats_desc;unsigned int i, n, idx =0 ; - stats_desc =get_tls_atomic_stats (priv); - n =mlx5e_tls_get_count (priv); +if (!priv->tls) +return 0 ; + + n =mlx5e_ktls_get_count (priv);for (i =0 ; i < n; i++)strcpy (data + (idx++) *ETH_GSTRING_LEN , - stats_desc[i].format); + mlx5e_ktls_sw_stats_desc[i].format);return n; } -int mlx5e_tls_get_stats (struct mlx5e_priv *priv,u64 *data) +int mlx5e_ktls_get_stats (struct mlx5e_priv *priv,u64 *data) { -const struct counter_desc *stats_desc;unsigned int i, n, idx =0 ; - stats_desc =get_tls_atomic_stats (priv); - n =mlx5e_tls_get_count (priv); +if (!priv->tls) +return 0 ; + + n =mlx5e_ktls_get_count (priv);for (i =0 ; i < n; i++) - data[idx++] = -MLX5E_READ_CTR_ATOMIC64 (&priv->tls->sw_stats, - stats_desc, i); + data[idx++] =MLX5E_READ_CTR_ATOMIC64 (&priv->tls->sw_stats, + mlx5e_ktls_sw_stats_desc, + i);return n; }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +15 -3
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB // Copyright (c) 2019 Mellanox Technologies. -#include "en_accel/tls.h" +#include "en_accel/ktls.h" #include "en_accel/ktls_txrx.h" #include "en_accel/ktls_utils.h"
@@ -448,14 +448,26 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,return MLX5E_KTLS_SYNC_FAIL ; } -bool mlx5e_ktls_handle_tx_skb (struct tls_context *tls_ctx,struct mlx5e_txqsq *sq, -struct sk_buff *skb,int datalen, +bool mlx5e_ktls_handle_tx_skb (struct net_device *netdev,struct mlx5e_txqsq *sq, +struct sk_buff *skb,struct mlx5e_accel_tx_tls_state *state) {struct mlx5e_ktls_offload_context_tx *priv_tx;struct mlx5e_sq_stats *stats = sq->stats; +struct tls_context *tls_ctx; +int datalen;u32 seq; + datalen = skb->len - (skb_transport_offset (skb) +tcp_hdrlen (skb)); +if (!datalen) +return true; + +mlx5e_tx_mpwqe_ensure_complete (sq); + + tls_ctx =tls_get_ctx (skb->sk); +if (WARN_ON_ONCE (tls_ctx->netdev != netdev)) + goto err_out; + priv_tx =mlx5e_get_ktls_tx_priv_ctx (tls_ctx);if (unlikely (mlx5e_ktls_tx_offload_test_and_clear_pending (priv_tx))) {
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h +26 -2
@@ -16,8 +16,8 @@ struct mlx5e_accel_tx_tls_state {u16 mlx5e_ktls_get_stop_room (struct mlx5_core_dev *mdev,struct mlx5e_params *params); -bool mlx5e_ktls_handle_tx_skb (struct tls_context *tls_ctx,struct mlx5e_txqsq *sq, -struct sk_buff *skb,int datalen, +bool mlx5e_ktls_handle_tx_skb (struct net_device *netdev,struct mlx5e_txqsq *sq, +struct sk_buff *skb,struct mlx5e_accel_tx_tls_state *state);void mlx5e_ktls_handle_rx_skb (struct mlx5e_rq *rq,struct sk_buff *skb,struct mlx5_cqe64 *cqe,u32 *cqe_bcnt);
@@ -48,6 +48,18 @@ mlx5e_ktls_rx_pending_resync_list(struct mlx5e_channel *c, int budget) {return budget &&test_bit (MLX5E_SQ_STATE_PENDING_TLS_RX_RESYNC , &c->async_icosq.state); } + +static inline bool mlx5e_ktls_skb_offloaded (struct sk_buff *skb) +{ +return skb->sk &&tls_is_sk_tx_device_offloaded (skb->sk); +} + +static inline void +mlx5e_ktls_handle_tx_wqe (struct mlx5_wqe_ctrl_seg *cseg, +struct mlx5e_accel_tx_tls_state *state) +{ + cseg->tis_tir_num =cpu_to_be32 (state->tls_tisn <<8 ); +}#else static inline bool mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
@@ -69,6 +81,18 @@ mlx5e_ktls_rx_pending_resync_list(struct mlx5e_channel *c, int budget)return false; } +static inline u16 mlx5e_ktls_get_stop_room (struct mlx5_core_dev *mdev, +struct mlx5e_params *params) +{ +return 0 ; +} + +static inline void mlx5e_ktls_handle_rx_skb (struct mlx5e_rq *rq, +struct sk_buff *skb, +struct mlx5_cqe64 *cqe, +u32 *cqe_bcnt) +{ +}#endif /* CONFIG_MLX5_EN_TLS */ #endif /* __MLX5E_TLS_TXRX_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c deleted +0 -70
70 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h deleted +0 -85
85 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c deleted +0 -70
70 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.h deleted +0 -85
85 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 -4
@@ -47,7 +47,7 @@#include "en_rep.h" #include "en_accel/ipsec.h" #include "en_accel/en_accel.h" -#include "en_accel/tls.h" +#include "en_accel/ktls.h" #include "accel/ipsec.h" #include "lib/vxlan.h" #include "lib/clock.h"
@@ -4930,7 +4930,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)mlx5e_set_netdev_dev_addr (netdev);mlx5e_ipsec_build_netdev (priv); -mlx5e_tls_build_netdev (priv); +mlx5e_ktls_build_netdev (priv); }void mlx5e_create_q_counters (struct mlx5e_priv *priv)
@@ -4992,7 +4992,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,if (err)mlx5_core_err (mdev,"IPSec initialization failed, %d\n" , err); - err =mlx5e_tls_init (priv); + err =mlx5e_ktls_init (priv);if (err)mlx5_core_err (mdev,"TLS initialization failed, %d\n" , err);
@@ -5003,7 +5003,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,static void mlx5e_nic_cleanup (struct mlx5e_priv *priv) {mlx5e_health_destroy_reporters (priv); -mlx5e_tls_cleanup (priv); +mlx5e_ktls_cleanup (priv);mlx5e_ipsec_cleanup (priv);mlx5e_fs_cleanup (priv); }
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +3 -2
@@ -51,7 +51,7 @@#include "accel/ipsec.h" #include "fpga/ipsec.h" #include "en_accel/ipsec_rxtx.h" -#include "en_accel/tls_rxtx.h" +#include "en_accel/ktls_txrx.h" #include "en/xdp.h" #include "en/xsk/rx.h" #include "en/health.h"
@@ -1416,7 +1416,8 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, skb->mac_len =ETH_HLEN ; -mlx5e_tls_handle_rx_skb (rq, skb, cqe, &cqe_bcnt); +if (unlikely (get_cqe_tls_offload (cqe))) +mlx5e_ktls_handle_rx_skb (rq, skb, cqe, &cqe_bcnt);if (unlikely (mlx5_ipsec_is_rx_flow (cqe)))mlx5e_ipsec_offload_handle_rx_skb (netdev, skb, cqe);
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +4 -4
@@ -32,7 +32,7 @@#include "lib/mlx5.h" #include "en.h" -#include "en_accel/tls.h" +#include "en_accel/ktls.h" #include "en_accel/en_accel.h" #include "en/ptp.h" #include "en/port.h"
@@ -1900,17 +1900,17 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(pme) { return; }static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS (tls) { -return mlx5e_tls_get_count (priv); +return mlx5e_ktls_get_count (priv); }static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS (tls) { -return idx +mlx5e_tls_get_strings (priv, data + idx *ETH_GSTRING_LEN ); +return idx +mlx5e_ktls_get_strings (priv, data + idx *ETH_GSTRING_LEN ); }static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS (tls) { -return idx +mlx5e_tls_get_stats (priv, data + idx); +return idx +mlx5e_ktls_get_stats (priv, data + idx); }static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (tls) {return ; }
Signature · 1 line
2.35.1
Re: [PATCH mlx5-next 4/5] net/mlx5: Remove tls vs. ktls separation as it is the same
Quoted 25 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
After removal FPGA TLS, we can remove
tls->ktlsindirection too, as it is the same thing.Reviewed-by Tariq Toukan <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>---
.../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../ethernet/mellanox/mlx5/core/en/params.c | 2 +- .../mellanox/mlx5/core/en_accel/en_accel.h | 11 +-- .../mellanox/mlx5/core/en_accel/ktls.c | 22 ++++- .../mellanox/mlx5/core/en_accel/ktls.h | 32 +++++++ .../mellanox/mlx5/core/en_accel/ktls_rx.c | 2 +- .../en_accel/{tls_stats.c => ktls_stats.c} | 38 ++++----- .../mellanox/mlx5/core/en_accel/ktls_tx.c | 18 +++- .../mellanox/mlx5/core/en_accel/ktls_txrx.h | 28 +++++- .../mellanox/mlx5/core/en_accel/tls.c | 70 --------------- .../mellanox/mlx5/core/en_accel/tls.h | 85 ------------------- .../mellanox/mlx5/core/en_accel/tls_rxtx.c | 70 --------------- .../mellanox/mlx5/core/en_accel/tls_rxtx.h | 85 ------------------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 8 +- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 5 +- .../ethernet/mellanox/mlx5/core/en_stats.c | 8 +- 16 files changed, 130 insertions(+), 356 deletions(-)
Quoted 1 line
rename
drivers/net/ethernet/mellanox/mlx5/core/en_accel/{tls_stats.c=>ktls_stats.c} (76%)
Why not ktls_*.c => tls_*.c ?
Since we now have one TLS implementation, it would've been easier to maybe repurpose TLS to be KTLS only and avoid renaming every TLS to KTLS in all functions and files.
So just keep tls.c and all mlx5_tls_xyz functions and implement ktls directly in them, the renaming will be done only on the ktls implementation part of the code rather than in every caller.
Quoted 5 lines
delete mode 100644
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.cdelete mode 100644drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.hdelete mode 100644drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.cdelete mode 100644drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.h
Re: [PATCH mlx5-next 4/5] net/mlx5: Remove tls vs. ktls separation as it is the same
Quoted 28 lines · Saeed Mahameed
Quoted 25 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
After removal FPGA TLS, we can remove
tls->ktlsindirection too, as it is the same thing.Reviewed-by Tariq Toukan <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>---
.../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../ethernet/mellanox/mlx5/core/en/params.c | 2 +- .../mellanox/mlx5/core/en_accel/en_accel.h | 11 +-- .../mellanox/mlx5/core/en_accel/ktls.c | 22 ++++- .../mellanox/mlx5/core/en_accel/ktls.h | 32 +++++++ .../mellanox/mlx5/core/en_accel/ktls_rx.c | 2 +- .../en_accel/{tls_stats.c => ktls_stats.c} | 38 ++++----- .../mellanox/mlx5/core/en_accel/ktls_tx.c | 18 +++- .../mellanox/mlx5/core/en_accel/ktls_txrx.h | 28 +++++- .../mellanox/mlx5/core/en_accel/tls.c | 70 --------------- .../mellanox/mlx5/core/en_accel/tls.h | 85 ------------------- .../mellanox/mlx5/core/en_accel/tls_rxtx.c | 70 --------------- .../mellanox/mlx5/core/en_accel/tls_rxtx.h | 85 ------------------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 8 +- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 5 +- .../ethernet/mellanox/mlx5/core/en_stats.c | 8 +- 16 files changed, 130 insertions(+), 356 deletions(-)Quoted 1 line
rename
drivers/net/ethernet/mellanox/mlx5/core/en_accel/{tls_stats.c=>ktls_stats.c} (76%)
Quoted 1 line
Why not ktls_*.c => tls_*.c ?
Mostly because other drivers use _ktls_ name for this type of functionality. Plus internally, Tariq suggested to squash everything into ktls.
Quoted 8 lines
Since we now have one TLS implementation, it would've been easier to maybe repurpose TLS to be KTLS only and avoid renaming every TLS to KTLS in all functions and files.
So just keep
tls.cand allmlx5_tls_xyzfunctions and implement ktls directly in them, the renaming will be done only on the ktls implementation part of the code rather than in every caller.
Should I do it or keep this patch as is?
Thanks
Quoted 7 lines
Quoted 6 lines
delete mode 100644
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.cdelete mode 100644drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.hdelete mode 100644drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.cdelete mode 100644drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.h
Re: [PATCH mlx5-next 4/5] net/mlx5: Remove tls vs. ktls separation as it is the same
Quoted 6 lines · Leon Romanovsky
Quoted 5 lines · Saeed Mahameed
Quoted 4 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
After removal FPGA TLS, we can remove
tls->ktlsindirection too, as it is the same thing.
[...]
Quoted 12 lines
Quoted 3 lines
rename
drivers/net/ethernet/mellanox/mlx5/core/en_accel/{tls_stats.c=>ktls_stats.c} (76%)Why not ktls_*.c => tls_*.c ?
Mostly because other drivers use _ktls_ name for this type of functionality. Plus internally, Tariq suggested to squash everything into ktls.
Quoted 5 lines
Since we now have one TLS implementation, it would've been easier to maybe repurpose TLS to be KTLS only and avoid renaming every TLS to KTLS in all functions and files.
Quoted 6 lines
Quoted 3 lines
So just keep
tls.cand allmlx5_tls_xyzfunctions and implement ktls directly in them, the renaming will be done only on the ktls implementation part of the code rather than in every caller.Should I do it or keep this patch as is?
Keep it, i don't have any strong feeling about this, I just wanted to reduce the patch size.
Re: [PATCH mlx5-next 4/5] net/mlx5: Remove tls vs. ktls separation as it is the same
Quoted 26 lines · Saeed Mahameed
Quoted 6 lines · Leon Romanovsky
Quoted 5 lines · Saeed Mahameed
Quoted 4 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
After removal FPGA TLS, we can remove
tls->ktlsindirection too, as it is the same thing.[...]
Quoted 16 lines
Quoted 3 lines
rename
drivers/net/ethernet/mellanox/mlx5/core/en_accel/{tls_stats.c=>ktls_stats.c} (76%)Why not ktls_*.c => tls_*.c ?
Mostly because other drivers use _ktls_ name for this type of functionality. Plus internally, Tariq suggested to squash everything into ktls.
Quoted 8 lines
Since we now have one TLS implementation, it would've been easier to maybe repurpose TLS to be KTLS only and avoid renaming every TLS to KTLS in all functions and files.
So just keep
tls.cand allmlx5_tls_xyzfunctions and implement ktls directly in them, the renaming will be done only on the ktls implementation part of the code rather than in every caller.
Quoted 5 lines
Quoted 2 lines
Should I do it or keep this patch as is?
Keep it, i don't have any strong feeling about this, I just wanted to reduce the patch size.
Thanks for the review.
PATCH 5/5 net/mlx5: Cleanup kTLS function names and their exposure
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The _accel_ part of the function is not relevant anymore, so rename kTLS functions to be without it, together with header cleanup to do not have declarations that are not used.
--- .../ethernet/mellanox/mlx5/core/en/params.c | 4 +-- .../mellanox/mlx5/core/en_accel/ktls.c | 12 +++---- .../mellanox/mlx5/core/en_accel/ktls.h | 35 ++++++------------- .../mellanox/mlx5/core/en_accel/ktls_tx.c | 2 +- 4 files changed, 19 insertions(+), 34 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +2 -2
@@ -804,7 +804,7 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5_core_dev *mdev,static u8 mlx5e_build_async_icosq_log_wq_sz (struct mlx5_core_dev *mdev) { -if (mlx5e_accel_is_ktls_rx (mdev)) +if (mlx5e_is_ktls_rx (mdev))return MLX5E_PARAMS_DEFAULT_LOG_SQ_SIZE ;return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE ;
@@ -833,7 +833,7 @@ static void mlx5e_build_async_icosq_param(struct mlx5_core_dev *mdev,mlx5e_build_sq_param_common (mdev, param); param->stop_room =mlx5e_stop_room_for_wqe (mdev,1 );/* for XSK NOP */ - param->is_tls =mlx5e_accel_is_ktls_rx (mdev); + param->is_tls =mlx5e_is_ktls_rx (mdev);if (param->is_tls) param->stop_room +=mlx5e_stop_room_for_wqe (mdev,1 );/* for TLS RX resync NOP */ MLX5_SET (sqc, sqc, reg_umr,MLX5_CAP_ETH (mdev, reg_umr_sq));
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +6 -6
@@ -97,15 +97,15 @@ void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)struct net_device *netdev = priv->netdev;struct mlx5_core_dev *mdev = priv->mdev; -if (!mlx5e_accel_is_ktls_tx (mdev) && !mlx5e_accel_is_ktls_rx (mdev)) +if (!mlx5e_is_ktls_tx (mdev) && !mlx5e_is_ktls_rx (mdev))return ; -if (mlx5e_accel_is_ktls_tx (mdev)) { +if (mlx5e_is_ktls_tx (mdev)) { netdev->hw_features |=NETIF_F_HW_TLS_TX ; netdev->features |=NETIF_F_HW_TLS_TX ; } -if (mlx5e_accel_is_ktls_rx (mdev)) +if (mlx5e_is_ktls_rx (mdev)) netdev->hw_features |=NETIF_F_HW_TLS_RX ; netdev->tlsdev_ops = &mlx5e_ktls_ops;
@@ -130,7 +130,7 @@ int mlx5e_ktls_init_rx(struct mlx5e_priv *priv) {int err; -if (!mlx5e_accel_is_ktls_rx (priv->mdev)) +if (!mlx5e_is_ktls_rx (priv->mdev))return 0 ; priv->tls->rx_wq =create_singlethread_workqueue ("mlx5e_tls_rx" );
@@ -150,7 +150,7 @@ int mlx5e_ktls_init_rx(struct mlx5e_priv *priv)void mlx5e_ktls_cleanup_rx (struct mlx5e_priv *priv) { -if (!mlx5e_accel_is_ktls_rx (priv->mdev)) +if (!mlx5e_is_ktls_rx (priv->mdev))return ;if (priv->netdev->features &NETIF_F_HW_TLS_RX )
@@ -163,7 +163,7 @@ int mlx5e_ktls_init(struct mlx5e_priv *priv) {struct mlx5e_tls *tls; -if (!mlx5e_accel_is_ktls_device (priv->mdev)) +if (!mlx5e_is_ktls_device (priv->mdev))return 0 ; tls =kzalloc (sizeof (*tls),GFP_KERNEL );
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h +10 -25
@@ -14,8 +14,11 @@ int mlx5_ktls_create_key(struct mlx5_core_dev *mdev, u32 *p_key_id);void mlx5_ktls_destroy_key (struct mlx5_core_dev *mdev,u32 key_id); -static inline bool mlx5_accel_is_ktls_device (struct mlx5_core_dev *mdev) +static inline bool mlx5e_is_ktls_device (struct mlx5_core_dev *mdev) { +if (is_kdump_kernel ()) +return false; +if (!MLX5_CAP_GEN (mdev, tls_tx) && !MLX5_CAP_GEN (mdev, tls_rx))return false;
@@ -46,22 +49,16 @@ struct mlx5e_ktls_resync_resp *mlx5e_ktls_rx_resync_create_resp_list (void);void mlx5e_ktls_rx_resync_destroy_resp_list (struct mlx5e_ktls_resync_resp *resp_list); -static inline bool mlx5e_accel_is_ktls_tx (struct mlx5_core_dev *mdev) +static inline bool mlx5e_is_ktls_tx (struct mlx5_core_dev *mdev) {return !is_kdump_kernel () &&MLX5_CAP_GEN (mdev, tls_tx); } -static inline bool mlx5e_accel_is_ktls_rx (struct mlx5_core_dev *mdev) +static inline bool mlx5e_is_ktls_rx (struct mlx5_core_dev *mdev) {return !is_kdump_kernel () &&MLX5_CAP_GEN (mdev, tls_rx); } -static inline bool mlx5e_accel_is_ktls_device (struct mlx5_core_dev *mdev) -{ -return !is_kdump_kernel () && -mlx5_accel_is_ktls_device (mdev); -} -struct mlx5e_tls_sw_stats {atomic64_t tx_tls_ctx;atomic64_t tx_tls_del;
@@ -82,19 +79,6 @@ int mlx5e_ktls_get_strings(struct mlx5e_priv *priv, uint8_t *data);int mlx5e_ktls_get_stats (struct mlx5e_priv *priv,u64 *data);#else -static inline int -mlx5_ktls_create_key (struct mlx5_core_dev *mdev, -struct tls_crypto_info *crypto_info, -u32 *p_key_id) {return -EOPNOTSUPP ; } -static inline void -mlx5_ktls_destroy_key (struct mlx5_core_dev *mdev,u32 key_id) {} - -static inline bool -mlx5_accel_is_ktls_device (struct mlx5_core_dev *mdev) {return false; } -static inline bool -mlx5e_ktls_type_check (struct mlx5_core_dev *mdev, -struct tls_crypto_info *crypto_info) {return false; } -static inline void mlx5e_ktls_build_netdev (struct mlx5e_priv *priv) { }
@@ -123,9 +107,10 @@ mlx5e_ktls_rx_resync_create_resp_list(void)static inline void mlx5e_ktls_rx_resync_destroy_resp_list (struct mlx5e_ktls_resync_resp *resp_list) {} -static inline bool mlx5e_accel_is_ktls_tx (struct mlx5_core_dev *mdev) {return false; } -static inline bool mlx5e_accel_is_ktls_rx (struct mlx5_core_dev *mdev) {return false; } -static inline bool mlx5e_accel_is_ktls_device (struct mlx5_core_dev *mdev) {return false; } +static inline bool mlx5e_is_ktls_rx (struct mlx5_core_dev *mdev) +{ +return false; +}static inline int mlx5e_ktls_init (struct mlx5e_priv *priv) {return 0 ; }static inline void mlx5e_ktls_cleanup (struct mlx5e_priv *priv) { }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +1 -1
@@ -27,7 +27,7 @@ u16 mlx5e_ktls_get_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *pa {u16 num_dumps, stop_room =0 ; -if (!mlx5e_accel_is_ktls_tx (mdev)) +if (!mlx5e_is_ktls_tx (mdev))return 0 ; num_dumps =mlx5e_ktls_dumps_num_wqes (params,MAX_SKB_FRAGS ,TLS_MAX_PAYLOAD_SIZE );
Signature · 1 line
2.35.1
Quoted 7 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Mellanox INNOVA TLS cards are EOL in May, 2018 [1]. As such, the code is unmaintained, untested and not in-use by any upstream/distro oriented customers. In order to reduce code complexity, drop the kernel code, clean build config options and delete useless kTLS vs. TLS separation.
Quoted 7 lines
[1] https://network.nvidia.com/related-docs/eol/LCR-000286.pdf
Thanks
BTW, the target of this series is mlx5-next, as other series removes FPGA IPsec together with relevant cleanup in RDMA side.
Other than the renaming ktls => tls comment, which is not a big deal anyhow. The series looks great.
Quoted 14 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Mellanox INNOVA TLS cards are EOL in May, 2018 [1]. As such, the code is unmaintained, untested and not in-use by any upstream/distro oriented customers. In order to reduce code complexity, drop the kernel code, clean build config options and delete useless kTLS vs. TLS separation.
[1] https://network.nvidia.com/related-docs/eol/LCR-000286.pdf
Thanks
BTW, the target of this series is mlx5-next, as other series removes FPGA IPsec together with relevant cleanup in RDMA side.
Quoted 7 lines
Leon Romanovsky (5):
net/mlx5_fpga: Drop INNOVA TLS support
net/mlx5: Reliably return TLS device capabilities net/mlx5: Remove indirection in TLS build net/mlx5: Remove tls vs. ktls separation as it is the same net/mlx5: Cleanup kTLS function names and their exposure
Thanks, applied to mlx5-next.
7a9104ea9011 net/mlx5: Cleanup kTLS function names and their exposure 943aa7bda373 net/mlx5: Remove tls vs. ktls separation as it is the same 691f17b980d0 net/mlx5: Remove indirection in TLS build e59437aa7ae6 net/mlx5: Reliably return TLS device capabilities 40379a0084c2 net/mlx5_fpga: Drop INNOVA TLS support