DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tal Shnaiderman <talshn@nvidia.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <matan@nvidia.com>, <rasland@nvidia.com>,
	<asafp@nvidia.com>, <viacheslavo@nvidia.com>, <eilong@nvidia.com>,
	<kcollins@nvidia.com>, <idanhac@nvidia.com>
Subject: [dpdk-dev] [PATCH v2 06/13] net/mlx5: query tunneling support on Windows
Date: Tue, 12 Oct 2021 15:45:47 +0300	[thread overview]
Message-ID: <20211012124554.21296-7-talshn@nvidia.com> (raw)
In-Reply-To: <20211012124554.21296-1-talshn@nvidia.com>

Query tunneling supported on the NIC.

Save the offloads values in a config parameter.
This is needed for the following TSO support:

DEV_TX_OFFLOAD_VXLAN_TNL_TSO
DEV_TX_OFFLOAD_GRE_TNL_TSO
DEV_TX_OFFLOAD_GENEVE_TNL_TSO

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
---
 drivers/net/mlx5/mlx5.c            | 14 ++++++++++++++
 drivers/net/mlx5/mlx5.h            |  2 ++
 drivers/net/mlx5/windows/mlx5_os.c | 20 ++++++++++++++++++--
 3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index add07db755..a957bc9938 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -966,6 +966,20 @@ mlx5_get_supported_sw_parsing_offloads(const struct mlx5_hca_attr *attr)
 	return sw_parsing_offloads;
 }
 
+uint32_t
+mlx5_get_supported_tunneling_offloads(const struct mlx5_hca_attr *attr)
+{
+	uint32_t tn_offloads = 0;
+
+	if (attr->tunnel_stateless_vxlan)
+		tn_offloads |= MLX5_TUNNELED_OFFLOADS_VXLAN_CAP;
+	if (attr->tunnel_stateless_gre)
+		tn_offloads |= MLX5_TUNNELED_OFFLOADS_GRE_CAP;
+	if (attr->tunnel_stateless_geneve_rx)
+		tn_offloads |= MLX5_TUNNELED_OFFLOADS_GENEVE_CAP;
+	return tn_offloads;
+}
+
 /*
  * Allocate Rx and Tx UARs in robust fashion.
  * This routine handles the following UAR allocation issues:
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 58f12cd75c..0dbb9aacb8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -1830,5 +1830,7 @@ int mlx5_aso_ct_available(struct mlx5_dev_ctx_shared *sh,
 			  struct mlx5_aso_ct_action *ct);
 uint32_t
 mlx5_get_supported_sw_parsing_offloads(const struct mlx5_hca_attr *attr);
+uint32_t
+mlx5_get_supported_tunneling_offloads(const struct mlx5_hca_attr *attr);
 
 #endif /* RTE_PMD_MLX5_H_ */
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 1e258e044e..fab7d7efcb 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -171,6 +171,8 @@ mlx5_os_get_dev_attr(void *ctx, struct mlx5_dev_attr *device_attr)
 	}
 	device_attr->sw_parsing_offloads =
 		mlx5_get_supported_sw_parsing_offloads(&hca_attr);
+	device_attr->tunnel_offloads_caps =
+		mlx5_get_supported_tunneling_offloads(&hca_attr);
 	pv_iseg = mlx5_glue->query_hca_iseg(mlx5_ctx, &cb_iseg);
 	if (pv_iseg == NULL) {
 		DRV_LOG(ERR, "Failed to get device hca_iseg");
@@ -402,8 +404,22 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		sh->device_attr.max_rwq_indirection_table_size;
 	cqe_comp = 0;
 	config->cqe_comp = cqe_comp;
-	DRV_LOG(DEBUG, "tunnel offloading is not supported");
-	config->tunnel_en = 0;
+	config->tunnel_en = device_attr.tunnel_offloads_caps &
+		(MLX5_TUNNELED_OFFLOADS_VXLAN_CAP |
+		 MLX5_TUNNELED_OFFLOADS_GRE_CAP |
+		 MLX5_TUNNELED_OFFLOADS_GENEVE_CAP);
+	if (config->tunnel_en) {
+		DRV_LOG(DEBUG, "tunnel offloading is supported for %s%s%s",
+		config->tunnel_en &
+		MLX5_TUNNELED_OFFLOADS_VXLAN_CAP ? "[VXLAN]" : "",
+		config->tunnel_en &
+		MLX5_TUNNELED_OFFLOADS_GRE_CAP ? "[GRE]" : "",
+		config->tunnel_en &
+		MLX5_TUNNELED_OFFLOADS_GENEVE_CAP ? "[GENEVE]" : ""
+		);
+	} else {
+		DRV_LOG(DEBUG, "tunnel offloading is not supported");
+	}
 	DRV_LOG(DEBUG, "MPLS over GRE/UDP tunnel offloading is no supported");
 	config->mpls_en = 0;
 	/* Allocate private eth device data. */
-- 
2.16.1.windows.4


  parent reply	other threads:[~2021-10-12 12:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 12:45 [dpdk-dev] [PATCH v2 00/13] Expand NIC offloads " Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 01/13] net/mlx5: fix software parsing support query Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 02/13] common/mlx5: read software parsing capabilities from DevX Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 03/13] net/mlx5: query software parsing support on Windows Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 04/13] net/mlx5: fix tunneling support query Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 05/13] common/mlx5: read tunneling capabilities from DevX Tal Shnaiderman
2021-10-12 12:45 ` Tal Shnaiderman [this message]
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 07/13] common/mlx5: read TSO capability " Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 08/13] net/mlx5: support TSO offload on Windows Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 09/13] common/mlx5: read VLAN capability from DevX Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 10/13] net/mlx5: support VLAN stripping offload on Windows Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 11/13] common/mlx5: read FCS scattering capability from DevX Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 12/13] net/mlx5: support keep-CRC offload on Windows Tal Shnaiderman
2021-10-12 12:45 ` [dpdk-dev] [PATCH v2 13/13] doc: add new Windows offloads to the release note Tal Shnaiderman
2021-10-12 14:24 ` [dpdk-dev] [PATCH v2 00/13] Expand NIC offloads support on Windows Raslan Darawsheh

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=20211012124554.21296-7-talshn@nvidia.com \
    --to=talshn@nvidia.com \
    --cc=asafp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=eilong@nvidia.com \
    --cc=idanhac@nvidia.com \
    --cc=kcollins@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.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).