DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com
Subject: [PATCH 05/17] net/bnxt: fix support for tunnel stateless offloads
Date: Wed, 27 Apr 2022 20:28:09 +0530	[thread overview]
Message-ID: <20220427145821.5987-6-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

The HW only supports tunnel header parsing globally for supported tunnel
types. When a function uses one default VNIC to receive both the tunnel
and non-tunnel packets, applying the same stateless offload operation to
both tunnel and non-tunnel packets can cause problems in certain scenarios.
To workaround these problems, the firmware advertises no tunnel header
parsing capabilities to the driver using the HWRM_FUNC_QCAPS.
The driver must check this flag setting and accordingly not advertise
tunnel packet stateless offload capabilities to the stack.

If the device supports VXLAN, GRE, IPIP and GENEVE tunnel parsing,
then reports RX_OFFLOAD_OUTER_IPV4_CKSUM, RX_OFFLOAD_OUTER_UDP_CKSUM
and TX_OFFLOAD_OUTER_IPV4_CKSUM in the Rx/Tx offload capabilities of
the device.
Also, advertise tunnel TSO capabilities based on FW support.

Fixes: 0a6d2a720078 ("net/bnxt: get device infos")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      |  1 +
 drivers/net/bnxt/bnxt_hwrm.c |  5 +++++
 drivers/net/bnxt/bnxt_hwrm.h | 20 ++++++++++++++++++++
 drivers/net/bnxt/bnxt_rxq.c  |  7 ++++---
 drivers/net/bnxt/bnxt_txq.c  | 18 ++++++++++++------
 5 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9e5ff74..e4e8e8e 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -871,6 +871,7 @@ struct bnxt {
 	uint32_t		max_mcast_addr; /* maximum number of mcast filters supported */
 
 	struct rte_eth_rss_conf	rss_conf; /* RSS configuration. */
+	uint16_t		tunnel_disable_flag; /* tunnel stateless offloads status */
 };
 
 static
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index bff73a9..178a112 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -939,6 +939,11 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT;
 		PMD_DRV_LOG(DEBUG, "VLAN acceleration for TX is enabled\n");
 	}
+
+	bp->tunnel_disable_flag = rte_le_to_cpu_16(resp->tunnel_disable_flag);
+	if (bp->tunnel_disable_flag)
+		PMD_DRV_LOG(DEBUG, "Tunnel parsing capability is disabled, flags : %#x\n",
+			    bp->tunnel_disable_flag);
 unlock:
 	HWRM_UNLOCK();
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 63f8d8c..77f8521 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -121,6 +121,26 @@ struct bnxt_pf_resource_info {
 
 #define BNXT_CTX_VAL_INVAL	0xFFFF
 
+#define BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp)		\
+	(!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_VXLAN))
+#define BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp)		\
+	(!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_NGE))
+#define BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp)		\
+	(!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_GRE))
+#define BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp)	\
+	(!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_IPINIP))
+
+/*
+ * If the device supports VXLAN, GRE, IPIP and GENEVE tunnel parsing, then report
+ * RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM and
+ * RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM in the Rx/Tx offload capabilities of the device.
+ */
+#define BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp)			\
+	(BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp) &&		\
+	 BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp)   &&		\
+	 BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp)   &&		\
+	 BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp))
+
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic,
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 8977138..8147404 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -34,14 +34,15 @@ uint64_t bnxt_get_rx_port_offloads(struct bnxt *bp)
 			  RTE_ETH_RX_OFFLOAD_SCATTER |
 			  RTE_ETH_RX_OFFLOAD_RSS_HASH;
 
-	rx_offload_capa |= RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
-			   RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM;
-
 	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
 		rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
 	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP)
 		rx_offload_capa |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP;
 
+	if (BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp))
+		rx_offload_capa |= RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+					RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM;
+
 	return rx_offload_capa;
 }
 
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 86073a5..c8745ad 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -28,15 +28,21 @@ uint64_t bnxt_get_tx_port_offloads(struct bnxt *bp)
 			  RTE_ETH_TX_OFFLOAD_QINQ_INSERT |
 			  RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
-	tx_offload_capa |= RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-			   RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
-			   RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |
-			   RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |
-			   RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO;
-
 	if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT)
 		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VLAN_INSERT;
 
+	if (BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp))
+		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM;
+
+	if (BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp))
+		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO;
+	if (BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp))
+		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO;
+	if (BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp))
+		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO;
+	if (BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp))
+		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO;
+
 	return tx_offload_capa;
 }
 
-- 
2.10.1


  parent reply	other threads:[~2022-04-27 14:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 14:58 [dpdk-dev] [PATCH 00/17] bnxt PMD fixes Kalesh A P
2022-04-27 14:58 ` [PATCH 01/17] net/bnxt: update HWRM structures Kalesh A P
2022-04-27 14:58 ` [PATCH 02/17] net/bnxt: fix device capability reporting Kalesh A P
2022-04-27 14:58 ` [PATCH 03/17] net/bnxt: fix to remove an unused macro Kalesh A P
2022-04-27 14:58 ` [PATCH 04/17] net/bnxt: fix Rxq configure Kalesh A P
2022-04-27 14:58 ` Kalesh A P [this message]
2022-04-27 14:58 ` [PATCH 06/17] net/bnxt: remove support for COUNT action Kalesh A P
2022-04-27 14:58 ` [PATCH 07/17] net/bnxt: fix RSS action support Kalesh A P
2022-04-27 14:58 ` [PATCH 08/17] net/bnxt: fix to reconfigure the VNIC's default receive ring Kalesh A P
2022-04-27 14:58 ` [PATCH 09/17] net/bnxt: add check for dupliate queue ids Kalesh A P
2022-04-27 14:58 ` [PATCH 10/17] net/bnxt: fix to handle queue stop during RSS flow create Kalesh A P
2022-04-27 14:58 ` [PATCH 11/17] net/bnxt: avoid unnecessary endianness conversion Kalesh A P
2022-04-27 14:58 ` [PATCH 12/17] net/bnxt: fix setting autoneg speed Kalesh A P
2022-04-27 14:58 ` [PATCH 13/17] net/bnxt: force PHY update on certain configurations Kalesh A P
2022-04-27 14:58 ` [PATCH 14/17] net/bnxt: fix reporting link status when port is stopped Kalesh A P
2022-04-27 14:58 ` [PATCH 15/17] net/bnxt: recheck FW readiness if FW is in reset process Kalesh A P
2022-04-27 14:58 ` [PATCH 16/17] net/bnxt: fix freeing of VNIC filters Kalesh A P
2022-04-27 14:58 ` [PATCH 17/17] net/bnxt: don't wait for link up completion in dev start Kalesh A P
2022-05-10  5:16 ` [dpdk-dev] [PATCH 00/17] bnxt PMD fixes Ajit Khaparde

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=20220427145821.5987-6-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    /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).