Mellanox, mlx5 updates 2020-04-20
Subsystems (6)
Hi Dave,
This series adds misc updates and cleanup to mlx5.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit b66c9b8de22b666718c2fcb0ae84ce620f9b81c0:
selftests: pmtu: implement IPIP, SIT and ip6tnl PMTU discovery tests (2020-04-20 12:08:06 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2020-04-20
for you to fetch changes up to 6533380dfd003ea7636cb5672f4f85124b56328b:
net/mlx5: improve some comments (2020-04-20 14:20:21 -0700)
----------------------------------------------------------------
mlx5-updates-2020-04-20
This series includes misc updates and clean ups to mlx5 driver:
1) improve some comments from Hu Haowen.
2) Handles errors of netif_set_real_num_{tx,rx}_queues, from Maxim
3) IPsec and FPGA related code cleanup to prepare for ASIC devices IPsec offloads, from Raed
4) Allow partial mask for tunnel options, from Roi.
----------------------------------------------------------------
Hu Haowen (1):
net/mlx5: improve some comments
Maxim Mikityanskiy (1):
net/mlx5e: Handle errors from netif_set_real_num_{tx,rx}_queues
Parav Pandit (1):
net/mlx5: Read embedded cpu bit only once
Raed Salem (5):
net/mlx5: Use the correct IPsec capability function for FPGA ops net/mlx5e: en_accel, Add missing net/geneve.h include net/mlx5: Refactor mlx5_accel_esp_create_hw_context parameter list net/mlx5e: IPSec, Expose IPsec HW stat only for supporting HW net/mlx5: IPsec, Refactor SA handle creation and destruction
Roi Dayan (1):
net/mlx5e: Allow partial data mask for tunnel options
Tariq Toukan (1):
net/mlx5e: Set of completion request bit should not clear other adjacent bits
.../net/ethernet/mellanox/mlx5/core/accel/ipsec.c | 19 +++-- .../net/ethernet/mellanox/mlx5/core/accel/ipsec.h | 8 +- .../ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 2 +- .../mellanox/mlx5/core/en_accel/en_accel.h | 2 + .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 87 +++++++++------------ .../ethernet/mellanox/mlx5/core/en_accel/ipsec.h | 25 ------ .../mellanox/mlx5/core/en_accel/ipsec_stats.c | 88 +++++++++++++--------- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 59 ++++++++++++--- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 29 ++----- drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 2 + drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 32 +++++--- .../net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 31 +++++++- .../net/ethernet/mellanox/mlx5/core/fpga/ipsec.h | 18 ++++- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 3 +- include/linux/mlx5/accel.h | 12 +++ 18 files changed, 242 insertions(+), 184 deletions(-)
PATCH 1/10 net/mlx5: Use the correct IPsec capability function for FPGA ops
From: Raed Salem <[email protected]>
Currently the IPsec acceleration capability function is also used at IPsec fpga capable device code.
This could cause a future bug as the acceleration layer is agnostic to the device implementing its API.
Fix by using the IPsec FPGA capability function instead of acceleration layer capability function in case of FPGA IPsec only related operations.
Downstream patches will add support for Connect-X IPsec, this can avoid a future bug.
--- .../net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 2 +- .../net/ethernet/mellanox/mlx5/core/fpga/ipsec.h | 15 ++++++++++++++- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 +++-- 3 files changed, 18 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +1 -1
@@ -602,7 +602,7 @@ static bool mlx5_is_fpga_ipsec_rule(struct mlx5_core_dev *dev,const u32 *match_c, const u32 *match_v) { - u32 ipsec_dev_caps = mlx5_accel_ipsec_device_caps(dev); + u32 ipsec_dev_caps = mlx5_fpga_ipsec_device_caps(dev);bool ipv6_flow; ipv6_flow =mlx5_fs_is_outer_ipv6_flow (dev, match_c, match_v);
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h +14 -1
@@ -37,6 +37,7 @@#include "accel/ipsec.h" #include "fs_cmd.h" +#ifdef CONFIG_MLX5_FPGA_IPSEC u32 mlx5_fpga_ipsec_device_caps (struct mlx5_core_dev *mdev);unsigned int mlx5_fpga_ipsec_counters_count (struct mlx5_core_dev *mdev); int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters,
@@ -63,5 +64,17 @@ int mlx5_fpga_esp_modify_xfrm(struct mlx5_accel_esp_xfrm *xfrm,const struct mlx5_flow_cmds *mlx5_fs_cmd_get_default_ipsec_fpga_cmds (enum fs_flow_table_type type); +#else +static inline u32 mlx5_fpga_ipsec_device_caps (struct mlx5_core_dev *mdev) +{ +return 0 ; +} -#endif /* __MLX5_FPGA_SADB_H__ */ +static inline const struct mlx5_flow_cmds * +mlx5_fs_cmd_get_default_ipsec_fpga_cmds (enum fs_flow_table_type type) +{ +return mlx5_fs_cmd_get_default (type); +} + +#endif /* CONFIG_MLX5_FPGA_IPSEC */ +#endif /* __MLX5_FPGA_IPSEC_H__ */
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +3 -2
@@ -2359,7 +2359,7 @@ static struct mlx5_flow_root_namespacestruct mlx5_flow_root_namespace *root_ns;struct mlx5_flow_namespace *ns; -if (mlx5_accel_ipsec_device_caps (steering->dev) &MLX5_ACCEL_IPSEC_CAP_DEVICE && +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);
@@ -2943,7 +2943,8 @@ int mlx5_init_fs(struct mlx5_core_dev *dev) goto err; } -if (MLX5_IPSEC_DEV (dev) ||MLX5_CAP_FLOWTABLE_NIC_TX (dev, ft_support)) { +if (mlx5_fpga_ipsec_device_caps (steering->dev) &MLX5_ACCEL_IPSEC_CAP_DEVICE || +MLX5_CAP_FLOWTABLE_NIC_TX (dev, ft_support)) { err =init_egress_root_ns (steering);if (err) goto err;
Signature · 1 line
2.25.3
PATCH 2/10 net/mlx5e: en_accel, Add missing net/geneve.h include
In reply to Saeed MahameedFrom: Raed Salem <[email protected]>
The cited commit relies on include <net/geneve.h> being included implicitly prior to include "en_accel/en_accel.h". This mandates that all files that needs to include en_accel.h to redantantly include net/geneve.h.
Include net/geneve.h explicitly at "en_accel/en_accel.h" to avoid undesired constrain as above.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h +2 -0
@@ -42,6 +42,8 @@#include "en/txrx.h" #if IS_ENABLED (CONFIG_GENEVE ) +#include <net/geneve.h> +static inline bool mlx5_geneve_tx_allowed (struct mlx5_core_dev *mdev) {return mlx5_tx_swp_supported (mdev);
Signature · 1 line
2.25.3
PATCH 3/10 net/mlx5: Refactor mlx5_accel_esp_create_hw_context parameter list
In reply to Saeed MahameedFrom: Raed Salem <[email protected]>
Currently the FPGA IPsec is the only hw implementation of the IPsec acceleration api, and so the mlx5_accel_esp_create_hw_context was wrongly made to suit this HW api, among other in its parameter list and some of its parameter endianness.
This implementation might not be suitable for different HW.
Refactor by group and pass all function arguments of mlx5_accel_esp_create_hw_context in common mlx5_accel_esp_xfrm_attrs struct field of mlx5_accel_esp_xfrm struct and correct the endianness according to the HW being called.
--- .../ethernet/mellanox/mlx5/core/accel/ipsec.c | 20 +++++++++++----- .../ethernet/mellanox/mlx5/core/accel/ipsec.h | 10 ++------ .../mellanox/mlx5/core/en_accel/ipsec.c | 23 ++++++++----------- include/linux/mlx5/accel.h | 12 ++++++++++ 4 files changed, 37 insertions(+), 28 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.c +14 -6
@@ -57,13 +57,21 @@ int mlx5_accel_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters, }void *mlx5_accel_esp_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) +struct mlx5_accel_esp_xfrm *xfrm) { -return mlx5_fpga_ipsec_create_sa_ctx (mdev, xfrm, saddr, daddr, - spi, is_ipv6); +__be32 saddr[4 ] = {}, daddr[4 ] = {}; + +if (!xfrm->attrs.is_ipv6) { + saddr[3 ] = xfrm->attrs.saddr.a4; + daddr[3 ] = xfrm->attrs.daddr.a4; + }else { +memcpy (saddr, xfrm->attrs.saddr.a6,sizeof (saddr)); +memcpy (daddr, xfrm->attrs.daddr.a6,sizeof (daddr)); + } + +return mlx5_fpga_ipsec_create_sa_ctx (mdev, xfrm, saddr, + daddr, xfrm->attrs.spi, + xfrm->attrs.is_ipv6); }void mlx5_accel_esp_free_hw_context (void *context)
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.h +2 -8
@@ -47,10 +47,7 @@ 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, -const __be32 saddr[4 ], -const __be32 daddr[4 ], -const __be32 spi,bool is_ipv6); +struct mlx5_accel_esp_xfrm *xfrm);void mlx5_accel_esp_free_hw_context (void *context);int mlx5_accel_ipsec_init (struct mlx5_core_dev *mdev);
@@ -63,10 +60,7 @@ void mlx5_accel_ipsec_cleanup(struct mlx5_core_dev *mdev);static inline void *mlx5_accel_esp_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) +struct mlx5_accel_esp_xfrm *xfrm) {return NULL ; }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +9 -14
@@ -199,6 +199,14 @@ mlx5e_ipsec_build_accel_xfrm_attrs(struct mlx5e_ipsec_sa_entry *sa_entry, attrs->flags |= (x->props.mode ==XFRM_MODE_TRANSPORT ) ?MLX5_ACCEL_ESP_FLAGS_TRANSPORT :MLX5_ACCEL_ESP_FLAGS_TUNNEL ; + +/* spi */ + attrs->spi = x->id.spi; + +/* source , destination ips */ +memcpy (&attrs->saddr, x->props.saddr.a6,sizeof (attrs->saddr)); +memcpy (&attrs->daddr, x->id.daddr.a6,sizeof (attrs->daddr)); + attrs->is_ipv6 = (x->props.family !=AF_INET ); }static inline int mlx5e_xfrm_validate_state (struct xfrm_state *x)
@@ -284,8 +292,6 @@ static int mlx5e_xfrm_add_state(struct xfrm_state *x)struct net_device *netdev = x->xso.dev;struct mlx5_accel_esp_xfrm_attrs attrs;struct mlx5e_priv *priv; -__be32 saddr[4 ] = {0 }, daddr[4 ] = {0 }, spi; -bool is_ipv6 = false;int err; priv =netdev_priv (netdev);
@@ -331,20 +337,9 @@ static int mlx5e_xfrm_add_state(struct xfrm_state *x) }/* create hw context */ -if (x->props.family ==AF_INET ) { - saddr[3 ] = x->props.saddr.a4; - daddr[3 ] = x->id.daddr.a4; - }else { -memcpy (saddr, x->props.saddr.a6,sizeof (saddr)); -memcpy (daddr, x->id.daddr.a6,sizeof (daddr)); - is_ipv6 = true; - } - spi = x->id.spi; sa_entry->hw_context =mlx5_accel_esp_create_hw_context (priv->mdev, - sa_entry->xfrm, - saddr, daddr, spi, - is_ipv6); + sa_entry->xfrm);if (IS_ERR (sa_entry->hw_context)) { err =PTR_ERR (sa_entry->hw_context); goto err_xfrm;
include/linux/mlx5/accel.h +12 -0
@@ -92,6 +92,18 @@ struct mlx5_accel_esp_xfrm_attrs {union {struct aes_gcm_keymat aes_gcm; } keymat; + +union { +__be32 a4; +__be32 a6[4 ]; + } saddr; + +union { +__be32 a4; +__be32 a6[4 ]; + } daddr; + +u8 is_ipv6; };struct mlx5_accel_esp_xfrm {
Signature · 1 line
2.25.3
PATCH 4/10 net/mlx5e: IPSec, Expose IPsec HW stat only for supporting HW
In reply to Saeed MahameedFrom: Raed Salem <[email protected]>
The current HW counters are supported only by Innova, split the ipsec stats group into two groups, one for HW and one for SW. And expose the HW counters to ethtool only if Innova HW is used for IPsec offload.
--- .../mellanox/mlx5/core/en_accel/ipsec.h | 25 ------ .../mellanox/mlx5/core/en_accel/ipsec_stats.c | 88 +++++++++++-------- .../ethernet/mellanox/mlx5/core/en_stats.c | 29 ++---- .../ethernet/mellanox/mlx5/core/en_stats.h | 2 + 4 files changed, 58 insertions(+), 86 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +0 -25
@@ -109,11 +109,6 @@ 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); -int mlx5e_ipsec_get_count (struct mlx5e_priv *priv); -int mlx5e_ipsec_get_strings (struct mlx5e_priv *priv,uint8_t *data); -void mlx5e_ipsec_update_stats (struct mlx5e_priv *priv); -int mlx5e_ipsec_get_stats (struct mlx5e_priv *priv,u64 *data); -struct xfrm_state *mlx5e_ipsec_sadb_rx_lookup (struct mlx5e_ipsec *dev,unsigned int handle);
@@ -136,26 +131,6 @@ static inline void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv) { } -static inline int mlx5e_ipsec_get_count (struct mlx5e_priv *priv) -{ -return 0 ; -} - -static inline int mlx5e_ipsec_get_strings (struct mlx5e_priv *priv, -uint8_t *data) -{ -return 0 ; -} - -static inline void mlx5e_ipsec_update_stats (struct mlx5e_priv *priv) -{ -} - -static inline int mlx5e_ipsec_get_stats (struct mlx5e_priv *priv,u64 *data) -{ -return 0 ; -} -#endif #endif /* __MLX5E_IPSEC_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c +51 -37
118 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +5 -24
@@ -32,8 +32,8 @@#include "lib/mlx5.h" #include "en.h" -#include "en_accel/ipsec.h" #include "en_accel/tls.h" +#include "en_accel/en_accel.h" static unsigned int stats_grps_num (struct mlx5e_priv *priv) {
@@ -1424,27 +1424,6 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(pme)static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (pme) {return ; } -static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS (ipsec) -{ -return mlx5e_ipsec_get_count (priv); -} - -static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS (ipsec) -{ -return idx +mlx5e_ipsec_get_strings (priv, - data + idx *ETH_GSTRING_LEN ); -} - -static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS (ipsec) -{ -return idx +mlx5e_ipsec_get_stats (priv, data + idx); -} - -static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (ipsec) -{ -mlx5e_ipsec_update_stats (priv); -} -static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS (tls) {return mlx5e_tls_get_count (priv);
@@ -1714,7 +1693,6 @@ MLX5E_DEFINE_STATS_GRP(pme, 0);MLX5E_DEFINE_STATS_GRP (channels,0 );MLX5E_DEFINE_STATS_GRP (per_port_buff_congest,0 );MLX5E_DEFINE_STATS_GRP (eth_ext,0 ); -static MLX5E_DEFINE_STATS_GRP(ipsec, 0); static MLX5E_DEFINE_STATS_GRP(tls, 0);/* The stats groups order is opposite to the update_stats() order calls */
@@ -1731,7 +1709,10 @@ mlx5e_stats_grp_t mlx5e_nic_stats_grps[] = { &MLX5E_STATS_GRP (pcie), &MLX5E_STATS_GRP (per_prio), &MLX5E_STATS_GRP (pme), - &MLX5E_STATS_GRP (ipsec), +#ifdef CONFIG_MLX5_EN_IPSEC + &MLX5E_STATS_GRP (ipsec_sw), + &MLX5E_STATS_GRP (ipsec_hw), +#endif &MLX5E_STATS_GRP (tls), &MLX5E_STATS_GRP (channels), &MLX5E_STATS_GRP(per_port_buff_congest),
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +2 -0
@@ -390,5 +390,7 @@ 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);#endif /* __MLX5_EN_STATS_H__ */
Signature · 1 line
2.25.3
PATCH 5/10 net/mlx5: IPsec, Refactor SA handle creation and destruction
In reply to Saeed MahameedFrom: Raed Salem <[email protected]>
Currently the SA handle is created and managed as part of the common code for different IPsec supporting HW, this handle is passed to HW to be used on Rx to identify the SA handle that was used to return the xfrm state to stack.
The above implementation pose a limitation on managing this handle.
Refactor by moving management of this field to the specific HW code.
Downstream patches will introduce the Connect-X support for IPsec that will use this handle differently than current implementation.
--- .../ethernet/mellanox/mlx5/core/accel/ipsec.c | 5 +- .../ethernet/mellanox/mlx5/core/accel/ipsec.h | 6 +- .../mellanox/mlx5/core/en_accel/ipsec.c | 68 ++++++++----------- .../ethernet/mellanox/mlx5/core/fpga/ipsec.c | 29 +++++++- .../ethernet/mellanox/mlx5/core/fpga/ipsec.h | 3 +- 5 files changed, 63 insertions(+), 48 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.c +3 -2
@@ -57,7 +57,8 @@ int mlx5_accel_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters, }void *mlx5_accel_esp_create_hw_context (struct mlx5_core_dev *mdev, -struct mlx5_accel_esp_xfrm *xfrm) +struct mlx5_accel_esp_xfrm *xfrm, +u32 *sa_handle) {__be32 saddr[4 ] = {}, daddr[4 ] = {};
@@ -71,7 +72,7 @@ void *mlx5_accel_esp_create_hw_context(struct mlx5_core_dev *mdev,return mlx5_fpga_ipsec_create_sa_ctx (mdev, xfrm, saddr, daddr, xfrm->attrs.spi, - xfrm->attrs.is_ipv6); + xfrm->attrs.is_ipv6, sa_handle); }void mlx5_accel_esp_free_hw_context (void *context)
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.h +4 -2
@@ -47,7 +47,8 @@ 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); +struct mlx5_accel_esp_xfrm *xfrm, +u32 *sa_handle);void mlx5_accel_esp_free_hw_context (void *context);int mlx5_accel_ipsec_init (struct mlx5_core_dev *mdev);
@@ -60,7 +61,8 @@ void mlx5_accel_ipsec_cleanup(struct mlx5_core_dev *mdev);static inline void *mlx5_accel_esp_create_hw_context (struct mlx5_core_dev *mdev, -struct mlx5_accel_esp_xfrm *xfrm) +struct mlx5_accel_esp_xfrm *xfrm, +u32 *sa_handle) {return NULL ; }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +28 -40
126 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +26 -3
@@ -65,6 +65,7 @@ struct mlx5_fpga_esp_xfrm;struct mlx5_fpga_ipsec_sa_ctx {struct rhash_head hash;struct mlx5_ifc_fpga_ipsec_sa hw_sa; +u32 sa_handle;struct mlx5_core_dev *dev;struct mlx5_fpga_esp_xfrm *fpga_xfrm; };
@@ -119,6 +120,8 @@ struct mlx5_fpga_ipsec {*/ struct rb_root rules_rb;struct mutex rules_rb_lock;/* rules lock */ + +struct ida halloc; };static bool mlx5_fpga_is_ipsec_device (struct mlx5_core_dev *mdev)
@@ -666,7 +669,8 @@ void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev,struct mlx5_accel_esp_xfrm *accel_xfrm, const __be32 saddr[4], const __be32 daddr[4], - const __be32 spi, bool is_ipv6) + const __be32 spi, bool is_ipv6, + u32 *sa_handle) { struct mlx5_fpga_ipsec_sa_ctx *sa_ctx; struct mlx5_fpga_esp_xfrm *fpga_xfrm =
@@ -704,6 +708,17 @@ void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev, goto exists; } +if (accel_xfrm->attrs.action &MLX5_ACCEL_ESP_ACTION_DECRYPT ) { + err =ida_simple_get (&fipsec->halloc,1 ,0 ,GFP_KERNEL ); +if (err <0 ) { + context =ERR_PTR (err); + goto exists; + } + + sa_ctx->sa_handle = err; +if (sa_handle) + *sa_handle = sa_ctx->sa_handle; + }/* This is unbounded fpga_xfrm, try to add to hash */ mutex_lock (&fipsec->sa_hash_lock);
@@ -744,7 +759,8 @@ void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev, rhash_sa)); unlock_hash:mutex_unlock (&fipsec->sa_hash_lock); - +if (accel_xfrm->attrs.action &MLX5_ACCEL_ESP_ACTION_DECRYPT ) +ida_simple_remove (&fipsec->halloc, sa_ctx->sa_handle); exists:mutex_unlock (&fpga_xfrm->lock);kfree (sa_ctx);
@@ -816,7 +832,7 @@ mlx5_fpga_ipsec_fs_create_sa_ctx(struct mlx5_core_dev *mdev,/* create */ return mlx5_fpga_ipsec_create_sa_ctx (mdev, accel_xfrm, saddr, daddr, - spi, is_ipv6); + spi, is_ipv6,NULL ); } static void
@@ -836,6 +852,10 @@ mlx5_fpga_ipsec_release_sa_ctx(struct mlx5_fpga_ipsec_sa_ctx *sa_ctx)return ; } +if (sa_ctx->fpga_xfrm->accel_xfrm.attrs.action & +MLX5_ACCEL_ESP_ACTION_DECRYPT ) +ida_simple_remove (&fipsec->halloc, sa_ctx->sa_handle); +mutex_lock (&fipsec->sa_hash_lock);WARN_ON (rhashtable_remove_fast (&fipsec->sa_hash, &sa_ctx->hash, rhash_sa));
@@ -1299,6 +1319,8 @@ int mlx5_fpga_ipsec_init(struct mlx5_core_dev *mdev) goto err_destroy_hash; } +ida_init (&fdev->ipsec->halloc); +return 0 ; err_destroy_hash:
@@ -1331,6 +1353,7 @@ void mlx5_fpga_ipsec_cleanup(struct mlx5_core_dev *mdev)if (!mlx5_fpga_is_ipsec_device (mdev))return ; +ida_destroy (&fdev->ipsec->halloc);destroy_rules_rb (&fdev->ipsec->rules_rb);rhashtable_destroy (&fdev->ipsec->sa_hash);
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h +2 -1
@@ -47,7 +47,8 @@ void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev,struct mlx5_accel_esp_xfrm *accel_xfrm, const __be32 saddr[4], const __be32 daddr[4], - const __be32 spi, bool is_ipv6); + const __be32 spi, bool is_ipv6, + u32 *sa_handle);void mlx5_fpga_ipsec_delete_sa_ctx (void *context);int mlx5_fpga_ipsec_init (struct mlx5_core_dev *mdev);
Signature · 1 line
2.25.3
PATCH 6/10 net/mlx5e: Set of completion request bit should not clear other adjacent bits
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
In notify HW (ring doorbell) flow, we set the bit to request a completion on the TX descriptor.
When doing so, we should not unset other bits in the same byte. Currently, this does not fix a real issue, as we still don't have a flow where both MLX5_WQE_CTRL_CQ_UPDATE and any adjacent bit are set together.
--- drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +1 -1
@@ -102,7 +102,7 @@ static inline void mlx5e_notify_hw(struct mlx5_wq_cyc *wq, u16 pc, void __iomem *uar_map, struct mlx5_wqe_ctrl_seg *ctrl) { - ctrl->fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; + ctrl->fm_ce_se |= MLX5_WQE_CTRL_CQ_UPDATE;/* ensure wqe is visible to device before updating doorbell record */ dma_wmb ();
Signature · 1 line
2.25.3
PATCH 7/10 net/mlx5e: Allow partial data mask for tunnel options
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
We use mapping to save and restore the tunnel options. Save also the tunnel options mask.
--- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +22 -10
@@ -171,6 +171,11 @@ struct tunnel_match_key {int filter_ifindex; }; +struct tunnel_match_enc_opts { +struct flow_dissector_key_enc_opts key; +struct flow_dissector_key_enc_opts mask; +}; +/* Tunnel_id mapping is TUNNEL_INFO_BITS + ENC_OPTS_BITS. * Upper TUNNEL_INFO_BITS for general tunnel info. * Lower ENC_OPTS_BITS bits for enc_opts.
@@ -1824,9 +1829,7 @@ enc_opts_is_dont_care_or_full_match(struct mlx5e_priv *priv, *dont_care = false;if (opt->opt_class !=U16_MAX || - opt->type !=U8_MAX || -memchr_inv (opt->opt_data,0xFF , - opt->length *4 )) { + opt->type !=U8_MAX ) {NL_SET_ERR_MSG (extack,"Partial match of tunnel options in chain > 0 isn't supported" ); netdev_warn(priv->netdev,
@@ -1863,6 +1866,7 @@ static int mlx5e_get_flow_tunnel_id(struct mlx5e_priv *priv,struct mlx5_esw_flow_attr *attr = flow->esw_attr;struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts;struct flow_match_enc_opts enc_opts_match; +struct tunnel_match_enc_opts tun_enc_opts;struct mlx5_rep_uplink_priv *uplink_priv;struct mlx5e_rep_priv *uplink_rpriv;struct tunnel_match_key tunnel_key;
@@ -1905,8 +1909,14 @@ static int mlx5e_get_flow_tunnel_id(struct mlx5e_priv *priv, goto err_enc_opts;if (!enc_opts_is_dont_care) { +memset (&tun_enc_opts,0 ,sizeof (tun_enc_opts)); +memcpy (&tun_enc_opts.key, enc_opts_match.key, +sizeof (*enc_opts_match.key)); +memcpy (&tun_enc_opts.mask, enc_opts_match.mask, +sizeof (*enc_opts_match.mask)); + err =mapping_add (uplink_priv->tunnel_enc_opts_mapping, - enc_opts_match.key, &enc_opts_id); + &tun_enc_opts, &enc_opts_id);if (err) goto err_enc_opts; }
@@ -4707,7 +4717,7 @@ void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv)int mlx5e_tc_esw_init (struct rhashtable *tc_ht) { -const size_t sz_enc_opts =sizeof (struct flow_dissector_key_enc_opts ); +const size_t sz_enc_opts =sizeof (struct tunnel_match_enc_opts );struct mlx5_rep_uplink_priv *uplink_priv;struct mlx5e_rep_priv *priv;struct mapping_ctx *mapping;
@@ -4802,7 +4812,7 @@ static bool mlx5e_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb, u32 tunnel_id) {struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; -struct flow_dissector_key_enc_opts enc_opts = {}; +struct tunnel_match_enc_opts enc_opts = {};struct mlx5_rep_uplink_priv *uplink_priv;struct mlx5e_rep_priv *uplink_rpriv;struct metadata_dst *tun_dst;
@@ -4840,7 +4850,7 @@ static bool mlx5e_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb, } } - tun_dst =tun_rx_dst (enc_opts.len); + tun_dst =tun_rx_dst (enc_opts.key.len);if (!tun_dst) {WARN_ON_ONCE (true);return false;
@@ -4854,9 +4864,11 @@ static bool mlx5e_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb,key32_to_tunnel_id (key.enc_key_id.keyid), TUNNEL_KEY); -if (enc_opts.len) -ip_tunnel_info_opts_set (&tun_dst->u.tun_info, enc_opts.data, - enc_opts.len, enc_opts.dst_opt_type); +if (enc_opts.key.len) +ip_tunnel_info_opts_set (&tun_dst->u.tun_info, + enc_opts.key.data, + enc_opts.key.len, + enc_opts.key.dst_opt_type);skb_dst_set (skb, (struct dst_entry *)tun_dst); dev =dev_get_by_index (&init_net, key.filter_ifindex);
Signature · 1 line
2.25.3
PATCH 8/10 net/mlx5e: Handle errors from netif_set_real_num_{tx,rx}_queues
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
netif_set_real_num_tx_queues and netif_set_real_num_rx_queues may fail. Now that mlx5e supports handling errors in the preactivate hook, this commit leverages that functionality to handle errors from those functions and roll back all changes on failure.
--- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 59 +++++++++++++++---- 2 files changed, 48 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -1
@@ -432,7 +432,7 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) { *cur_params = new_channels.params; -mlx5e_num_channels_changed (priv); + err =mlx5e_num_channels_changed (priv); goto out; }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +47 -12
90 lines not on this page · raw message
Signature · 1 line
2.25.3
PATCH 9/10 net/mlx5: Read embedded cpu bit only once
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Embedded CPU bit doesn't change with PCI resume/suspend. Hence read it only once while probing the PCI device.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -2
@@ -782,7 +782,7 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct pci_dev *pdev, }mlx5_pci_vsc_init (dev); - + dev->caps.embedded_cpu =mlx5_read_embedded_cpu (dev);return 0 ; err_clr_master:
@@ -1180,7 +1180,6 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) {int err =0 ; - dev->caps.embedded_cpu =mlx5_read_embedded_cpu (dev);mutex_lock (&dev->intf_state_mutex);if (test_bit (MLX5_INTERFACE_STATE_UP , &dev->intf_state)) {mlx5_core_warn (dev,"interface is up, NOP\n" );
Signature · 1 line
2.25.3
PATCH 10/10 net/mlx5: improve some comments
In reply to Saeed MahameedFrom: Hu Haowen <[email protected]>
Replaced "its" with "it's".
--- drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +1 -1
@@ -684,7 +684,7 @@ static void mlx5_fw_tracer_handle_traces(struct work_struct *work)get_block_timestamp (tracer, &tmp_trace_block[TRACES_PER_BLOCK -1 ]);while (block_timestamp > tracer->last_timestamp) { -/* Check block override if its not the first block */ +/* Check block override if it's not the first block */ if (!tracer->last_timestamp) {u64 *ts_event;/* To avoid block override be the HW in case of buffer
Signature · 1 line
2.25.3
David Miller
maintainerFrom: Saeed Mahameed <[email protected]>
Date: Mon, 20 Apr 2020 14:22:13 -0700
Quoted 5 lines
This series adds misc updates and cleanup to mlx5.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Pulled, thanks Saeed.