DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
To: dev@dpdk.org
Cc: Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
	Shuanglin Wang <shuanglin.wang@broadcom.com>,
	Shahaji Bhosle <sbhosle@broadcom.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [PATCH v3 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified
Date: Tue,  1 Oct 2024 11:28:16 +0530	[thread overview]
Message-ID: <20241001055833.757163-31-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20241001055833.757163-1-sriharsha.basavapatna@broadcom.com>

From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

If application does not specify mask in a field description then
use the default mask values from dpdk header files.

This patch also includes the following related changes.

fix stats collection for shared session
	The stats accumulation was being performed on default session,
	it needs to get the correct session type to get shared session
	counters.

updated ulp flow db for 64 bit handles
	Updated the ulp flow database so that all the hardware handles
	are 64 bit for all the resource types.

Template rejection with no tables fails for vf to vf
	Fixed the template rejection logic to include the table even on
	unconditional rejection.  This was exposed for vf to vf traffic on
	Thor 2 and resulted in a segmentation fault.

fix spec and default mask parsing for flow items.
	Fixed the protocol header parsing when bith spec and mask are
	not given.

Thor2 priority for l2 tcam records not adhered to
	Fix l2 context records priority in template compiler
	Fix flow handle mask offset
	Fix cpu_to_le_16 macro issues
	Fix misspellings in code

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c     |  6 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h     |  2 +
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c  | 17 +++--
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c |  1 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c    | 92 +++++-------------------
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h    | 27 +++----
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |  7 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c |  4 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c    | 10 +--
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 64 +++++++++++++++--
 10 files changed, 118 insertions(+), 112 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
index 0c46c7d4c9..eb2d14f3be 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
@@ -525,6 +525,7 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 	bool found_cntr_resource = false;
 	bool found_parent_flow = false;
 	uint32_t pc_idx = 0;
+	uint32_t session_type = 0;
 	uint8_t dir;
 
 	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
@@ -569,8 +570,9 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 	}
 
 	dir = params.direction;
