DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@mellanox.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Shahaf Shuler <shahafs@mellanox.com>
Cc: dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 06/18] net/mlx5: fix tunnel offloads cap query
Date: Mon, 26 Feb 2018 23:09:35 +0800	[thread overview]
Message-ID: <20180226150947.107179-7-xuemingl@mellanox.com> (raw)
In-Reply-To: <20180226150947.107179-1-xuemingl@mellanox.com>

From: Shahaf Shuler <shahafs@mellanox.com>

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>
---
 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 3bc9736..afda411 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 6c0985b..61cb931 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -584,7 +584,7 @@
 	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 @@
 		       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 @@
 	 * 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 @@
 		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 @@
 				    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 965c19f..3e2d96a 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -75,13 +75,13 @@ struct mlx5_xstats_ctrl {
  */
 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 ff58c49..238fa7e 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1006,7 +1006,7 @@ struct mlx5_rxq_ctrl*
 	/* 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);
-- 
1.8.3.1

  parent reply	other threads:[~2018-02-26 15:10 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 15:09 [dpdk-dev] [PATCH 00/18] MLX5 tunnel Rx offloading Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 01/18] ethdev: support tunnel RSS level Xueming Li
2018-02-27 13:09   ` Ferruh Yigit
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 00/21] MLX5 tunnel Rx offloading Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 01/21] ethdev: support tunnel RSS level Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 02/21] app/testpmd: support flow RSS level parsing Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 03/21] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 04/21] app/testpmd: " Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 05/21] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 06/21] net/mlx5: fix tunnel offloads cap query Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 07/21] net/mlx5: support GRE tunnel flow Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 08/21] net/mlx5: support L3 vxlan Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 09/21] net/mlx5: support tunnel inner csum offloads Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 10/21] net/mlx5: support packet tunnel type Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 11/21] net/mlx5: split flow RSS handling logic Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 12/21] net/mlx5: support tunnel RSS level Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 13/21] net/mlx5: support 16 hardware priorities Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 14/21] net/mlx5: add hardware flow debug dump Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 15/21] net/mlx5: fix control flow create failure Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 16/21] net/mlx5: introduce new tunnel VXLAN-GPE Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 17/21] net/mlx5: allow flow tunnel ID 0 with outer pattern Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 18/21] doc: update mlx5 guide on tunnel offloading Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 19/21] doc: remove announce of ethdev API change for RSS configuration Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 20/21] ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP Xueming Li
2018-03-09 11:29   ` [dpdk-dev] [PATCH v1 21/21] net/mlx5: support MPLS-in-GRE and MPLS-in-UDP flow pattern Xueming Li
2018-04-10 13:00   ` [dpdk-dev] [PATCH v2 0/5] introduce new tunnel types Xueming Li
2018-04-10 13:00   ` [dpdk-dev] [PATCH v2 1/5] doc: remove RSS configuration change announcement Xueming Li
2018-04-11  9:57     ` Adrien Mazarguil
2018-04-10 13:00   ` [dpdk-dev] [PATCH v2 2/5] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-11  9:59     ` Adrien Mazarguil
2018-04-11 12:04       ` Xueming(Steven) Li
2018-04-10 13:00   ` [dpdk-dev] [PATCH v2 3/5] ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP Xueming Li
2018-04-11  9:58     ` Adrien Mazarguil
2018-04-10 13:00   ` [dpdk-dev] [PATCH v2 4/5] app/testpmd: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-10 14:07     ` Nélio Laranjeiro
2018-04-11  9:59     ` Adrien Mazarguil
2018-04-10 13:00   ` [dpdk-dev] [PATCH v2 5/5] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-04-12  7:33   ` [dpdk-dev] [PATCH v3 0/5] introduce new tunnel types Xueming Li
2018-04-12  7:33   ` [dpdk-dev] [PATCH v3 1/5] doc: remove RSS configuration change announcement Xueming Li
2018-04-12  7:33   ` [dpdk-dev] [PATCH v3 2/5] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-12 12:01     ` Adrien Mazarguil
2018-04-12  7:33   ` [dpdk-dev] [PATCH v3 3/5] ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP Xueming Li
2018-04-12  7:33   ` [dpdk-dev] [PATCH v3 4/5] app/testpmd: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-12 12:01     ` Adrien Mazarguil
2018-04-12  7:33   ` [dpdk-dev] [PATCH v3 5/5] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-04-13 11:02   ` [dpdk-dev] [PATCH v4 0/5] introduce new tunnel types Xueming Li
2018-04-16 22:33     ` Thomas Monjalon
2018-04-17 15:04     ` [dpdk-dev] [PATCH v5 0/4] " Xueming Li
2018-04-17 16:05       ` Iremonger, Bernard
2018-04-18 11:55         ` Xueming(Steven) Li
2018-04-18 15:11           ` Iremonger, Bernard
2018-04-19 14:24             ` Xueming(Steven) Li
2018-04-19 14:57               ` Thomas Monjalon
2018-04-19 19:56                 ` Ferruh Yigit
2018-04-17 15:04     ` [dpdk-dev] [PATCH v5 1/4] doc: remove RSS configuration change announcement Xueming Li
2018-04-17 15:04     ` [dpdk-dev] [PATCH v5 2/4] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-17 20:56       ` Thomas Monjalon
2018-04-18  8:12         ` Adrien Mazarguil
2018-04-17 15:04     ` [dpdk-dev] [PATCH v5 3/4] app/testpmd: " Xueming Li
2018-04-17 15:04     ` [dpdk-dev] [PATCH v5 4/4] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-04-17 15:33     ` [dpdk-dev] [PATCH v5 2/4] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-20 11:56     ` [dpdk-dev] [PATCH v6 0/5] introduce new tunnel types Xueming Li
2018-04-23 12:16       ` [dpdk-dev] [PATCH v7 " Xueming Li
2018-04-25 21:31         ` Ferruh Yigit
2018-04-23 12:16       ` [dpdk-dev] [PATCH v7 1/5] doc: remove RSS configuration change announcement Xueming Li
2018-04-23 16:13         ` Ferruh Yigit
2018-04-23 16:56           ` Thomas Monjalon
2018-04-24  5:07           ` Xueming(Steven) Li
2018-04-25 17:38             ` Ferruh Yigit
2018-04-23 12:16       ` [dpdk-dev] [PATCH v7 2/5] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-23 12:16       ` [dpdk-dev] [PATCH v7 3/5] ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP Xueming Li
2018-04-23 15:15         ` Thomas Monjalon
2018-04-23 12:16       ` [dpdk-dev] [PATCH v7 4/5] app/testpmd: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-23 12:16       ` [dpdk-dev] [PATCH v7 5/5] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-04-20 11:56     ` [dpdk-dev] [PATCH v6 1/5] doc: remove RSS configuration change announcement Xueming Li
2018-04-20 11:56     ` [dpdk-dev] [PATCH v6 2/5] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-23  9:43       ` Olivier Matz
2018-04-20 11:56     ` [dpdk-dev] [PATCH v6 3/5] ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP Xueming Li
2018-04-23  9:43       ` Olivier Matz
2018-04-20 11:56     ` [dpdk-dev] [PATCH v6 4/5] app/testpmd: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-20 11:56     ` [dpdk-dev] [PATCH v6 5/5] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-04-13 11:02   ` [dpdk-dev] [PATCH v4 1/5] doc: remove RSS configuration change announcement Xueming Li
2018-04-17 15:16     ` Iremonger, Bernard
2018-04-17 15:37       ` Xueming(Steven) Li
2018-04-13 11:02   ` [dpdk-dev] [PATCH v4 2/5] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-16 22:23     ` Thomas Monjalon
2018-04-17  8:54       ` Mohammad Abdul Awal
2018-04-13 11:02   ` [dpdk-dev] [PATCH v4 3/5] ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP Xueming Li
2018-04-13 11:02   ` [dpdk-dev] [PATCH v4 4/5] app/testpmd: introduce new tunnel VXLAN-GPE Xueming Li
2018-04-13 11:02   ` [dpdk-dev] [PATCH v4 5/5] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-04-17 15:12     ` Iremonger, Bernard
2018-02-26 15:09 ` [dpdk-dev] [PATCH 02/18] app/testpmd: support flow RSS level parsing Xueming Li
2018-02-27 13:10   ` Ferruh Yigit
2018-03-05 10:36     ` Xueming(Steven) Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 03/18] ethdev: introduce new tunnel VXLAN-GPE Xueming Li
2018-02-27 15:25   ` Mohammad Abdul Awal
2018-02-26 15:09 ` [dpdk-dev] [PATCH 04/18] app/testpmd: " Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 05/18] app/testpmd: add more GRE extension support to csum engine Xueming Li
2018-02-26 15:09 ` Xueming Li [this message]
2018-02-26 15:09 ` [dpdk-dev] [PATCH 07/18] net/mlx5: support GRE tunnel flow Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 08/18] net/mlx5: support L3 vxlan Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 09/18] net/mlx5: support tunnel inner csum offloads Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 10/18] net/mlx5: support packet tunnel type Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 11/18] net/mlx5: split flow RSS handling logic Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 12/18] net/mlx5: support tunnel RSS level Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 13/18] net/mlx5: support 16 hardware priorities Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 14/18] net/mlx5: add hardware flow debug dump Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 15/18] net/mlx5: fix control flow create failure Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 16/18] net/mlx5: introduce new tunnel VXLAN-GPE Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 17/18] net/mlx5: allow flow tunnel ID 0 with outer pattern Xueming Li
2018-02-26 15:09 ` [dpdk-dev] [PATCH 18/18] doc: update mlx5 guide on tunnel offloading Xueming Li

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=20180226150947.107179-7-xuemingl@mellanox.com \
    --to=xuemingl@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=shahafs@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.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).