DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 17/36] net/bnxt: extend index table processing to process action templates
Date: Fri, 12 Jun 2020 18:20:05 +0530
Message-ID: <20200612125024.15989-18-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200612125024.15989-1-somnath.kotur@broadcom.com>

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

The index table processing is extended to address encapsulation fields
so that action template index table can be processed by a common index
processing function that can process both class and action index
tables.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 305 ++++++++------------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   5 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     |   9 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  21 +-
 4 files changed, 109 insertions(+), 231 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index a0b77c0..7f7335a 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -159,7 +159,7 @@ ulp_mapper_act_prop_size_get(uint32_t idx)
  *
  * Returns An array of action tables to implement the flow, or NULL on error.
  */
-static struct bnxt_ulp_mapper_act_tbl_info *
+static struct bnxt_ulp_mapper_tbl_info *
 ulp_mapper_action_tbl_list_get(uint32_t dev_id,
 			       uint32_t tid,
 			       uint32_t *num_tbls)
@@ -196,7 +196,7 @@ ulp_mapper_action_tbl_list_get(uint32_t dev_id,
  * returns An array of classifier tables to implement the flow, or NULL on
  * error
  */
-static struct bnxt_ulp_mapper_class_tbl_info *
+static struct bnxt_ulp_mapper_tbl_info *
 ulp_mapper_class_tbl_list_get(uint32_t dev_id,
 			      uint32_t tid,
 			      uint32_t *num_tbls)
@@ -228,7 +228,7 @@ ulp_mapper_class_tbl_list_get(uint32_t dev_id,
  * Returns array of Key fields, or NULL on error.
  */
 static struct bnxt_ulp_mapper_class_key_field_info *
-ulp_mapper_key_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
+ulp_mapper_key_fields_get(struct bnxt_ulp_mapper_tbl_info *tbl,
 			  uint32_t *num_flds)
 {
 	uint32_t idx;
@@ -255,7 +255,7 @@ ulp_mapper_key_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
  * Returns array of data fields, or NULL on error.
  */
 static struct bnxt_ulp_mapper_result_field_info *
-ulp_mapper_result_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
+ulp_mapper_result_fields_get(struct bnxt_ulp_mapper_tbl_info *tbl,
 			     uint32_t *num_flds)
 {
 	uint32_t idx;
@@ -280,7 +280,7 @@ ulp_mapper_result_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
  * Returns array of data fields, or NULL on error.
  */
 static struct bnxt_ulp_mapper_result_field_info *
-ulp_mapper_act_result_fields_get(struct bnxt_ulp_mapper_act_tbl_info *tbl,
+ulp_mapper_act_result_fields_get(struct bnxt_ulp_mapper_tbl_info *tbl,
 				 uint32_t *num_rslt_flds,
 				 uint32_t *num_encap_flds)
 {
@@ -307,7 +307,7 @@ ulp_mapper_act_result_fields_get(struct bnxt_ulp_mapper_act_tbl_info *tbl,
  * returns array of ident fields, or NULL on error
  */
 static struct bnxt_ulp_mapper_ident_info *
-ulp_mapper_ident_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
+ulp_mapper_ident_fields_get(struct bnxt_ulp_mapper_tbl_info *tbl,
 			    uint32_t *num_flds)
 {
 	uint32_t idx;
@@ -522,7 +522,7 @@ ulp_mapper_mark_free(struct bnxt_ulp_context *ulp,
  */
 static int32_t
 ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,
-			 struct bnxt_ulp_mapper_class_tbl_info *tbl,
+			 struct bnxt_ulp_mapper_tbl_info *tbl,
 			 struct bnxt_ulp_mapper_ident_info *ident,
 			 uint16_t *val)
 {
@@ -892,185 +892,9 @@ ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 	return 0;
 }
 
-/* Function to alloc action record and set the table. */
-static int32_t
-ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms,
-				struct ulp_blob *blob)
-{
-	struct ulp_flow_db_res_params		fid_parms;
-	struct tf_alloc_tbl_entry_parms		alloc_parms = { 0 };
-	struct tf_free_tbl_entry_parms		free_parms = { 0 };
-	struct bnxt_ulp_mapper_act_tbl_info	*atbls = parms->atbls;
-	int32_t					rc = 0;
-	int32_t trc;
-	uint64_t				idx;
-	uint32_t tbl_scope_id;
-
-	bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id);
-
-	/* Set the allocation parameters for the table*/
-	alloc_parms.dir = atbls->direction;
-	alloc_parms.type = atbls->resource_type;
-	alloc_parms.search_enable = atbls->srch_b4_alloc;
-	alloc_parms.result = ulp_blob_data_get(blob,
-					       &alloc_parms.result_sz_in_bytes);
-	alloc_parms.tbl_scope_id = tbl_scope_id;
-	if (!alloc_parms.result) {
-		BNXT_TF_DBG(ERR, "blob is not populated\n");
-		return -EINVAL;
-	}
-
-	rc = tf_alloc_tbl_entry(parms->tfp, &alloc_parms);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "table type= [%d] dir = [%s] alloc failed\n",
-			    alloc_parms.type,
-			    (alloc_parms.dir == TF_DIR_RX) ? "RX" : "TX");
-		return rc;
-	}
-
-	/* Need to calculate the idx for the result record */
-	uint64_t tmpidx = alloc_parms.idx;
-
-	if (atbls->resource_type == TF_TBL_TYPE_EXT)
-		tmpidx = TF_ACT_REC_OFFSET_2_PTR(alloc_parms.idx);
-	else
-		tmpidx = alloc_parms.idx;
-
-	idx = tfp_cpu_to_be_64(tmpidx);
-
-	/* Store the allocated index for future use in the regfile */
-	rc = ulp_regfile_write(parms->regfile, atbls->regfile_wr_idx, idx);
-	if (!rc) {
-		BNXT_TF_DBG(ERR, "regfile[%d] write failed\n",
-			    atbls->regfile_wr_idx);
-		rc = -EINVAL;
-		goto error;
-	}
-
-	/*
-	 * The set_tbl_entry API if search is not enabled or searched entry
-	 * is not found.
-	 */
-	if (!atbls->srch_b4_alloc || !alloc_parms.hit) {
-		struct tf_set_tbl_entry_parms set_parm = { 0 };
-		uint16_t	length;
-
-		set_parm.dir	= atbls->direction;
-		set_parm.type	= atbls->resource_type;
-		set_parm.idx	= alloc_parms.idx;
-		set_parm.data	= ulp_blob_data_get(blob, &length);
-		set_parm.data_sz_in_bytes = length / 8;
-
-		if (set_parm.type == TF_TBL_TYPE_EXT)
-			set_parm.tbl_scope_id = tbl_scope_id;
-
-		/* set the table entry */
-		rc = tf_set_tbl_entry(parms->tfp, &set_parm);
-		if (rc) {
-			BNXT_TF_DBG(ERR, "table[%d][%s][%d] set failed\n",
-				    set_parm.type,
-				    (set_parm.dir == TF_DIR_RX) ? "RX" : "TX",
-				    set_parm.idx);
-			goto error;
-		}
-	}
-
-	/* Link the resource to the flow in the flow db */
-	memset(&fid_parms, 0, sizeof(fid_parms));
-	fid_parms.direction		= atbls->direction;
-	fid_parms.resource_func		= atbls->resource_func;
-	fid_parms.resource_type		= atbls->resource_type;
-	fid_parms.resource_hndl		= alloc_parms.idx;
-	fid_parms.critical_resource	= 0;
-
-	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-				      parms->tbl_idx,
-				      parms->fid,
-				      &fid_parms);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n",
-			    rc);
-		rc = -EINVAL;
-		goto error;
-	}
-
-	return 0;
-error:
-
-	free_parms.dir	= alloc_parms.dir;
-	free_parms.type	= alloc_parms.type;
-	free_parms.idx	= alloc_parms.idx;
-
-	trc = tf_free_tbl_entry(parms->tfp, &free_parms);
-	if (trc)
-		BNXT_TF_DBG(ERR, "Failed to free table entry on failure\n");
-
-	return rc;
-}
-
-/*
- * Function to process the action Info. Iterate through the list
- * action info templates and process it.
- */
-static int32_t
-ulp_mapper_action_info_process(struct bnxt_ulp_mapper_parms *parms,
-			       struct bnxt_ulp_mapper_act_tbl_info *tbl)
-{
-	struct ulp_blob					blob;
-	struct bnxt_ulp_mapper_result_field_info	*flds, *fld;
-	uint32_t					num_flds = 0;
-	uint32_t					encap_flds = 0;
-	uint32_t					i;
-	int32_t						rc;
-	uint16_t					bit_size;
-
-	if (!tbl || !parms->act_prop || !parms->act_bitmap || !parms->regfile)
-		return -EINVAL;
-
-	/* use the max size if encap is enabled */
-	if (tbl->encap_num_fields)
-		bit_size = BNXT_ULP_FLMP_BLOB_SIZE_IN_BITS;
-	else
-		bit_size = tbl->result_bit_size;
-	if (!ulp_blob_init(&blob, bit_size, parms->device_params->byte_order)) {
-		BNXT_TF_DBG(ERR, "action blob init failed\n");
-		return -EINVAL;
-	}
-
-	flds = ulp_mapper_act_result_fields_get(tbl, &num_flds, &encap_flds);
-	if (!flds || !num_flds) {
-		BNXT_TF_DBG(ERR, "Template undefined for action\n");
-		return -EINVAL;
-	}
-
-	for (i = 0; i < (num_flds + encap_flds); i++) {
-		fld = &flds[i];
-		rc = ulp_mapper_result_field_process(parms,
-						     tbl->direction,
-						     fld,
-						     &blob,
-						     "Action");
-		if (rc) {
-			BNXT_TF_DBG(ERR, "Action field failed\n");
-			return rc;
-		}
-		/* set the swap index if 64 bit swap is enabled */
-		if (parms->device_params->encap_byte_swap && encap_flds) {
-			if ((i + 1) == num_flds)
-				ulp_blob_encap_swap_idx_set(&blob);
-			/* if 64 bit swap is enabled perform the 64bit swap */
-			if ((i + 1) == (num_flds + encap_flds))
-				ulp_blob_perform_encap_swap(&blob);
-		}
-	}
-
-	rc = ulp_mapper_action_alloc_and_set(parms, &blob);
-	return rc;
-}
-
 static int32_t
 ulp_mapper_mark_gfid_process(struct bnxt_ulp_mapper_parms *parms,
-			     struct bnxt_ulp_mapper_class_tbl_info *tbl,
+			     struct bnxt_ulp_mapper_tbl_info *tbl,
 			     uint64_t flow_id)
 {
 	struct ulp_flow_db_res_params fid_parms;
@@ -1112,7 +936,7 @@ ulp_mapper_mark_gfid_process(struct bnxt_ulp_mapper_parms *parms,
 
 static int32_t
 ulp_mapper_mark_act_ptr_process(struct bnxt_ulp_mapper_parms *parms,
-				struct bnxt_ulp_mapper_class_tbl_info *tbl)
+				struct bnxt_ulp_mapper_tbl_info *tbl)
 {
 	struct ulp_flow_db_res_params fid_parms;
 	uint32_t act_idx, mark, mark_flag;
@@ -1160,7 +984,7 @@ ulp_mapper_mark_act_ptr_process(struct bnxt_ulp_mapper_parms *parms,
 
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
-			    struct bnxt_ulp_mapper_class_tbl_info *tbl)
+			    struct bnxt_ulp_mapper_tbl_info *tbl)
 {
 	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
 	struct ulp_blob key, mask, data;
@@ -1397,7 +1221,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 static int32_t
 ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
-			  struct bnxt_ulp_mapper_class_tbl_info *tbl)
+			  struct bnxt_ulp_mapper_tbl_info *tbl)
 {
 	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
 	struct bnxt_ulp_mapper_result_field_info *dflds;
@@ -1538,7 +1362,8 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 static int32_t
 ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
-			     struct bnxt_ulp_mapper_class_tbl_info *tbl)
+			     struct bnxt_ulp_mapper_tbl_info *tbl,
+			     bool is_class_tbl)
 {
 	struct bnxt_ulp_mapper_result_field_info *flds;
 	struct ulp_flow_db_res_params	fid_parms;
@@ -1552,22 +1377,49 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	struct tf_free_tbl_entry_parms	free_parms = { 0 };
 	uint32_t tbl_scope_id;
 	struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+	uint16_t bit_size;
+	uint32_t encap_flds = 0;
+
+	/* Get the scope id first */
+	rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to get table scope rc=%d\n", rc);
+		return rc;
+	}
 
