DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
To: dev@dpdk.org
Cc: Shuanglin Wang <shuanglin.wang@broadcom.com>,
	Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Subject: [PATCH 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard
Date: Fri, 30 Aug 2024 19:30:30 +0530	[thread overview]
Message-ID: <20240830140049.1715230-29-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20240830140049.1715230-1-sriharsha.basavapatna@broadcom.com>

From: Shuanglin Wang <shuanglin.wang@broadcom.com>

Modified return values of the several ULP utilities to comply C
coding standard.  Like using macros EXIT_SUCCESS(0) and
EXIT_FAILURE(1) for the conventional status value for success
and failure, respectively. They are declared in the file stdlib.h.

Signed-off-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     | 172 +++++++++++------------
 drivers/net/bnxt/tf_ulp/ulp_mapper_tf.c  |  40 +++---
 drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c |  50 +++----
 drivers/net/bnxt/tf_ulp/ulp_utils.c      |  70 ++++-----
 drivers/net/bnxt/tf_ulp/ulp_utils.h      |  26 ++--
 5 files changed, 181 insertions(+), 177 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index b44b25429f..ff57469aa3 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -573,7 +573,7 @@ ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms,
 		/* get the fid from the regfile */
 		rc = ulp_regfile_read(parms->regfile, tbl->fdb_operand,
 				      &val64);
-		if (!rc) {
+		if (rc) {
 			BNXT_DRV_DBG(ERR, "regfile[%d] read oob\n",
 				     tbl->fdb_operand);
 			return -EINVAL;
@@ -630,8 +630,8 @@ ulp_mapper_priority_opc_process(struct bnxt_ulp_mapper_parms *parms,
 			*priority = tbl->pri_operand;
 		break;
 	case BNXT_ULP_PRI_OPC_REGFILE:
-		if (!ulp_regfile_read(parms->regfile, tbl->pri_operand,
-				      &regval)) {
+		if (ulp_regfile_read(parms->regfile, tbl->pri_operand,
+				     &regval)) {
 			BNXT_DRV_DBG(ERR, "regfile[%u] read oob\n",
 				     tbl->pri_operand);
 			rc = -EINVAL;
@@ -880,8 +880,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		*value = 1;
 		break;
 	case BNXT_ULP_FIELD_SRC_CF:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "CF operand read failed\n");
 			return -EINVAL;
 		}
@@ -896,15 +896,15 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		*value = ULP_COMP_FLD_IDX_RD(parms, idx);
 		break;
 	case BNXT_ULP_FIELD_SRC_RF:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "RF operand read failed\n");
 			return -EINVAL;
 		}
 
 		idx = tfp_be_to_cpu_16(idx);
 		/* Uninitialized regfile entries return 0 */
-		if (!ulp_regfile_read(parms->regfile, idx, &lregval) ||
+		if (ulp_regfile_read(parms->regfile, idx, &lregval) ||
 		    sizeof(uint64_t) < bytelen) {
 			BNXT_DRV_DBG(ERR, "regfile[%d] read oob %u\n", idx,
 				     bytelen);
@@ -915,8 +915,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		*value = tfp_be_to_cpu_64(lregval);
 		break;
 	case BNXT_ULP_FIELD_SRC_ACT_PROP:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Action operand read failed\n");
 			return -EINVAL;
 		}
@@ -940,8 +940,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	case BNXT_ULP_FIELD_SRC_ACT_PROP_SZ:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Action sz operand read failed\n");
 			return -EINVAL;
 		}
@@ -954,8 +954,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		*val = &parms->act_prop->act_details[idx];
 
 		/* get the size index next */
-		if (!ulp_operand_read(&field_opr[sizeof(uint16_t)],
-				      (uint8_t *)&size_idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(&field_opr[sizeof(uint16_t)],
+				     (uint8_t *)&size_idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Action sz operand read failed\n");
 			return -EINVAL;
 		}
@@ -970,8 +970,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		*val_len = ULP_BYTE_2_BITS(val_size);
 		break;
 	case BNXT_ULP_FIELD_SRC_GLB_RF:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Global regfile read failed\n");
 			return -EINVAL;
 		}
@@ -990,8 +990,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		break;
 	case BNXT_ULP_FIELD_SRC_HF:
 	case BNXT_ULP_FIELD_SRC_SUB_HF:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Header field read failed\n");
 			return -EINVAL;
 		}
@@ -1021,9 +1021,9 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 			*val = &buffer[field_size - bytelen];
 		} else {
 			/* get the offset next */
-			if (!ulp_operand_read(&field_opr[sizeof(uint16_t)],
-					      (uint8_t *)&offset,
-					      sizeof(uint16_t))) {
+			if (ulp_operand_read(&field_opr[sizeof(uint16_t)],
+					     (uint8_t *)&offset,
+					     sizeof(uint16_t))) {
 				BNXT_DRV_DBG(ERR, "Hdr fld size read failed\n");
 				return -EINVAL;
 			}
@@ -1037,8 +1037,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	case BNXT_ULP_FIELD_SRC_HDR_BIT:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&lregval, sizeof(uint64_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&lregval, sizeof(uint64_t))) {
 			BNXT_DRV_DBG(ERR, "Header bit read failed\n");
 			return -EINVAL;
 		}
@@ -1051,8 +1051,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	case BNXT_ULP_FIELD_SRC_ACT_BIT:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&lregval, sizeof(uint64_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&lregval, sizeof(uint64_t))) {
 			BNXT_DRV_DBG(ERR, "Action bit read failed\n");
 			return -EINVAL;
 		}
@@ -1065,8 +1065,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	case BNXT_ULP_FIELD_SRC_FIELD_BIT:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Field bit read failed\n");
 			return -EINVAL;
 		}
