patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: bluca@debian.org
Cc: stable@dpdk.org, nelio.laranjeiro@6wind.com, yskoh@mellanox.com,
	adrien.mazarguil@6wind.com
Subject: [dpdk-stable] [PATCH 03/33] net/mlx5: fix tunnel offloads cap query
Date: Sun,  6 May 2018 09:05:32 +0300	[thread overview]
Message-ID: <54515546b2fc144b62dc37c217ca073d92132c62.1525586525.git.shahafs@mellanox.com> (raw)
In-Reply-To: <cover.1525586525.git.shahafs@mellanox.com>

[ upstream commit 038e72511f2147c238ff1cb021c82d74efcf630f ]

The query for the tunnel stateless offloads is wrongly implemented
because of:

1. It was using the device id to query for the offloads.
2. It was using a compilation flag for Verbs which no longer exits.

The main reason was lack of proper API from Verbs.

Fixing the query to use rdma-core API. The capability returned from
rdma-core refer to both Tx and Rx sides.
Eventhough there is a separate cap for GRE and VXLAN, implementation merge
them into a single flag in order to simplify the checks on the data
path.

Fixes: 43e9d9794cde ("net/mlx5: support upstream rdma-core")
Fixes: f5fde5205101 ("net/mlx5: add hardware checksum offload for tunnel packets")
Cc: stable@dpdk.org

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/Makefile   |  6 +++---
 drivers/net/mlx5/mlx5.c     | 39 +++++++++++++++------------------------
 drivers/net/mlx5/mlx5.h     |  4 ++--
 drivers/net/mlx5/mlx5_rxq.c |  2 +-
 4 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 3bc9736c9c..afda4118fd 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -125,9 +125,9 @@ mlx5_autoconf.h.new: FORCE
 mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
 	$Q $(RM) -f -- '$@'
 	$Q sh -- '$<' '$@' \
-		HAVE_IBV_DEVICE_VXLAN_SUPPORT \
-		infiniband/verbs.h \
-		enum IBV_DEVICE_VXLAN_SUPPORT \
+		HAVE_IBV_DEVICE_TUNNEL_SUPPORT \
+		infiniband/mlx5dv.h \
+		enum MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS \
 		$(AUTOCONF_OUTPUT)
 	$Q sh -- '$<' '$@' \
 		HAVE_IBV_WQ_FLAG_RX_END_PADDING \
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 6c0985bd69..61cb93101a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -584,7 +584,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	unsigned int tunnel_en = 0;
 	int idx;
 	int i;
-	struct mlx5dv_context attrs_out;
+	struct mlx5dv_context attrs_out = {0};
 #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
 	struct ibv_counter_set_description cs_desc;
 #endif
@@ -633,20 +633,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		       PCI_DEVICE_ID_MELLANOX_CONNECTX5VF) ||
 		      (pci_dev->id.device_id ==
 		       PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF));
