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 v6 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support
Date: Mon, 21 Oct 2024 13:55:33 +0530	[thread overview]
Message-ID: <20241021082607.232829-14-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20241021082607.232829-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 ce10167e1f..b50ae71c1f 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -989,13 +989,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 97ea32b286..c102e2cdb3 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3542,6 +3542,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)
@@ -4839,6 +4843,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;
 	}
@@ -4869,6 +4877,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;
@@ -4915,6 +4926,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 5afb4d4e3d..a0b252c6e4 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-21  8:16 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  8:25 [PATCH v6 00/47] TruFlow update for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 01/47] net/bnxt: tf_core: fix wc tcam multi slice delete issue Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 02/47] net/bnxt: tf_core: tcam manager data corruption Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 03/47] net/bnxt: tf_core: External EM support cleanup Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 04/47] net/bnxt: tf_core: Thor TF EM key size check Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 05/47] net/bnxt: tf_core: flow scale improvement Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 06/47] net/bnxt: tf_core: TF support flow scale query Sriharsha Basavapatna
2024-10-21 16:09   ` Stephen Hemminger
2024-10-22 16:12     ` Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 07/47] net/bnxt: tf_core: fix slice count in case of HA entry move Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 08/47] net/bnxt: tf_core: convert priority based TCAM manager to dynamic allocation Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 09/47] net/bnxt: tf_core: remove dead AFM code from session-based priority TCAM mgr Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 10/47] net/bnxt: tf_core: remove dead " Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 11/47] net/bnxt: tfc: support tf-core for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 12/47] net/bnxt: tf_ulp: add vxlan-gpe base support Sriharsha Basavapatna
2024-10-21 15:54   ` Stephen Hemminger
2024-10-22 16:07     ` Sriharsha Basavapatna
2024-10-22 21:32       ` Ajit Khaparde
2024-10-23  0:44         ` Stephen Hemminger
2024-10-21  8:25 ` Sriharsha Basavapatna [this message]
2024-10-21  8:25 ` [PATCH v6 14/47] net/bnxt: tf_ulp: add support for vf to vf flow offload Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 16/47] net/bnxt: tf_ulp: miscellaneous fixes Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 17/47] net/bnxt: tf_ulp: support for Thor2 ulp layer Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 18/47] net/bnxt: tf_ulp: add support for overlapping flows Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 19/47] net/bnxt: tf_ulp: convert recipe table to dynamic memory Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 20/47] net/bnxt: tf_ulp: add feature bit support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 21/47] net/bnxt: tf_ulp: add action read and clear support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 22/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 24/47] net/bnxt: tf_ulp: add support for tunnel flow stats Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 25/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 26/47] net/bnxt: tf_ulp: enable recipe id generation Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 27/47] net/bnxt: tf_ulp: fixed parent child db counters Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 29/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 31/47] net/bnxt: tf_ulp: add jump action support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 32/47] net/bnxt: tf_ulp: add support for flow priority Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 33/47] net/bnxt: tf_ulp: support for dynamic tunnel ports Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 34/47] net/bnxt: tf_ulp: add rte_mtr support for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 35/47] net/bnxt: tf_ulp: TF support flow scale query Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 36/47] net/bnxt: tf_ulp: add support for rss flow query to ULP Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 37/47] net/bnxt: tf_ulp: add track type feature to tables Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 38/47] net/bnxt: tf_ulp: inline utility functions and use likely/unlikely Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 39/47] net/bnxt: tf_ulp: switch ulp to use rte crc32 hash Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 40/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 41/47] net/bnxt: tf_ulp: support a few generic template items Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2 Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 43/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 44/47] net/bnxt: tf_ulp: enable support for truflow feature configuration Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 45/47] net/bnxt: tf_ulp: support a few feature extensions Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 46/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 47/47] net/bnxt: tf_ulp: add stats cache for thor2 Sriharsha Basavapatna
2024-10-24  5:26 ` [PATCH v6 00/47] TruFlow update for Thor2 Ajit Khaparde
2024-10-28 12:58   ` Thomas Monjalon
2024-10-28 16:32     ` 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=20241021082607.232829-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).