@@ -1085,8 +1085,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	case BNXT_ULP_FIELD_SRC_PORT_TABLE:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "CF operand read failed\n");
 			return -EINVAL;
 		}
@@ -1100,8 +1100,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		/* The port id is present in the comp field list */
 		port_id = ULP_COMP_FLD_IDX_RD(parms, idx);
 		/* get the port table enum  */
-		if (!ulp_operand_read(field_opr + sizeof(uint16_t),
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr + sizeof(uint16_t),
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Port table enum read failed\n");
 			return -EINVAL;
 		}
@@ -1113,8 +1113,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	case BNXT_ULP_FIELD_SRC_ENC_HDR_BIT:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&lregval, sizeof(uint64_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&lregval, sizeof(uint64_t))) {
 			BNXT_DRV_DBG(ERR, "Header bit read failed\n");
 			return -EINVAL;
 		}
@@ -1127,8 +1127,8 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	case BNXT_ULP_FIELD_SRC_ENC_FIELD:
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Header field read failed\n");
 			return -EINVAL;
 		}
@@ -1158,15 +1158,15 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
 	case BNXT_ULP_FIELD_SRC_LIST_AND:
 	case BNXT_ULP_FIELD_SRC_LIST_OR:
 		/* read the cond table index and count */
-		if (!ulp_operand_read(field_opr,
-				      (uint8_t *)&idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr,
+				     (uint8_t *)&idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Cond idx operand read failed\n");
 			return -EINVAL;
 		}
 		idx = tfp_be_to_cpu_16(idx);
 
-		if (!ulp_operand_read(field_opr + sizeof(uint16_t),
-				      (uint8_t *)&size_idx, sizeof(uint16_t))) {
+		if (ulp_operand_read(field_opr + sizeof(uint16_t),
+				     (uint8_t *)&size_idx, sizeof(uint16_t))) {
 			BNXT_DRV_DBG(ERR, "Cond count operand read failed\n");
 			return -EINVAL;
 		}
@@ -1244,7 +1244,7 @@ static int32_t ulp_mapper_field_blob_write(enum bnxt_ulp_field_src fld_src,
 	} else if (fld_src == BNXT_ULP_FIELD_SRC_SKIP) {
 		/* do nothing */
 	} else {
-		if (!ulp_blob_push(blob, val, val_len)) {
+		if (ulp_blob_push(blob, val, val_len)) {
 			BNXT_DRV_DBG(ERR, "push of val1 failed\n");
 			return -EINVAL;
 		}
@@ -1265,8 +1265,8 @@ ulp_mapper_field_opc_next(struct bnxt_ulp_mapper_parms *parms,
 	uint16_t idx;
 
 	/* read the cond table index and count */
-	if (!ulp_operand_read(field_opr,
-			      (uint8_t *)&idx, sizeof(uint16_t))) {
+	if (ulp_operand_read(field_opr,
+			     (uint8_t *)&idx, sizeof(uint16_t))) {
 		BNXT_DRV_DBG(ERR, "field idx operand read failed\n");
 		return -EINVAL;
 	}
@@ -1534,8 +1534,8 @@ ulp_mapper_key_recipe_fields_get(struct bnxt_ulp_mapper_parms *parms,
 	};
 
 	/* Get the recipe index from the registry file */
-	if (!ulp_regfile_read(parms->regfile, tbl->key_recipe_operand,
-			      &regval)) {
+	if (ulp_regfile_read(parms->regfile, tbl->key_recipe_operand,
+			     &regval)) {
 		BNXT_DRV_DBG(ERR, "Failed to get tbl idx from regfile[%d].\n",
 			     tbl->tbl_operand);
 		return NULL;
@@ -1568,8 +1568,8 @@ ulp_mapper_key_recipe_field_opc_next(struct bnxt_ulp_mapper_parms *parms,
 	uint16_t idx;
 
 	/* read the cond table index and count */
-	if (!ulp_operand_read(field_opr,
-			      (uint8_t *)&idx, sizeof(uint16_t))) {
+	if (ulp_operand_read(field_opr,
+			     (uint8_t *)&idx, sizeof(uint16_t))) {
 		BNXT_DRV_DBG(ERR, "field idx operand read failed\n");
 		return -EINVAL;
 	}
@@ -1749,9 +1749,9 @@ ulp_mapper_key_recipe_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 	/* Get the recipe_id from the regfile */
 	if (!alloc && regfile) {
-		if (!ulp_regfile_read(parms->regfile,
-				      tbl->tbl_operand,
-				      &regval)) {
+		if (ulp_regfile_read(parms->regfile,
+				     tbl->tbl_operand,
+				     &regval)) {
 			BNXT_DRV_DBG(ERR,
 				     "Fail to get tbl idx from regfile[%d].\n",
 				     tbl->tbl_operand);
@@ -2162,9 +2162,9 @@ ulp_mapper_tbl_result_build(struct bnxt_ulp_mapper_parms *parms,
 	if (encap_flds) {
 		uint32_t pad = 0;
 		/* Initialize the encap blob */
-		if (!ulp_blob_init(&encap_blob,
-				   ULP_BYTE_2_BITS(tbl->record_size),
-				   parms->device_params->encap_byte_order)) {
+		if (ulp_blob_init(&encap_blob,
+				  ULP_BYTE_2_BITS(tbl->record_size),
+				  parms->device_params->encap_byte_order)) {
 			BNXT_DRV_DBG(ERR, "blob inits failed.\n");
 			return -EINVAL;
 		}
@@ -2276,9 +2276,9 @@ ulp_mapper_mark_act_ptr_process(struct bnxt_ulp_mapper_parms *parms,
 	       sizeof(mark));
 	mark = tfp_be_to_cpu_32(mark);
 
-	if (!ulp_regfile_read(parms->regfile,
-			      BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
-			      &val64)) {
+	if (ulp_regfile_read(parms->regfile,
+			     BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
+			     &val64)) {
 		BNXT_DRV_DBG(ERR, "read action ptr main failed\n");
 		return -EINVAL;
 	}
@@ -2321,9 +2321,9 @@ ulp_mapper_mark_vfr_idx_process(struct bnxt_ulp_mapper_parms *parms,
 	mark = ULP_COMP_FLD_IDX_RD(parms, BNXT_ULP_CF_IDX_DEV_PORT_ID);
 
 	 /* Get the main action pointer */
-	if (!ulp_regfile_read(parms->regfile,
-			      BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
-			      &val64)) {
+	if (ulp_regfile_read(parms->regfile,
+			     BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
+			     &val64)) {
 		BNXT_DRV_DBG(ERR, "read action ptr main failed\n");
 		return -EINVAL;
 	}
@@ -2425,8 +2425,8 @@ ulp_mapper_wc_tcam_tbl_dyn_post_process(struct bnxt_ulp_device_params *dparms,
 
 	/* The new length accounts for the ctrl word length and num slices */
 	tlen = tlen + clen * num_slices;
-	if (!ulp_blob_init(tkey, tlen, key->byte_order) ||
-	    !ulp_blob_init(tmask, tlen, mask->byte_order)) {
+	if (ulp_blob_init(tkey, tlen, key->byte_order) ||
+	    ulp_blob_init(tmask, tlen, mask->byte_order)) {
 		BNXT_DRV_DBG(ERR, "Unable to post process wc tcam entry\n");
 		return -EINVAL;
 	}
@@ -2560,9 +2560,9 @@ ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		pad = ULP_BYTE_2_BITS(sizeof(uint8_t)) -
 		ULP_BITS_IS_BYTE_NOT_ALIGNED(tbl->key_bit_size);
 
-	if (!ulp_blob_init(&key, tbl->key_bit_size + pad +
-			   tbl->partial_key_bit_size,
-			   parms->device_params->key_byte_order)) {
+	if (ulp_blob_init(&key, tbl->key_bit_size + pad +
+			  tbl->partial_key_bit_size,
+			  parms->device_params->key_byte_order)) {
 		BNXT_DRV_DBG(ERR, "Failed to alloc blob\n");
 		return -EINVAL;
 	}
@@ -2722,8 +2722,8 @@ ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 
 		/* Initialize the blob data */
-		if (!ulp_blob_init(&data, tbl->result_bit_size,
-				   gen_tbl_ent.byte_order)) {
+		if (ulp_blob_init(&data, tbl->result_bit_size,
+				  gen_tbl_ent.byte_order)) {
 			BNXT_DRV_DBG(ERR, "Failed initial index table blob\n");
 			return -EINVAL;
 		}
@@ -2816,7 +2816,7 @@ ulp_mapper_ctrl_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 	} else if (tbl->fdb_opcode == BNXT_ULP_FDB_OPC_DELETE_RID_REGFILE) {
 		rc = ulp_regfile_read(parms->regfile, tbl->fdb_operand, &val64);
-		if (!rc) {
+		if (rc) {
 			BNXT_DRV_DBG(ERR, "Failed to get RID from regfile\n");
 			return rc;
 		}
@@ -2959,8 +2959,8 @@ ulp_mapper_global_register_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	uint8_t ttype;
 
 	/* Initialize the blob data */
-	if (!ulp_blob_init(&data, tbl->result_bit_size,
-			   BNXT_ULP_BYTE_ORDER_BE)) {
+	if (ulp_blob_init(&data, tbl->result_bit_size,
+			  BNXT_ULP_BYTE_ORDER_BE)) {
 		BNXT_DRV_DBG(ERR, "Failed initial ulp_global table blob\n");
 		return -EINVAL;
 	}
@@ -3213,7 +3213,7 @@ ulp_mapper_cond_opc_process(struct bnxt_ulp_mapper_parms *parms,
 		result = !ULP_INDEX_BITMAP_GET(parms->fld_bitmap->bits, bit);
 		break;
 	case BNXT_ULP_COND_OPC_RF_IS_SET:
-		if (!ulp_regfile_read(parms->regfile, operand, &regval)) {
+		if (ulp_regfile_read(parms->regfile, operand, &regval)) {
 			BNXT_DRV_DBG(ERR,
 				     "regfile[%" PRIu64 "] read oob\n",
 				     operand);
@@ -3222,7 +3222,7 @@ ulp_mapper_cond_opc_process(struct bnxt_ulp_mapper_parms *parms,
 		result = regval != 0;
 		break;
 	case BNXT_ULP_COND_OPC_RF_NOT_SET:
-		if (!ulp_regfile_read(parms->regfile, operand, &regval)) {
+		if (ulp_regfile_read(parms->regfile, operand, &regval)) {
 			BNXT_DRV_DBG(ERR,
 				    "regfile[%" PRIu64 "] read oob\n", operand);
 			return -EINVAL;
@@ -3369,7 +3369,7 @@ ulp_mapper_func_opr_compute(struct bnxt_ulp_mapper_parms *parms,
 		*result = ULP_COMP_FLD_IDX_RD(parms, func_opr);
 		break;
 	case BNXT_ULP_FUNC_SRC_REGFILE:
-		if (!ulp_regfile_read(parms->regfile, func_opr, &regval)) {
+		if (ulp_regfile_read(parms->regfile, func_opr, &regval)) {
 			BNXT_DRV_DBG(ERR, "regfile[%d] read oob\n",
 						(uint32_t)func_opr);
 			return -EINVAL;
@@ -3480,9 +3480,9 @@ ulp_mapper_func_cond_list_process(struct bnxt_ulp_mapper_parms *parms,
 	if (value) {
 		if (fld->field_src2 == BNXT_ULP_FIELD_SRC_NEXT) {
 			/* read the next key ext table index */
-			if (!ulp_operand_read(fld->field_opr2,
-					      (uint8_t *)&ext_idx,
-					      sizeof(uint16_t))) {
+			if (ulp_operand_read(fld->field_opr2,
+					     (uint8_t *)&ext_idx,
+					     sizeof(uint16_t))) {
 				BNXT_DRV_DBG(ERR,
 					     "field idx operand read failed\n");
 				return -EINVAL;
@@ -3507,9 +3507,9 @@ ulp_mapper_func_cond_list_process(struct bnxt_ulp_mapper_parms *parms,
 	} else {
 		if (fld->field_src3 == BNXT_ULP_FIELD_SRC_NEXT) {
 			/* read the next key ext table index */
-			if (!ulp_operand_read(fld->field_opr3,
-					      (uint8_t *)&ext_idx,
-					      sizeof(uint16_t))) {
+			if (ulp_operand_read(fld->field_opr3,
+					     (uint8_t *)&ext_idx,
+					     sizeof(uint16_t))) {
 				BNXT_DRV_DBG(ERR,
 					     "field idx operand read failed\n");
 				return -EINVAL;
@@ -3938,9 +3938,9 @@ ulp_mapper_conflict_resolution_process(struct bnxt_ulp_mapper_parms *parms,
 		if (tbl->resource_func ==
 		    BNXT_ULP_RESOURCE_FUNC_GENERIC_TABLE) {
 			/* Perform the check that generic table is hit or not */
-			if (!ulp_regfile_read(parms->regfile,
-					      BNXT_ULP_RF_IDX_GENERIC_TBL_MISS,
-					      &regval)) {
+			if (ulp_regfile_read(parms->regfile,
+					     BNXT_ULP_RF_IDX_GENERIC_TBL_MISS,
+					     &regval)) {
 				BNXT_DRV_DBG(ERR, "regfile[%d] read oob\n",
 					     BNXT_ULP_RF_IDX_GENERIC_TBL_MISS);
 				return -EINVAL;
@@ -3952,9 +3952,9 @@ ulp_mapper_conflict_resolution_process(struct bnxt_ulp_mapper_parms *parms,
 			}
 		}
 		/* compare the new flow signature against stored one */
-		if (!ulp_regfile_read(parms->regfile,
-				      BNXT_ULP_RF_IDX_FLOW_SIG_ID,
-				      &regval)) {
+		if (ulp_regfile_read(parms->regfile,
+				     BNXT_ULP_RF_IDX_FLOW_SIG_ID,
+				     &regval)) {
 			BNXT_DRV_DBG(ERR, "regfile[%d] read oob\n",
 				     BNXT_ULP_RF_IDX_FLOW_SIG_ID);
 			return -EINVAL;
@@ -4111,8 +4111,8 @@ ulp_mapper_tbls_process(struct bnxt_ulp_mapper_parms *parms, void *error)
 
 			/* least significant 16 bits from reg_file index */
 			rf_idx = (uint32_t)(cond_goto & 0xFFFF);
-			if (!ulp_regfile_read(parms->regfile, rf_idx,
-					      &regval)) {
+			if (ulp_regfile_read(parms->regfile, rf_idx,
+					     &regval)) {
 				BNXT_DRV_DBG(ERR, "regfile[%d] read oob\n",
 					     rf_idx);
 				rc = -EINVAL;
@@ -4364,7 +4364,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	}
 
 	/* initialize the registry file for further processing */
-	if (!ulp_regfile_init(parms->regfile)) {
+	if (ulp_regfile_init(parms->regfile)) {
 		BNXT_DRV_DBG(ERR, "regfile initialization failed.\n");
 		return -EINVAL;
 	}
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper_tf.c b/drivers/net/bnxt/tf_ulp/ulp_mapper_tf.c
index 73c2b42a43..c16261047d 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper_tf.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper_tf.c
@@ -135,12 +135,12 @@ ulp_mapper_tf_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	else
 		key_byte_order = dparms->key_byte_order;
 
-	if (!ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
-	    !ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
-	    !ulp_blob_init(&data, tbl->result_bit_size,
-			   dparms->result_byte_order) ||
-	    !ulp_blob_init(&update_data, tbl->result_bit_size,
-			   dparms->result_byte_order)) {
+	if (ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
+	    ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
+	    ulp_blob_init(&data, tbl->result_bit_size,
+			  dparms->result_byte_order) ||
+	    ulp_blob_init(&update_data, tbl->result_bit_size,
+			  dparms->result_byte_order)) {
 		BNXT_DRV_DBG(ERR, "blob inits failed.\n");
 		return -EINVAL;
 	}
@@ -314,8 +314,8 @@ ulp_mapper_tf_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	res_order = dparms->em_byte_order;
 
 	/* Initialize the key/result blobs */
-	if (!ulp_blob_init(&key, tbl->blob_key_bit_size, key_order) ||
-	    !ulp_blob_init(&data, tbl->result_bit_size, res_order)) {
+	if (ulp_blob_init(&key, tbl->blob_key_bit_size, key_order) ||
+	    ulp_blob_init(&data, tbl->result_bit_size, res_order)) {
 		BNXT_DRV_DBG(ERR, "blob inits failed.\n");
 		return -EINVAL;
 	}
@@ -626,8 +626,8 @@ ulp_mapper_tf_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	bit_size = ulp_mapper_tf_dyn_blob_size_get(parms, tbl);
 
 	/* Initialize the blob data */
-	if (!ulp_blob_init(&data, bit_size,
-			   parms->device_params->result_byte_order)) {
+	if (ulp_blob_init(&data, bit_size,
+			  parms->device_params->result_byte_order)) {
 		BNXT_DRV_DBG(ERR, "Failed to initialize index table blob\n");
 		return -EINVAL;
 	}
@@ -656,9 +656,9 @@ ulp_mapper_tf_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		 * 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)) {
+		if (ulp_regfile_read(parms->regfile,
+				    tbl->tbl_operand,
+				    &regval)) {
 			BNXT_DRV_DBG(ERR,
 				    "Failed to get tbl idx from regfile[%d].\n",
 				     tbl->tbl_operand);
@@ -721,8 +721,8 @@ ulp_mapper_tf_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 				     "Ext Table Read Opcode not supported.\n");
 			return -EINVAL;
 		}
-		if (!ulp_regfile_read(parms->regfile,
-				      tbl->tbl_operand, &regval)) {
+		if (ulp_regfile_read(parms->regfile,
+				     tbl->tbl_operand, &regval)) {
 			BNXT_DRV_DBG(ERR,
 				     "Failed to get tbl idx from regfile[%d]\n",
 				     tbl->tbl_operand);
@@ -947,8 +947,8 @@ ulp_mapper_tf_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 	tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->session_type);
 	/* Initialize the blob data */
-	if (!ulp_blob_init(&data, tbl->result_bit_size,
-			   parms->device_params->result_byte_order)) {
+	if (ulp_blob_init(&data, tbl->result_bit_size,
+			  parms->device_params->result_byte_order)) {
 		BNXT_DRV_DBG(ERR, "Failed initial index table blob\n");
 		return -EINVAL;
 	}
@@ -966,7 +966,7 @@ ulp_mapper_tf_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		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)) {
+		if (ulp_regfile_read(parms->regfile, tbl->tbl_operand, &idx)) {
 			BNXT_DRV_DBG(ERR, "regfile[%d] read oob\n",
 				     tbl->tbl_operand);
 			return -EINVAL;
@@ -978,8 +978,8 @@ ulp_mapper_tf_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		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->result_byte_order)) {
+		if (ulp_blob_init(&res_blob, tbl->result_bit_size,
+				  parms->device_params->result_byte_order)) {
 			BNXT_DRV_DBG(ERR, "Failed initial result blob\n");
 			return -EINVAL;
 		}
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
index b3fcc73975..f5c0aca1f1 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
@@ -116,7 +116,7 @@ ulp_mapper_tfc_wc_tcam_post_process(struct bnxt_ulp_device_params *dparms,
 
 	/* The new length accounts for the ctrl word length and num slices */
 	tlen = tlen + (clen + 1) * num_slices;
-	if (!ulp_blob_init(tkey, tlen, key->byte_order)) {
+	if (ulp_blob_init(tkey, tlen, key->byte_order)) {
 		BNXT_DRV_DBG(ERR, "Unable to post process wc tcam entry\n");
 		return -EINVAL;
 	}
@@ -225,9 +225,9 @@ ulp_mapper_tfc_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		key_byte_order = dparms->key_byte_order;
 
 	res_byte_order = dparms->result_byte_order;
-	if (!ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
-	    !ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
-	    !ulp_blob_init(&data, tbl->result_bit_size, res_byte_order)) {
+	if (ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
+	    ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
+	    ulp_blob_init(&data, tbl->result_bit_size, res_byte_order)) {
 		BNXT_DRV_DBG(ERR, "blob inits failed.\n");
 		return -EINVAL;
 	}
@@ -491,8 +491,8 @@ ulp_mapper_tfc_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 	byte_order = dparms->em_byte_order;
 	/* Initialize the key/result blobs */
-	if (!ulp_blob_init(&key, tbl->blob_key_bit_size, byte_order) ||
-	    !ulp_blob_init(&data, tbl->result_bit_size, byte_order)) {
+	if (ulp_blob_init(&key, tbl->blob_key_bit_size, byte_order) ||
+	    ulp_blob_init(&data, tbl->result_bit_size, byte_order)) {
 		BNXT_DRV_DBG(ERR, "blob inits failed.\n");
 		return -EINVAL;
 	}
@@ -780,8 +780,8 @@ ulp_mapper_tfc_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	bit_size = ulp_mapper_tfc_dyn_blob_size_get(parms, tbl);
 
 	/* Initialize the blob data */
-	if (!ulp_blob_init(&data, bit_size,
-			   parms->device_params->result_byte_order)) {
+	if (ulp_blob_init(&data, bit_size,
+			  parms->device_params->result_byte_order)) {
 		BNXT_DRV_DBG(ERR, "Failed to initialize index table blob\n");
 		return -EINVAL;
 	}
@@ -846,8 +846,8 @@ ulp_mapper_tfc_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		 * with the index from the regfile, scan and store the
 		 * identifiers, and return.
 		 */
-		if (!ulp_regfile_read(parms->regfile,
-				      tbl->tbl_operand, &regval)) {
+		if (ulp_regfile_read(parms->regfile,
+				     tbl->tbl_operand, &regval)) {
 			BNXT_DRV_DBG(ERR,
 				     "Failed to get tbl idx from regfile[%d]\n",
 				     tbl->tbl_operand);
@@ -894,9 +894,9 @@ ulp_mapper_tfc_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 	/* read the CMM identifier from the regfile, it is not allocated */
 	if (!alloc && regfile) {
-		if (!ulp_regfile_read(parms->regfile,
-				      tbl->tbl_operand,
-				      &regval)) {
+		if (ulp_regfile_read(parms->regfile,
+				     tbl->tbl_operand,
+				     &regval)) {
 			BNXT_DRV_DBG(ERR,
 				    "Failed to get tbl idx from regfile[%d].\n",
 				     tbl->tbl_operand);
@@ -1093,8 +1093,8 @@ ulp_mapper_tfc_cmm_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	bit_size = ulp_mapper_tfc_dyn_blob_size_get(parms, tbl);
 
 	/* Initialize the blob data */
-	if (!ulp_blob_init(&data, bit_size,
-			   parms->device_params->result_byte_order)) {
+	if (ulp_blob_init(&data, bit_size,
+			  parms->device_params->result_byte_order)) {
 		BNXT_DRV_DBG(ERR, "Failed to initialize cmm table blob\n");
 		return -EINVAL;
 	}
@@ -1159,8 +1159,8 @@ ulp_mapper_tfc_cmm_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		 * with the index from the regfile, scan and store the
 		 * identifiers, and return.
 		 */
-		if (!ulp_regfile_read(parms->regfile,
-				      tbl->tbl_operand, &regval)) {
+		if (ulp_regfile_read(parms->regfile,
+				     tbl->tbl_operand, &regval)) {
 			BNXT_DRV_DBG(ERR,
 				     "Failed to get tbl idx from regfile[%d]\n",
 				     tbl->tbl_operand);
@@ -1180,9 +1180,9 @@ ulp_mapper_tfc_cmm_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 
 	/* read the CMM handle from the regfile, it is not allocated */
 	if (!alloc && regfile) {
-		if (!ulp_regfile_read(parms->regfile,
-				      tbl->tbl_operand,
-				      &regval)) {
+		if (ulp_regfile_read(parms->regfile,
+				     tbl->tbl_operand,
+				     &regval)) {
 			BNXT_DRV_DBG(ERR,
 				    "Failed to get tbl idx from regfile[%d].\n",
 				     tbl->tbl_operand);
@@ -1449,8 +1449,8 @@ ulp_mapper_tfc_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* Initialize the blob data */
-	if (!ulp_blob_init(&data, tbl->result_bit_size,
-			   parms->device_params->result_byte_order)) {
+	if (ulp_blob_init(&data, tbl->result_bit_size,
+			  parms->device_params->result_byte_order)) {
 		BNXT_DRV_DBG(ERR, "Failed initial index table blob\n");
 		return -EINVAL;
 	}
@@ -1468,7 +1468,7 @@ ulp_mapper_tfc_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		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)) {
+		if (ulp_regfile_read(parms->regfile, tbl->tbl_operand, &idx)) {
 			BNXT_DRV_DBG(ERR, "regfile[%d] read oob\n",
 				     tbl->tbl_operand);
 			return -EINVAL;
@@ -1480,8 +1480,8 @@ ulp_mapper_tfc_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		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->result_byte_order)) {
+		if (ulp_blob_init(&res_blob, tbl->result_bit_size,
+				  parms->device_params->result_byte_order)) {
 			BNXT_DRV_DBG(ERR, "Failed initial result blob\n");
 			return -EINVAL;
 		}
diff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.c b/drivers/net/bnxt/tf_ulp/ulp_utils.c
index cf6d1df9f2..c9dbcea4d2 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_utils.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_utils.c
@@ -12,18 +12,18 @@
  *
  * regfile [in] Ptr to a regfile instance
  *
- * returns 0 on error or 1 on success
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_regfile_init(struct ulp_regfile *regfile)
 {
 	/* validate the arguments */
 	if (!regfile) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0; /* failure */
+		return -EINVAL;
 	}
 	memset(regfile, 0, sizeof(struct ulp_regfile));
-	return 1; /* Success */
+	return 0; /* Success */
 }
 
 /*
@@ -35,9 +35,9 @@ ulp_regfile_init(struct ulp_regfile *regfile)
  *
  * data [in/out]
  *
- * returns size, zero on failure
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_regfile_read(struct ulp_regfile *regfile,
 		 enum bnxt_ulp_rf_idx field,
 		 uint64_t *data)
@@ -45,11 +45,11 @@ ulp_regfile_read(struct ulp_regfile *regfile,
 	/* validate the arguments */
 	if (!regfile || field >= BNXT_ULP_RF_IDX_LAST) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0; /* failure */
+		return -EINVAL;
 	}
 
 	*data = regfile->entry[field].data;
-	return sizeof(*data);
+	return 0;
 }
 
 /*
@@ -229,10 +229,10 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
  * order [in] The byte order for the blob.  Currently only supporting
  * big endian.  All fields are packed with this order.
  *
- * returns 0 on error or 1 on success
+ * returns zero on success
  * Notes - If bitlen is zero then set it to max.
  */
-uint32_t
+int32_t
 ulp_blob_init(struct ulp_blob *blob,
 	      uint16_t bitlen,
 	      enum bnxt_ulp_byte_order order)
@@ -240,7 +240,7 @@ ulp_blob_init(struct ulp_blob *blob,
 	/* validate the arguments */
 	if (!blob || bitlen > (8 * sizeof(blob->data))) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0; /* failure */
+		return -EINVAL;
 	}
 	if (bitlen)
 		blob->bitlen = bitlen;
@@ -249,7 +249,7 @@ ulp_blob_init(struct ulp_blob *blob,
 	blob->byte_order = order;
 	blob->write_idx = 0;
 	memset(blob->data, 0, sizeof(blob->data));
-	return 1; /* Success */
+	return 0; /* Success */
 }
 
 /*
@@ -263,12 +263,13 @@ ulp_blob_init(struct ulp_blob *blob,
  * datalen [in] The number of bits to be added to the blob.
  *
  * The offset of the data is updated after each push of data.
- * NULL returned on error.
+ *
+ * returns zero on success
  */
 #define ULP_BLOB_BYTE		8
 #define ULP_BLOB_BYTE_HEX	0xFF
 #define BLOB_MASK_CAL(x)	((0xFF << (x)) & 0xFF)
-uint32_t
+int32_t
 ulp_blob_push(struct ulp_blob *blob,
 	      uint8_t *data,
 	      uint32_t datalen)
@@ -278,7 +279,7 @@ ulp_blob_push(struct ulp_blob *blob,
 	/* validate the arguments */
 	if (!blob || datalen > (uint32_t)(blob->bitlen - blob->write_idx)) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0; /* failure */
+		return -EINVAL;
 	}
 
 	if (blob->byte_order == BNXT_ULP_BYTE_ORDER_BE)
@@ -293,10 +294,10 @@ ulp_blob_push(struct ulp_blob *blob,
 				     data);
 	if (!rc) {
 		BNXT_DRV_DBG(ERR, "Failed to write blob\n");
-		return 0;
+		return -EINVAL;
 	}
 	blob->write_idx += datalen;
-	return datalen;
+	return 0;
 }
 
 /*
@@ -312,9 +313,10 @@ ulp_blob_push(struct ulp_blob *blob,
  * datalen [in] The number of bits to be added to the blob.
  *
  * The offset of the data is updated after each push of data.
- * NULL returned on error.
+ *
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 		uint8_t *data, uint32_t datalen)
 {
@@ -326,7 +328,7 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 	if (!blob || datalen > (uint32_t)(blob->bitlen - blob->write_idx) ||
 	    offset > blob->write_idx) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0; /* failure */
+		return -EINVAL;
 	}
 
 	mov_len = blob->write_idx - offset;
@@ -334,7 +336,7 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 	if (ULP_BITS_IS_BYTE_NOT_ALIGNED(offset) ||
 	    ULP_BITS_IS_BYTE_NOT_ALIGNED(datalen)) {
 		BNXT_DRV_DBG(ERR, "invalid argument, not aligned\n");
-		return 0; /* failure */
+		return -EINVAL;
 	}
 
 	/* copy the data so we can move the data */
@@ -353,13 +355,13 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 				     data);
 	if (!rc) {
 		BNXT_DRV_DBG(ERR, "Failed to write blob\n");
-		return 0;
+		return -EINVAL;
 	}
 	/* copy the previously stored data */
 	memcpy(&blob->data[ULP_BITS_2_BYTE_NR(offset + datalen)], local_data,
 	       ULP_BITS_2_BYTE(mov_len));
 	blob->write_idx += (mov_len + datalen);
-	return datalen;
+	return 0;
 }
 
 /*
@@ -388,12 +390,12 @@ ulp_blob_push_64(struct ulp_blob *blob,
 	if (!blob || !data ||
 	    datalen > (uint32_t)(blob->bitlen - blob->write_idx)) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0;
+		return NULL;
 	}
 
 	rc = ulp_blob_push(blob, &val[8 - size], datalen);
-	if (!rc)
-		return 0;
+	if (rc)
+		return NULL;
 
 	return &val[8 - size];
 }
@@ -422,12 +424,12 @@ ulp_blob_push_32(struct ulp_blob *blob,
 
 	if (!data || size > sizeof(uint32_t)) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0;
+		return NULL;
 	}
 
 	rc = ulp_blob_push(blob, &val[sizeof(uint32_t) - size], datalen);
-	if (!rc)
-		return 0;
+	if (rc)
+		return NULL;
 
 	return &val[sizeof(uint32_t) - size];
 }
@@ -474,7 +476,7 @@ ulp_blob_push_encap(struct ulp_blob *blob,
 		} else {
 			size = write_size;
 		}
-		if (!ulp_blob_push(blob, val, size)) {
+		if (ulp_blob_push(blob, val, size)) {
 			BNXT_DRV_DBG(ERR, "push field failed\n");
 			return -1;
 		}
@@ -1028,9 +1030,9 @@ ulp_blob_buffer_copy(struct ulp_blob *dst, struct ulp_blob *src)
  *
  * bytes [in] The number of bytes to read into val
  *
- * returns number of bits read, zero on error
+ * returns zero on success.
  */
-uint16_t
+int32_t
 ulp_operand_read(uint8_t *operand,
 		 uint8_t *val,
 		 uint16_t bytes)
@@ -1038,10 +1040,10 @@ ulp_operand_read(uint8_t *operand,
 	/* validate the arguments */
 	if (!operand || !val) {
 		BNXT_DRV_DBG(ERR, "invalid argument\n");
-		return 0; /* failure */
+		return -EINVAL;
 	}
 	memcpy(val, operand, bytes);
-	return bytes;
+	return 0;
 }
 
 /*
diff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.h b/drivers/net/bnxt/tf_ulp/ulp_utils.h
index 420b7c6815..f0dc6dbfec 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_utils.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_utils.h
@@ -108,9 +108,9 @@ struct ulp_regfile {
  *
  * regfile [in] Ptr to a regfile instance
  *
- * returns 0 on error or 1 on success
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_regfile_init(struct ulp_regfile *regfile);
 
 /*
@@ -120,9 +120,9 @@ ulp_regfile_init(struct ulp_regfile *regfile);
  *
  * field [in] The field to be read within the regfile.
  *
- * returns the byte array
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_regfile_read(struct ulp_regfile *regfile,
 		 enum bnxt_ulp_rf_idx field,
 		 uint64_t *data);
@@ -186,9 +186,9 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val);
  * order [in] The byte order for the blob.  Currently only supporting
  * big endian.  All fields are packed with this order.
  *
- * returns 0 on error or 1 on success
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_blob_init(struct ulp_blob *blob,
 	      uint16_t bitlen,
 	      enum bnxt_ulp_byte_order order);
@@ -204,9 +204,10 @@ ulp_blob_init(struct ulp_blob *blob,
  * datalen [in] The number of bits to be added to the blob.
  *
  * The offset of the data is updated after each push of data.
- * NULL returned on error.
+ *
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_blob_push(struct ulp_blob *blob,
 	      uint8_t *data,
 	      uint32_t datalen);
@@ -224,9 +225,10 @@ ulp_blob_push(struct ulp_blob *blob,
  * datalen [in] The number of bits to be added to the blob.
  *
  * The offset of the data is updated after each push of data.
- * NULL returned on error.
+ *
+ * returns zero on success
  */
-uint32_t
+int32_t
 ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 		uint8_t *data, uint32_t datalen);
 
@@ -503,9 +505,9 @@ ulp_blob_buffer_copy(struct ulp_blob *dst, struct ulp_blob *src);
  *
  * bitlen [in] The number of bits to read into val
  *
- * returns number of bits read, zero on error
+ * returns zero on success.
  */
-uint16_t
+int32_t
 ulp_operand_read(uint8_t *operand,
 		 uint8_t *val,
 		 uint16_t bitlen);
-- 
2.39.3


  parent reply	other threads:[~2024-08-30 13:54 UTC|newest]

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

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=20240830140049.1715230-29-sriharsha.basavapatna@broadcom.com \
    --to=sriharsha.basavapatna@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@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).