+	session_type = ulp_flow_db_shared_session_get(&params);
 	if (!(ulp_fc_info->flags & ULP_FLAG_FC_SW_AGG_EN)) {
-		rc = fc_ops->ulp_flow_stat_get(ctxt, dir,
+		rc = fc_ops->ulp_flow_stat_get(ctxt, dir, session_type,
 					       params.resource_hndl, count);
 		bnxt_ulp_cntxt_release_fdb_lock(ctxt);
 		return rc;
@@ -581,7 +583,7 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT) {
 		hw_cntr_id = params.resource_hndl;
 		if (!ulp_fc_info->num_counters) {
-			rc = fc_ops->ulp_flow_stat_get(ctxt, dir,
+			rc = fc_ops->ulp_flow_stat_get(ctxt, dir, session_type,
 						       hw_cntr_id, count);
 			bnxt_ulp_cntxt_release_fdb_lock(ctxt);
 			return rc;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h
index daa2210728..0b81be7af9 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h
@@ -7,6 +7,7 @@
 #define _ULP_FC_MGR_H_
 
 #include "bnxt_ulp.h"
+#include "ulp_flow_db.h"
 
 #define ULP_FLAG_FC_THREAD			BIT(0)
 #define ULP_FLAG_FC_SW_AGG_EN			BIT(1)
@@ -28,6 +29,7 @@ struct bnxt_ulp_fc_core_ops {
 	int32_t
 	(*ulp_flow_stat_get)(struct bnxt_ulp_context *ctxt,
 			     uint8_t direction,
+			     uint32_t session_type,
 			     uint64_t handle,
 			     struct rte_flow_query_count *count);
 	int32_t
diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c
index 9c91569473..cd6d067bc9 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c
@@ -157,17 +157,19 @@ ulp_fc_tf_update_accum_stats(struct bnxt_ulp_context *ctxt,
 	enum tf_dir dir;
 	struct tf *tfp;
 
-	tfp = bnxt_ulp_cntxt_tfp_get(ctxt, BNXT_ULP_SESSION_TYPE_DEFAULT);
-	if (!tfp) {
-		BNXT_DRV_DBG(ERR, "Failed to get the truflow pointer\n");
-		return 0; /* This can happen, return for now with success */
-	}
-
 	num_entries = dparms->flow_count_db_entries / 2;
 	for (dir = 0; dir < TF_DIR_MAX; dir++) {
 		for (j = 0; j < num_entries; j++) {
 			if (!fc_info->sw_acc_tbl[dir][j].valid)
 				continue;
+			tfp = bnxt_ulp_cntxt_tfp_get(ctxt,
+						     fc_info->sw_acc_tbl[dir][j].session_type);
+			if (!tfp) {
+				BNXT_DRV_DBG(ERR,
+					     "Failed to get the tfp\n");
+				return 0;
+			}
+
 			hw_cntr_id = fc_info->sw_acc_tbl[dir][j].hw_cntr_id;
 
 			rc = ulp_fc_tf_flow_stat_update(ctxt, tfp, fc_info, dir,
@@ -183,6 +185,7 @@ ulp_fc_tf_update_accum_stats(struct bnxt_ulp_context *ctxt,
 static int32_t
 ulp_fc_tf_flow_stat_get(struct bnxt_ulp_context *ctxt,
 			uint8_t direction,
+			uint32_t session_type,
 			uint64_t handle,
 			struct rte_flow_query_count *qcount)
 {
@@ -195,7 +198,7 @@ ulp_fc_tf_flow_stat_get(struct bnxt_ulp_context *ctxt,
 	uint32_t dev_id = 0;
 	int32_t rc = 0;
 
-	tfp = bnxt_ulp_cntxt_tfp_get(ctxt, BNXT_ULP_SESSION_TYPE_DEFAULT);
+	tfp = bnxt_ulp_cntxt_tfp_get(ctxt, session_type);
 	if (!tfp) {
 		BNXT_DRV_DBG(ERR, "Failed to get the truflow pointer\n");
 		return -EINVAL;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c
index 24299a269b..7c404685df 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c
@@ -43,6 +43,7 @@ static uint8_t *data;
 static int32_t
 ulp_fc_tfc_flow_stat_get(struct bnxt_ulp_context *ctxt,
 			 uint8_t direction,
+			 uint32_t session_type __rte_unused,
 			 uint64_t handle,
 			 struct rte_flow_query_count *count)
 {
diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
index 679dab0f17..79e2931e43 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
@@ -15,12 +15,7 @@
 
 #define ULP_FLOW_DB_RES_DIR_BIT		31
 #define ULP_FLOW_DB_RES_DIR_MASK	0x80000000
-#define ULP_FLOW_DB_RES_FUNC_BITS	28
-#define ULP_FLOW_DB_RES_FUNC_MASK	0x70000000
-#define ULP_FLOW_DB_RES_NXT_MASK	0x0FFFFFFF
-#define ULP_FLOW_DB_RES_FUNC_UPPER	5
-#define ULP_FLOW_DB_RES_FUNC_NEED_LOWER	0x80
-#define ULP_FLOW_DB_RES_FUNC_LOWER_MASK	0x1F
+#define ULP_FLOW_DB_RES_NXT_MASK	0x7FFFFFFF
 
 /* Macro to copy the nxt_resource_idx */
 #define ULP_FLOW_DB_RES_NXT_SET(dst, src)	{(dst) |= ((src) &\
@@ -109,17 +104,10 @@ ulp_flow_db_resource_dir_get(struct ulp_fdb_resource_info *res_info)
 		ULP_FLOW_DB_RES_DIR_BIT);
 }
 
-static uint8_t
+static inline uint8_t
 ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info)
 {
-	uint8_t func;
-
-	func = (((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_FUNC_MASK) >>
-		 ULP_FLOW_DB_RES_FUNC_BITS) << ULP_FLOW_DB_RES_FUNC_UPPER);
-	/* The resource func is split into upper and lower */
-	if (func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER)
-		return (func | res_info->resource_func_lower);
-	return func;
+	return res_info->resource_func;
 }
 
 /*
@@ -134,35 +122,14 @@ static void
 ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info,
 			       struct ulp_flow_db_res_params *params)
 {
-	uint32_t resource_func;
-
 	resource_info->nxt_resource_idx |= ((params->direction <<
 				      ULP_FLOW_DB_RES_DIR_BIT) &
 				     ULP_FLOW_DB_RES_DIR_MASK);
-	resource_func = (params->resource_func >> ULP_FLOW_DB_RES_FUNC_UPPER);
-	resource_info->nxt_resource_idx |= ((resource_func <<
-					     ULP_FLOW_DB_RES_FUNC_BITS) &
-					    ULP_FLOW_DB_RES_FUNC_MASK);
-
-	if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
-		/* Break the resource func into two parts */
-		resource_func = (params->resource_func &
-				 ULP_FLOW_DB_RES_FUNC_LOWER_MASK);
-		resource_info->resource_func_lower = resource_func;
-	}
-
-	/* Store the handle as 64bit only for EM table entries */
-	if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE &&
-	    params->resource_func != BNXT_ULP_RESOURCE_FUNC_CMM_TABLE &&
-	    params->resource_func != BNXT_ULP_RESOURCE_FUNC_CMM_STAT) {
-		resource_info->resource_hndl = (uint32_t)params->resource_hndl;
-		resource_info->resource_type = params->resource_type;
-		resource_info->resource_sub_type = params->resource_sub_type;
-		resource_info->fdb_flags = params->fdb_flags;
-	} else {
-		resource_info->resource_em_handle = params->resource_hndl;
-		resource_info->reserve_flag = params->reserve_flag;
-	}
+	resource_info->resource_func = params->resource_func;
+	resource_info->resource_type = params->resource_type;
+	resource_info->resource_sub_type = params->resource_sub_type;
+	resource_info->fdb_flags = params->fdb_flags;
+	resource_info->resource_hndl = params->resource_hndl;
 }
 
 /*
@@ -179,22 +146,13 @@ ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,
 			       struct ulp_flow_db_res_params *params)
 {
 	memset(params, 0, sizeof(struct ulp_flow_db_res_params));
-
 	/* use the helper function to get the resource func */
 	params->direction = ulp_flow_db_resource_dir_get(resource_info);
 	params->resource_func = ulp_flow_db_resource_func_get(resource_info);
-
-	if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE ||
-	    params->resource_func == BNXT_ULP_RESOURCE_FUNC_CMM_TABLE ||
-	    params->resource_func == BNXT_ULP_RESOURCE_FUNC_CMM_STAT) {
-		params->resource_hndl = resource_info->resource_em_handle;
-		params->reserve_flag = resource_info->reserve_flag;
-	} else if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
-		params->resource_hndl = resource_info->resource_hndl;
-		params->resource_type = resource_info->resource_type;
-		params->resource_sub_type = resource_info->resource_sub_type;
-		params->fdb_flags = resource_info->fdb_flags;
-	}
+	params->resource_type = resource_info->resource_type;
+	params->resource_sub_type = resource_info->resource_sub_type;
+	params->fdb_flags = resource_info->fdb_flags;
+	params->resource_hndl = resource_info->resource_hndl;
 }
 
 /*
@@ -627,7 +585,8 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt,
 	}
 	fid_resource = &flow_tbl->flow_resources[fid];
 
-	if (params->critical_resource && fid_resource->resource_em_handle) {
+	if (params->critical_resource && (fid_resource->fdb_flags &
+					  ULP_FDB_FLAG_CRITICAL_RES)) {
 		BNXT_DRV_DBG(DEBUG, "Ignore multiple critical resources\n");
 		/* Ignore the multiple critical resources */
 		params->critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
@@ -650,6 +609,7 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt,
 	} else {
 		/* critical resource. Just update the fid resource */
 		ulp_flow_db_res_params_to_info(fid_resource, params);
+		fid_resource->fdb_flags |= ULP_FDB_FLAG_CRITICAL_RES;
 	}
 
 	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ulp_ctxt);
@@ -1148,24 +1108,10 @@ ulp_flow_db_resource_params_get(struct bnxt_ulp_context *ulp_ctx,
 	memset(params, 0, sizeof(struct ulp_flow_db_res_params));
 	while (res_id) {
 		fid_res = &flow_tbl->flow_resources[res_id];
-		if (ulp_flow_db_resource_func_get(fid_res) == resource_func) {
-			if (resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
-				if (res_subtype == fid_res->resource_sub_type) {
-					ulp_flow_db_res_info_to_params(fid_res,
-								       params);
-					return 0;
-				}
-
-			} else if (resource_func ==
-				   BNXT_ULP_RESOURCE_FUNC_EM_TABLE ||
-				   resource_func ==
-				   BNXT_ULP_RESOURCE_FUNC_CMM_TABLE ||
-				   resource_func ==
-				   BNXT_ULP_RESOURCE_FUNC_CMM_STAT) {
-				ulp_flow_db_res_info_to_params(fid_res,
-							       params);
-				return 0;
-			}
+		if (ulp_flow_db_resource_func_get(fid_res) == resource_func &&
+		    fid_res->resource_sub_type == res_subtype) {
+			ulp_flow_db_res_info_to_params(fid_res, params);
+			return 0;
 		}
 		res_id = 0;
 		ULP_FLOW_DB_RES_NXT_SET(res_id, fid_res->nxt_resource_idx);
diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
index 5a4b5a1ebf..762ebb039d 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
@@ -16,30 +16,22 @@
 /* Defines for the fdb flag */
 #define ULP_FDB_FLAG_SHARED_SESSION	0x1
 #define ULP_FDB_FLAG_SHARED_WC_SESSION	0x2
+#define ULP_FDB_FLAG_SW_ONLY		0x4
+#define ULP_FDB_FLAG_CRITICAL_RES	0x8
 
 /*
  * Structure for the flow database resource information
  * The below structure is based on the below partitions
- * nxt_resource_idx = dir[31],resource_func_upper[30:28],nxt_resource_idx[27:0]
- * If resource_func is EM_TBL then use resource_em_handle.
- * Else the other part of the union is used and
- * resource_func is resource_func_upper[30:28] << 5 | resource_func_lower
+ * nxt_resource_idx = dir[31],nxt_resource_idx[30:0]
  */
 struct ulp_fdb_resource_info {
 	/* Points to next resource in the chained list. */
-	uint32_t			nxt_resource_idx;
-	/* TBD: used for tfc stat resource for now */
-	uint32_t			reserve_flag;
-	union {
-		uint64_t		resource_em_handle;
-		struct {
-			uint8_t		resource_func_lower;
-			uint8_t		resource_type;
-			uint8_t		resource_sub_type;
-			uint8_t		fdb_flags;
-			uint32_t	resource_hndl;
-		};
-	};
+	uint32_t	nxt_resource_idx;
+	uint8_t		resource_func;
+	uint8_t		resource_type;
+	uint8_t		resource_sub_type;
+	uint8_t		fdb_flags;
+	uint64_t	resource_hndl;
 };
 
 /* Structure for the flow database resource information. */
@@ -97,7 +89,6 @@ struct ulp_flow_db_res_params {
 	uint8_t				fdb_flags;
 	uint8_t				critical_resource;
 	uint64_t			resource_hndl;
-	uint32_t			reserve_flag;
 };
 
 /*
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index ff57469aa3..3034397166 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -585,7 +585,7 @@ ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms,
 	case BNXT_ULP_FDB_OPC_PUSH_FID_SW_ONLY:
 		push_fid = parms->flow_id;
 		flow_type = parms->flow_type;
-		fid_parms->reserve_flag = 0x1;
+		fid_parms->fdb_flags = ULP_FDB_FLAG_SW_ONLY;
 		break;
 	default:
 		return rc; /* Nothing to be done */
@@ -3804,6 +3804,11 @@ ulp_mapper_cond_reject_list_process(struct bnxt_ulp_mapper_parms *parms,
 	/* get the reject condition list */
 	reject_info = ulp_mapper_tmpl_reject_list_get(parms, tid);
 
+	if (reject_info->cond_list_opcode == BNXT_ULP_COND_LIST_OPC_TRUE) {
+		cond_list_res  = 1;
+		goto jump_exit;
+	}
+
 	/* If there are no reject conditions then skip */
 	if (!reject_info->cond_nums)
 		return rc;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
index f5c0aca1f1..834516dc56 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
@@ -1381,8 +1381,8 @@ ulp_mapper_tfc_cmm_entry_free(struct bnxt_ulp_context *ulp_ctx,
 	uint16_t fw_fid = 0;
 	int32_t rc = 0;
 
-	/* skip cmm processing if reserve flag is enabled */
-	if (res->reserve_flag)
+	/* skip cmm processing if fdb flag is sw only */
+	if (res->fdb_flags & ULP_FDB_FLAG_SW_ONLY)
 		return 0;
 
 	if (bnxt_ulp_cntxt_fid_get(ulp_ctx, &fw_fid)) {
diff --git a/drivers/net/bnxt/tf_ulp/ulp_matcher.c b/drivers/net/bnxt/tf_ulp/ulp_matcher.c
index 9e0a9458e7..06fdaccbd4 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_matcher.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_matcher.c
@@ -43,7 +43,7 @@ ulp_matcher_action_list_lookup(struct ulp_rte_parser_params *params,
 	uint32_t idx = 0;
 
 	while (++idx < BNXT_ULP_ACT_MATCH_LIST_MAX_SZ) {
-		/* iterate the list of class matches to find header match */
+		/* iterate the list of action matches to find header match */
 		if ((act_bits & act_list[idx].act_bitmap.bits) == act_bits) {
 			/* Found the match */
 			*act_tmpl_idx = act_list[idx].act_tid;
@@ -111,7 +111,7 @@ ulp_matcher_class_hash_lookup(struct bnxt_ulp_matcher_data *matcher_data,
 	int32_t idx;
 	int32_t rc = -ENOENT;
 
-	/* popoulate the key for the search */
+	/* populate the key for the search */
 	key.app_id = params->app_id;
 	key.hdr_bitmap = params->hdr_bitmap;
 
@@ -142,7 +142,7 @@ ulp_matcher_class_hash_add(struct bnxt_ulp_matcher_data *matcher_data,
 	int32_t hash_idx;
 	int32_t rc = -EINVAL;
 
-	/* popoulate the key for the search */
+	/* populate the key for the search */
 	key.app_id = params->app_id;
 	key.hdr_bitmap = params->hdr_bitmap;
 
@@ -239,7 +239,7 @@ ulp_matcher_action_hash_lookup(struct bnxt_ulp_matcher_data *matcher_data,
 	struct ulp_matcher_act_db_node *node;
 	int32_t idx;
 
-	/* popoulate the key for the search */
+	/* populate the key for the search */
 	key.act_bitmap = params->act_bitmap;
 
 	/* search the hash table for the hdr bit match */
@@ -263,7 +263,7 @@ ulp_matcher_action_hash_add(struct bnxt_ulp_matcher_data *matcher_data,
 	int32_t hash_idx;
 	int32_t rc = -EINVAL;
 
-	/* popoulate the key for the search */
+	/* populate the key for the search */
 	key.act_bitmap = params->act_bitmap;
 
 	/* add to the hash table for the hdr bit match */
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 82197cde86..335cdcc130 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -106,7 +106,8 @@ ulp_rte_prsr_fld_mask(struct ulp_rte_parser_params *params,
 	field->size = size;
 
 	/* copy the mask specifications only if mask is not null */
-	if (!(prsr_act & ULP_PRSR_ACT_MASK_IGNORE) && mask_buff) {
+	if (!(prsr_act & ULP_PRSR_ACT_MASK_IGNORE) && mask_buff &&
+	    spec_buff && ulp_bitmap_notzero(spec_buff, size)) {
 		memcpy(field->mask, mask_buff, size);
 		ulp_rte_parser_field_bitmap_update(params, *idx, prsr_act);
 	}
@@ -724,8 +725,13 @@ ulp_rte_eth_hdr_handler(const struct rte_flow_item *item,
 		eth_type = eth_spec->hdr.ether_type;
 		has_vlan = eth_spec->has_vlan;
 	}
+
+	/* If mask is not specified then use the default mask */
+	if (eth_spec && !eth_mask)
+		eth_mask = &rte_flow_item_eth_mask;
+
 	if (eth_mask) {
-		eth_type &= eth_mask->hdr.ether_type;
+		eth_type &= eth_mask->type;
 		has_vlan_mask = eth_mask->has_vlan;
 	}
 
@@ -808,11 +814,14 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
 		eth_type = vlan_spec->hdr.eth_proto;
 	}
 
+	/* assign default vlan mask if spec is valid and mask is not */
+	if (vlan_spec && !vlan_mask)
+		vlan_mask = &rte_flow_item_vlan_mask;
+
 	if (vlan_mask) {
-		vlan_tag_mask = ntohs(vlan_mask->hdr.vlan_tci);
+		vlan_tag_mask = ntohs(vlan_mask->tci);
 		priority_mask = htons(vlan_tag_mask >> ULP_VLAN_PRIORITY_SHIFT);
 		vlan_tag_mask &= 0xfff;
-
 		/*
 		 * the storage for priority and vlan tag is 2 bytes
 		 * The mask of priority which is 3 bits if it is all 1's
@@ -1018,6 +1027,10 @@ ulp_rte_ipv4_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	/* If mask is not specified then use the default mask */
+	if (ipv4_spec && !ipv4_mask)
+		ipv4_mask = &rte_flow_item_ipv4_mask;
+
 	/*
 	 * Copy the rte_flow_item for ipv4 into hdr_field using ipv4
 	 * header fields
@@ -1166,6 +1179,10 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	/* If mask is not specified then use the default mask */
+	if (ipv6_spec && !ipv6_mask)
+		ipv6_mask = &rte_flow_item_ipv6_mask;
+
 	/*
 	 * Copy the rte_flow_item for ipv6 into hdr_field using ipv6
 	 * header fields
@@ -1399,6 +1416,9 @@ ulp_rte_udp_hdr_handler(const struct rte_flow_item *item,
 		sport = udp_spec->hdr.src_port;
 		dport = udp_spec->hdr.dst_port;
 	}
+	if (udp_spec && !udp_mask)
+		udp_mask = &rte_flow_item_udp_mask;
+
 	if (udp_mask) {
 		sport_mask = udp_mask->hdr.src_port;
 		dport_mask = udp_mask->hdr.dst_port;
@@ -1475,6 +1495,10 @@ ulp_rte_tcp_hdr_handler(const struct rte_flow_item *item,
 		sport = tcp_spec->hdr.src_port;
 		dport = tcp_spec->hdr.dst_port;
 	}
+
+	if (tcp_spec && !tcp_mask)
+		tcp_mask = &rte_flow_item_tcp_mask;
+
 	if (tcp_mask) {
 		sport_mask = tcp_mask->hdr.src_port;
 		dport_mask = tcp_mask->hdr.dst_port;
@@ -1574,6 +1598,8 @@ ulp_rte_vxlan_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	if (vxlan_spec && !vxlan_mask)
+		vxlan_mask = &rte_flow_item_vxlan_mask;
 	/*
 	 * Copy the rte_flow_item for vxlan into hdr_field using vxlan
 	 * header fields
@@ -1646,6 +1672,8 @@ ulp_rte_vxlan_gpe_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	if (vxlan_gpe_spec && !vxlan_gpe_mask)
+		vxlan_gpe_mask = &rte_flow_item_vxlan_gpe_mask;
 	/*
 	 * Copy the rte_flow_item for vxlan gpe into hdr_field using vxlan
 	 * header fields
@@ -1724,6 +1752,9 @@ ulp_rte_geneve_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	if (geneve_spec && !geneve_mask)
+		geneve_mask = &rte_flow_item_geneve_mask;
+
 	/*
 	 * Copy the rte_flow_item for geneve into hdr_field using geneve
 	 * header fields
@@ -1784,6 +1815,9 @@ ulp_rte_gre_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	if (gre_spec && !gre_mask)
+		gre_mask = &rte_flow_item_gre_mask;
+
 	size = sizeof(((struct rte_flow_item_gre *)NULL)->c_rsvd0_ver);
 	ulp_rte_prsr_fld_mask(params, &idx, size,
 			      ulp_deference_struct(gre_spec, c_rsvd0_ver),
@@ -1827,6 +1861,9 @@ ulp_rte_icmp_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	if (icmp_spec && !icmp_mask)
+		icmp_mask = &rte_flow_item_icmp_mask;
+
 	size = sizeof(((struct rte_flow_item_icmp *)NULL)->hdr.icmp_type);
 	ulp_rte_prsr_fld_mask(params, &idx, size,
 			      ulp_deference_struct(icmp_spec, hdr.icmp_type),
@@ -1882,6 +1919,9 @@ ulp_rte_icmp6_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	if (icmp_spec && !icmp_mask)
+		icmp_mask = &rte_flow_item_icmp6_mask;
+
 	size = sizeof(((struct rte_flow_item_icmp6 *)NULL)->type);
 	ulp_rte_prsr_fld_mask(params, &idx, size,
 			      ulp_deference_struct(icmp_spec, type),
@@ -1933,6 +1973,9 @@ ulp_rte_ecpri_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
+	if (ecpri_spec && !ecpri_mask)
+		ecpri_mask = &rte_flow_item_ecpri_mask;
+
 	/* Figure out if eCPRI is within L4(UDP), unsupported, for now */
 	cnt = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_L4_HDR_CNT);
 	if (cnt >= 1) {
@@ -2652,6 +2695,19 @@ ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param,
 					BNXT_ULP_CF_IDX_MP_VPORT_B :
 					BNXT_ULP_CF_IDX_MP_VPORT_A,
 				    pid_s);
+
+		/* Setup the VF_TO_VF VNIC information */
+		if (!multi_port && port_type == BNXT_ULP_INTF_TYPE_VF_REP) {
+			if (ulp_port_db_default_vnic_get(param->ulp_ctx,
+							 ifindex,
+							 BNXT_ULP_VF_FUNC_VNIC,
+							 &pid_s))
+				return BNXT_TF_RC_ERROR;
+			pid = pid_s;
+
+			/* Allows use of func_opcode with VNIC */
+			ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_VNIC, pid);
+		}
 	} else {
 		/* For ingress direction, fill vnic */
 		/*
-- 
2.39.3


  parent reply	other threads:[~2024-10-01  5:52 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 ` [PATCH v3 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Sriharsha Basavapatna
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 ` Sriharsha Basavapatna [this message]
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-31-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 \
    --cc=shuanglin.wang@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).