-		switch (pci_dev->id.device_id) {
-		case PCI_DEVICE_ID_MELLANOX_CONNECTX4:
-			tunnel_en = 1;
-			break;
-		case PCI_DEVICE_ID_MELLANOX_CONNECTX4LX:
-		case PCI_DEVICE_ID_MELLANOX_CONNECTX5:
-		case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
-		case PCI_DEVICE_ID_MELLANOX_CONNECTX5EX:
-		case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF:
-			tunnel_en = 1;
-			break;
-		default:
-			break;
-		}
 		INFO("PCI information matches, using device \"%s\""
 		     " (SR-IOV: %s)",
 		     list[i]->name,
@@ -675,6 +661,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	 * Multi-packet send is supported by ConnectX-4 Lx PF as well
 	 * as all ConnectX-5 devices.
 	 */
+#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
+	attrs_out.comp_mask |= MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS;
+#endif
 	mlx5_glue->dv_query_device(attr_ctx, &attrs_out);
 	if (attrs_out.flags & MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED) {
 		if (attrs_out.flags & MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW) {
@@ -693,6 +682,17 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		cqe_comp = 0;
 	else
 		cqe_comp = 1;
+#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
+	if (attrs_out.comp_mask & MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS) {
+		tunnel_en = ((attrs_out.tunnel_offloads_caps &
+			      MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_VXLAN) &&
+			     (attrs_out.tunnel_offloads_caps &
+			      MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_GRE));
+	}
+	DEBUG("Tunnel offloading is %ssupported", tunnel_en ? "" : "not ");
+#else
+	WARN("Tunnel offloading disabled due to old OFED/rdma-core version");
+#endif
 	if (mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr))
 		goto error;
 	INFO("%u port(s) detected", device_attr.orig_attr.phys_port_cnt);
@@ -838,15 +838,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 				    IBV_DEVICE_RAW_IP_CSUM);
 		DEBUG("checksum offloading is %ssupported",
 		      (config.hw_csum ? "" : "not "));
-
-#ifdef HAVE_IBV_DEVICE_VXLAN_SUPPORT
-		config.hw_csum_l2tun =
-				!!(exp_device_attr.exp_device_cap_flags &
-				   IBV_DEVICE_VXLAN_SUPPORT);
-#endif
-		DEBUG("Rx L2 tunnel checksum offloads are %ssupported",
-		      (config.hw_csum_l2tun ? "" : "not "));
-
 #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
 		config.flow_counter_en = !!(device_attr.max_counter_sets);
 		mlx5_glue->describe_counter_set(ctx, 0, &cs_desc);
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index da44faaf4f..9ad0533fcd 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -75,13 +75,13 @@ TAILQ_HEAD(mlx5_flows, rte_flow);
  */
 struct mlx5_dev_config {
 	unsigned int hw_csum:1; /* Checksum offload is supported. */
-	unsigned int hw_csum_l2tun:1; /* Same for L2 tunnels. */
 	unsigned int hw_vlan_strip:1; /* VLAN stripping is supported. */
 	unsigned int hw_fcs_strip:1; /* FCS stripping is supported. */
 	unsigned int hw_padding:1; /* End alignment padding is supported. */
 	unsigned int sriov:1; /* This is a VF or PF with VF devices. */
 	unsigned int mps:2; /* Multi-packet send supported mode. */
-	unsigned int tunnel_en:1; /* Whether tunnel is supported. */
+	unsigned int tunnel_en:1;
+	/* Whether tunnel stateless offloads are supported. */
 	unsigned int flow_counter_en:1; /* Whether flow counter is supported. */
 	unsigned int cqe_comp:1; /* CQE compression is enabled. */
 	unsigned int tso:1; /* Whether TSO is supported. */
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index ff58c49213..238fa7e563 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1006,7 +1006,7 @@ mlx5_priv_rxq_new(struct priv *priv, uint16_t idx, uint16_t desc,
 	/* Toggle RX checksum offload if hardware supports it. */
 	tmpl->rxq.csum = !!(conf->offloads & DEV_RX_OFFLOAD_CHECKSUM);
 	tmpl->rxq.csum_l2tun = (!!(conf->offloads & DEV_RX_OFFLOAD_CHECKSUM) &&
-				priv->config.hw_csum_l2tun);
+				priv->config.tunnel_en);
 	tmpl->rxq.hw_timestamp = !!(conf->offloads & DEV_RX_OFFLOAD_TIMESTAMP);
 	/* Configure VLAN stripping. */
 	tmpl->rxq.vlan_strip = !!(conf->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
-- 
2.12.0

  parent reply	other threads:[~2018-05-06  6:06 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06  6:05 [dpdk-stable] [PATCH 00/33] mlx5 backports for 18.02.2 stable Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 01/33] net/mlx: control netdevices through ioctl only Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 02/33] net/mlx5: fix flow creation with a single target queue Shahaf Shuler
2018-05-06  6:05 ` Shahaf Shuler [this message]
2018-05-06  6:05 ` [dpdk-stable] [PATCH 04/33] net/mlx5: fix disabling Tx packet inlining Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 05/33] net/mlx: fix rdma-core glue path with EAL plugins Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 06/33] net/mlx5: fix sriov flag Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 07/33] net/mlx5: name parameters in function prototypes Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 08/33] net/mlx5: mark parameters with unused attribute Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 09/33] net/mlx5: normalize function prototypes Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 10/33] net/mlx5: add missing function documentation Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 11/33] net/mlx5: remove useless empty lines Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 12/33] net/mlx5: remove control path locks Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 13/33] net/mlx5: prefix all functions with mlx5 Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 14/33] net/mlx5: change non failing function return values Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 15/33] net/mlx5: standardize on negative errno values Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 16/33] net/mlx5: fix existing file removal Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 17/33] net/mlx5: fix ARM build Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 18/33] net/mlx5: remove kernel version check Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 19/33] net/mlx5: fix link status behavior Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 20/33] net/mlx5: fix link status to use wait to complete Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 21/33] net/mlx5: fix TSO enablement Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 22/33] net/mlx5: fix icc build Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 23/33] net/mlx5: fix RSS key length query Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 24/33] net/mlx: fix warnings for unused compiler arguments Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 25/33] net/mlx5: fix link status initialization Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 26/33] net/mlx5: fix RSS flow action bounds check Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 27/33] net/mlx5: split L3/L4 in flow director Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 28/33] net/mlx5: fix flow director mask Shahaf Shuler
2018-05-06  6:05 ` [dpdk-stable] [PATCH 29/33] net/mlx5: fix flow director rule deletion crash Shahaf Shuler
2018-05-08  9:49 ` [dpdk-stable] [PATCH 00/33] mlx5 backports for 18.02.2 stable Luca Boccassi
2018-05-08  9:56   ` Luca Boccassi
2018-05-09  7:51     ` Shahaf Shuler
2018-05-09 10:27       ` Luca Boccassi
2018-05-09 11:18         ` Shahaf Shuler
2018-05-09 14:03           ` Luca Boccassi
2018-05-09 15:03 ` [dpdk-stable] [PATCH v2 00/20] " Shahaf Shuler
2018-05-09 15:03   ` [dpdk-stable] [PATCH v2 01/20] net/mlx: control netdevices through ioctl only Shahaf Shuler
2018-05-09 15:03   ` [dpdk-stable] [PATCH v2 02/20] net/mlx5: name parameters in function prototypes Shahaf Shuler
2018-05-09 15:03   ` [dpdk-stable] [PATCH v2 03/20] net/mlx5: mark parameters with unused attribute Shahaf Shuler
2018-05-09 15:03   ` [dpdk-stable] [PATCH v2 04/20] net/mlx5: normalize function prototypes Shahaf Shuler
2018-05-09 15:03   ` [dpdk-stable] [PATCH v2 05/20] net/mlx5: add missing function documentation Shahaf Shuler
2018-05-09 15:03   ` [dpdk-stable] [PATCH v2 06/20] net/mlx5: remove useless empty lines Shahaf Shuler
2018-05-09 15:03   ` [dpdk-stable] [PATCH v2 07/20] net/mlx5: remove control path locks Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 08/20] net/mlx5: prefix all functions with mlx5 Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 09/20] net/mlx5: change non failing function return values Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 10/20] net/mlx5: standardize on negative errno values Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 11/20] net/mlx5: remove kernel version check Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 12/20] net/mlx5: fix link status behavior Shahaf Shuler
2018-05-09 15:17     ` Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 13/20] net/mlx5: fix link status to use wait to complete Shahaf Shuler
2018-05-09 15:17     ` Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 14/20] net/mlx5: fix link status initialization Shahaf Shuler
2018-05-09 15:17     ` Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 15/20] net/mlx5: split L3/L4 in flow director Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 16/20] net/mlx5: fix flow director mask Shahaf Shuler
2018-05-09 15:17     ` Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 17/20] net/mlx5: fix ethtool link setting call order Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 18/20] net/mlx5: fix socket connection return value Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 19/20] net/mlx5: fix probe return value polarity Shahaf Shuler
2018-05-09 15:04   ` [dpdk-stable] [PATCH v2 20/20] net/mlx5: fix flow validation Shahaf Shuler
2018-05-09 15:17     ` Shahaf Shuler
2018-05-09 15:15   ` [dpdk-stable] [PATCH v2 00/20] mlx5 backports for 18.02.2 stable Shahaf Shuler
2018-05-09 16:04   ` Luca Boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54515546b2fc144b62dc37c217ca073d92132c62.1525586525.git.shahafs@mellanox.com \
    --to=shahafs@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=bluca@debian.org \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=stable@dpdk.org \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).