From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 35B14458A8; Fri, 30 Aug 2024 15:54:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A843942EEF; Fri, 30 Aug 2024 15:54:10 +0200 (CEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mails.dpdk.org (Postfix) with ESMTP id 3D61A42EAB for ; Fri, 30 Aug 2024 15:54:09 +0200 (CEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-71433096e89so1541405b3a.3 for ; Fri, 30 Aug 2024 06:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1725026048; x=1725630848; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z9aHvoJRzV4EXJF52M1nW7Cru7BE/a11AkUMsXun8Fg=; b=Lzdc8QFaqvFJ0DOW9MZfci8hgXS+yhg/nOQuksqyBxtVGU+E9YaZvZwqepLJzvQDYC IeTJDdozgIh3JoDyLKn8TN4i2ON6u9+8SESvYi2EAKF3DgkFwKQ8yI5vWRVb/7wL5zPc VuSwis8NJ711tDZPO64CjHdKCSLpvK2nZS0Ig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725026048; x=1725630848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z9aHvoJRzV4EXJF52M1nW7Cru7BE/a11AkUMsXun8Fg=; b=DSXVXsvyjB5gjdqxL0AKIA+cc/tPXUrk2uNT5TEWNj1vmeLnioLnDhAcQ6QzpjRfH9 wrzmelFgX3w3O9sGUfTkiwpTRHQFOljiKNQN8jcsIhBptCxVarfNRlcjyx3vSkvAGlKR +NiAQZHsJxHAj+soHydNiTquOYdbELAYzSHjMI876C6QBw/dUej2YisWPeebOVeaH0Hc MamfVJKCvYHmZUr/qNOW5FN3W8ymByKytasqS8SErFa2gdjSvEdAhkeRE55zF7CLweaJ N1d1FNm+f+M2unMWaaisXrF2NeOuSwBCLsoOGY4ATXtK6WlX5fJp34kjy7DkRIRKmf00 uS8A== X-Gm-Message-State: AOJu0YyO5Qif/677y+sSTDbwzgA9F3bZpl3V9br3bgc9kBiDQkUZhMYz yCGF0BnPHzt9tp+kZJOhZCTqoJxYN8BIvw+atFPUGa8LbHuehM30f+NkY+TAtiqEFVzgeUH/huj A8HAx9R316P5gpQexbGHjFUhKxNLHhG8IBKVu2j3MlP4T8HlkzvLbJkJ+COzSPywRAEBw6gU5um UQ9OnxxPq0UWLgWopGxRLPFLjGjEHsenIai4cgnVDcMNrd X-Google-Smtp-Source: AGHT+IE5j88JndtUzLRkznvPyPLQlIrfaHuqUBcF6TxYoYcUP2HjqchOTWLj1G80kdgJl+9wWTwzNg== X-Received: by 2002:a05:6a21:6e4b:b0:1cc:c202:b289 with SMTP id adf61e73a8af0-1cce0eeb267mr6103680637.0.1725026047637; Fri, 30 Aug 2024 06:54:07 -0700 (PDT) Received: from dhcp-10-123-154-23.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-205155658dfsm27067145ad.297.2024.08.30.06.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 06:54:07 -0700 (PDT) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shuanglin Wang , Kishore Padmanabha , Sriharsha Basavapatna 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 Message-Id: <20240830140049.1715230-29-sriharsha.basavapatna@broadcom.com> X-Mailer: git-send-email 2.39.0.189.g4dbebc36b0 In-Reply-To: <20240830140049.1715230-1-sriharsha.basavapatna@broadcom.com> References: <20240830140049.1715230-1-sriharsha.basavapatna@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Shuanglin Wang 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 Reviewed-by: Kishore Padmanabha Signed-off-by: Sriharsha Basavapatna --- 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, tbl->pri_operand, + ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, tbl->key_recipe_operand, + ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, + tbl->tbl_operand, + ®val)) { 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, ®val)) { + if (ulp_regfile_read(parms->regfile, operand, ®val)) { 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, ®val)) { + if (ulp_regfile_read(parms->regfile, operand, ®val)) { 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, ®val)) { + if (ulp_regfile_read(parms->regfile, func_opr, ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, + BNXT_ULP_RF_IDX_GENERIC_TBL_MISS, + ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, + BNXT_ULP_RF_IDX_FLOW_SIG_ID, + ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, rf_idx, + ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, + tbl->tbl_operand, + ®val)) { 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, ®val)) { + if (ulp_regfile_read(parms->regfile, + tbl->tbl_operand, ®val)) { 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, ®val)) { + if (ulp_regfile_read(parms->regfile, + tbl->tbl_operand, ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, + tbl->tbl_operand, + ®val)) { 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, ®val)) { + if (ulp_regfile_read(parms->regfile, + tbl->tbl_operand, ®val)) { 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, - ®val)) { + if (ulp_regfile_read(parms->regfile, + tbl->tbl_operand, + ®val)) { 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