From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6E1F91B518 for ; Fri, 30 Nov 2018 00:12:45 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 30 Nov 2018 01:18:38 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wATNCW77032075; Fri, 30 Nov 2018 01:12:43 +0200 From: Yongseok Koh To: Shahaf Shuler Cc: dpdk stable Date: Thu, 29 Nov 2018 15:10:01 -0800 Message-Id: <20181129231202.30436-7-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181129231202.30436-1-yskoh@mellanox.com> References: <20181129231202.30436-1-yskoh@mellanox.com> Subject: [dpdk-stable] patch 'net/mlx5: disable ConnectX-4 Lx Multi Packet Send by default' has been queued to LTS release 17.11.5 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2018 23:12:45 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/01/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Yongseok --- >>From a2ffb6cbc8fd31294b63d893967e0b50816d3adf Mon Sep 17 00:00:00 2001 From: Shahaf Shuler Date: Mon, 13 Aug 2018 09:47:57 +0300 Subject: [PATCH] net/mlx5: disable ConnectX-4 Lx Multi Packet Send by default [ backported from upstream commit f9de87187b7f233cc5b1ea964c05311dfeed951a ] On ConnectX-4 Lx the Multi Packet Send (MPW) feature is considered un-secure, as on some cases were the application provides incorrect mbufs on the Tx burst the host or NIC can get stuck. Hence, disabling the feature by default for this specific NIC. Users can still enable this feature and enjoy the performance gain (mostly for low number of cores) by using the txq_mpw_en devarg. This patch will impact the out of the box performance of some application using ConnectX-4 Lx for the sack of security and robustness. Since we need different defaults based on the underlying device the mpw field in the configuration struct was extended to contain also the MLX5_ARG_UNSET option. Signed-off-by: Shahaf Shuler Acked-by: Yongseok Koh --- doc/guides/nics/mlx5.rst | 7 ++++++- drivers/net/mlx5/mlx5.c | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 1f675777a..1da0dc986 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -262,7 +262,12 @@ Run-time configuration is set, ``txq_mpw_en`` is disabled. It is currently only supported on the ConnectX-4 Lx, ConnectX-5 and Bluefield - families of adapters. Enabled by default. + families of adapters. + On ConnectX-4 Lx the MPW is considered un-secure hence disabled by default. + Users which enable the MPW should be aware that application which provides incorrect + mbuf descriptors in the Tx burst can lead to serious errors in the host including, on some cases, + NIC to get stuck. + On ConnectX-5 and Bluefield the MPW is secure and enabled by default. - ``txq_mpw_hdr_dseg_en`` parameter [int] diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 2db8d414b..b9db45770 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -640,8 +640,15 @@ mlx5_args_assign(struct priv *priv, struct mlx5_args *args) priv->txq_inline = args->txq_inline; if (args->txqs_inline != MLX5_ARG_UNSET) priv->txqs_inline = args->txqs_inline; - if (args->mps != MLX5_ARG_UNSET) + if (args->mps != MLX5_ARG_UNSET) { priv->mps = args->mps ? priv->mps : 0; + } else if (priv->mps == MLX5_MPW) { + /* + * MPW is disabled by default, while the Enhanced MPW is enabled + * by default. + */ + priv->mps = MLX5_MPW_DISABLED; + } if (args->mpw_hdr_dseg != MLX5_ARG_UNSET) priv->mpw_hdr_dseg = args->mpw_hdr_dseg; if (args->inline_max_packet_sz != MLX5_ARG_UNSET) -- 2.11.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-29 15:01:45.614282183 -0800 +++ 0007-net-mlx5-disable-ConnectX-4-Lx-Multi-Packet-Send-by-.patch 2018-11-29 15:01:44.971962000 -0800 @@ -1,8 +1,10 @@ -From f9de87187b7f233cc5b1ea964c05311dfeed951a Mon Sep 17 00:00:00 2001 +From a2ffb6cbc8fd31294b63d893967e0b50816d3adf Mon Sep 17 00:00:00 2001 From: Shahaf Shuler Date: Mon, 13 Aug 2018 09:47:57 +0300 Subject: [PATCH] net/mlx5: disable ConnectX-4 Lx Multi Packet Send by default +[ backported from upstream commit f9de87187b7f233cc5b1ea964c05311dfeed951a ] + On ConnectX-4 Lx the Multi Packet Send (MPW) feature is considered un-secure, as on some cases were the application provides incorrect mbufs on the Tx burst the host or NIC can get stuck. @@ -18,22 +20,19 @@ field in the configuration struct was extended to contain also the MLX5_ARG_UNSET option. -Cc: stable@dpdk.org - Signed-off-by: Shahaf Shuler Acked-by: Yongseok Koh --- - doc/guides/nics/mlx5.rst | 7 ++++++- - drivers/net/mlx5/mlx5.c | 20 +++++++++++--------- - drivers/net/mlx5/mlx5.h | 2 +- - 3 files changed, 18 insertions(+), 11 deletions(-) + doc/guides/nics/mlx5.rst | 7 ++++++- + drivers/net/mlx5/mlx5.c | 9 ++++++++- + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst -index 52e1213cf..dbdb90b59 100644 +index 1f675777a..1da0dc986 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst -@@ -339,7 +339,12 @@ Run-time configuration - When those offloads are requested the MPS send function will not be used. +@@ -262,7 +262,12 @@ Run-time configuration + is set, ``txq_mpw_en`` is disabled. It is currently only supported on the ConnectX-4 Lx, ConnectX-5 and Bluefield - families of adapters. Enabled by default. @@ -47,77 +46,26 @@ - ``txq_mpw_hdr_dseg_en`` parameter [int] diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c -index ec63bc6e2..30d4e70a7 100644 +index 2db8d414b..b9db45770 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c -@@ -477,7 +477,7 @@ mlx5_args_check(const char *key, const char *val, void *opaque) - } else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) { - config->txqs_inline = tmp; - } else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) { -- config->mps = !!tmp ? config->mps : 0; -+ config->mps = !!tmp; - } else if (strcmp(MLX5_TXQ_MPW_HDR_DSEG_EN, key) == 0) { - config->mpw_hdr_dseg = !!tmp; - } else if (strcmp(MLX5_TXQ_MAX_INLINE_LEN, key) == 0) { -@@ -702,6 +702,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, - struct mlx5dv_context dv_attr = { .comp_mask = 0 }; - struct mlx5_dev_config config = { - .vf = !!vf, -+ .mps = MLX5_ARG_UNSET, - .tx_vec_en = 1, - .rx_vec_en = 1, - .mpw_hdr_dseg = 0, -@@ -791,7 +792,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, - DRV_LOG(DEBUG, "MPW isn't supported"); - mps = MLX5_MPW_DISABLED; - } -- config.mps = mps; - #ifdef HAVE_IBV_MLX5_MOD_SWP - if (dv_attr.comp_mask & MLX5DV_CONTEXT_MASK_SWP) - swp = dv_attr.sw_parsing_caps.sw_parsing_offloads; -@@ -1035,13 +1035,15 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, - (1 << IBV_QPT_RAW_PACKET))); - if (config.tso) - config.tso_max_payload_sz = attr.tso_caps.max_tso; -- if (config.mps && !mps) { -- DRV_LOG(ERR, -- "multi-packet send not supported on this device" -- " (" MLX5_TXQ_MPW_EN ")"); -- err = ENOTSUP; -- goto error; -- } -+ /* -+ * MPW is disabled by default, while the Enhanced MPW is enabled -+ * by default. -+ */ -+ if (config.mps == MLX5_ARG_UNSET) -+ config.mps = (mps == MLX5_MPW_ENHANCED) ? MLX5_MPW_ENHANCED : -+ MLX5_MPW_DISABLED; -+ else -+ config.mps = config.mps ? mps : MLX5_MPW_DISABLED; - DRV_LOG(INFO, "%sMPS is %s", - config.mps == MLX5_MPW_ENHANCED ? "enhanced " : "", - config.mps != MLX5_MPW_DISABLED ? "enabled" : "disabled"); -diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h -index a3a34cffd..35a196e76 100644 ---- a/drivers/net/mlx5/mlx5.h -+++ b/drivers/net/mlx5/mlx5.h -@@ -99,7 +99,6 @@ struct mlx5_dev_config { - unsigned int hw_fcs_strip:1; /* FCS stripping is supported. */ - unsigned int hw_padding:1; /* End alignment padding is supported. */ - unsigned int vf:1; /* This is a VF. */ -- unsigned int mps:2; /* Multi-packet send supported mode. */ - unsigned int tunnel_en:1; - /* Whether tunnel stateless offloads are supported. */ - unsigned int mpls_en:1; /* MPLS over GRE/UDP is enabled. */ -@@ -122,6 +121,7 @@ struct mlx5_dev_config { - unsigned int min_rxqs_num; - /* Rx queue count threshold to enable MPRQ. */ - } mprq; /* Configurations for Multi-Packet RQ. */ -+ int mps; /* Multi-packet send supported mode. */ - unsigned int flow_prio; /* Number of flow priorities. */ - unsigned int tso_max_payload_sz; /* Maximum TCP payload for TSO. */ - unsigned int ind_table_max_size; /* Maximum indirection table size. */ +@@ -640,8 +640,15 @@ mlx5_args_assign(struct priv *priv, struct mlx5_args *args) + priv->txq_inline = args->txq_inline; + if (args->txqs_inline != MLX5_ARG_UNSET) + priv->txqs_inline = args->txqs_inline; +- if (args->mps != MLX5_ARG_UNSET) ++ if (args->mps != MLX5_ARG_UNSET) { + priv->mps = args->mps ? priv->mps : 0; ++ } else if (priv->mps == MLX5_MPW) { ++ /* ++ * MPW is disabled by default, while the Enhanced MPW is enabled ++ * by default. ++ */ ++ priv->mps = MLX5_MPW_DISABLED; ++ } + if (args->mpw_hdr_dseg != MLX5_ARG_UNSET) + priv->mpw_hdr_dseg = args->mpw_hdr_dseg; + if (args->inline_max_packet_sz != MLX5_ARG_UNSET) -- 2.11.0