diff mbox series

[32/58] net/bnxt: modify table processing

Message ID 20210530085929.29695-33-venkatkumar.duvvuru@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ajit Khaparde
Headers show
Series enhancements to host based flow table management | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Venkat Duvvuru May 30, 2021, 8:59 a.m. UTC
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

1. Added interface table specific opcode to process interface table
entry creation and reuse. This allows reuse of the interface table
entry for multiple flows. Changed the regfile apis to store
the data in big endian format.

2. The result blob creation being done in tcam, interface, index
tables are consolidate to a common method.

3. Added result blob processing for generic table write

4. Modified the index table opcode processing to support new opcodes.

5. The driver was setting key size that did not take into account
   the word alignment.

6. The hard coded values for critical resource is replaced with
   template defined values.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |  18 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h         |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 674 ++++++++++--------
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |  22 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c | 108 +--
 .../tf_ulp/ulp_template_db_wh_plus_class.c    |  69 +-
 6 files changed, 512 insertions(+), 383 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
index 0edbe77a96..dd2b799b30 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
@@ -5,6 +5,8 @@ 
 
 #include <rte_log.h>
 #include <rte_malloc.h>
+#include "tf_core.h"
+#include "tfp.h"
 #include "ulp_mapper.h"
 #include "ulp_flow_db.h"
 
@@ -163,18 +165,20 @@  ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir)
 }
 
 /*
- * Set the data in the generic table entry
+ * Set the data in the generic table entry, Data is in Big endian format
  *
  * entry [in] - generic table entry
  * offset [in] - The offset in bits where the data has to be set
  * len [in] - The length of the data in bits to be set
  * data [in] - pointer to the data to be used for setting the value.
+ * data_size [in] - length of the data pointer in bytes.
  *
  * returns 0 on success
  */
 int32_t
 ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
