Drop Mellanox FPGA IPsec support from the kernel
Subsystems (7)
cover Drop Mellanox FPGA IPsec support from the kernel
From: Leon Romanovsky <[email protected]>
Together with FPGA TLS, the IPsec went to EOL state in the November of 2019 [1]. Exactly like FPGA TLS, no active customers exist for this upstream code and all the complexity around that area can be deleted.
[1] https://network.nvidia.com/related-docs/eol/LCR-000535.pdf
Thanks
Leon Romanovsky (17):
net/mlx5_fpga: Drop INNOVA IPsec support
net/mlx5: Delete metadata handling logic
net/mlx5: Remove not-used IDA field from IPsec struct net/mlx5: Remove XFRM no_trailer flag
net/mlx5: Remove FPGA ipsec specific statistics RDMA/mlx5: Delete never supported IPsec flow action RDMA/mlx5: Drop crypto flow steering API
RDMA/core: Delete IPsec flow action logic from the core net/mlx5: Remove ipsec vs. ipsec offload file separation net/mlx5: Remove useless IPsec device checks
net/mlx5: Unify device IPsec capabilities check net/mlx5: Align flow steering allocation namespace to common style net/mlx5: Remove not-needed IPsec config
net/mlx5: Move IPsec file to relevant directory net/mlx5: Reduce kconfig complexity while building crypto support net/mlx5: Remove ipsec_ops function table
net/mlx5: Remove not-implemented IPsec capabilities
drivers/infiniband/core/device.c | 2 -
.../core/uverbs_std_types_flow_action.c | 383 +---
drivers/infiniband/hw/mlx5/fs.c | 223 +--
drivers/infiniband/hw/mlx5/main.c | 31 -
.../net/ethernet/mellanox/mlx5/core/Kconfig | 33 +-
.../net/ethernet/mellanox/mlx5/core/Makefile | 9 +-
.../ethernet/mellanox/mlx5/core/accel/accel.h | 36 -
.../ethernet/mellanox/mlx5/core/accel/ipsec.c | 179 --
.../ethernet/mellanox/mlx5/core/accel/ipsec.h | 96 -
.../mellanox/mlx5/core/accel/ipsec_offload.h | 38 -
.../ethernet/mellanox/mlx5/core/en/params.c | 13 +-
.../mellanox/mlx5/core/en_accel/ipsec.c | 30 +-
.../mellanox/mlx5/core/en_accel/ipsec.h | 31 +-
.../mellanox/mlx5/core/en_accel/ipsec_fs.c | 5 +-
.../mellanox/mlx5/core/en_accel/ipsec_fs.h | 7 +-
.../core/{accel => en_accel}/ipsec_offload.c | 95 +-
.../mlx5/core/en_accel/ipsec_offload.h | 14 +
.../mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 245 +--
.../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 3 -
.../mellanox/mlx5/core/en_accel/ipsec_stats.c | 63 +-
.../net/ethernet/mellanox/mlx5/core/en_main.c | 12 +-
.../net/ethernet/mellanox/mlx5/core/en_rep.c | 1 -
.../net/ethernet/mellanox/mlx5/core/en_rx.c | 56 +-
.../ethernet/mellanox/mlx5/core/en_stats.c | 1 -
.../ethernet/mellanox/mlx5/core/en_stats.h | 1 -
.../ethernet/mellanox/mlx5/core/fpga/core.h | 2 -
.../ethernet/mellanox/mlx5/core/fpga/ipsec.c | 1582 -----------------
.../ethernet/mellanox/mlx5/core/fpga/ipsec.h | 62 -
.../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 2 -
.../net/ethernet/mellanox/mlx5/core/fs_core.c | 15 +-
.../net/ethernet/mellanox/mlx5/core/main.c | 8 +-
include/linux/mlx5/accel.h | 35 +-
include/linux/mlx5/driver.h | 3 -
include/linux/mlx5/mlx5_ifc_fpga.h | 148 --
include/rdma/ib_verbs.h | 8 -
35 files changed, 143 insertions(+), 3329 deletions(-)
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/accel.h
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.h
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.h
rename drivers/net/ethernet/mellanox/mlx5/core/{accel => en_accel}/ipsec_offload.c (84%)
create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.h
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.hSignature · 1 line
2.35.1
PATCH 1/17 net/mlx5_fpga: Drop INNOVA IPsec support
From: Leon Romanovsky <[email protected]>
Mellanox INNOVA IPsec cards are EOL in Nov, 2019 [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-000535.pdf
--- .../net/ethernet/mellanox/mlx5/core/Kconfig | 14 +- .../net/ethernet/mellanox/mlx5/core/Makefile | 1 - .../ethernet/mellanox/mlx5/core/accel/ipsec.c | 6 +- .../ethernet/mellanox/mlx5/core/en/params.c | 7 - .../mellanox/mlx5/core/en_accel/ipsec_stats.c | 17 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 7 - .../net/ethernet/mellanox/mlx5/core/en_rx.c | 54 +- .../ethernet/mellanox/mlx5/core/fpga/core.h | 2 - .../ethernet/mellanox/mlx5/core/fpga/ipsec.c | 1582 ----------------- .../ethernet/mellanox/mlx5/core/fpga/ipsec.h | 62 - .../net/ethernet/mellanox/mlx5/core/fs_core.c | 9 +- .../net/ethernet/mellanox/mlx5/core/main.c | 2 - include/linux/mlx5/mlx5_ifc_fpga.h | 148 -- 13 files changed, 5 insertions(+), 1906 deletions(-) delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -13
@@ -22,7 +22,6 @@ config MLX5_ACCEL config MLX5_FPGA bool "Mellanox Technologies Innova support" depends on MLX5_CORE - select MLX5_ACCEL help Build support for the Innova family of network cards by Mellanox Technologies. Innova network cards are comprised of a ConnectX chip
@@ -143,17 +142,6 @@ config MLX5_CORE_IPOIB help MLX5 IPoIB offloads & acceleration support. -config MLX5_FPGA_IPSEC - bool "Mellanox Technologies IPsec Innova support" - depends on MLX5_CORE - depends on MLX5_FPGA - help - Build IPsec 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_IPSEC bool "Mellanox Technologies IPsec Connect-X support" depends on MLX5_CORE_EN
@@ -171,7 +159,7 @@ config MLX5_EN_IPSEC depends on MLX5_CORE_EN depends on XFRM_OFFLOAD depends on INET_ESP_OFFLOAD || INET6_ESP_OFFLOAD - depends on MLX5_FPGA_IPSEC || MLX5_IPSEC + depends on MLX5_IPSEC help Build support for IPsec cryptography-offload acceleration in the NIC. Note: Support for hardware with this capability needs to be selected
drivers/net/ethernet/mellanox/mlx5/core/Makefile +0 -1
@@ -89,7 +89,6 @@ mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib # Accelerations & FPGA # 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/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/ipsec.c +1 -5
@@ -35,7 +35,6 @@#include "accel/ipsec.h" #include "mlx5_core.h" -#include "fpga/ipsec.h" #include "accel/ipsec_offload.h" void mlx5_accel_ipsec_init (struct mlx5_core_dev *mdev)
@@ -43,10 +42,7 @@ void mlx5_accel_ipsec_init(struct mlx5_core_dev *mdev)const struct mlx5_accel_ipsec_ops *ipsec_ops;int err =0 ; - ipsec_ops = (mlx5_ipsec_offload_ops (mdev)) ? -mlx5_ipsec_offload_ops (mdev) : -mlx5_fpga_ipsec_ops (mdev); - + ipsec_ops =mlx5_ipsec_offload_ops (mdev);if (!ipsec_ops || !ipsec_ops->init) {mlx5_core_dbg (mdev,"IPsec ops is not supported\n" );return ;
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +0 -7
@@ -6,7 +6,6 @@#include "en/port.h" #include "en_accel/en_accel.h" #include "accel/ipsec.h" -#include "fpga/ipsec.h" static bool mlx5e_rx_is_xdp (struct mlx5e_params *params,struct mlx5e_xsk_param *xsk)
@@ -327,9 +326,6 @@ bool mlx5e_striding_rq_possible(struct mlx5_core_dev *mdev,if (!mlx5e_check_fragmented_striding_rq_cap (mdev))return false; -if (mlx5_fpga_is_ipsec_device (mdev)) -return false; -if (params->xdp_prog) {/* XSK params are not considered here. If striding RQ is in use, * and an XSK is being opened, mlx5e_rx_mpwqe_is_linear_skb will
@@ -423,9 +419,6 @@ static int mlx5e_build_rq_frags_info(struct mlx5_core_dev *mdev,int max_mtu;int i; -if (mlx5_fpga_is_ipsec_device (mdev)) - byte_count +=MLX5E_METADATA_ETHER_LEN ; -if (mlx5e_rx_is_linear_skb (params, xsk)) {int frag_stride;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c +1 -16
@@ -38,7 +38,6 @@#include "accel/ipsec.h" #include "fpga/sdk.h" #include "en_accel/ipsec.h" -#include "fpga/ipsec.h" static const struct counter_desc mlx5e_ipsec_hw_stats_desc[] = { { MLX5E_DECLARE_STAT(struct mlx5e_ipsec_stats, ipsec_dec_in_packets) },
@@ -105,7 +104,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_sw)static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS (ipsec_hw) { -return (priv->ipsec &&mlx5_fpga_ipsec_device_caps (priv->mdev)) ?NUM_IPSEC_HW_COUNTERS :0 ; +return 0 ; }static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (ipsec_hw)
@@ -121,25 +120,11 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(ipsec_hw)static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS (ipsec_hw) { -unsigned int i; - -if (priv->ipsec &&mlx5_fpga_ipsec_device_caps (priv->mdev)) -for (i =0 ; i <NUM_IPSEC_HW_COUNTERS ; i++) -strcpy (data + (idx++) *ETH_GSTRING_LEN , - mlx5e_ipsec_hw_stats_desc[i].format); -return idx; }static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS (ipsec_hw) { -int i; - -if (priv->ipsec &&mlx5_fpga_ipsec_device_caps (priv->mdev)) -for (i =0 ; i <NUM_IPSEC_HW_COUNTERS ; i++) - data[idx++] =MLX5E_READ_CTR64_CPU (&priv->ipsec->stats, - mlx5e_ipsec_hw_stats_desc, - i);return idx; }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -7
@@ -67,7 +67,6 @@#include "en/ptp.h" #include "qos.h" #include "en/trap.h" -#include "fpga/ipsec.h" bool mlx5e_check_fragmented_striding_rq_cap (struct mlx5_core_dev *mdev) {
@@ -4467,12 +4466,6 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog)return -EINVAL ; } -if (mlx5_fpga_is_ipsec_device (priv->mdev)) { -netdev_warn (netdev, -"XDP is not available on Innova cards with IPsec support\n" ); -return -EINVAL ; - } - new_params = priv->channels.params; new_params.xdp_prog = prog;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -53
78 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/fpga/core.h +0 -2
@@ -57,8 +57,6 @@ struct mlx5_fpga_device {u32 mkey;struct mlx5_uars_page *uar; } conn_res; - -struct mlx5_fpga_ipsec *ipsec; };#define mlx5_fpga_dbg (__adev, format, ...) \
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c deleted +0 -1582
1,582 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h deleted +0 -62
62 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 -8
@@ -40,8 +40,6 @@#include "fs_cmd.h" #include "fs_ft_pool.h" #include "diag/fs_tracepoint.h" -#include "accel/ipsec.h" -#include "fpga/ipsec.h" #define INIT_TREE_NODE_ARRAY_SIZE (...) (sizeof((struct init_tree_node[]){__VA_ARGS__}) /\ sizeof(struct init_tree_node))
@@ -2519,10 +2517,6 @@ static struct mlx5_flow_root_namespacestruct mlx5_flow_root_namespace *root_ns;struct mlx5_flow_namespace *ns; -if (mlx5_fpga_ipsec_device_caps (steering->dev) &MLX5_ACCEL_IPSEC_CAP_DEVICE && - (table_type ==FS_FT_NIC_RX || table_type ==FS_FT_NIC_TX )) - cmds =mlx5_fs_cmd_get_default_ipsec_fpga_cmds (table_type); -/* Create the root namespace */ root_ns =kzalloc (sizeof (*root_ns),GFP_KERNEL );if (!root_ns)
@@ -3172,8 +3166,7 @@ int mlx5_init_fs(struct mlx5_core_dev *dev) goto err; } -if (mlx5_fpga_ipsec_device_caps (steering->dev) &MLX5_ACCEL_IPSEC_CAP_DEVICE || -MLX5_CAP_FLOWTABLE_NIC_TX (dev, ft_support)) { +if (MLX5_CAP_FLOWTABLE_NIC_TX (dev, ft_support)) { err =init_egress_root_ns (steering);if (err) goto err;
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -2
@@ -62,7 +62,6 @@#include "lib/mlx5.h" #include "lib/tout.h" #include "fpga/core.h" -#include "fpga/ipsec.h" #include "accel/ipsec.h" #include "lib/clock.h" #include "lib/vxlan.h"
@@ -1937,7 +1936,6 @@ static int __init init(void)get_random_bytes (&sw_owner_id,sizeof (sw_owner_id));mlx5_core_verify_params (); -mlx5_fpga_ipsec_build_fs_cmds ();mlx5_register_debugfs (); err =pci_register_driver (&mlx5_core_driver);
include/linux/mlx5/mlx5_ifc_fpga.h +0 -148
158 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 2/17 net/mlx5: Delete metadata handling logic
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Remove specific to FPGS IPsec metadata handling logic which is not required for mlx5 NICs devices.
--- .../ethernet/mellanox/mlx5/core/accel/accel.h | 36 ---- .../mellanox/mlx5/core/en_accel/ipsec.h | 6 - .../mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 199 ------------------ .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 3 - .../net/ethernet/mellanox/mlx5/core/en_main.c | 1 - 5 files changed, 245 deletions(-) delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/accel.h
drivers/net/ethernet/mellanox/mlx5/core/accel/accel.h deleted +0 -36
@@ -1,36 +0,0 @@ -#ifndef __MLX5E_ACCEL_H__ -#define __MLX5E_ACCEL_H__ - -#ifdef CONFIG_MLX5_ACCEL - -#include <linux/skbuff.h> -#include <linux/netdevice.h> - -static inline bool is_metadata_hdr_valid (struct sk_buff *skb) -{ -__be16 *ethtype; - -if (unlikely (skb->len <ETH_HLEN +MLX5E_METADATA_ETHER_LEN )) -return false; - ethtype = (__be16 *)(skb->data +ETH_ALEN *2 ); -if (*ethtype !=cpu_to_be16 (MLX5E_METADATA_ETHER_TYPE )) -return false; -return true; -} - -static inline void remove_metadata_hdr (struct sk_buff *skb) -{ -struct ethhdr *old_eth; -struct ethhdr *new_eth; - -/* Remove the metadata from the buffer */ - old_eth = (struct ethhdr *)skb->data; - new_eth = (struct ethhdr *)(skb->data +MLX5E_METADATA_ETHER_LEN ); -memmove (new_eth, old_eth,2 *ETH_ALEN ); -/* Ethertype is already in its new place */ -skb_pull_inline (skb,MLX5E_METADATA_ETHER_LEN ); -} - -#endif /* CONFIG_MLX5_ACCEL */ - -#endif /* __MLX5E_EN_ACCEL_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +0 -6
@@ -116,7 +116,6 @@ struct mlx5e_ipsec_sa_entry {struct mlx5e_ipsec_rule ipsec_rule; }; -void mlx5e_ipsec_build_inverse_table (void );int mlx5e_ipsec_init (struct mlx5e_priv *priv);void mlx5e_ipsec_cleanup (struct mlx5e_priv *priv);void mlx5e_ipsec_build_netdev (struct mlx5e_priv *priv);
@@ -125,11 +124,6 @@ struct xfrm_state *mlx5e_ipsec_sadb_rx_lookup(struct mlx5e_ipsec *dev, unsigned int handle);#else - -static inline void mlx5e_ipsec_build_inverse_table (void ) -{ -} -static inline int mlx5e_ipsec_init (struct mlx5e_priv *priv) {return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +0 -199
241 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +0 -3
@@ -53,9 +53,6 @@ struct mlx5e_accel_tx_ipsec_state {#ifdef CONFIG_MLX5_EN_IPSEC -struct sk_buff *mlx5e_ipsec_handle_rx_skb (struct net_device *netdev, -struct sk_buff *skb,u32 *cqe_bcnt); -void mlx5e_ipsec_inverse_table_init (void );void mlx5e_ipsec_set_iv_esn (struct sk_buff *skb,struct xfrm_state *x,struct xfrm_offload *xo);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -1
@@ -5693,7 +5693,6 @@ int mlx5e_init(void) {int ret; -mlx5e_ipsec_build_inverse_table ();mlx5e_build_ptys2ethtool_map (); ret =auxiliary_driver_register (&mlx5e_driver);if (ret)
Signature · 1 line
2.35.1
PATCH 3/17 net/mlx5: Remove not-used IDA field from IPsec struct
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The IDA halloc variable is not needed and can be removed.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 2 -- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +0 -2
@@ -425,7 +425,6 @@ int mlx5e_ipsec_init(struct mlx5e_priv *priv)hash_init (ipsec->sadb_rx);spin_lock_init (&ipsec->sadb_rx_lock); -ida_init (&ipsec->halloc); ipsec->en_priv = priv; ipsec->no_trailer = !!(mlx5_accel_ipsec_device_caps (priv->mdev) &MLX5_ACCEL_IPSEC_CAP_RX_NO_TRAILER );
@@ -452,7 +451,6 @@ void mlx5e_ipsec_cleanup(struct mlx5e_priv *priv)mlx5e_accel_ipsec_fs_cleanup (priv);destroy_workqueue (ipsec->wq); -ida_destroy (&ipsec->halloc);kfree (ipsec); priv->ipsec =NULL ; }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +1 -2
@@ -82,8 +82,7 @@ struct mlx5e_ipsec {struct mlx5e_priv *en_priv;DECLARE_HASHTABLE (sadb_rx,MLX5E_IPSEC_SADB_RX_BITS );bool no_trailer; -spinlock_t sadb_rx_lock;/* Protects sadb_rx and halloc */ -struct ida halloc; +spinlock_t sadb_rx_lock;/* Protects sadb_rx */ struct mlx5e_ipsec_sw_stats sw_stats;struct mlx5e_ipsec_stats stats;struct workqueue_struct *wq;
Signature · 1 line
2.35.1
PATCH 4/17 net/mlx5: Remove XFRM no_trailer flag
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Only FPGA needed this NO_TRAILER flag, so remove this assignment.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 2 -- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h | 1 - drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 2 -- 3 files changed, 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +0 -2
@@ -426,8 +426,6 @@ int mlx5e_ipsec_init(struct mlx5e_priv *priv)hash_init (ipsec->sadb_rx);spin_lock_init (&ipsec->sadb_rx_lock); ipsec->en_priv = priv; - ipsec->no_trailer = !!(mlx5_accel_ipsec_device_caps (priv->mdev) & -MLX5_ACCEL_IPSEC_CAP_RX_NO_TRAILER ); ipsec->wq =alloc_ordered_workqueue ("mlx5e_ipsec: %s" ,0 , priv->netdev->name);if (!ipsec->wq) {
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +0 -1
@@ -81,7 +81,6 @@ struct mlx5e_ipsec_tx;struct mlx5e_ipsec {struct mlx5e_priv *en_priv; DECLARE_HASHTABLE(sadb_rx, MLX5E_IPSEC_SADB_RX_BITS); -bool no_trailer;spinlock_t sadb_rx_lock;/* Protects sadb_rx */ struct mlx5e_ipsec_sw_stats sw_stats;struct mlx5e_ipsec_stats stats;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +0 -2
@@ -347,8 +347,6 @@ void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,switch (MLX5_IPSEC_METADATA_SYNDROM (ipsec_meta_data)) {case MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_DECRYPTED : xo->status =CRYPTO_SUCCESS ; -if (WARN_ON_ONCE (priv->ipsec->no_trailer)) - xo->flags |=XFRM_ESP_NO_TRAILER ;break ;case MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_AUTH_FAILED : xo->status =CRYPTO_TUNNEL_ESP_AUTH_FAILED ;
Signature · 1 line
2.35.1
PATCH 5/17 net/mlx5: Remove FPGA ipsec specific statistics
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Delete the statistics that is not used anymore.
--- .../mellanox/mlx5/core/en_accel/ipsec.h | 19 -------- .../mellanox/mlx5/core/en_accel/ipsec_stats.c | 46 ------------------- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 1 - .../ethernet/mellanox/mlx5/core/en_stats.c | 1 - .../ethernet/mellanox/mlx5/core/en_stats.h | 1 - 5 files changed, 68 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +0 -19
@@ -55,24 +55,6 @@ struct mlx5e_ipsec_sw_stats {atomic64_t ipsec_tx_drop_no_state;atomic64_t ipsec_tx_drop_not_ip;atomic64_t ipsec_tx_drop_trailer; -atomic64_t ipsec_tx_drop_metadata; -}; - -struct mlx5e_ipsec_stats { -u64 ipsec_dec_in_packets; -u64 ipsec_dec_out_packets; -u64 ipsec_dec_bypass_packets; -u64 ipsec_enc_in_packets; -u64 ipsec_enc_out_packets; -u64 ipsec_enc_bypass_packets; -u64 ipsec_dec_drop_packets; -u64 ipsec_dec_auth_fail_packets; -u64 ipsec_enc_drop_packets; -u64 ipsec_add_sa_success; -u64 ipsec_add_sa_fail; -u64 ipsec_del_sa_success; -u64 ipsec_del_sa_fail; -u64 ipsec_cmd_drop; };struct mlx5e_accel_fs_esp ;
@@ -83,7 +65,6 @@ struct mlx5e_ipsec {DECLARE_HASHTABLE (sadb_rx,MLX5E_IPSEC_SADB_RX_BITS );spinlock_t sadb_rx_lock;/* Protects sadb_rx */ struct mlx5e_ipsec_sw_stats sw_stats; -struct mlx5e_ipsec_stats stats;struct workqueue_struct *wq;struct mlx5e_accel_fs_esp *rx_fs;struct mlx5e_ipsec_tx *tx_fs;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c +0 -46
67 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +0 -1
@@ -1112,7 +1112,6 @@ static mlx5e_stats_grp_t mlx5e_ul_rep_stats_grps[] = { &MLX5E_STATS_GRP (per_port_buff_congest), #ifdef CONFIG_MLX5_EN_IPSEC &MLX5E_STATS_GRP (ipsec_sw), - &MLX5E_STATS_GRP (ipsec_hw), #endif &MLX5E_STATS_GRP(ptp), };
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +0 -1
@@ -2443,7 +2443,6 @@ mlx5e_stats_grp_t mlx5e_nic_stats_grps[] = { &MLX5E_STATS_GRP (pme), #ifdef CONFIG_MLX5_EN_IPSEC &MLX5E_STATS_GRP (ipsec_sw), - &MLX5E_STATS_GRP (ipsec_hw), #endif &MLX5E_STATS_GRP (tls), &MLX5E_STATS_GRP(channels),
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +0 -1
@@ -482,7 +482,6 @@ extern MLX5E_DECLARE_STATS_GRP(per_prio);extern MLX5E_DECLARE_STATS_GRP (pme);extern MLX5E_DECLARE_STATS_GRP (channels);extern MLX5E_DECLARE_STATS_GRP (per_port_buff_congest); -extern MLX5E_DECLARE_STATS_GRP (ipsec_hw);extern MLX5E_DECLARE_STATS_GRP (ipsec_sw);extern MLX5E_DECLARE_STATS_GRP (ptp);
Signature · 1 line
2.35.1
PATCH 6/17 RDMA/mlx5: Delete never supported IPsec flow action
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The IPSEC_REQUIRED_METADATA capability bit is never set, and can be safely removed from the flow action flags.
--- drivers/infiniband/hw/mlx5/main.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/infiniband/hw/mlx5/main.c +0 -4
@@ -1798,15 +1798,11 @@ static int set_ucontext_resp(struct ib_ucontext *uctx,if (mlx5_get_flow_namespace (dev->mdev,MLX5_FLOW_NAMESPACE_EGRESS )) resp->flow_action_flags |=MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM ; -if (mlx5_accel_ipsec_device_caps (dev->mdev) & -MLX5_ACCEL_IPSEC_CAP_REQUIRED_METADATA ) - resp->flow_action_flags |=MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_REQ_METADATA ;if (MLX5_CAP_FLOWTABLE (dev->mdev, flow_table_properties_nic_receive.ft_field_support.outer_esp_spi)) resp->flow_action_flags |=MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_SPI_STEERING ;if (mlx5_accel_ipsec_device_caps (dev->mdev) &MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN ) resp->flow_action_flags |=MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_TX_IV_IS_ESN ; -/* MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_FULL_OFFLOAD is currently always 0 */ } resp->tot_bfregs = bfregi->lib_uar_dyn ? 0 :
Signature · 1 line
2.35.1
PATCH 7/17 RDMA/mlx5: Drop crypto flow steering API
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The mlx5 flow steering crypto API was intended to be used in FPGA devices, which is not supported for years already. The removal of mlx5 crypto FPGA code together with inability to configure encryption keys makes the low steering API completely unusable.
So delete the code, so any ESP flow steering requests will fail with not supported error, as it is happening now anyway as no device support this type of API.
--- drivers/infiniband/hw/mlx5/fs.c | 223 +----------------- drivers/infiniband/hw/mlx5/main.c | 27 --- .../ethernet/mellanox/mlx5/core/accel/ipsec.c | 5 +- .../mellanox/mlx5/core/en_accel/ipsec.c | 4 +- include/linux/mlx5/accel.h | 13 +- 5 files changed, 10 insertions(+), 262 deletions(-)
drivers/infiniband/hw/mlx5/fs.c +2 -221
@@ -15,7 +15,6 @@#include <linux/mlx5/driver.h> #include <linux/mlx5/fs.h> #include <linux/mlx5/fs_helpers.h> -#include <linux/mlx5/accel.h> #include <linux/mlx5/eswitch.h> #include <net/inet_ecn.h> #include "mlx5_ib.h"
@@ -148,16 +147,6 @@ int parse_flow_flow_action(struct mlx5_ib_flow_action *maction, {switch (maction->ib_action.type) { -case IB_FLOW_ACTION_ESP : -if (action->action & (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT | -MLX5_FLOW_CONTEXT_ACTION_DECRYPT )) -return -EINVAL ; -/* Currently only AES_GCM keymat is supported by the driver */ - action->esp_id = (uintptr_t )maction->esp_aes_gcm.ctx; - action->action |= is_egress ? -MLX5_FLOW_CONTEXT_ACTION_ENCRYPT : -MLX5_FLOW_CONTEXT_ACTION_DECRYPT ; -return 0 ;case IB_FLOW_ACTION_UNSPECIFIED :if (maction->flow_action_raw.sub_type ==MLX5_IB_FLOW_ACTION_MODIFY_HEADER ) {
@@ -368,14 +357,7 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, ib_spec->type & IB_FLOW_SPEC_INNER);break ;case IB_FLOW_SPEC_ESP : -if (ib_spec->esp.mask.seq) -return -EOPNOTSUPP ; - -MLX5_SET (fte_match_set_misc, misc_params_c, outer_esp_spi, -ntohl (ib_spec->esp.mask.spi)); -MLX5_SET (fte_match_set_misc, misc_params_v, outer_esp_spi, -ntohl (ib_spec->esp.val.spi)); -break ; +return -EOPNOTSUPP ;case IB_FLOW_SPEC_TCP :if (FIELDS_NOT_SUPPORTED (ib_spec->tcp_udp.mask,LAST_TCP_UDP_FIELD ))
@@ -587,47 +569,6 @@ static bool flow_is_multicast_only(const struct ib_flow_attr *ib_attr)return false; } -enum valid_spec { -VALID_SPEC_INVALID , -VALID_SPEC_VALID , -VALID_SPEC_NA , -}; - -static enum valid_spec -is_valid_esp_aes_gcm (struct mlx5_core_dev *mdev, -const struct mlx5_flow_spec *spec, -const struct mlx5_flow_act *flow_act, -bool egress) -{ -const u32 *match_c = spec->match_criteria; -bool is_crypto = - (flow_act->action & (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT | -MLX5_FLOW_CONTEXT_ACTION_DECRYPT )); -bool is_ipsec =mlx5_fs_is_ipsec_flow (match_c); -bool is_drop = flow_act->action &MLX5_FLOW_CONTEXT_ACTION_DROP ; - -/* -* Currently only crypto is supported in egress, when regular egress -* rules would be supported, always return VALID_SPEC_NA. -*/ -if (!is_crypto) -return VALID_SPEC_NA ; - -return is_crypto && is_ipsec && - (!egress || (!is_drop && - !(spec->flow_context.flags &FLOW_CONTEXT_HAS_TAG ))) ? -VALID_SPEC_VALID :VALID_SPEC_INVALID ; -} - -static bool is_valid_spec (struct mlx5_core_dev *mdev, -const struct mlx5_flow_spec *spec, -const struct mlx5_flow_act *flow_act, -bool egress) -{ -/* We curretly only support ipsec egress flow */ -return is_valid_esp_aes_gcm (mdev, spec, flow_act, egress) !=VALID_SPEC_INVALID ; -} -static bool is_valid_ethertype (struct mlx5_core_dev *mdev,const struct ib_flow_attr *flow_attr,bool check_inner)
@@ -1154,8 +1095,7 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, spec->match_criteria_enable =get_match_criteria_enable (spec->match_criteria); -if (is_egress && - !is_valid_spec (dev->mdev, spec, &flow_act, is_egress)) { +if (is_egress) { err = -EINVAL ; goto free; }
@@ -1740,149 +1680,6 @@ static struct mlx5_ib_flow_handler *raw_fs_rule_add(return ERR_PTR (err); } -static u32 mlx5_ib_flow_action_flags_to_accel_xfrm_flags (u32 mlx5_flags) -{ -u32 flags =0 ; - -if (mlx5_flags &MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA ) - flags |=MLX5_ACCEL_XFRM_FLAG_REQUIRE_METADATA ; - -return flags; -} - -#define MLX5_FLOW_ACTION_ESP_CREATE_LAST_SUPPORTED \ - MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA -static struct ib_flow_action * -mlx5_ib_create_flow_action_esp (struct ib_device *device, -const struct ib_flow_action_attrs_esp *attr, -struct uverbs_attr_bundle *attrs) -{ -struct mlx5_ib_dev *mdev =to_mdev (device); -struct ib_uverbs_flow_action_esp_keymat_aes_gcm *aes_gcm; -struct mlx5_accel_esp_xfrm_attrs accel_attrs = {}; -struct mlx5_ib_flow_action *action; -u64 action_flags; -u64 flags; -int err =0 ; - - err =uverbs_get_flags64 ( - &action_flags, attrs,MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS , - ((MLX5_FLOW_ACTION_ESP_CREATE_LAST_SUPPORTED <<1 ) -1 )); -if (err) -return ERR_PTR (err); - - flags =mlx5_ib_flow_action_flags_to_accel_xfrm_flags (action_flags); - -/* We current only support a subset of the standard features. Only a -* keymat of type AES_GCM, with icv_len == 16, iv_algo == SEQ and esn -* (with overlap). Full offload mode isn't supported. -*/ -if (!attr->keymat || attr->replay || attr->encap || - attr->spi || attr->seq || attr->tfc_pad || - attr->hard_limit_pkts || - (attr->flags & ~(IB_FLOW_ACTION_ESP_FLAGS_ESN_TRIGGERED | -IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT ))) -return ERR_PTR (-EOPNOTSUPP ); - -if (attr->keymat->protocol != -IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM ) -return ERR_PTR (-EOPNOTSUPP ); - - aes_gcm = &attr->keymat->keymat.aes_gcm; - -if (aes_gcm->icv_len !=16 || - aes_gcm->iv_algo !=IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ ) -return ERR_PTR (-EOPNOTSUPP ); - - action =kmalloc (sizeof (*action),GFP_KERNEL ); -if (!action) -return ERR_PTR (-ENOMEM ); - - action->esp_aes_gcm.ib_flags = attr->flags; -memcpy (&accel_attrs.keymat.aes_gcm.aes_key, &aes_gcm->aes_key, -sizeof (accel_attrs.keymat.aes_gcm.aes_key)); - accel_attrs.keymat.aes_gcm.key_len = aes_gcm->key_len *8 ; -memcpy (&accel_attrs.keymat.aes_gcm.salt, &aes_gcm->salt, -sizeof (accel_attrs.keymat.aes_gcm.salt)); -memcpy (&accel_attrs.keymat.aes_gcm.seq_iv, &aes_gcm->iv, -sizeof (accel_attrs.keymat.aes_gcm.seq_iv)); - accel_attrs.keymat.aes_gcm.icv_len = aes_gcm->icv_len *8 ; - accel_attrs.keymat.aes_gcm.iv_algo =MLX5_ACCEL_ESP_AES_GCM_IV_ALGO_SEQ ; - accel_attrs.keymat_type =MLX5_ACCEL_ESP_KEYMAT_AES_GCM ; - - accel_attrs.esn = attr->esn; -if (attr->flags &IB_FLOW_ACTION_ESP_FLAGS_ESN_TRIGGERED ) - accel_attrs.flags |=MLX5_ACCEL_ESP_FLAGS_ESN_TRIGGERED ; -if (attr->flags &IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW ) - accel_attrs.flags |=MLX5_ACCEL_ESP_FLAGS_ESN_STATE_OVERLAP ; - -if (attr->flags &IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT ) - accel_attrs.action |=MLX5_ACCEL_ESP_ACTION_ENCRYPT ; - - action->esp_aes_gcm.ctx = -mlx5_accel_esp_create_xfrm (mdev->mdev, &accel_attrs, flags); -if (IS_ERR (action->esp_aes_gcm.ctx)) { - err =PTR_ERR (action->esp_aes_gcm.ctx); - goto err_parse; - } - - action->esp_aes_gcm.ib_flags = attr->flags; - -return &action->ib_action; - -err_parse: -kfree (action); -return ERR_PTR (err); -} - -static int -mlx5_ib_modify_flow_action_esp (struct ib_flow_action *action, -const struct ib_flow_action_attrs_esp *attr, -struct uverbs_attr_bundle *attrs) -{ -struct mlx5_ib_flow_action *maction =to_mflow_act (action); -struct mlx5_accel_esp_xfrm_attrs accel_attrs; -int err =0 ; - -if (attr->keymat || attr->replay || attr->encap || - attr->spi || attr->seq || attr->tfc_pad || - attr->hard_limit_pkts || - (attr->flags & ~(IB_FLOW_ACTION_ESP_FLAGS_ESN_TRIGGERED | -IB_FLOW_ACTION_ESP_FLAGS_MOD_ESP_ATTRS | -IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW ))) -return -EOPNOTSUPP ; - -/* Only the ESN value or the MLX5_ACCEL_ESP_FLAGS_ESN_STATE_OVERLAP can -* be modified. -*/ -if (!(maction->esp_aes_gcm.ib_flags & -IB_FLOW_ACTION_ESP_FLAGS_ESN_TRIGGERED ) && - attr->flags & (IB_FLOW_ACTION_ESP_FLAGS_ESN_TRIGGERED | -IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW )) -return -EINVAL ; - -memcpy (&accel_attrs, &maction->esp_aes_gcm.ctx->attrs, -sizeof (accel_attrs)); - - accel_attrs.esn = attr->esn; -if (attr->flags &IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW ) - accel_attrs.flags |=MLX5_ACCEL_ESP_FLAGS_ESN_STATE_OVERLAP ; -else - accel_attrs.flags &= ~MLX5_ACCEL_ESP_FLAGS_ESN_STATE_OVERLAP ; - - err =mlx5_accel_esp_modify_xfrm (maction->esp_aes_gcm.ctx, - &accel_attrs); -if (err) -return err; - - maction->esp_aes_gcm.ib_flags &= - ~IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW ; - maction->esp_aes_gcm.ib_flags |= - attr->flags &IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW ; - -return 0 ; -} -static void destroy_flow_action_raw (struct mlx5_ib_flow_action *maction) {switch (maction->flow_action_raw.sub_type) {
@@ -1906,13 +1703,6 @@ static int mlx5_ib_destroy_flow_action(struct ib_flow_action *action)struct mlx5_ib_flow_action *maction =to_mflow_act (action);switch (action->type) { -case IB_FLOW_ACTION_ESP : -/* -* We only support aes_gcm by now, so we implicitly know this is -* the underline crypto. -*/ -mlx5_accel_esp_destroy_xfrm (maction->esp_aes_gcm.ctx); -break ;case IB_FLOW_ACTION_UNSPECIFIED :destroy_flow_action_raw (maction);break ;
@@ -2709,11 +2499,6 @@ static const struct ib_device_ops flow_ops = { .destroy_flow_action = mlx5_ib_destroy_flow_action, }; -static const struct ib_device_ops flow_ipsec_ops = { - .create_flow_action_esp = mlx5_ib_create_flow_action_esp, - .modify_flow_action_esp = mlx5_ib_modify_flow_action_esp, -}; -int mlx5_ib_fs_init (struct mlx5_ib_dev *dev) { dev->flow_db =kzalloc (sizeof (*dev->flow_db),GFP_KERNEL );
@@ -2724,9 +2509,5 @@ int mlx5_ib_fs_init(struct mlx5_ib_dev *dev)mutex_init (&dev->flow_db->lock);ib_set_device_ops (&dev->ib_dev, &flow_ops); -if (mlx5_accel_ipsec_device_caps (dev->mdev) & -MLX5_ACCEL_IPSEC_CAP_DEVICE ) -ib_set_device_ops (&dev->ib_dev, &flow_ipsec_ops); -return 0 ; }
drivers/infiniband/hw/mlx5/main.c +0 -27
@@ -42,7 +42,6 @@#include "restrack.h" #include "counters.h" #include "umr.h" -#include <linux/mlx5/accel.h> #include <rdma/uverbs_std_types.h> #include <rdma/uverbs_ioctl.h> #include <rdma/mlx5_user_ioctl_verbs.h>
@@ -907,10 +906,6 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,MLX5_RX_HASH_SRC_PORT_UDP |MLX5_RX_HASH_DST_PORT_UDP |MLX5_RX_HASH_INNER ; -if (mlx5_accel_ipsec_device_caps (dev->mdev) & -MLX5_ACCEL_IPSEC_CAP_DEVICE ) - resp.rss_caps.rx_hash_fields_mask |= -MLX5_RX_HASH_IPSEC_SPI ; resp.response_length +=sizeof (resp.rss_caps); } }else {
@@ -1792,19 +1787,6 @@ static int set_ucontext_resp(struct ib_ucontext *uctx, resp->num_uars_per_page =MLX5_CAP_GEN (dev->mdev, uar_4k) ?MLX5_CAP_GEN (dev->mdev, num_of_uars_per_page) :1 ; - -if (mlx5_accel_ipsec_device_caps (dev->mdev) & -MLX5_ACCEL_IPSEC_CAP_DEVICE ) { -if (mlx5_get_flow_namespace (dev->mdev, -MLX5_FLOW_NAMESPACE_EGRESS )) - resp->flow_action_flags |=MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM ; -if (MLX5_CAP_FLOWTABLE (dev->mdev, flow_table_properties_nic_receive.ft_field_support.outer_esp_spi)) - resp->flow_action_flags |=MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_SPI_STEERING ; -if (mlx5_accel_ipsec_device_caps (dev->mdev) & -MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN ) - resp->flow_action_flags |=MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_TX_IV_IS_ESN ; - } - resp->tot_bfregs = bfregi->lib_uar_dyn ?0 : bfregi->total_num_bfregs - bfregi->num_dyn_bfregs; resp->num_ports = dev->num_ports;
@@ -3601,13 +3583,6 @@ DECLARE_UVERBS_NAMED_OBJECT(MLX5_IB_OBJECT_UAR, &UVERBS_METHOD (MLX5_IB_METHOD_UAR_OBJ_ALLOC ), &UVERBS_METHOD(MLX5_IB_METHOD_UAR_OBJ_DESTROY)); -ADD_UVERBS_ATTRIBUTES_SIMPLE ( - mlx5_ib_flow_action, -UVERBS_OBJECT_FLOW_ACTION , -UVERBS_METHOD_FLOW_ACTION_ESP_CREATE , -UVERBS_ATTR_FLAGS_IN (MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS , - enum mlx5_ib_uapi_flow_action_flags)); - ADD_UVERBS_ATTRIBUTES_SIMPLE( mlx5_ib_query_context, UVERBS_OBJECT_DEVICE,
@@ -3625,8 +3600,6 @@ static const struct uapi_definition mlx5_ib_defs[] = {UAPI_DEF_CHAIN (mlx5_ib_std_types_defs),UAPI_DEF_CHAIN (mlx5_ib_dm_defs), -UAPI_DEF_CHAIN_OBJ_TREE (UVERBS_OBJECT_FLOW_ACTION , - &mlx5_ib_flow_action),UAPI_DEF_CHAIN_OBJ_TREE (UVERBS_OBJECT_DEVICE , &mlx5_ib_query_context),UAPI_DEF_CHAIN_OBJ_TREE_NAMED (MLX5_IB_OBJECT_VAR , UAPI_DEF_IS_OBJ_SUPPORTED(var_is_supported)),
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.c +2 -3
@@ -133,8 +133,7 @@ void mlx5_accel_esp_free_hw_context(struct mlx5_core_dev *mdev, void *context)struct mlx5_accel_esp_xfrm *mlx5_accel_esp_create_xfrm (struct mlx5_core_dev *mdev, -const struct mlx5_accel_esp_xfrm_attrs *attrs, -u32 flags) +const struct mlx5_accel_esp_xfrm_attrs *attrs) {const struct mlx5_accel_ipsec_ops *ipsec_ops = mdev->ipsec_ops;struct mlx5_accel_esp_xfrm *xfrm;
@@ -142,7 +141,7 @@ mlx5_accel_esp_create_xfrm(struct mlx5_core_dev *mdev,if (!ipsec_ops || !ipsec_ops->esp_create_xfrm)return ERR_PTR (-EOPNOTSUPP ); - xfrm = ipsec_ops->esp_create_xfrm (mdev, attrs, flags); + xfrm = ipsec_ops->esp_create_xfrm (mdev, attrs,0 );if (IS_ERR (xfrm))return xfrm;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +1 -3
@@ -333,9 +333,7 @@ static int mlx5e_xfrm_add_state(struct xfrm_state *x)/* create xfrm */ mlx5e_ipsec_build_accel_xfrm_attrs (sa_entry, &attrs); - sa_entry->xfrm = -mlx5_accel_esp_create_xfrm (priv->mdev, &attrs, -MLX5_ACCEL_XFRM_FLAG_REQUIRE_METADATA ); + sa_entry->xfrm =mlx5_accel_esp_create_xfrm (priv->mdev, &attrs);if (IS_ERR (sa_entry->xfrm)) { err =PTR_ERR (sa_entry->xfrm); goto err_sa_entry;
include/linux/mlx5/accel.h +5 -8
@@ -111,10 +111,6 @@ struct mlx5_accel_esp_xfrm {struct mlx5_accel_esp_xfrm_attrs attrs; }; -enum { -MLX5_ACCEL_XFRM_FLAG_REQUIRE_METADATA =1UL <<0 , -}; -enum mlx5_accel_ipsec_cap {MLX5_ACCEL_IPSEC_CAP_DEVICE =1 <<0 ,MLX5_ACCEL_IPSEC_CAP_REQUIRED_METADATA =1 <<1 ,
@@ -132,8 +128,7 @@ u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev);struct mlx5_accel_esp_xfrm *mlx5_accel_esp_create_xfrm (struct mlx5_core_dev *mdev, -const struct mlx5_accel_esp_xfrm_attrs *attrs, -u32 flags); +const struct mlx5_accel_esp_xfrm_attrs *attrs);void mlx5_accel_esp_destroy_xfrm (struct mlx5_accel_esp_xfrm *xfrm);int mlx5_accel_esp_modify_xfrm (struct mlx5_accel_esp_xfrm *xfrm,const struct mlx5_accel_esp_xfrm_attrs *attrs);
@@ -144,8 +139,10 @@ static inline u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev) { retstatic inline struct mlx5_accel_esp_xfrm *mlx5_accel_esp_create_xfrm (struct mlx5_core_dev *mdev, -const struct mlx5_accel_esp_xfrm_attrs *attrs, -u32 flags) {return ERR_PTR (-EOPNOTSUPP ); } +const struct mlx5_accel_esp_xfrm_attrs *attrs) +{ +return ERR_PTR (-EOPNOTSUPP ); +}static inline void mlx5_accel_esp_destroy_xfrm (struct mlx5_accel_esp_xfrm *xfrm) {} static inline int
Signature · 1 line
2.35.1
PATCH 8/17 RDMA/core: Delete IPsec flow action logic from the core
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The removal of mlx5 flow steering logic, left the kernel without any RDMA drivers that implements flow action callbacks supplied by RDMA/core. Any user access to them caused to EOPNOTSUPP error, which can be achieved by simply removing ioctl implementation.
--- drivers/infiniband/core/device.c | 2 - .../core/uverbs_std_types_flow_action.c | 383 +----------------- include/rdma/ib_verbs.h | 8 - 3 files changed, 1 insertion(+), 392 deletions(-)
drivers/infiniband/core/device.c +0 -2
@@ -2613,7 +2613,6 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, create_counters);SET_DEVICE_OP (dev_ops, create_cq);SET_DEVICE_OP (dev_ops, create_flow); -SET_DEVICE_OP (dev_ops, create_flow_action_esp);SET_DEVICE_OP (dev_ops, create_qp);SET_DEVICE_OP (dev_ops, create_rwq_ind_table);SET_DEVICE_OP (dev_ops, create_srq);
@@ -2676,7 +2675,6 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, modify_ah);SET_DEVICE_OP (dev_ops, modify_cq);SET_DEVICE_OP (dev_ops, modify_device); -SET_DEVICE_OP (dev_ops, modify_flow_action_esp);SET_DEVICE_OP (dev_ops, modify_hw_stat);SET_DEVICE_OP (dev_ops, modify_port);SET_DEVICE_OP (dev_ops, modify_qp);
drivers/infiniband/core/uverbs_std_types_flow_action.c +1 -382
395 lines not on this page · raw message
include/rdma/ib_verbs.h +0 -8
@@ -2529,15 +2529,7 @@ struct ib_device_ops {struct ib_flow_attr *flow_attr, struct ib_udata *udata);int (*destroy_flow)(struct ib_flow *flow_id); -struct ib_flow_action *(*create_flow_action_esp)( -struct ib_device *device, -const struct ib_flow_action_attrs_esp *attr, -struct uverbs_attr_bundle *attrs);int (*destroy_flow_action)(struct ib_flow_action *action); -int (*modify_flow_action_esp)( -struct ib_flow_action *action, -const struct ib_flow_action_attrs_esp *attr, -struct uverbs_attr_bundle *attrs);int (*set_vf_link_state)(struct ib_device *device,int vf,u32 port,int state); int (*get_vf_config)(struct ib_device *device, int vf, u32 port,
Signature · 1 line
2.35.1
Re: [PATCH mlx5-next 08/17] RDMA/core: Delete IPsec flow action logic from the core
Quoted 7 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
The removal of mlx5 flow steering logic, left the kernel without any RDMA drivers that implements flow action callbacks supplied by RDMA/core. Any user access to them caused to EOPNOTSUPP error, which can be achieved by simply removing ioctl implementation.
Quoted 7 lines
Reviewed-by Raed Salem <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- drivers/infiniband/core/device.c | 2 - .../core/uverbs_std_types_flow_action.c | 383 +----------------- include/rdma/ib_verbs.h | 8 - 3 files changed, 1 insertion(+), 392 deletions(-)
Jason
PATCH 9/17 net/mlx5: Remove ipsec vs. ipsec offload file separation
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The IPsec won't be initialized at all if device doesn't support IPsec offload. It means that we can combine the ipsec.c and ipsec_offload.c files to one file. Such change will allow us to remove ipsec_ops indirection.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../ethernet/mellanox/mlx5/core/accel/ipsec.c | 174 ------------------ .../ethernet/mellanox/mlx5/core/accel/ipsec.h | 96 ---------- .../mellanox/mlx5/core/accel/ipsec_offload.c | 145 ++++++++++++++- .../mellanox/mlx5/core/accel/ipsec_offload.h | 61 +++++- .../ethernet/mellanox/mlx5/core/en/params.c | 2 +- .../mellanox/mlx5/core/en_accel/ipsec.h | 2 +- .../mellanox/mlx5/core/en_accel/ipsec_stats.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +- .../net/ethernet/mellanox/mlx5/core/main.c | 2 +- 11 files changed, 205 insertions(+), 285 deletions(-) delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.c delete mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -89,7 +89,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib # Accelerations & FPGA # mlx5_core-$(CONFIG_MLX5_IPSEC) += accel/ipsec_offload.o -mlx5_core-$(CONFIG_MLX5_ACCEL) += lib/crypto.o accel/ipsec.o +mlx5_core-$(CONFIG_MLX5_ACCEL) += lib/crypto.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/ipsec.c deleted +0 -174
174 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.h deleted +0 -96
96 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.c +142 -3
160 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.h +56 -5
77 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +1 -1
@@ -5,7 +5,7 @@#include "en/txrx.h" #include "en/port.h" #include "en_accel/en_accel.h" -#include "accel/ipsec.h" +#include "accel/ipsec_offload.h" static bool mlx5e_rx_is_xdp (struct mlx5e_params *params,struct mlx5e_xsk_param *xsk)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +1 -1
@@ -40,7 +40,7 @@#include <net/xfrm.h> #include <linux/idr.h> -#include "accel/ipsec.h" +#include "accel/ipsec_offload.h" #define MLX5E_IPSEC_SADB_RX_BITS 10#define MLX5E_IPSEC_ESN_SCOPE_MID 0x80000000L
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c +1 -1
@@ -35,7 +35,7 @@#include <net/sock.h> #include "en.h" -#include "accel/ipsec.h" +#include "accel/ipsec_offload.h" #include "fpga/sdk.h" #include "en_accel/ipsec.h"
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -48,7 +48,7 @@#include "en_accel/ipsec.h" #include "en_accel/en_accel.h" #include "en_accel/ktls.h" -#include "accel/ipsec.h" +#include "accel/ipsec_offload.h" #include "lib/vxlan.h" #include "lib/clock.h" #include "en/port.h"
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -1
@@ -48,7 +48,7 @@#include "en_rep.h" #include "en/rep/tc.h" #include "ipoib/ipoib.h" -#include "accel/ipsec.h" +#include "accel/ipsec_offload.h" #include "en_accel/ipsec_rxtx.h" #include "en_accel/ktls_txrx.h" #include "en/xdp.h"
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -62,7 +62,7 @@#include "lib/mlx5.h" #include "lib/tout.h" #include "fpga/core.h" -#include "accel/ipsec.h" +#include "accel/ipsec_offload.h" #include "lib/clock.h" #include "lib/vxlan.h" #include "lib/geneve.h"
Signature · 1 line
2.35.1
PATCH 10/17 net/mlx5: Remove useless IPsec device checks
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The mlx5_is_ipsec_device() check was to distinguish ConnectX device related ops from FPGA, so post removing FPGA IPsec code this check can be removed as no other device implements it.
It is safe to do it as there is already embedded check of IPsec device in mlx5_accel_ipsec_device_caps().
--- .../mellanox/mlx5/core/en_accel/ipsec.c | 10 +---- .../mellanox/mlx5/core/en_accel/ipsec_fs.c | 3 -- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 42 +++++++++---------- 3 files changed, 20 insertions(+), 35 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +1 -9
@@ -286,9 +286,6 @@ static inline int mlx5e_xfrm_validate_state(struct xfrm_state *x)static int mlx5e_xfrm_fs_add_rule (struct mlx5e_priv *priv,struct mlx5e_ipsec_sa_entry *sa_entry) { -if (!mlx5_is_ipsec_device (priv->mdev)) -return 0 ; -return mlx5e_accel_ipsec_fs_add_rule (priv, &sa_entry->xfrm->attrs, sa_entry->ipsec_obj_id, &sa_entry->ipsec_rule);
@@ -297,9 +294,6 @@ static int mlx5e_xfrm_fs_add_rule(struct mlx5e_priv *priv,static void mlx5e_xfrm_fs_del_rule (struct mlx5e_priv *priv,struct mlx5e_ipsec_sa_entry *sa_entry) { -if (!mlx5_is_ipsec_device (priv->mdev)) -return ; -mlx5e_accel_ipsec_fs_del_rule (priv, &sa_entry->xfrm->attrs, &sa_entry->ipsec_rule); }
@@ -550,9 +544,7 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)return ; } -if (mlx5_is_ipsec_device (mdev)) - netdev->gso_partial_features |=NETIF_F_GSO_ESP ; - + netdev->gso_partial_features |=NETIF_F_GSO_ESP ;mlx5_core_dbg (mdev,"mlx5e: ESP GSO capability turned on\n" ); netdev->features |=NETIF_F_GSO_ESP ; netdev->hw_features |=NETIF_F_GSO_ESP ;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c +0 -3
@@ -700,9 +700,6 @@ int mlx5e_accel_ipsec_fs_init(struct mlx5e_priv *priv) {int err; -if (!mlx5_is_ipsec_device (priv->mdev) || !priv->ipsec) -return -EOPNOTSUPP ; - err =fs_init_tx (priv);if (err)return err;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +19 -23
54 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 11/17 net/mlx5: Unify device IPsec capabilities check
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Merge two different function to one in order to provide coherent picture if the device is IPsec capable or not.
--- .../mellanox/mlx5/core/accel/ipsec_offload.c | 38 +++++++++---------- .../mellanox/mlx5/core/accel/ipsec_offload.h | 26 ------------- .../ethernet/mellanox/mlx5/core/en/params.c | 4 +- .../mellanox/mlx5/core/en_accel/ipsec.c | 12 +++--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- include/linux/mlx5/accel.h | 7 +++- 6 files changed, 32 insertions(+), 57 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.c +19 -19
@@ -6,9 +6,6 @@#include "lib/mlx5.h" #include "en_accel/ipsec_fs.h" -#define MLX5_IPSEC_DEV_BASIC_CAPS (MLX5_ACCEL_IPSEC_CAP_DEVICE | MLX5_ACCEL_IPSEC_CAP_IPV6 | \ - MLX5_ACCEL_IPSEC_CAP_LSO) -struct mlx5_ipsec_sa_ctx {struct rhash_head hash;u32 enc_key_id;
@@ -25,17 +22,31 @@ struct mlx5_ipsec_esp_xfrm {struct mlx5_accel_esp_xfrm accel_xfrm; }; -static u32 mlx5_ipsec_offload_device_caps (struct mlx5_core_dev *mdev) +u32 mlx5_ipsec_device_caps (struct mlx5_core_dev *mdev) { -u32 caps =MLX5_IPSEC_DEV_BASIC_CAPS ; +u32 caps; + +if (!MLX5_CAP_GEN (mdev, ipsec_offload)) +return 0 ; + +if (!MLX5_CAP_GEN (mdev, log_max_dek)) +return 0 ; + +if (!(MLX5_CAP_GEN_64 (mdev, general_obj_types) & +MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC )) +return 0 ; -if (!mlx5_is_ipsec_device (mdev)) +if (!MLX5_CAP_IPSEC (mdev, ipsec_crypto_offload) || + !MLX5_CAP_ETH (mdev, insert_trailer))return 0 ;if (!MLX5_CAP_FLOWTABLE_NIC_TX (mdev, ipsec_encrypt) || !MLX5_CAP_FLOWTABLE_NIC_RX (mdev, ipsec_decrypt))return 0 ; + caps =MLX5_ACCEL_IPSEC_CAP_DEVICE |MLX5_ACCEL_IPSEC_CAP_IPV6 | +MLX5_ACCEL_IPSEC_CAP_LSO ; +if (MLX5_CAP_IPSEC (mdev, ipsec_crypto_esp_aes_gcm_128_encrypt) &&MLX5_CAP_IPSEC (mdev, ipsec_crypto_esp_aes_gcm_128_decrypt)) caps |=MLX5_ACCEL_IPSEC_CAP_ESP ;
@@ -52,6 +63,7 @@ static u32 mlx5_ipsec_offload_device_caps(struct mlx5_core_dev *mdev)WARN_ON_ONCE (MLX5_CAP_IPSEC (mdev, log_max_ipsec_offload) >24 );return caps; } +EXPORT_SYMBOL_GPL (mlx5_ipsec_device_caps); static int mlx5_ipsec_offload_esp_validate_xfrm_attrs(struct mlx5_core_dev *mdev,
@@ -367,7 +379,6 @@ static int mlx5_ipsec_offload_esp_modify_xfrm(struct mlx5_accel_esp_xfrm *xfrm, }static const struct mlx5_accel_ipsec_ops ipsec_offload_ops = { - .device_caps = mlx5_ipsec_offload_device_caps, .create_hw_context = mlx5_ipsec_offload_create_sa_ctx, .free_hw_context = mlx5_ipsec_offload_delete_sa_ctx, .init = mlx5_ipsec_offload_init,
@@ -379,7 +390,7 @@ static const struct mlx5_accel_ipsec_ops ipsec_offload_ops = {static const struct mlx5_accel_ipsec_ops *mlx5_ipsec_offload_ops (struct mlx5_core_dev *mdev) { -if (!mlx5_ipsec_offload_device_caps (mdev)) +if (!mlx5_ipsec_device_caps (mdev))return NULL ;return &ipsec_offload_ops;
@@ -416,17 +427,6 @@ void mlx5_accel_ipsec_cleanup(struct mlx5_core_dev *mdev) ipsec_ops->cleanup (mdev); } -u32 mlx5_accel_ipsec_device_caps (struct mlx5_core_dev *mdev) -{ -const struct mlx5_accel_ipsec_ops *ipsec_ops = mdev->ipsec_ops; - -if (!ipsec_ops || !ipsec_ops->device_caps) -return 0 ; - -return ipsec_ops->device_caps (mdev); -} -EXPORT_SYMBOL_GPL (mlx5_accel_ipsec_device_caps); -unsigned int mlx5_accel_ipsec_counters_count (struct mlx5_core_dev *mdev) {const struct mlx5_accel_ipsec_ops *ipsec_ops = mdev->ipsec_ops;
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.h +0 -26
@@ -9,9 +9,6 @@#ifdef CONFIG_MLX5_IPSEC -#define MLX5_IPSEC_DEV (mdev) (mlx5_accel_ipsec_device_caps(mdev) & \ - MLX5_ACCEL_IPSEC_CAP_DEVICE) -unsigned int mlx5_accel_ipsec_counters_count (struct mlx5_core_dev *mdev);int mlx5_accel_ipsec_counters_read (struct mlx5_core_dev *mdev,u64 *counters,unsigned int count);
@@ -25,7 +22,6 @@ void mlx5_accel_ipsec_init(struct mlx5_core_dev *mdev);void mlx5_accel_ipsec_cleanup (struct mlx5_core_dev *mdev);struct mlx5_accel_ipsec_ops { -u32 (*device_caps)(struct mlx5_core_dev *mdev);unsigned int (*counters_count)(struct mlx5_core_dev *mdev);int (*counters_read)(struct mlx5_core_dev *mdev,u64 *counters,unsigned int count);
@@ -45,25 +41,8 @@ struct mlx5_accel_ipsec_ops {void (*esp_destroy_xfrm)(struct mlx5_accel_esp_xfrm *xfrm); }; -static inline bool mlx5_is_ipsec_device (struct mlx5_core_dev *mdev) -{ -if (!MLX5_CAP_GEN (mdev, ipsec_offload)) -return false; - -if (!MLX5_CAP_GEN (mdev, log_max_dek)) -return false; - -if (!(MLX5_CAP_GEN_64 (mdev, general_obj_types) & -MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC )) -return false; - -return MLX5_CAP_IPSEC (mdev, ipsec_crypto_offload) && -MLX5_CAP_ETH (mdev, insert_trailer); -}#else -#define MLX5_IPSEC_DEV (mdev) false -static inline void * mlx5_accel_esp_create_hw_context(struct mlx5_core_dev *mdev, struct mlx5_accel_esp_xfrm *xfrm,
@@ -80,10 +59,5 @@ static inline void mlx5_accel_esp_free_hw_context(struct mlx5_core_dev *mdev,static inline void mlx5_accel_ipsec_init (struct mlx5_core_dev *mdev) {}static inline void mlx5_accel_ipsec_cleanup (struct mlx5_core_dev *mdev) {} -static inline bool mlx5_is_ipsec_device (struct mlx5_core_dev *mdev) -{ -return false; -} -#endif /* CONFIG_MLX5_IPSEC */ #endif /* __MLX5_IPSEC_OFFLOAD_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +2 -2
@@ -689,8 +689,8 @@ void mlx5e_build_sq_param(struct mlx5_core_dev *mdev,void *wq =MLX5_ADDR_OF (sqc, sqc, wq);bool allow_swp; - allow_swp =mlx5_geneve_tx_allowed (mdev) || - !!MLX5_IPSEC_DEV (mdev); + allow_swp = +mlx5_geneve_tx_allowed (mdev) || !!mlx5_ipsec_device_caps (mdev);mlx5e_build_sq_param_common (mdev, param);MLX5_SET (wq, wq, log_wq_sz, params->log_sq_size);MLX5_SET (sqc, sqc, allow_swp, allow_swp);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +5 -7
@@ -226,8 +226,7 @@ static inline int mlx5e_xfrm_validate_state(struct xfrm_state *x)return -EINVAL ; }if (x->props.flags &XFRM_STATE_ESN && - !(mlx5_accel_ipsec_device_caps (priv->mdev) & -MLX5_ACCEL_IPSEC_CAP_ESN )) { + !(mlx5_ipsec_device_caps (priv->mdev) &MLX5_ACCEL_IPSEC_CAP_ESN )) {netdev_info (netdev,"Cannot offload ESN xfrm states\n" );return -EINVAL ; }
@@ -275,8 +274,7 @@ static inline int mlx5e_xfrm_validate_state(struct xfrm_state *x)return -EINVAL ; }if (x->props.family ==AF_INET6 && - !(mlx5_accel_ipsec_device_caps (priv->mdev) & -MLX5_ACCEL_IPSEC_CAP_IPV6 )) { + !(mlx5_ipsec_device_caps (priv->mdev) &MLX5_ACCEL_IPSEC_CAP_IPV6 )) {netdev_info (netdev,"IPv6 xfrm state offload is not supported by this device\n" );return -EINVAL ; }
@@ -406,7 +404,7 @@ int mlx5e_ipsec_init(struct mlx5e_priv *priv) {struct mlx5e_ipsec *ipsec =NULL ; -if (!MLX5_IPSEC_DEV (priv->mdev)) { +if (!mlx5_ipsec_device_caps (priv->mdev)) {netdev_dbg (priv->netdev,"Not an IPSec offload device\n" );return 0 ; }
@@ -519,7 +517,7 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)struct mlx5_core_dev *mdev = priv->mdev;struct net_device *netdev = priv->netdev; -if (!(mlx5_accel_ipsec_device_caps (mdev) &MLX5_ACCEL_IPSEC_CAP_ESP ) || +if (!(mlx5_ipsec_device_caps (mdev) &MLX5_ACCEL_IPSEC_CAP_ESP ) || !MLX5_CAP_ETH (mdev, swp)) {mlx5_core_dbg (mdev,"mlx5e: ESP and SWP offload not supported\n" );return ;
@@ -538,7 +536,7 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv) netdev->features |=NETIF_F_HW_ESP_TX_CSUM ; netdev->hw_enc_features |=NETIF_F_HW_ESP_TX_CSUM ; -if (!(mlx5_accel_ipsec_device_caps (mdev) &MLX5_ACCEL_IPSEC_CAP_LSO ) || +if (!(mlx5_ipsec_device_caps (mdev) &MLX5_ACCEL_IPSEC_CAP_LSO ) || !MLX5_CAP_ETH (mdev, swp_lso)) {mlx5_core_dbg (mdev,"mlx5e: ESP LSO not supported\n" );return ;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -1329,7 +1329,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,INIT_WORK (&sq->recover_work, mlx5e_tx_err_cqe_work);if (!MLX5_CAP_ETH (mdev, wqe_vlan_insert))set_bit (MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE , &sq->state); -if (MLX5_IPSEC_DEV (c->priv->mdev)) +if (mlx5_ipsec_device_caps (c->priv->mdev))set_bit (MLX5E_SQ_STATE_IPSEC , &sq->state);if (param->is_mpw)set_bit (MLX5E_SQ_STATE_MPWQE , &sq->state);
include/linux/mlx5/accel.h +5 -2
@@ -124,7 +124,7 @@ enum mlx5_accel_ipsec_cap {#ifdef CONFIG_MLX5_ACCEL -u32 mlx5_accel_ipsec_device_caps (struct mlx5_core_dev *mdev); +u32 mlx5_ipsec_device_caps (struct mlx5_core_dev *mdev);struct mlx5_accel_esp_xfrm * mlx5_accel_esp_create_xfrm(struct mlx5_core_dev *mdev,
@@ -135,7 +135,10 @@ int mlx5_accel_esp_modify_xfrm(struct mlx5_accel_esp_xfrm *xfrm,#else -static inline u32 mlx5_accel_ipsec_device_caps (struct mlx5_core_dev *mdev) {return 0 ; } +static inline u32 mlx5_ipsec_device_caps (struct mlx5_core_dev *mdev) +{ +return 0 ; +}static inline struct mlx5_accel_esp_xfrm * mlx5_accel_esp_create_xfrm(struct mlx5_core_dev *mdev,
Signature · 1 line
2.35.1
PATCH 12/17 net/mlx5: Align flow steering allocation namespace to common style
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Flow steering is a low level internal driver API, as such it relies on the callers to check if namespace is supported and not rely on some compilation flag.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 2 -- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 6 ------ 2 files changed, 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +0 -2
@@ -878,9 +878,7 @@ static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns, table_type =FS_FT_NIC_RX ;break ;case MLX5_FLOW_NAMESPACE_EGRESS : -#ifdef CONFIG_MLX5_IPSEC case MLX5_FLOW_NAMESPACE_EGRESS_KERNEL : -#endif max_actions =MLX5_CAP_FLOWTABLE_NIC_TX (dev, max_modify_header_actions); table_type =FS_FT_NIC_TX ;break ;
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +0 -6
@@ -186,24 +186,18 @@ static struct init_tree_node {static struct init_tree_node egress_root_fs = { .type =FS_TYPE_NAMESPACE , -#ifdef CONFIG_MLX5_IPSEC .ar_size =2 , -#else - .ar_size =1 , -#endif .children = (struct init_tree_node []) {ADD_PRIO (0 ,MLX5_BY_PASS_NUM_PRIOS ,0 ,FS_CHAINING_CAPS_EGRESS ,ADD_NS (MLX5_FLOW_TABLE_MISS_ACTION_DEF ,ADD_MULTIPLE_PRIO (MLX5_BY_PASS_NUM_PRIOS ,BY_PASS_PRIO_NUM_LEVELS ))), -#ifdef CONFIG_MLX5_IPSECADD_PRIO (0 ,KERNEL_TX_MIN_LEVEL ,0 ,FS_CHAINING_CAPS_EGRESS ,ADD_NS (MLX5_FLOW_TABLE_MISS_ACTION_DEF ,ADD_MULTIPLE_PRIO (KERNEL_TX_IPSEC_NUM_PRIOS ,KERNEL_TX_IPSEC_NUM_LEVELS ))), -#endif } };
Signature · 1 line
2.35.1
PATCH 13/17 net/mlx5: Remove not-needed IPsec config
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
In current code, the CONFIG_MLX5_IPSEC and CONFIG_MLX5_EN_IPSEC are the same. So remove useless indirection.
--- .../net/ethernet/mellanox/mlx5/core/Kconfig | 16 +--------------- .../net/ethernet/mellanox/mlx5/core/Makefile | 4 ++-- .../mellanox/mlx5/core/accel/ipsec_offload.h | 18 ++---------------- include/linux/mlx5/accel.h | 4 ++-- include/linux/mlx5/driver.h | 2 +- 5 files changed, 8 insertions(+), 36 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -15
@@ -142,28 +142,14 @@ config MLX5_CORE_IPOIB help MLX5 IPoIB offloads & acceleration support. -config MLX5_IPSEC +config MLX5_EN_IPSEC bool "Mellanox Technologies IPsec Connect-X support" depends on MLX5_CORE_EN depends on XFRM_OFFLOAD depends on INET_ESP_OFFLOAD || INET6_ESP_OFFLOAD select MLX5_ACCEL - help - Build IPsec support for the Connect-X family of network cards by Mellanox - Technologies. - Note: If you select this option, the mlx5_core driver will include - IPsec support for the Connect-X family. - -config MLX5_EN_IPSEC - bool "IPSec XFRM cryptography-offload acceleration" - depends on MLX5_CORE_EN - depends on XFRM_OFFLOAD - depends on INET_ESP_OFFLOAD || INET6_ESP_OFFLOAD - depends on MLX5_IPSEC help Build support for IPsec 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_EN_TLS bool "Mellanox Technologies TLS Connect-X support"
drivers/net/ethernet/mellanox/mlx5/core/Makefile +2 -2
@@ -88,13 +88,13 @@ mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib # # Accelerations & FPGA # -mlx5_core-$(CONFIG_MLX5_IPSEC) += accel/ipsec_offload.o mlx5_core-$(CONFIG_MLX5_ACCEL) += lib/crypto.o 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 + en_accel/ipsec_stats.o en_accel/ipsec_fs.o \ + accel/ipsec_offload.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 \
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.h +2 -16
@@ -7,7 +7,7 @@#include <linux/mlx5/driver.h> #include <linux/mlx5/accel.h> -#ifdef CONFIG_MLX5_IPSEC +#ifdef CONFIG_MLX5_EN_IPSEC unsigned int mlx5_accel_ipsec_counters_count (struct mlx5_core_dev *mdev); int mlx5_accel_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters,
@@ -42,22 +42,8 @@ struct mlx5_accel_ipsec_ops { };#else - -static inline void * -mlx5_accel_esp_create_hw_context (struct mlx5_core_dev *mdev, -struct mlx5_accel_esp_xfrm *xfrm, -u32 *sa_handle) -{ -return NULL ; -} - -static inline void mlx5_accel_esp_free_hw_context (struct mlx5_core_dev *mdev, -void *context) -{ -} -static inline void mlx5_accel_ipsec_init (struct mlx5_core_dev *mdev) {}static inline void mlx5_accel_ipsec_cleanup (struct mlx5_core_dev *mdev) {} -#endif /* CONFIG_MLX5_IPSEC */ +#endif /* CONFIG_MLX5_EN_IPSEC */ #endif /* __MLX5_IPSEC_OFFLOAD_H__ */
include/linux/mlx5/accel.h +2 -2
@@ -122,7 +122,7 @@ enum mlx5_accel_ipsec_cap { MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN = 1 << 7, }; -#ifdef CONFIG_MLX5_ACCEL +#ifdef CONFIG_MLX5_EN_IPSEC u32 mlx5_ipsec_device_caps (struct mlx5_core_dev *mdev);
@@ -152,5 +152,5 @@ static inline int mlx5_accel_esp_modify_xfrm(struct mlx5_accel_esp_xfrm *xfrm, const struct mlx5_accel_esp_xfrm_attrs *attrs) { return -EOPNOTSUPP; } -#endif /* CONFIG_MLX5_ACCEL */ +#endif /* CONFIG_MLX5_EN_IPSEC */ #endif /* __MLX5_ACCEL_H__ */
include/linux/mlx5/driver.h +1 -1
@@ -778,7 +778,7 @@ struct mlx5_core_dev {#ifdef CONFIG_MLX5_FPGA struct mlx5_fpga_device *fpga;#endif -#ifdef CONFIG_MLX5_ACCEL +#ifdef CONFIG_MLX5_EN_IPSEC const struct mlx5_accel_ipsec_ops *ipsec_ops;#endif struct mlx5_clock clock;
Signature · 1 line
2.35.1
PATCH 14/17 net/mlx5: Move IPsec file to relevant directory
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
IPsec is part of ethernet side of mlx5 driver and needs to be placed in en_accel folder.
---
drivers/net/ethernet/mellanox/mlx5/core/Makefile | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.h | 2 +-
.../mellanox/mlx5/core/{accel => en_accel}/ipsec_offload.c | 2 +-
.../mellanox/mlx5/core/{accel => en_accel}/ipsec_offload.h | 0
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +-
12 files changed, 11 insertions(+), 11 deletions(-)
rename drivers/net/ethernet/mellanox/mlx5/core/{accel => en_accel}/ipsec_offload.c (99%)
rename drivers/net/ethernet/mellanox/mlx5/core/{accel => en_accel}/ipsec_offload.h (100%)drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -94,7 +94,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 \ - accel/ipsec_offload.o + en_accel/ipsec_offload.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 \
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +1 -1
@@ -5,7 +5,7 @@#include "en/txrx.h" #include "en/port.h" #include "en_accel/en_accel.h" -#include "accel/ipsec_offload.h" +#include "en_accel/ipsec_offload.h" static bool mlx5e_rx_is_xdp (struct mlx5e_params *params,struct mlx5e_xsk_param *xsk)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +1 -1
@@ -40,7 +40,7 @@#include <net/xfrm.h> #include <linux/idr.h> -#include "accel/ipsec_offload.h" +#include "ipsec_offload.h" #define MLX5E_IPSEC_SADB_RX_BITS 10#define MLX5E_IPSEC_ESN_SCOPE_MID 0x80000000L
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c +1 -1
@@ -2,7 +2,7 @@/* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ #include <linux/netdevice.h> -#include "accel/ipsec_offload.h" +#include "ipsec_offload.h" #include "ipsec_fs.h" #include "fs_core.h"
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.h +1 -1
@@ -6,7 +6,7 @@#include "en.h" #include "ipsec.h" -#include "accel/ipsec_offload.h" +#include "ipsec_offload.h" #include "en/fs.h" #ifdef CONFIG_MLX5_EN_IPSEC
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c renamed from drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.c +1 -1
@@ -2,7 +2,7 @@/* Copyright (c) 2017, Mellanox Technologies inc. All rights reserved. */ #include "mlx5_core.h" -#include "accel/ipsec_offload.h" +#include "ipsec_offload.h" #include "lib/mlx5.h" #include "en_accel/ipsec_fs.h"
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.h renamed from drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec_offload.h +0 -0
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +1 -1
@@ -34,7 +34,7 @@#include <crypto/aead.h> #include <net/xfrm.h> #include <net/esp.h> -#include "accel/ipsec_offload.h" +#include "ipsec_offload.h" #include "en_accel/ipsec_rxtx.h" #include "en_accel/ipsec.h" #include "en.h"
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c +1 -1
@@ -35,7 +35,7 @@#include <net/sock.h> #include "en.h" -#include "accel/ipsec_offload.h" +#include "ipsec_offload.h" #include "fpga/sdk.h" #include "en_accel/ipsec.h"
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -48,7 +48,7 @@#include "en_accel/ipsec.h" #include "en_accel/en_accel.h" #include "en_accel/ktls.h" -#include "accel/ipsec_offload.h" +#include "en_accel/ipsec_offload.h" #include "lib/vxlan.h" #include "lib/clock.h" #include "en/port.h"
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -1
@@ -48,7 +48,7 @@#include "en_rep.h" #include "en/rep/tc.h" #include "ipoib/ipoib.h" -#include "accel/ipsec_offload.h" +#include "en_accel/ipsec_offload.h" #include "en_accel/ipsec_rxtx.h" #include "en_accel/ktls_txrx.h" #include "en/xdp.h"
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -62,7 +62,7 @@#include "lib/mlx5.h" #include "lib/tout.h" #include "fpga/core.h" -#include "accel/ipsec_offload.h" +#include "en_accel/ipsec_offload.h" #include "lib/clock.h" #include "lib/vxlan.h" #include "lib/geneve.h"
Signature · 1 line
2.35.1
PATCH 15/17 net/mlx5: Reduce kconfig complexity while building crypto support
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Both IPsec and kTLS need two functions declared in the lib/crypto.c file. These functions are advertised through general mlx5.h file and don't have any protection from attempts to call them without proper config option.
Instead of creating stubs just for two functions, simply build that *.c file as part of regular mlx5_eth build and rely on compiler to throw them away if no callers exist in produced code.
--- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 5 ----- drivers/net/ethernet/mellanox/mlx5/core/Makefile | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +0 -5
@@ -16,9 +16,6 @@ config MLX5_CORE Core driver for low level functionality of the ConnectX-4 and Connect-IB cards by Mellanox Technologies. -config MLX5_ACCEL - bool - config MLX5_FPGA bool "Mellanox Technologies Innova support" depends on MLX5_CORE
@@ -147,7 +144,6 @@ config MLX5_EN_IPSEC depends on MLX5_CORE_EN depends on XFRM_OFFLOAD depends on INET_ESP_OFFLOAD || INET6_ESP_OFFLOAD - select MLX5_ACCEL help Build support for IPsec cryptography-offload acceleration in the NIC.
@@ -156,7 +152,6 @@ config MLX5_EN_TLS depends on TLS_DEVICE depends on TLS=y || MLX5_CORE=m depends on MLX5_CORE_EN - select MLX5_ACCEL help Build support for TLS cryptography-offload acceleration in the NIC.
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -3
@@ -28,7 +28,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en/rqt.o en/tir.o en/rss.o en/rx_res.o \ en_selftest.o en/port.o en/monitor_stats.o en/health.o \ en/reporter_tx.o en/reporter_rx.o en/params.o en/xsk/pool.o \ en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o en/devlink.o en/ptp.o \ - en/qos.o en/trap.o en/fs_tt_redirect.o en/selq.o + en/qos.o en/trap.o en/fs_tt_redirect.o en/selq.o lib/crypto.o # # Netdev extra
@@ -88,8 +88,6 @@ mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib # # Accelerations & FPGA # -mlx5_core-$(CONFIG_MLX5_ACCEL) += lib/crypto.o - 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 \
Signature · 1 line
2.35.1
PATCH 16/17 net/mlx5: Remove ipsec_ops function table
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
There is only one IPsec implementation and ipsec_ops is not needed at all in this situation. Together with removal of ipsec_ops, we can drop the entry checks as these functions are called for IPsec devices only.
--- .../mellanox/mlx5/core/en_accel/ipsec_fs.h | 5 - .../mlx5/core/en_accel/ipsec_offload.c | 118 ++---------------- .../mlx5/core/en_accel/ipsec_offload.h | 35 ------ .../net/ethernet/mellanox/mlx5/core/main.c | 4 - include/linux/mlx5/driver.h | 3 - 5 files changed, 8 insertions(+), 157 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.h +0 -5
@@ -9,7 +9,6 @@#include "ipsec_offload.h" #include "en/fs.h" -#ifdef CONFIG_MLX5_EN_IPSEC void mlx5e_accel_ipsec_fs_cleanup (struct mlx5e_priv *priv);int mlx5e_accel_ipsec_fs_init (struct mlx5e_priv *priv); int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_priv *priv,
@@ -19,8 +18,4 @@ int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_priv *priv,void mlx5e_accel_ipsec_fs_del_rule (struct mlx5e_priv *priv,struct mlx5_accel_esp_xfrm_attrs *attrs,struct mlx5e_ipsec_rule *ipsec_rule); -#else -static inline void mlx5e_accel_ipsec_fs_cleanup (struct mlx5e_priv *priv) {} -static inline int mlx5e_accel_ipsec_fs_init (struct mlx5e_priv *priv) {return 0 ; } -#endif #endif /* __MLX5_IPSEC_STEERING_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +8 -110
172 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.h +0 -35
@@ -7,43 +7,8 @@#include <linux/mlx5/driver.h> #include <linux/mlx5/accel.h> -#ifdef CONFIG_MLX5_EN_IPSEC - -unsigned int mlx5_accel_ipsec_counters_count (struct mlx5_core_dev *mdev); -int mlx5_accel_ipsec_counters_read (struct mlx5_core_dev *mdev,u64 *counters, -unsigned int count); -void *mlx5_accel_esp_create_hw_context (struct mlx5_core_dev *mdev,struct mlx5_accel_esp_xfrm *xfrm,u32 *sa_handle);void mlx5_accel_esp_free_hw_context (struct mlx5_core_dev *mdev,void *context); - -void mlx5_accel_ipsec_init (struct mlx5_core_dev *mdev); -void mlx5_accel_ipsec_cleanup (struct mlx5_core_dev *mdev); - -struct mlx5_accel_ipsec_ops { -unsigned int (*counters_count)(struct mlx5_core_dev *mdev); -int (*counters_read)(struct mlx5_core_dev *mdev,u64 *counters, -unsigned int count); -void *(*create_hw_context)(struct mlx5_core_dev *mdev, -struct mlx5_accel_esp_xfrm *xfrm, -const __be32 saddr[4 ],const __be32 daddr[4 ], -const __be32 spi,bool is_ipv6, -u32 *sa_handle); -void (*free_hw_context)(void *context); -int (*init)(struct mlx5_core_dev *mdev); -void (*cleanup)(struct mlx5_core_dev *mdev); -struct mlx5_accel_esp_xfrm *(*esp_create_xfrm)( -struct mlx5_core_dev *mdev, -const struct mlx5_accel_esp_xfrm_attrs *attrs,u32 flags); -int (*esp_modify_xfrm)(struct mlx5_accel_esp_xfrm *xfrm, -const struct mlx5_accel_esp_xfrm_attrs *attrs); -void (*esp_destroy_xfrm)(struct mlx5_accel_esp_xfrm *xfrm); -}; - -#else -static inline void mlx5_accel_ipsec_init (struct mlx5_core_dev *mdev) {} - -static inline void mlx5_accel_ipsec_cleanup (struct mlx5_core_dev *mdev) {} -#endif /* CONFIG_MLX5_EN_IPSEC */ #endif /* __MLX5_IPSEC_OFFLOAD_H__ */
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -4
@@ -1181,8 +1181,6 @@ static int mlx5_load(struct mlx5_core_dev *dev) goto err_fpga_start; } -mlx5_accel_ipsec_init (dev); - err =mlx5_init_fs (dev);if (err) {mlx5_core_err (dev,"Failed to init flow steering\n" );
@@ -1230,7 +1228,6 @@ static int mlx5_load(struct mlx5_core_dev *dev) err_set_hca:mlx5_cleanup_fs (dev); err_fs: -mlx5_accel_ipsec_cleanup (dev);mlx5_fpga_device_stop (dev); err_fpga_start:mlx5_rsc_dump_cleanup (dev);
@@ -1256,7 +1253,6 @@ static void mlx5_unload(struct mlx5_core_dev *dev)mlx5_sf_hw_table_destroy (dev);mlx5_vhca_event_stop (dev);mlx5_cleanup_fs (dev); -mlx5_accel_ipsec_cleanup (dev);mlx5_fpga_device_stop (dev);mlx5_rsc_dump_cleanup (dev);mlx5_hv_vhca_cleanup (dev->hv_vhca);
include/linux/mlx5/driver.h +0 -3
@@ -777,9 +777,6 @@ struct mlx5_core_dev { } roce;#ifdef CONFIG_MLX5_FPGA struct mlx5_fpga_device *fpga; -#endif -#ifdef CONFIG_MLX5_EN_IPSEC -const struct mlx5_accel_ipsec_ops *ipsec_ops;#endif struct mlx5_clock clock;struct mlx5_ib_clock_info *clock_info;
Signature · 1 line
2.35.1
PATCH 17/17 net/mlx5: Remove not-implemented IPsec capabilities
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Clean a capabilities enum to remove not-implemented bits.
--- .../mellanox/mlx5/core/en_accel/ipsec_offload.c | 4 +--- include/linux/mlx5/accel.h | 11 ++++------- 2 files changed, 5 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +1 -3
@@ -51,10 +51,8 @@ u32 mlx5_ipsec_device_caps(struct mlx5_core_dev *mdev) MLX5_CAP_IPSEC(mdev, ipsec_crypto_esp_aes_gcm_128_decrypt)) caps |=MLX5_ACCEL_IPSEC_CAP_ESP ; -if (MLX5_CAP_IPSEC (mdev, ipsec_esn)) { +if (MLX5_CAP_IPSEC (mdev, ipsec_esn)) caps |=MLX5_ACCEL_IPSEC_CAP_ESN ; - caps |=MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN ; - }/* We can accommodate up to 2^24 different IPsec objects * because we use up to 24 bit in flow table metadata
include/linux/mlx5/accel.h +4 -7
@@ -113,13 +113,10 @@ struct mlx5_accel_esp_xfrm {enum mlx5_accel_ipsec_cap {MLX5_ACCEL_IPSEC_CAP_DEVICE =1 <<0 , -MLX5_ACCEL_IPSEC_CAP_REQUIRED_METADATA =1 <<1 , -MLX5_ACCEL_IPSEC_CAP_ESP =1 <<2 , -MLX5_ACCEL_IPSEC_CAP_IPV6 =1 <<3 , -MLX5_ACCEL_IPSEC_CAP_LSO =1 <<4 , -MLX5_ACCEL_IPSEC_CAP_RX_NO_TRAILER =1 <<5 , -MLX5_ACCEL_IPSEC_CAP_ESN =1 <<6 , -MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN =1 <<7 , +MLX5_ACCEL_IPSEC_CAP_ESP =1 <<1 , +MLX5_ACCEL_IPSEC_CAP_IPV6 =1 <<2 , +MLX5_ACCEL_IPSEC_CAP_LSO =1 <<3 , +MLX5_ACCEL_IPSEC_CAP_ESN =1 <<4 , };#ifdef CONFIG_MLX5_EN_IPSEC
Signature · 1 line
2.35.1
Quoted 20 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Together with FPGA TLS, the IPsec went to EOL state in the November of 2019 [1]. Exactly like FPGA TLS, no active customers exist for this upstream code and all the complexity around that area can be deleted.
[1] https://network.nvidia.com/related-docs/eol/LCR-000535.pdf
Thanks
Leon Romanovsky (17):
net/mlx5_fpga: Drop INNOVA IPsec support net/mlx5: Delete metadata handling logic net/mlx5: Remove not-used IDA field from IPsec struct net/mlx5: Remove XFRMno_trailerflag
net/mlx5: Remove FPGA ipsec specific statistics RDMA/mlx5: Delete never supported IPsec flow action RDMA/mlx5: Drop crypto flow steering API RDMA/core: Delete IPsec flow action logic from the core net/mlx5: Remove ipsec vs. ipsec offload file separation
Quoted 8 lines
net/mlx5: Remove useless IPsec device checks
net/mlx5: Unify device IPsec capabilities check net/mlx5: Align flow steering allocation namespace to common style net/mlx5: Remove not-needed IPsec config
net/mlx5: Move IPsec file to relevant directory net/mlx5: Reduce kconfig complexity while building crypto support net/mlx5: Removeipsec_opsfunction table
net/mlx5: Remove not-implemented IPsec capabilities
Thanks, applied to mlx5-next.
2984287c4c19 net/mlx5: Remove not-implemented IPsec capabilities f2b41b32cde8 net/mlx5: Remove ipsec_ops function table f03c7b183ef9 net/mlx5: Reduce kconfig complexity while building crypto support 16fe5a1c5c07 net/mlx5: Move IPsec file to relevant directory 54deb0e77561 net/mlx5: Remove not-needed IPsec configa6a9eaf14222 net/mlx5: Align flow steering allocation namespace to common style 2451da081a34 net/mlx5: Unify device IPsec capabilities check 5a985aa3c922 net/mlx5: Remove useless IPsec device checks 7e4e84912139 net/mlx5: Remove ipsec vs. ipsec offload file separation 32313c6ae622 RDMA/core: Delete IPsec flow action logic from the core de8bdb476908 RDMA/mlx5: Drop crypto flow steering API74ec29bdb0eb RDMA/mlx5: Delete never supported IPsec flow action 0d90bd551446 net/mlx5: Remove FPGA ipsec specific statistics 3c811a6b4552 net/mlx5: Remove XFRM no_trailer flag501a9b23b23c net/mlx5: Remove not-used IDA field from IPsec struct df439fcb1cd4 net/mlx5: Delete metadata handling logic2fa33b3518a8 net/mlx5_fpga: Drop INNOVA IPsec support