DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
To: dev@dpdk.org
Cc: Shahaji Bhosle <sbhosle@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
	Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [PATCH v3 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support
Date: Tue,  1 Oct 2024 11:27:59 +0530	[thread overview]
Message-ID: <20241001055833.757163-14-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20241001055833.757163-1-sriharsha.basavapatna@broadcom.com>

From: Shahaji Bhosle <sbhosle@broadcom.com>

Add hooks in the hwrm and ulp layer to enable,
custom tunnel header support on wh+ generic app(ovs).

Signed-off-by: Shahaji Bhosle <sbhosle@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h            |  4 +++
 drivers/net/bnxt/bnxt_hwrm.c       | 18 ++++++++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 54 ++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h |  3 ++
 4 files changed, 79 insertions(+)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 00123e51ac..b905d9fd3e 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -988,13 +988,17 @@ struct bnxt {
 	uint8_t			vxlan_port_cnt;
 	uint8_t			geneve_port_cnt;
 	uint8_t			ecpri_port_cnt;
+	uint8_t			l2_etype_tunnel_cnt;
 	uint16_t		vxlan_port;
 	uint16_t		geneve_port;
 	uint16_t		ecpri_port;
 	uint16_t		vxlan_fw_dst_port_id;
 	uint16_t		geneve_fw_dst_port_id;
 	uint16_t		ecpri_fw_dst_port_id;
+#define BNXT_L2_ETYPE_TUNNEL_ID 0xFFFF /* CUSTOM L2 ENCAP - VF representors */
+	uint16_t		l2_etype_tunnel_id;
 	uint16_t		ecpri_upar_in_use;
+	uint8_t			l2_etype_upar_in_use;
 	uint32_t		fw_ver;
 	uint32_t		hwrm_spec_code;
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4e62dbbcca..778488ce1a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3515,6 +3515,10 @@ bnxt_free_tunnel_ports(struct bnxt *bp)
 	if (bp->ecpri_port_cnt)
 		bnxt_hwrm_tunnel_dst_port_free(bp, bp->ecpri_fw_dst_port_id,
 			HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_ECPRI);
+
+	if (bp->l2_etype_tunnel_cnt)
+		bnxt_hwrm_tunnel_dst_port_free(bp, bp->l2_etype_tunnel_id,
+			HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_L2_ETYPE);
 }
 
 void bnxt_free_all_hwrm_resources(struct bnxt *bp)
@@ -4811,6 +4815,10 @@ int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
 		bp->ecpri_port = port;
 		bp->ecpri_upar_in_use = resp->upar_in_use;
 		break;
+	case HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE:
+		bp->l2_etype_tunnel_id = port;
+		bp->l2_etype_upar_in_use = resp->upar_in_use;
+		break;
 	default:
 		break;
 	}
@@ -4841,6 +4849,9 @@ int bnxt_hwrm_tunnel_upar_id_get(struct bnxt *bp, uint8_t *upar_id,
 	case HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_SRV6:
 		*upar_id = resp->upar_in_use;
 		break;
+	case HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE:
+		*upar_id = resp->upar_in_use;
+		break;
 	default:
 		/* INVALID UPAR Id if another tunnel type tries to retrieve */
 		*upar_id = 0xff;
@@ -4887,6 +4898,13 @@ int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
 		bp->ecpri_port_cnt = 0;
 	}
 
+	if (tunnel_type ==
+	    HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_L2_ETYPE) {
+		bp->l2_etype_tunnel_cnt = 0;
+		bp->l2_etype_tunnel_id = 0;
+		bp->l2_etype_upar_in_use = 0;
+	}
+
 	bnxt_hwrm_set_tpa(bp);
 	return rc;
 }
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 96a5353aaf..912946303a 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -454,6 +454,10 @@ bnxt_ulp_cntxt_app_caps_init(struct bnxt *bp,
 			}
 		}
 
+		if (info[i].flags & BNXT_ULP_APP_CAP_L2_ETYPE)
+			ulp_ctx->cfg_data->ulp_flags |=
+				BNXT_ULP_APP_L2_ETYPE;
+
 		bnxt_ulp_vxlan_ip_port_set(ulp_ctx, info[i].vxlan_ip_port);
 		bnxt_ulp_vxlan_port_set(ulp_ctx, info[i].vxlan_port);
 		bnxt_ulp_ecpri_udp_port_set(ulp_ctx, info[i].ecpri_udp_port);
@@ -1795,6 +1799,29 @@ bnxt_ulp_init(struct bnxt *bp,
 	return rc;
 }
 
+static int
+ulp_l2_etype_tunnel_alloc(struct bnxt *bp)
+{
+	int rc = 0;
+
+	if (!ULP_APP_L2_ETYPE_SUPPORT(bp->ulp_ctx))
+		return rc;
+
+	if (bp->l2_etype_tunnel_cnt) {
+		BNXT_TF_DBG(DEBUG, "L2 ETYPE Custom Tunnel already allocated\n");
+		return rc;
+	}
+	rc = bnxt_tunnel_dst_port_alloc(bp,
+					BNXT_L2_ETYPE_TUNNEL_ID,
+					HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE);
+	if (rc)
+		BNXT_TF_DBG(ERR, "Failed to set global L2 ETYPE Custom Tunnel\n");
+	else
+		bp->l2_etype_tunnel_cnt++;
+
+	return rc;
+}
+
 static int
 ulp_cust_vxlan_alloc(struct bnxt *bp)
 {
@@ -1943,6 +1970,10 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	if (rc)
 		goto jump_to_error;
 
+	rc = ulp_l2_etype_tunnel_alloc(bp);
+	if (rc)
+		goto jump_to_error;
+
 	return rc;
 
 jump_to_error:
@@ -1950,6 +1981,28 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	return rc;
 }
 