-				  uint32_t offset, uint32_t len, uint8_t *data)
+				  uint32_t offset, uint32_t len, uint8_t *data,
+				  uint32_t data_size)
 {
 	/* validate the null arguments */
 	if (!entry || !data) {
@@ -183,12 +187,17 @@  ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
 	}
 
 	/* check the size of the buffer for validation */
-	if ((offset + len) > ULP_BYTE_2_BITS(entry->byte_data_size)) {
+	if ((offset + len) > ULP_BYTE_2_BITS(entry->byte_data_size) ||
+	    data_size < ULP_BITS_2_BYTE(len)) {
 		BNXT_TF_DBG(ERR, "invalid offset or length %x:%x:%x\n",
 			    offset, len, entry->byte_data_size);
 		return -EINVAL;
 	}
 
+	/* adjust the data pointer */
+	data = data + (data_size - ULP_BITS_2_BYTE(len));
+
+	/* Push the data into the byte data array */
 	if (entry->byte_order == BNXT_ULP_BYTE_ORDER_LE) {
 		if (ulp_bs_push_lsb(entry->byte_data, offset, len, data) !=
 		    len) {
@@ -208,7 +217,7 @@  ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
 }
 
 /*
- * Get the data in the generic table entry
+ * Get the data in the generic table entry, Data is in Big endian format
  *
  * entry [in] - generic table entry
  * offset [in] - The offset in bits where the data has to get
@@ -298,6 +307,7 @@  ulp_mapper_gen_tbl_res_free(struct bnxt_ulp_context *ulp_ctx,
 			    tbl_idx, res->resource_hndl);
 		return -EINVAL;
 	}
+	fid = tfp_be_to_cpu_32(fid);
 
 	/* Destroy the flow associated with the shared flow id */
 	if (ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h b/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h
index c8a1112af4..701a8d10e5 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h
@@ -104,12 +104,14 @@  ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir);
  * offset [in] - The offset in bits where the data has to be set
  * len [in] - The length of the data in bits to be set
  * data [in] - pointer to the data to be used for setting the value.
+ * data_size [in] - length of the data pointer in bytes.
  *
  * returns 0 on success
  */
 int32_t
 ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
-				  uint32_t offset, uint32_t len, uint8_t *data);
+				  uint32_t offset, uint32_t len, uint8_t *data,
+				  uint32_t data_size);
 
 /*
  * Get the data in the generic table entry
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index c511f835ff..eb57ec8ba3 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -530,7 +530,7 @@  ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms,
 	case BNXT_ULP_FDB_OPC_ALLOC_PUSH_REGFILE:
 		/* allocate a new fid */
 		rc = ulp_flow_db_fid_alloc(parms->ulp_ctx,
-					   BNXT_ULP_FDB_TYPE_REGULAR,
+					   parms->flow_type,
 					   tbl->resource_func, &fid);
 		if (rc) {
 			BNXT_TF_DBG(ERR,
@@ -540,7 +540,7 @@  ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms,
 		/* Store the allocated fid in regfile*/
 		val64 = fid;
 		rc = ulp_regfile_write(parms->regfile, tbl->flow_db_operand,
-				       val64);
+				       tfp_cpu_to_be_64(val64));
 		if (!rc) {
 			BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n",
 				    tbl->flow_db_operand);
@@ -560,7 +560,7 @@  ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms,
 			return -EINVAL;
 		}
 		/* Use the extracted fid to update the flow resource */
-		push_fid = (uint32_t)val64;
+		push_fid = tfp_be_to_cpu_64((uint32_t)val64);
 		break;
 	default:
 		return rc; /* Nothing to be done */
@@ -584,6 +584,65 @@  ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
+/*
+ * Process the identifier list in the given table.
+ * Extract the ident from the table entry and
+ * write it to the reg file.
+ * returns 0 on success.
+ */
+static int32_t
+ulp_mapper_tbl_ident_scan_ext(struct bnxt_ulp_mapper_parms *parms,
+			      struct bnxt_ulp_mapper_tbl_info *tbl,
+			      uint8_t *byte_data,
+			      uint32_t byte_data_size,
+			      enum bnxt_ulp_byte_order byte_order)
+{
+	struct bnxt_ulp_mapper_ident_info *idents;
+	uint32_t i, num_idents = 0;
+	uint64_t val64;
+
+	/* validate the null arguments */
+	if (!byte_data) {
+		BNXT_TF_DBG(ERR, "invalid argument\n");
+		return -EINVAL;
+	}
+
+	/* Get the ident list and process each one */
+	idents = ulp_mapper_ident_fields_get(parms, tbl, &num_idents);
+
+	for (i = 0; i < num_idents; i++) {
+		/* check the size of the buffer for validation */
+		if ((idents[i].ident_bit_pos + idents[i].ident_bit_size) >
+		    ULP_BYTE_2_BITS(byte_data_size) ||
+		    idents[i].ident_bit_size > ULP_BYTE_2_BITS(sizeof(val64))) {
+			BNXT_TF_DBG(ERR, "invalid offset or length %x:%x:%x\n",
+				    idents[i].ident_bit_pos,
+				    idents[i].ident_bit_size,
+				    byte_data_size);
+			return -EINVAL;
+		}
+		if (byte_order == BNXT_ULP_BYTE_ORDER_LE)
+			ulp_bs_pull_lsb(byte_data, (uint8_t *)&val64,
+					sizeof(val64),
+					idents[i].ident_bit_pos,
+					idents[i].ident_bit_size);
+		else
+			ulp_bs_pull_msb(byte_data, (uint8_t *)&val64,
+					idents[i].ident_bit_pos,
+					idents[i].ident_bit_size);
+
+		/* Write it to the regfile, val64 is already in big-endian*/
+		if (!ulp_regfile_write(parms->regfile,
+				       idents[i].regfile_idx,
+				       val64)) {
+			BNXT_TF_DBG(ERR, "Regfile[%d] write failed.\n",
+				    idents[i].regfile_idx);
+			return -EINVAL;
+		}
+	}
+	return 0;
+}
+
 /*
  * Process the identifier instruction and either store it in the flow database
  * or return it in the val (if not NULL) on success.  If val is NULL, the
@@ -637,7 +696,7 @@  ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,
 		fid_parms.resource_func	= ident->resource_func;
 		fid_parms.resource_type	= ident->ident_type;
 		fid_parms.resource_hndl	= iparms.id;
-		fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+		fid_parms.critical_resource = tbl->critical_resource;
 
 		rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 		if (rc) {
@@ -729,7 +788,7 @@  ulp_mapper_ident_extract(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.resource_func = ident->resource_func;
 	fid_parms.resource_type = ident->ident_type;
 	fid_parms.resource_hndl = sparms.search_id;
-	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	fid_parms.critical_resource = tbl->critical_resource;
 	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Failed to link res to flow rc = %d\n",
@@ -1044,6 +1103,57 @@  ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 	return 0;
 }
 
+/*
+ * Result table process and fill the result blob.
+ * data [out] - the result blob data
+ */
+static int32_t
+ulp_mapper_tbl_result_build(struct bnxt_ulp_mapper_parms *parms,
+			    struct bnxt_ulp_mapper_tbl_info *tbl,
+			    struct ulp_blob *data,
+			    const char *name)
+{
+	struct bnxt_ulp_mapper_result_field_info *dflds;
+	uint32_t i, num_flds = 0, encap_flds = 0;
+	int32_t rc = 0;
+
+	/* Get the result field list */
+	dflds = ulp_mapper_result_fields_get(parms, tbl, &num_flds,
+					     &encap_flds);
+
+	/* validate the result field list counts */
+	if ((tbl->resource_func == BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE &&
+	     (!num_flds && !encap_flds)) || !dflds ||
+	    (tbl->resource_func != BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE &&
+		(!num_flds || encap_flds))) {
+		BNXT_TF_DBG(ERR, "Failed to get data fields %x:%x\n",
+			    num_flds, encap_flds);
+		return -EINVAL;
+	}
+
+	/* 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 == num_flds)
+			ulp_blob_encap_swap_idx_set(data);
+
+		/* Process the result fields */
+		rc = ulp_mapper_result_field_process(parms, tbl->direction,
+						     &dflds[i], data, name);
+		if (rc) {
+			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)
+		ulp_blob_perform_encap_swap(data);
+
+	return rc;
+}
+
 /* Function to alloc action record and set the table. */
 static int32_t
 ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
@@ -1209,7 +1319,7 @@  ulp_mapper_mark_gfid_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 	fid_parms.direction = tbl->direction;
 	fid_parms.resource_func = BNXT_ULP_RESOURCE_FUNC_HW_FID;
-	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	fid_parms.critical_resource = tbl->critical_resource;
 	fid_parms.resource_type	= mark_flag;
 	fid_parms.resource_hndl	= gfid;
 	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
@@ -1255,7 +1365,7 @@  ulp_mapper_mark_act_ptr_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 	fid_parms.direction = tbl->direction;
 	fid_parms.resource_func = BNXT_ULP_RESOURCE_FUNC_HW_FID;
-	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	fid_parms.critical_resource = tbl->critical_resource;
 	fid_parms.resource_type	= mark_flag;
 	fid_parms.resource_hndl	= act_idx;
 	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
@@ -1301,7 +1411,7 @@  ulp_mapper_mark_vfr_idx_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 	fid_parms.direction = tbl->direction;
 	fid_parms.resource_func = BNXT_ULP_RESOURCE_FUNC_HW_FID;
-	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	fid_parms.critical_resource = tbl->critical_resource;
 	fid_parms.resource_type	= mark_flag;
 	fid_parms.resource_hndl	= act_idx;
 	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
@@ -1310,43 +1420,6 @@  ulp_mapper_mark_vfr_idx_process(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
-/*
- * Tcam table - create the result blob.
- * data [out] - the result blob data
- */
-static int32_t
-ulp_mapper_tcam_tbl_result_create(struct bnxt_ulp_mapper_parms *parms,
-				  struct bnxt_ulp_mapper_tbl_info *tbl,
-				  struct ulp_blob *data)
-{
-	struct bnxt_ulp_mapper_result_field_info *dflds;
-	uint32_t num_dflds;
-	uint32_t encap_flds = 0;
-	uint32_t i;
-	int32_t rc = 0;
-
-	/* Create the result data blob */
-	dflds = ulp_mapper_result_fields_get(parms, tbl, &num_dflds,
-					     &encap_flds);
-	if (!dflds || !num_dflds || encap_flds) {
-		BNXT_TF_DBG(ERR, "Failed to get data fields.\n");
-		return -EINVAL;
-	}
-
-	for (i = 0; i < num_dflds; i++) {
-		rc = ulp_mapper_result_field_process(parms,
-						     tbl->direction,
-						     &dflds[i],
-						     data,
-						     "TCAM Result");
-		if (rc) {
-			BNXT_TF_DBG(ERR, "Failed to set data fields\n");
-			return -EINVAL;
-		}
-	}
-	return rc;
-}
-
 /* Tcam table scan the identifier list and allocate each identifier */
 static int32_t
 ulp_mapper_tcam_tbl_scan_ident_alloc(struct bnxt_ulp_mapper_parms *parms,
@@ -1418,8 +1491,8 @@  ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
 	sparms.idx		= idx;
 	/* Already verified the key/mask lengths */
 	sparms.key		= ulp_blob_data_get(key, &tmplen);
+	sparms.key_sz_in_bits	= tmplen;
 	sparms.mask		= ulp_blob_data_get(mask, &tmplen);
-	sparms.key_sz_in_bits	= tbl->key_bit_size;
 	sparms.result		= ulp_blob_data_get(data, &tmplen);
 
 	if (tbl->result_bit_size != tmplen) {
@@ -1625,8 +1698,8 @@  ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		rc = ulp_mapper_tcam_tbl_scan_ident_alloc(parms, tbl);
 		/* Create the result blob */
 		if (!rc)
-			rc = ulp_mapper_tcam_tbl_result_create(parms, tbl,
-							       &data);
+			rc = ulp_mapper_tbl_result_build(parms, tbl, &data,
+							 "TCAM Result");
 		/* write the tcam entry */
 		if (!rc)
 			rc = ulp_mapper_tcam_tbl_entry_write(parms, tbl, &key,
@@ -1669,9 +1742,8 @@  ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl)
 {
 	struct bnxt_ulp_mapper_key_field_info	*kflds;
-	struct bnxt_ulp_mapper_result_field_info *dflds;
 	struct ulp_blob key, data;
-	uint32_t i, num_kflds, num_dflds;
+	uint32_t i, num_kflds;
 	uint16_t tmplen;
 	struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
 	struct ulp_flow_db_res_params	fid_parms = { 0 };
@@ -1680,7 +1752,6 @@  ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	enum bnxt_ulp_flow_mem_type mtype;
 	int32_t	trc;
 	int32_t rc = 0;
-	uint32_t encap_flds = 0;
 
 	rc = bnxt_ulp_cntxt_mem_type_get(parms->ulp_ctx, &mtype);
 	if (rc) {
@@ -1721,27 +1792,10 @@  ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	 */
 
 	/* Create the result data blob */
-	dflds = ulp_mapper_result_fields_get(parms, tbl,
-					     &num_dflds, &encap_flds);
-	if (!dflds || !num_dflds || encap_flds) {
-		BNXT_TF_DBG(ERR, "Failed to get data fields.\n");
-		return -EINVAL;
-	}
-
-	for (i = 0; i < num_dflds; i++) {
-		struct bnxt_ulp_mapper_result_field_info *fld;
-
-		fld = &dflds[i];
-
-		rc = ulp_mapper_result_field_process(parms,
-						     tbl->direction,
-						     fld,
-						     &data,
-						     "EM Result");
-		if (rc) {
-			BNXT_TF_DBG(ERR, "Failed to set data fields.\n");
-			return rc;
-		}
+	rc = ulp_mapper_tbl_result_build(parms, tbl, &data, "EM Result");
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to build the result blob\n");
+		return rc;
 	}
 	/* do the transpose for the internal EM keys */
 	if (tbl->resource_func == BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE)
@@ -1818,28 +1872,23 @@  static int32_t
 ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			     struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_result_field_info *flds;
-	struct ulp_flow_db_res_params	fid_parms;
+	struct ulp_flow_db_res_params fid_parms;
 	struct ulp_blob	data;
-	uint64_t idx = 0;
+	uint64_t regval = 0;
 	uint16_t tmplen;
-	uint32_t i, num_flds, index, hit;
+	uint32_t index, hit;
 	int32_t rc = 0, trc = 0;
-	struct tf_alloc_tbl_entry_parms	aparms = { 0 };
+	struct tf_alloc_tbl_entry_parms aparms = { 0 };
 	struct tf_search_tbl_entry_parms srchparms = { 0 };
-	struct tf_set_tbl_entry_parms	sparms = { 0 };
-	struct tf_free_tbl_entry_parms	free_parms = { 0 };
+	struct tf_set_tbl_entry_parms sparms = { 0 };
+	struct tf_get_tbl_entry_parms gparms = { 0 };
+	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;
-	}
+	bool alloc = false;
+	bool write = false;
+	bool search = false;
 
 	/* use the max size if encap is enabled */
 	if (tbl->encap_num_fields)
@@ -1850,82 +1899,150 @@  ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	/* 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");
+		BNXT_TF_DBG(ERR, "Failed to initialize index table blob\n");
 		return -EINVAL;
 	}
 
-	/* Get the result fields list */
-	flds = ulp_mapper_result_fields_get(parms, tbl, &num_flds, &encap_flds);
-
-	if (!flds || (!num_flds && !encap_flds)) {
-		BNXT_TF_DBG(ERR, "template undefined for the index table\n");
-		return -EINVAL;
+	/* 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;
 	}
 
-	/* 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 == num_flds)
-			ulp_blob_encap_swap_idx_set(&data);
-
-		/* Process the result fields */
-		rc = ulp_mapper_result_field_process(parms,
-						     tbl->direction,
-						     &flds[i],
-						     &data,
-						     "Indexed Result");
-		if (rc) {
-			BNXT_TF_DBG(ERR, "data field failed\n");
-			return rc;
+	switch (tbl->tbl_opcode) {
+	case BNXT_ULP_INDEX_TBL_OPC_ALLOC_REGFILE:
+		alloc = true;
+		break;
+	case BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE:
+		/*
+		 * Build the entry, alloc an index, write the table, and store
+		 * the data in the regfile.
+		 */
+		alloc = true;
+		write = true;
+		break;
+	case BNXT_ULP_INDEX_TBL_OPC_SRCH_ALLOC_WR_REGFILE:
+		if (tbl->resource_type == TF_TBL_TYPE_EXT) {
+			/* Not currently supporting with EXT */
+			BNXT_TF_DBG(ERR,
+				    "Ext Table Search Opcode not supported.\n");
+			return -EINVAL;
 		}
-	}
-
-	/* if encap bit swap is enabled perform the bit swap */
-	if (parms->device_params->encap_byte_swap && encap_flds) {
-		ulp_blob_perform_encap_swap(&data);
-	}
+		/*
+		 * Search for the entry in the tf core.  If it is hit, save the
+		 * index in the regfile.  If it is a miss, Build the entry,
+		 * alloc an index, write the table, and store the data in the
+		 * regfile (same as ALLOC_WR).
+		 */
+		search = true;
+		break;
+	case BNXT_ULP_INDEX_TBL_OPC_WR_REGFILE:
+		/*
+		 * get the index to write to from the regfile and then write
+		 * the table entry.
+		 */
+		if (!ulp_regfile_read(parms->regfile,
+				      tbl->tbl_operand,
+				      &regval)) {
+			BNXT_TF_DBG(ERR,
+				    "Failed to get tbl idx from regfile[%d].\n",
+				    tbl->tbl_operand);
+			return -EINVAL;
+		}
+		index = tfp_be_to_cpu_64(regval);
+		/* For external, we need to reverse shift */
+		if (tbl->resource_type == TF_TBL_TYPE_EXT)
+			index = TF_ACT_REC_PTR_2_OFFSET(index);
 
-	/*
-	 * Check for index opcode, if it is Global then
-	 * no need to allocate the table, just set the table
-	 * and exit since it is not maintained in the flow db.
-	 */
-	if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_GLOBAL) {
-		/* get the index from index operand */
-		if (tbl->index_operand < BNXT_ULP_GLB_REGFILE_INDEX_LAST &&
-		    ulp_mapper_glb_resource_read(parms->mapper_data,
+		write = true;
+		break;
+	case BNXT_ULP_INDEX_TBL_OPC_WR_GLB_REGFILE:
+		/*
+		 * get the index to write to from the global regfile and then
+		 * write the table.
+		 */
+		if (ulp_mapper_glb_resource_read(parms->mapper_data,
 						 tbl->direction,
-						 tbl->index_operand,
-						 &idx)) {
-			BNXT_TF_DBG(ERR, "Glbl regfile[%d] read failed.\n",
+						 tbl->tbl_operand,
+						 &regval)) {
+			BNXT_TF_DBG(ERR,
+				    "Failed to get tbl idx from Global "
+				    "regfile[%d].\n",
 				    tbl->index_operand);
 			return -EINVAL;
 		}
-		/* set the Tf index table */
-		sparms.dir		= tbl->direction;
-		sparms.type		= tbl->resource_type;
-		sparms.data		= ulp_blob_data_get(&data, &tmplen);
-		sparms.data_sz_in_bytes = ULP_BITS_2_BYTE(tmplen);
-		sparms.idx		= tfp_be_to_cpu_64(idx);
-		sparms.tbl_scope_id	= tbl_scope_id;
+		index = tfp_be_to_cpu_64(regval);
+		/* For external, we need to reverse shift */
+		if (tbl->resource_type == TF_TBL_TYPE_EXT)
+			index = TF_ACT_REC_PTR_2_OFFSET(index);
+		write = true;
+		break;
+	case BNXT_ULP_INDEX_TBL_OPC_RD_REGFILE:
+		/*
+		 * The read is different from the rest and can be handled here
+		 * instead of trying to use common code.  Simply read the table
+		 * with the index from the regfile, scan and store the
+		 * identifiers, and return.
+		 */
+		if (tbl->resource_type == TF_TBL_TYPE_EXT) {
+			/* Not currently supporting with EXT */
+			BNXT_TF_DBG(ERR,
+				    "Ext Table Read Opcode not supported.\n");
+			return -EINVAL;
+		}
+		if (!ulp_regfile_read(parms->regfile,
+				      tbl->tbl_operand, &regval)) {
+			BNXT_TF_DBG(ERR,
+				    "Failed to get tbl idx from regfile[%d]\n",
+				    tbl->tbl_operand);
+			return -EINVAL;
+		}
+		index = tfp_be_to_cpu_64(regval);
+		gparms.dir = tbl->direction;
+		gparms.type = tbl->resource_type;
+		gparms.data = ulp_blob_data_get(&data, &tmplen);
+		gparms.data_sz_in_bytes = ULP_BITS_2_BYTE(tbl->result_bit_size);
+		gparms.idx = index;
+		rc = tf_get_tbl_entry(tfp, &gparms);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Failed to read the tbl entry %d:%d\n",
+				    tbl->resource_type, index);
+			return rc;
+		}
+		/*
+		 * Scan the fields in the entry and push them into the regfile.
+		 */
+		rc = ulp_mapper_tbl_ident_scan_ext(parms, tbl,
+						   gparms.data,
+						   gparms.data_sz_in_bytes,
+						   data.byte_order);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Failed to read fields on tbl read "
+				    "rc=%d\n", rc);
+			return rc;
+		}
+		return 0;
+	default:
+		BNXT_TF_DBG(ERR, "Invalid index table opcode %d\n",
+			    tbl->tbl_opcode);
+		return -EINVAL;
+	}
 
-		rc = tf_set_tbl_entry(tfp, &sparms);
+	if (write || search) {
+		/* Get the result fields list */
+		rc = ulp_mapper_tbl_result_build(parms,
+						 tbl,
+						 &data,
+						 "Indexed Result");
 		if (rc) {
-			BNXT_TF_DBG(ERR,
-				    "Glbl Index table[%s][%s][%x] failed rc=%d\n",
-				    tf_tbl_type_2_str(sparms.type),
-				    tf_dir_2_str(sparms.dir),
-				    sparms.idx, rc);
+			BNXT_TF_DBG(ERR, "Failed to build the result blob\n");
 			return rc;
 		}
-		return 0; /* success */
 	}
 
-	index = 0;
-	hit = 0;
-	/* Perform the tf table allocation by filling the alloc params */
-	if (tbl->srch_b4_alloc) {
+	if (search) {
+		/* Use the result blob to perform a search */
 		memset(&srchparms, 0, sizeof(srchparms));
 		srchparms.dir = tbl->direction;
 		srchparms.type = tbl->resource_type;
@@ -1948,12 +2065,15 @@  ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		index = srchparms.idx;
 		hit = srchparms.hit;
-	} else {
+		if (hit)
+			write = false;
+		else
+			write = true;
+	}
+
+	if (alloc) {
 		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_BITS_2_BYTE(tmplen);
 		aparms.tbl_scope_id	= tbl_scope_id;
 
 		/* All failures after the alloc succeeds require a free */
@@ -1967,39 +2087,43 @@  ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		index = aparms.idx;
 	}
 
-	/*
-	 * 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 (tbl->resource_type == TF_TBL_TYPE_EXT)
-		idx = TF_ACT_REC_OFFSET_2_PTR(index);
-	else
-		idx = index;
+	if (search || alloc) {
+		/*
+		 * Store the index in the regfile since we either allocated it
+		 * or it was a hit.
+		 *
+		 * 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 (tbl->resource_type == TF_TBL_TYPE_EXT)
+			regval = TF_ACT_REC_OFFSET_2_PTR(index);
+		else
+			regval = index;
 
-	/* Always storing values in Regfile in BE */
-	idx = tfp_cpu_to_be_64(idx);
-	if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_ALLOCATE) {
-		rc = ulp_regfile_write(parms->regfile, tbl->index_operand, idx);
+		rc = ulp_regfile_write(parms->regfile,
+				       tbl->tbl_operand,
+				       tfp_cpu_to_be_64(regval));
 		if (!rc) {
-			BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n",
-				    tbl->index_operand);
+			BNXT_TF_DBG(ERR, "Failed to write regfile[%d] rc=%d\n",
+				    tbl->tbl_operand, rc);
 			goto error;
 		}
 	}
 
-	/* Perform the tf table set by filling the set params */
-	if (!tbl->srch_b4_alloc || !hit) {
-		sparms.dir		= tbl->direction;
-		sparms.type		= tbl->resource_type;
-		sparms.data		= ulp_blob_data_get(&data, &tmplen);
+	if (write) {
+		sparms.dir = tbl->direction;
+		sparms.type = tbl->resource_type;
+		sparms.data = ulp_blob_data_get(&data, &tmplen);
 		sparms.data_sz_in_bytes = ULP_BITS_2_BYTE(tmplen);
-		sparms.idx		= index;
-		sparms.tbl_scope_id	= tbl_scope_id;
-
+		sparms.idx = index;
+		sparms.tbl_scope_id = tbl_scope_id;
 		rc = tf_set_tbl_entry(tfp, &sparms);
 		if (rc) {
-			BNXT_TF_DBG(ERR, "Set table[%s][%s][%x] failed rc=%d\n",
+			BNXT_TF_DBG(ERR,
+				    "Index table[%s][%s][%x] write failed "
+				    "rc=%d\n",
 				    tf_tbl_type_2_str(sparms.type),
 				    tf_dir_2_str(sparms.dir),
 				    sparms.idx, rc);
@@ -2014,7 +2138,7 @@  ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.resource_type	= tbl->resource_type;
 	fid_parms.resource_sub_type = tbl->resource_sub_type;
 	fid_parms.resource_hndl	= index;
-	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	fid_parms.critical_resource = tbl->critical_resource;
 
 	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc) {
@@ -2051,15 +2175,15 @@  static int32_t
 ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_result_field_info *flds;
-	struct ulp_blob	data;
+	struct ulp_blob	data, res_blob;
 	uint64_t idx;
 	uint16_t tmplen;
-	uint32_t i, num_flds;
 	int32_t rc = 0;
 	struct tf_set_if_tbl_entry_parms iftbl_params = { 0 };
+	struct tf_get_if_tbl_entry_parms get_parms = { 0 };
 	struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
-	uint32_t encap_flds;
+	enum bnxt_ulp_if_tbl_opc if_opc = tbl->tbl_opcode;
+	uint32_t res_size;
 
 	/* Initialize the blob data */
 	if (!ulp_blob_init(&data, tbl->result_bit_size,
@@ -2068,34 +2192,64 @@  ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	/* Get the result fields list */
-	flds = ulp_mapper_result_fields_get(parms, tbl, &num_flds, &encap_flds);
-
-	if (!flds || !num_flds || encap_flds) {
-		BNXT_TF_DBG(ERR, "template undefined for the IF table\n");
-		return -EINVAL;
+	/* create the result blob */
+	rc = ulp_mapper_tbl_result_build(parms, tbl, &data, "IFtable Result");
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to build the result blob\n");
+		return rc;
 	}
 
-	/* process the result fields, loop through them */
-	for (i = 0; i < num_flds; i++) {
-		/* Process the result fields */
-		rc = ulp_mapper_result_field_process(parms,
-						     tbl->direction,
-						     &flds[i],
-						     &data,
-						     "IFtable Result");
+	/* Get the index details */
+	switch (if_opc) {
+	case BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD:
+		idx = ULP_COMP_FLD_IDX_RD(parms, tbl->tbl_operand);
+		break;
+	case BNXT_ULP_IF_TBL_OPC_WR_REGFILE:
+		if (!ulp_regfile_read(parms->regfile, tbl->tbl_operand, &idx)) {
+			BNXT_TF_DBG(ERR, "regfile[%d] read oob\n",
+				    tbl->tbl_operand);
+			return -EINVAL;
+		}
+		idx = tfp_be_to_cpu_64(idx);
+		break;
+	case BNXT_ULP_IF_TBL_OPC_WR_CONST:
+		idx = tbl->tbl_operand;
+		break;
+	case BNXT_ULP_IF_TBL_OPC_RD_COMP_FIELD:
+		/* Initialize the result blob */
+		if (!ulp_blob_init(&res_blob, tbl->result_bit_size,
+				   parms->device_params->byte_order)) {
+			BNXT_TF_DBG(ERR, "Failed initial result blob\n");
+			return -EINVAL;
+		}
+
+		/* read the interface table */
+		idx = ULP_COMP_FLD_IDX_RD(parms, tbl->tbl_operand);
+		res_size = ULP_BITS_2_BYTE(tbl->result_bit_size);
+		get_parms.dir = tbl->direction;
+		get_parms.type = tbl->resource_type;
+		get_parms.idx = idx;
+		get_parms.data = ulp_blob_data_get(&res_blob, &tmplen);
+		get_parms.data_sz_in_bytes = res_size;
+
+		rc = tf_get_if_tbl_entry(tfp, &get_parms);
 		if (rc) {
-			BNXT_TF_DBG(ERR, "data field failed\n");
+			BNXT_TF_DBG(ERR, "Get table[%d][%s][%x] failed rc=%d\n",
+				    get_parms.type,
+				    tf_dir_2_str(get_parms.dir),
+				    get_parms.idx, rc);
 			return rc;
 		}
-	}
-
-	/* Get the index details from computed field */
-	if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_COMP_FIELD) {
-		idx = ULP_COMP_FLD_IDX_RD(parms, tbl->index_operand);
-	} else if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_CONSTANT) {
-		idx = tbl->index_operand;
-	} else {
+		rc = ulp_mapper_tbl_ident_scan_ext(parms, tbl,
+						   res_blob.data,
+						   res_size,
+						   res_blob.byte_order);
+		if (rc)
+			BNXT_TF_DBG(ERR, "Scan and extract failed rc=%d\n", rc);
+		return rc;
+	case BNXT_ULP_IF_TBL_OPC_NOT_USED:
+		return rc; /* skip it */
+	default:
 		BNXT_TF_DBG(ERR, "Invalid tbl index opcode\n");
 		return -EINVAL;
 	}
@@ -2123,98 +2277,20 @@  ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
-/*
- * Process the identifier list in the generic table.
- * Extract the ident from the generic table entry and
- * write it to the reg file.
- */
-static int32_t
-ulp_mapper_gen_tbl_ident_scan(struct bnxt_ulp_mapper_parms *parms,
-			      struct bnxt_ulp_mapper_tbl_info *tbl,
-			      struct ulp_mapper_gen_tbl_entry *gen_tbl_ent)
-{
-	struct bnxt_ulp_mapper_ident_info *idents;
-	uint32_t i, idx, num_idents = 0;
-	int32_t rc = 0;
-
-	/* Get the ident list */
-	idents = ulp_mapper_ident_fields_get(parms, tbl, &num_idents);
-
-	for (i = 0; i < num_idents; i++) {
-		/* Extract the index from the result byte data array */
-		rc = ulp_mapper_gen_tbl_entry_data_get(gen_tbl_ent,
-						       idents[i].ident_bit_pos,
-						       idents[i].ident_bit_size,
-						       (uint8_t *)&idx,
-						       sizeof(idx));
-
-		/* validate the extraction */
-		if (rc) {
-			BNXT_TF_DBG(ERR, "failed to read %s:%x:%x\n",
-				    idents[i].description,
-				    idents[i].ident_bit_pos,
-				    idents[i].ident_bit_size);
-			return -EINVAL;
-		}
-
-		/* Write it to the regfile */
-		if (!ulp_regfile_write(parms->regfile,
-				       idents[i].regfile_idx, idx)) {
-			BNXT_TF_DBG(ERR, "Regfile[%d] write failed.\n",
-				    idents[i].regfile_idx);
-			return -EINVAL;
-		}
-	}
-	return 0;
-}
-
-/*
- * Process the identifier list in the generic table.
- * Write the ident to the generic table entry
- */
-static int32_t
-ulp_mapper_gen_tbl_ident_write(struct bnxt_ulp_mapper_parms *parms,
-			       struct bnxt_ulp_mapper_tbl_info *tbl,
-			       struct ulp_mapper_gen_tbl_entry *gen_tbl_ent)
-{
-	struct bnxt_ulp_mapper_ident_info *idents;
-	uint32_t i, num_idents = 0;
-	uint64_t idx;
-
-	/* Get the ident list */
-	idents = ulp_mapper_ident_fields_get(parms, tbl, &num_idents);
-
-	for (i = 0; i < num_idents; i++) {
-		/* read from the regfile */
-		if (!ulp_regfile_read(parms->regfile, idents[i].regfile_idx,
-				      &idx)) {
-			BNXT_TF_DBG(ERR, "Regfile[%d] write failed.\n",
-				    idents[i].regfile_idx);
-			return -EINVAL;
-		}
-
-		/* Update the gen tbl entry with the new data */
-		ulp_mapper_gen_tbl_entry_data_set(gen_tbl_ent,
-						  idents[i].ident_bit_pos,
-						  idents[i].ident_bit_size,
-						  (uint8_t *)&idx);
-	}
-	return 0;
-}
-
 static int32_t
 ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			   struct bnxt_ulp_mapper_tbl_info *tbl)
 {
 	struct bnxt_ulp_mapper_key_field_info *kflds;
 	struct ulp_flow_db_res_params fid_parms;
-	struct ulp_mapper_gen_tbl_entry gen_tbl_ent;
+	struct ulp_mapper_gen_tbl_entry gen_tbl_ent, *g;
 	uint16_t tmplen;
-	struct ulp_blob key;
+	struct ulp_blob key, data;
 	uint8_t *cache_key;
 	int32_t tbl_idx;
 	uint32_t i, ckey, num_kflds = 0;
 	uint32_t gen_tbl_hit = 0, fdb_write = 0;
+	uint8_t *byte_data;
 	int32_t rc = 0;
 
 	/* Get the key fields list and build the key. */
@@ -2265,9 +2341,12 @@  ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	case BNXT_ULP_GENERIC_TBL_OPC_READ:
 		/* check the reference count */
 		if (ULP_GEN_TBL_REF_CNT(&gen_tbl_ent)) {
+			g = &gen_tbl_ent;
 			/* Scan ident list and create the result blob*/
-			rc = ulp_mapper_gen_tbl_ident_scan(parms, tbl,
-							   &gen_tbl_ent);
+			rc = ulp_mapper_tbl_ident_scan_ext(parms, tbl,
+							   g->byte_data,
+							   g->byte_data_size,
+							   g->byte_order);
 			if (rc) {
 				BNXT_TF_DBG(ERR,
 					    "Failed to scan ident list\n");
@@ -2290,11 +2369,26 @@  ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			return -EINVAL; /* success */
 		}
 
-		/* Create the result blob from the ident list */
-		rc = ulp_mapper_gen_tbl_ident_write(parms, tbl, &gen_tbl_ent);
+		/* Initialize the blob data */
+		if (!ulp_blob_init(&data, tbl->result_bit_size,
+				   BNXT_ULP_BYTE_ORDER_BE)) {
+			BNXT_TF_DBG(ERR, "Failed initial index table blob\n");
+			return -EINVAL;
+		}
+
+		/* Get the result fields list */
+		rc = ulp_mapper_tbl_result_build(parms, tbl, &data,
+						 "Gen tbl Result");
 		if (rc) {
-			BNXT_TF_DBG(ERR,
-				    "Failed to write  ident list\n");
+			BNXT_TF_DBG(ERR, "Failed to build the result blob\n");
+			return rc;
+		}
+		byte_data = ulp_blob_data_get(&data, &tmplen);
+		rc = ulp_mapper_gen_tbl_entry_data_set(&gen_tbl_ent, 0,
+						       tmplen, byte_data,
+						       ULP_BITS_2_BYTE(tmplen));
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Failed to write generic table\n");
 			return -EINVAL;
 		}
 
@@ -2310,7 +2404,7 @@  ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	/* Set the generic entry hit */
 	rc = ulp_regfile_write(parms->regfile,
 			       BNXT_ULP_REGFILE_INDEX_GENERIC_TBL_HIT,
-			       gen_tbl_hit);
+			       tfp_cpu_to_be_64(gen_tbl_hit));
 	if (!rc) {
 		BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n",
 			    tbl->index_operand);
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
index ddc396b3f9..b9a81d881b 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
@@ -3,6 +3,8 @@ 
  * All rights reserved.
  */
 
+/* date: Thu Oct 15 17:28:37 2020 */
+
 #ifndef ULP_TEMPLATE_DB_H_
 #define ULP_TEMPLATE_DB_H_
 
@@ -230,6 +232,26 @@  enum bnxt_ulp_hdr_type {
 	BNXT_ULP_HDR_TYPE_LAST = 3
 };
 
+enum bnxt_ulp_if_tbl_opc {
+	BNXT_ULP_IF_TBL_OPC_NOT_USED = 0,
+	BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD = 1,
+	BNXT_ULP_IF_TBL_OPC_WR_REGFILE = 2,
+	BNXT_ULP_IF_TBL_OPC_WR_CONST = 3,
+	BNXT_ULP_IF_TBL_OPC_RD_COMP_FIELD = 4,
+	BNXT_ULP_IF_TBL_OPC_LAST = 5
+};
+
+enum bnxt_ulp_index_tbl_opc {
+	BNXT_ULP_INDEX_TBL_OPC_NOT_USED = 0,
+	BNXT_ULP_INDEX_TBL_OPC_ALLOC_REGFILE = 1,
+	BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE = 2,
+	BNXT_ULP_INDEX_TBL_OPC_SRCH_ALLOC_WR_REGFILE = 3,
+	BNXT_ULP_INDEX_TBL_OPC_WR_GLB_REGFILE = 4,
+	BNXT_ULP_INDEX_TBL_OPC_WR_REGFILE = 5,
+	BNXT_ULP_INDEX_TBL_OPC_RD_REGFILE = 6,
+	BNXT_ULP_INDEX_TBL_OPC_LAST = 7
+};
+
 enum bnxt_ulp_index_opcode {
 	BNXT_ULP_INDEX_OPCODE_NOT_USED = 0,
 	BNXT_ULP_INDEX_OPCODE_ALLOCATE = 1,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
index be6149b9ce..73f57409a9 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
@@ -56,8 +56,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -73,7 +73,7 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
 	.index_operand = BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_SRC_PTR_0
 	},
 	{
@@ -90,8 +90,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_DST_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_DST_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -105,8 +105,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 0,
 	.encap_num_fields = 12,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_GLOBAL,
-	.index_operand = BNXT_ULP_GLB_REGFILE_INDEX_ENCAP_MAC_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_WR_GLB_REGFILE,
+	.tbl_operand = BNXT_ULP_GLB_REGFILE_INDEX_ENCAP_MAC_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -121,8 +121,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -137,8 +137,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -154,8 +154,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -170,8 +170,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -186,8 +186,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -203,8 +203,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -219,8 +219,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -235,8 +235,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -252,8 +252,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -269,7 +269,7 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 0,
 	.encap_num_fields = 3,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
 	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_SP_PTR
 	},
 	{
@@ -286,8 +286,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 0,
 	.encap_num_fields = 3,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_SP_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_SP_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -301,8 +301,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 0,
 	.encap_num_fields = 12,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_ENCAP_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_ENCAP_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -317,8 +317,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 12,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -333,8 +333,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -350,8 +350,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -367,8 +367,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_SRC_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_SRC_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -384,7 +384,7 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
 	.index_operand = BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_DST_PTR_0
 	},
 	{
@@ -400,8 +400,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 0,
 	.encap_num_fields = 12,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_GLOBAL,
-	.index_operand = BNXT_ULP_GLB_REGFILE_INDEX_ENCAP_MAC_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_WR_GLB_REGFILE,
+	.tbl_operand = BNXT_ULP_GLB_REGFILE_INDEX_ENCAP_MAC_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -416,8 +416,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -432,8 +432,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 11,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -449,8 +449,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -467,7 +467,7 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 0,
 	.encap_num_fields = 12,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
 	.index_operand = BNXT_ULP_REGFILE_INDEX_ENCAP_PTR_0
 	},
 	{
@@ -483,8 +483,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -501,8 +501,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -519,8 +519,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 11,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	}
 };
 
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
index a505337bb2..0cd9518e2a 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
@@ -202,8 +202,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{ /* class_tid: 1, wh_plus, table: l2_cntxt_cache_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INVALID,
@@ -250,8 +250,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_COMP_FIELD,
-	.index_operand = BNXT_ULP_CF_IDX_PHY_PORT_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD,
+	.tbl_operand = BNXT_ULP_CF_IDX_PHY_PORT_PARIF,
 	},
 	{ /* class_tid: 1, wh_plus, table: parif_def_arec_ptr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IF_TABLE,
@@ -261,8 +261,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_COMP_FIELD,
-	.index_operand = BNXT_ULP_CF_IDX_PHY_PORT_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD,
+	.tbl_operand = BNXT_ULP_CF_IDX_PHY_PORT_PARIF
 	},
 	{ /* class_tid: 1, wh_plus, table: parif_def_err_arec_ptr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IF_TABLE,
@@ -272,8 +272,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_COMP_FIELD,
-	.index_operand = BNXT_ULP_CF_IDX_PHY_PORT_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD,
+	.tbl_operand = BNXT_ULP_CF_IDX_PHY_PORT_PARIF
 	},
 	{ /* class_tid: 2, wh_plus, table: int_full_act_record_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -287,8 +287,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{ /* class_tid: 2, wh_plus, table: l2_cntxt_tcam_vfr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
@@ -361,8 +361,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_COMP_FIELD,
-	.index_operand = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD,
+	.tbl_operand = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF
 	},
 	{ /* class_tid: 2, wh_plus, table: parif_def_arec_ptr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IF_TABLE,
@@ -372,8 +372,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_COMP_FIELD,
-	.index_operand = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD,
+	.tbl_operand = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF
 	},
 	{ /* class_tid: 2, wh_plus, table: parif_def_err_arec_ptr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IF_TABLE,
@@ -383,8 +383,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_COMP_FIELD,
-	.index_operand = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD,
+	.tbl_operand = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF
 	},
 	{ /* class_tid: 3, wh_plus, table: egr_int_vtag_encap_record_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -398,8 +398,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 0,
 	.encap_num_fields = 12,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_ENCAP_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_ENCAP_PTR_0
 	},
 	{ /* class_tid: 3, wh_plus, table: egr_int_full_act_record_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -413,8 +413,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{ /* class_tid: 3, wh_plus, table: egr_l2_cntxt_cache_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INVALID,
@@ -465,8 +465,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{ /* class_tid: 3, wh_plus, table: ing_l2_cntxt_dtagged_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
@@ -551,8 +551,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_CONSTANT,
-	.index_operand = BNXT_ULP_SYM_VF_FUNC_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_CONST,
+	.tbl_operand = BNXT_ULP_SYM_VF_FUNC_PARIF
 	},
 	{ /* class_tid: 4, wh_plus, table: egr_parif_def_arec_ptr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IF_TABLE,
@@ -562,8 +562,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_CONSTANT,
-	.index_operand = BNXT_ULP_SYM_VF_FUNC_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_CONST,
+	.tbl_operand = BNXT_ULP_SYM_VF_FUNC_PARIF
 	},
 	{ /* class_tid: 4, wh_plus, table: egr_parif_def_err_arec_ptr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IF_TABLE,
@@ -573,8 +573,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_bit_size = 32,
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_CONSTANT,
-	.index_operand = BNXT_ULP_SYM_VF_FUNC_PARIF
+	.tbl_opcode = BNXT_ULP_IF_TBL_OPC_WR_CONST,
+	.tbl_operand = BNXT_ULP_SYM_VF_FUNC_PARIF
 	},
 	{ /* class_tid: 4, wh_plus, table: ing_int_full_act_record_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
@@ -588,8 +588,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_SET_VFR_FLAG,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR
 	},
 	{ /* class_tid: 4, wh_plus, table: ing_l2_cntxt_tcam_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
@@ -623,8 +623,9 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 26,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_GLOBAL,
-	.index_operand = BNXT_ULP_GLB_REGFILE_INDEX_GLB_LB_AREC_PTR
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_WR_GLB_REGFILE,
+	.tbl_operand = BNXT_ULP_GLB_REGFILE_INDEX_GLB_LB_AREC_PTR,
+	.fdb_opcode = BNXT_ULP_FDB_OPC_NOP
 	},
 	{ /* class_tid: 6, wh_plus, table: l2_cntxt_tcam_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
@@ -1824,8 +1825,8 @@  struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.result_num_fields = 1,
 	.encap_num_fields = 0,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP,
-	.index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE,
-	.index_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
+	.tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
+	.tbl_operand = BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0
 	},
 	{ /* class_tid: 18, wh_plus, table: l2_cntxt_tcam_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,