-	bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id);
+	/* use the max size if encap is enabled */
+	if (tbl->encap_num_fields)
+		bit_size = BNXT_ULP_FLMP_BLOB_SIZE_IN_BITS;
+	else
+		bit_size = tbl->result_bit_size;
 
-	if (!ulp_blob_init(&data, tbl->result_bit_size,
+	/* Initialize the blob data */
+	if (!ulp_blob_init(&data, bit_size,
 			   parms->device_params->byte_order)) {
 		BNXT_TF_DBG(ERR, "Failed initial index table blob\n");
 		return -EINVAL;
 	}
 
-	flds = ulp_mapper_result_fields_get(tbl, &num_flds);
+	/* Get the result fields list */
+	if (is_class_tbl)
+		flds = ulp_mapper_result_fields_get(tbl, &num_flds);
+	else
+		flds = ulp_mapper_act_result_fields_get(tbl, &num_flds,
+							&encap_flds);
+
 	if (!flds || !num_flds) {
-		BNXT_TF_DBG(ERR, "Template undefined for action\n");
+		BNXT_TF_DBG(ERR, "template undefined for the index table\n");
 		return -EINVAL;
 	}
 
-	for (i = 0; i < num_flds; i++) {
+	/* process the result fields, loop through them */
+	for (i = 0; i < (num_flds + encap_flds); i++) {
+		/* set the swap index if encap swap bit is enabled */
+		if (parms->device_params->encap_byte_swap && encap_flds &&
+		    ((i + 1) == num_flds))
+			ulp_blob_encap_swap_idx_set(&data);
+
+		/* Process the result fields */
 		rc = ulp_mapper_result_field_process(parms,
 						     tbl->direction,
 						     &flds[i],
@@ -1577,27 +1429,50 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			BNXT_TF_DBG(ERR, "data field failed\n");
 			return rc;
 		}
+
+		/* if encap bit swap is enabled perform the bit swap */
+		if (parms->device_params->encap_byte_swap && encap_flds) {
+			if ((i + 1) == (num_flds + encap_flds))
+				ulp_blob_perform_encap_swap(&data);
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+			if ((i + 1) == (num_flds + encap_flds)) {
+				BNXT_TF_DBG(INFO, "Dump fter encap swap\n");
+				ulp_mapper_blob_dump(&data);
+			}
+#endif
+		}
 	}
 
+	/* Perform the tf table allocation by filling the alloc params */
 	aparms.dir		= tbl->direction;
 	aparms.type		= tbl->resource_type;
 	aparms.search_enable	= tbl->srch_b4_alloc;
 	aparms.result		= ulp_blob_data_get(&data, &tmplen);
-	aparms.result_sz_in_bytes = ULP_SZ_BITS2BYTES(tbl->result_bit_size);
+	aparms.result_sz_in_bytes = ULP_BITS_2_BYTE(tmplen);
 	aparms.tbl_scope_id	= tbl_scope_id;
 
 	/* All failures after the alloc succeeds require a free */
 	rc = tf_alloc_tbl_entry(tfp, &aparms);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Alloc table[%d][%s] failed rc=%d\n",
-			    tbl->resource_type,
-			    (tbl->direction == TF_DIR_RX) ? "RX" : "TX",
+			    aparms.type,
+			    (aparms.dir == TF_DIR_RX) ? "RX" : "TX",
 			    rc);
 		return rc;
 	}
 
+	/*
+	 * calculate the idx for the result record, for external EM the offset
+	 * needs to be shifted accordingly. If external non-inline table types
+	 * are used then need to revisit this logic.
+	 */
+	if (aparms.type == TF_TBL_TYPE_EXT)
+		idx = TF_ACT_REC_OFFSET_2_PTR(aparms.idx);
+	else
+		idx = aparms.idx;
+
 	/* Always storing values in Regfile in BE */
-	idx = tfp_cpu_to_be_64(aparms.idx);
+	idx = tfp_cpu_to_be_64(idx);
 	rc = ulp_regfile_write(parms->regfile, tbl->regfile_wr_idx, idx);
 	if (!rc) {
 		BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n",
@@ -1605,23 +1480,22 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		goto error;
 	}
 
-	if (!tbl->srch_b4_alloc) {
+	/* Perform the tf table set by filling the set params */
+	if (!tbl->srch_b4_alloc || !aparms.hit) {
 		sparms.dir		= tbl->direction;
 		sparms.type		= tbl->resource_type;
 		sparms.data		= ulp_blob_data_get(&data, &tmplen);
-		sparms.data_sz_in_bytes =
-			ULP_SZ_BITS2BYTES(tbl->result_bit_size);
+		sparms.data_sz_in_bytes = ULP_BITS_2_BYTE(tmplen);
 		sparms.idx		= aparms.idx;
 		sparms.tbl_scope_id	= tbl_scope_id;
 
 		rc = tf_set_tbl_entry(tfp, &sparms);
 		if (rc) {
 			BNXT_TF_DBG(ERR, "Set table[%d][%s][%d] failed rc=%d\n",
-				    tbl->resource_type,
-				    (tbl->direction == TF_DIR_RX) ? "RX" : "TX",
+				    sparms.type,
+				    (sparms.dir == TF_DIR_RX) ? "RX" : "TX",
 				    sparms.idx,
 				    rc);
-
 			goto error;
 		}
 	}
@@ -1664,7 +1538,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 static int32_t
 ulp_mapper_cache_tbl_process(struct bnxt_ulp_mapper_parms *parms,
-			     struct bnxt_ulp_mapper_class_tbl_info *tbl)
+			     struct bnxt_ulp_mapper_tbl_info *tbl)
 {
 	struct bnxt_ulp_mapper_class_key_field_info *kflds;
 	struct bnxt_ulp_mapper_cache_entry *cache_entry;
@@ -1858,6 +1732,7 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)
 {
 	uint32_t	i;
 	int32_t		rc = 0;
+	struct bnxt_ulp_mapper_tbl_info *tbl;
 
 	if (!parms->atbls || !parms->num_atbls) {
 		BNXT_TF_DBG(ERR, "No action tables for template[%d][%d].\n",
@@ -1866,9 +1741,21 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)
 	}
 
 	for (i = 0; i < parms->num_atbls; i++) {
-		rc = ulp_mapper_action_info_process(parms, &parms->atbls[i]);
-		if (rc)
-			return rc;
+		tbl = &parms->atbls[i];
+		switch (tbl->resource_func) {
+		case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:
+			rc = ulp_mapper_index_tbl_process(parms, tbl, false);
+			break;
+		default:
+			BNXT_TF_DBG(ERR, "Unexpected action resource %d\n",
+				    tbl->resource_func);
+			return -EINVAL;
+		}
+	}
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Resource type %d failed\n",
+			    tbl->resource_func);
+		return rc;
 	}
 
 	return rc;