+static void
+ulp_l2_etype_tunnel_free(struct bnxt *bp)
+{
+	int rc;
+
+	if (!ULP_APP_L2_ETYPE_SUPPORT(bp->ulp_ctx))
+		return;
+
+	if (bp->l2_etype_tunnel_cnt == 0) {
+		BNXT_TF_DBG(DEBUG, "L2 ETYPE Custom Tunnel already freed\n");
+		return;
+	}
+
+	rc = bnxt_tunnel_dst_port_free(bp,
+				       BNXT_L2_ETYPE_TUNNEL_ID,
+				       HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE);
+	if (rc)
+		BNXT_TF_DBG(ERR, "Failed to clear L2 ETYPE Custom Tunnel\n");
+
+	bp->l2_etype_tunnel_cnt--;
+}
+
 static void
 ulp_cust_vxlan_free(struct bnxt *bp)
 {
@@ -2026,6 +2079,7 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		if (bp->ulp_ctx->cfg_data->ref_cnt) {
 			/* Free tunnel configurations */
 			ulp_cust_vxlan_free(bp);
+			ulp_l2_etype_tunnel_free(bp);
 
 			/* free the port details */
 			/* Free the default flow rule associated to this port */
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index d42382d947..8b75120926 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -40,6 +40,7 @@
 #define BNXT_ULP_CUST_VXLAN_SUPPORT	0x100
 #define BNXT_ULP_MULTI_SHARED_SUPPORT	0x200
 #define BNXT_ULP_APP_HA_DYNAMIC		0x400
+#define BNXT_ULP_APP_L2_ETYPE		0x800
 
 #define ULP_VF_REP_IS_ENABLED(flag)	((flag) & BNXT_ULP_VF_REP_ENABLED)
 #define ULP_SHARED_SESSION_IS_ENABLED(flag) ((flag) &\
@@ -60,6 +61,8 @@
 #define ULP_APP_CUST_VXLAN_SUPPORT(ctx)	   ((ctx)->cfg_data->vxlan_port != 0)
 #define ULP_APP_VXLAN_GPE_SUPPORT(ctx)     ((ctx)->cfg_data->vxlan_gpe_port != 0)
 #define ULP_APP_CUST_VXLAN_IP_SUPPORT(ctx) ((ctx)->cfg_data->vxlan_ip_port != 0)
+#define ULP_APP_L2_ETYPE_SUPPORT(ctx)	((ctx)->cfg_data->ulp_flags &\
+					BNXT_ULP_APP_L2_ETYPE)
 
 enum bnxt_ulp_flow_mem_type {
 	BNXT_ULP_FLOW_MEM_TYPE_INT = 0,
-- 
2.39.3


  parent reply	other threads:[~2024-10-01  5:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  5:57 [PATCH v3 00/47] TruFlow update for Thor2 Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 01/47] net/bnxt: tf_core: fix wc tcam multi slice delete issue Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 02/47] net/bnxt: tf_core: tcam manager data corruption Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 03/47] net/bnxt: tf_core: External EM support cleanup Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 04/47] net/bnxt: tf_core: Thor TF EM key size check Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 05/47] net/bnxt: tf_core: flow scale improvement Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 06/47] net/bnxt: tf_core: TF support flow scale query Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 07/47] net/bnxt: tf_core: fix slice count in case of HA entry move Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 08/47] net/bnxt: tf_core: convert priority based TCAM manager to dynamic allocation Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 09/47] net/bnxt: tf_core: remove dead AFM code from session-based priority TCAM mgr Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 10/47] net/bnxt: tf_core: remove dead " Sriharsha Basavapatna
2024-10-01  5:57 ` Sriharsha Basavapatna [this message]
2024-10-01  5:58 ` [PATCH v3 14/47] net/bnxt: tf_ulp: add support for vf to vf flow offload Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 16/47] net/bnxt: tf_ulp: miscellaneous fixes Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 19/47] net/bnxt: tf_ulp: convert recipe table to dynamic memory Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 21/47] net/bnxt: tf_ulp: add action read and clear support Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2 Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 25/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 26/47] net/bnxt: tf_ulp: enable recipe id generation Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 27/47] net/bnxt: tf_ulp: fixed parent child db counters Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 29/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 32/47] net/bnxt: tf_ulp: add support for flow priority Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 34/47] net/bnxt: tf_ulp: add rte_mtr support for Thor2 Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 35/47] net/bnxt: tf_ulp: TF support flow scale query Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 36/47] net/bnxt: tf_ulp: add support for rss flow query to ULP Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 38/47] net/bnxt: tf_ulp: inline utility functions and use likely/unlikely Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 39/47] net/bnxt: tf_ulp: switch ulp to use rte crc32 hash Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 41/47] net/bnxt: tf_ulp: support a few generic template items Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2 Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 44/47] net/bnxt: tf_ulp: enable support for truflow feature configuration Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 45/47] net/bnxt: tf_ulp: support a few feature extensions Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 47/47] net/bnxt: tf_ulp: add stats cache for thor2 Sriharsha Basavapatna

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=20241001055833.757163-14-sriharsha.basavapatna@broadcom.com \
    --to=sriharsha.basavapatna@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=sbhosle@broadcom.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).