@@ -1891,7 +1778,7 @@ ulp_mapper_class_tbls_process(struct bnxt_ulp_mapper_parms *parms)
 	}
 
 	for (i = 0; i < parms->num_ctbls; i++) {
-		struct bnxt_ulp_mapper_class_tbl_info *tbl = &parms->ctbls[i];
+		struct bnxt_ulp_mapper_tbl_info *tbl = &parms->ctbls[i];
 
 		switch (tbl->resource_func) {
 		case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE:
@@ -1901,7 +1788,7 @@ ulp_mapper_class_tbls_process(struct bnxt_ulp_mapper_parms *parms)
 			rc = ulp_mapper_em_tbl_process(parms, tbl);
 			break;
 		case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:
-			rc = ulp_mapper_index_tbl_process(parms, tbl);
+			rc = ulp_mapper_index_tbl_process(parms, tbl, true);
 			break;
 		case BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE:
 			rc = ulp_mapper_cache_tbl_process(parms, tbl);
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h
index 0c9bb86..67410c9 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h
@@ -15,7 +15,6 @@
 #include "bnxt_ulp.h"
 #include "ulp_utils.h"
 
-#define ULP_SZ_BITS2BYTES(x) (((x) + 7) / 8)
 #define ULP_IDENTS_INVALID ((uint16_t)0xffff)
 
 /*
@@ -56,10 +55,10 @@ struct bnxt_ulp_mapper_data {
 struct bnxt_ulp_mapper_parms {
 	uint32_t				dev_id;
 	uint32_t				act_tid;
-	struct bnxt_ulp_mapper_act_tbl_info	*atbls;
+	struct bnxt_ulp_mapper_tbl_info		*atbls; /* action table */
 	uint32_t				num_atbls;
 	uint32_t				class_tid;
-	struct bnxt_ulp_mapper_class_tbl_info	*ctbls;
+	struct bnxt_ulp_mapper_tbl_info		*ctbls; /* class table */
 	uint32_t				num_ctbls;
 	struct ulp_rte_act_prop			*act_prop;
 	struct ulp_rte_act_bitmap		*act_bitmap;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
index 395d33b..bac3bce 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
@@ -587,7 +587,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_class_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE,
 	.resource_type = TF_TCAM_TBL_TYPE_L2_CTXT_TCAM,
@@ -602,6 +602,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = {
 	.result_start_idx = 0,
 	.result_bit_size = 10,
 	.result_num_fields = 1,
+	.encap_num_fields = 0,
 	.ident_start_idx = 0,
 	.ident_nums = 1,
 	.mark_enable = BNXT_ULP_MARK_ENABLE_NO,
@@ -623,6 +624,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = {
 	.result_start_idx = 1,
 	.result_bit_size = 64,
 	.result_num_fields = 13,
+	.encap_num_fields = 0,
 	.ident_start_idx = 1,
 	.ident_nums = 0,
 	.mark_enable = BNXT_ULP_MARK_ENABLE_NO,
@@ -644,6 +646,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = {
 	.result_start_idx = 14,
 	.result_bit_size = 10,
 	.result_num_fields = 1,
+	.encap_num_fields = 0,
 	.ident_start_idx = 1,
 	.ident_nums = 1,
 	.mark_enable = BNXT_ULP_MARK_ENABLE_NO,
@@ -665,6 +668,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = {
 	.result_start_idx = 15,
 	.result_bit_size = 38,
 	.result_num_fields = 8,
+	.encap_num_fields = 0,
 	.ident_start_idx = 2,
 	.ident_nums = 0,
 	.mark_enable = BNXT_ULP_MARK_ENABLE_NO,
@@ -686,6 +690,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = {
 	.result_start_idx = 23,
 	.result_bit_size = 64,
 	.result_num_fields = 9,
+	.encap_num_fields = 0,
 	.ident_start_idx = 2,
 	.ident_nums = 0,
 	.mark_enable = BNXT_ULP_MARK_ENABLE_YES,
@@ -1615,7 +1620,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_act_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_act_tbl_info ulp_act_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_EXT,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
index b51cca2..df3519d 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
@@ -155,7 +155,7 @@ struct bnxt_ulp_mapper_tbl_list_info {
 	uint32_t	num_tbls;
 };
 
-struct bnxt_ulp_mapper_class_tbl_info {
+struct bnxt_ulp_mapper_tbl_info {
 	enum bnxt_ulp_resource_func	resource_func;
 	uint32_t			resource_type; /* TF_ enum type */
 	enum bnxt_ulp_resource_sub_type	resource_sub_type;
@@ -175,6 +175,7 @@ struct bnxt_ulp_mapper_class_tbl_info {
 	uint32_t	result_start_idx;
 	uint16_t	result_bit_size;
 	uint16_t	result_num_fields;
+	uint16_t	encap_num_fields;
 
 	/* Information for accessing the ulp_ident_list */
 	uint32_t	ident_start_idx;
@@ -185,20 +186,6 @@ struct bnxt_ulp_mapper_class_tbl_info {
 	enum bnxt_ulp_vfr_flag		vfr_flag;
 };
 
-struct bnxt_ulp_mapper_act_tbl_info {
-	enum bnxt_ulp_resource_func	resource_func;
-	uint32_t			resource_type; /* TF_ enum type */
-	enum bnxt_ulp_resource_sub_type	resource_sub_type;
-	uint8_t		direction;
-	uint8_t		srch_b4_alloc;
-	uint32_t	result_start_idx;
-	uint16_t	result_bit_size;
-	uint16_t	encap_num_fields;
-	uint16_t	result_num_fields;
-
-	enum bnxt_ulp_regfile_index	regfile_wr_idx;
-};
-
 struct bnxt_ulp_mapper_class_key_field_info {
 	uint8_t			description[64];
 	enum bnxt_ulp_mask_opc	mask_opcode;
@@ -263,8 +250,8 @@ extern struct bnxt_ulp_mapper_tbl_list_info	ulp_act_tmpl_list[];
  * table entry to include the start index and number of instructions in the
  * field lists.
  */
-extern struct bnxt_ulp_mapper_class_tbl_info	ulp_class_tbl_list[];
-extern struct bnxt_ulp_mapper_act_tbl_info	ulp_act_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info	ulp_class_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info	ulp_act_tbl_list[];
 
 /*
  * The ulp_class_result_field_list provides the instructions for creating result
-- 
2.7.4


  parent reply	other threads:[~2020-06-12 12:57 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 12:49 [dpdk-dev] [PATCH v3 00/36] bnxt patches Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 01/36] net/bnxt: Makefile changes Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 02/36] net/bnxt: remove svif and vlan information from header bitmap Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 03/36] net/bnxt: add vfr flag to the mark manager Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 04/36] net/bnxt: support for mark action for LFID rules Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 05/36] net/bnxt: remove mem field from mapper class table Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 06/36] net/bnxt: support more resource functions in flow database Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 07/36] net/bnxt: rename the ulp action bitmap enumeration values Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 08/36] net/bnxt: add support for computed header field in result opcode Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 09/36] net/bnxt: updated compute field list and access macros Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 10/36] net/bnxt: extend default identifier list to be global resource list Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 11/36] net/bnxt: add resource sub type to class and action tables Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 12/36] net/bnxt: remove cache tbl id from the mapper class table Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 13/36] net/bnxt: move vfr flag from computed field list to " Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 14/36] net/bnxt: add support for action bitmap opcode in result field processing Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 15/36] net/bnxt: direction bit needs to be added to the action bitmap Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 16/36] net/bnxt: remove cache_tbl_id enums Somnath Kotur
2020-06-12 12:50 ` Somnath Kotur [this message]
2020-06-12 12:50 ` [dpdk-dev] [PATCH 18/36] net/bnxt: use vport in the phy port act handler Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 19/36] net/bnxt: add enum to the critical resource Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 20/36] net/bnxt: rename regfile_wr_idx to regfile_idx Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 21/36] net/bnxt: remove unused enum in regfile index Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 22/36] net/bnxt: rename an enum in the " Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 23/36] net/bnxt: rename the enums in the bnxt_ulp_resource_sub_type Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 24/36] net/bnxt: add a devarg to set max flow count Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 25/36] net/bnxt: add support for vxlan encap and decap templates Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 26/36] net/bnxt: flow db api to get vf rep action record Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 27/36] net/bnxt: parse ipv6 vtc_flow field for more granularly Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 28/36] net/bnxt: remove the implicit bitset update for vnic action Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 29/36] net/bnxt: divide the ulp template db file to smaller modules Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 30/36] net/bnxt: unify the mapper opcodes into single enum Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 31/36] net/bnxt: change opcode for adding pad to setting zero for common usage Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH] net/bnxt: optimized key/mask/result fields to use set to zero opcode Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 33/36] net/bnxt: add support for internal exact match flows Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 34/36] net/bnxt: enable vfr flag processing with mark db opcode Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 35/36] net/bnxt: rename fields in the device params structure Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 36/36] net/bnxt: update ulp template database for new opcodes Somnath Kotur
2020-06-27 10:00 ` [dpdk-dev] [PATCH v4 00/25] bnxt patches Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 01/25] net/bnxt: changes to makefile Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 02/25] net/bnxt: remove fields from bitmap and mapper table Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 03/25] net/bnxt: support more resource functions in flow database Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 04/25] net/bnxt: add computed header field in result opcode Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 05/25] net/bnxt: update compute field list and access macros Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 06/25] net/bnxt: change default identifier to global resource Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 07/25] net/bnxt: add resource sub type to class and action tables Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 08/25] net/bnxt: remove cache tbl id from mapper class table Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 09/25] net/bnxt: add support for action bitmap opcode Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 10/25] net/bnxt: process action templates Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 11/25] net/bnxt: use vport in the phy port act handler Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 12/25] net/bnxt: add enum to the critical resource Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 13/25] net/bnxt: refactor and rename some fields and enums Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 14/25] net/bnxt: add a devarg to set max flow count Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 15/25] net/bnxt: add support for vxlan encap and decap templates Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 16/25] net/bnxt: flow db API to get VF rep action record Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 17/25] net/bnxt: modify IPV6 vtc flow field parsing Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 18/25] net/bnxt: remove the implicit bitset update for vnic action Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 19/25] net/bnxt: divide ulp template db file to smaller modules Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 20/25] net/bnxt: refactor the mapper opcodes Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 21/25] net/bnxt: add support for internal exact match flows Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 22/25] net/bnxt: add vfr flag to the mark manager Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 23/25] net/bnxt: support for mark action for LFID rules Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 24/25] net/bnxt: rename fields in the device params structure Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 25/25] net/bnxt: update ulp template database for new opcodes Ajit Khaparde
2020-06-27 15:47   ` [dpdk-dev] [PATCH v4 00/25] bnxt patches Ajit Khaparde
2020-06-30  7:49     ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2020-06-10 11:43 [dpdk-dev] [PATCH 00/36] " Somnath Kotur
2020-06-10 11:44 ` [dpdk-dev] [PATCH 17/36] net/bnxt: extend index table processing to process action templates Somnath Kotur
2020-06-10  6:56 [dpdk-dev] [PATCH 00/36] bnxt fixes and enhancements Somnath Kotur
2020-06-10  6:57 ` [dpdk-dev] [PATCH 17/36] net/bnxt: extend index table processing to process action templates Somnath Kotur

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=20200612125024.15989-18-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git