[v2,1/1] ml/cnxk: fix reporting of incorrect error info

Message ID 20230316172215.20067-1-syalavarthi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/1] ml/cnxk: fix reporting of incorrect error info |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Srikanth Yalavarthi March 16, 2023, 5:22 p.m. UTC
  In the rte_ml_op_error_get driver function, the errcode
field of rte_ml_op_error structure is not being updated.
This is causing an incorrect or junk value being reported
as errcode to caller.

For error subtype not supported by driver, the error
message reported is incorrect or junk.

Fixes: 57c37b852f2c ("ml/cnxk: support firmware error code query")

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---

v2:
* updated commit message

 drivers/ml/cnxk/cn10k_ml_ops.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon March 19, 2023, 4:51 p.m. UTC | #1
16/03/2023 18:22, Srikanth Yalavarthi:
> In the rte_ml_op_error_get driver function, the errcode
> field of rte_ml_op_error structure is not being updated.
> This is causing an incorrect or junk value being reported
> as errcode to caller.
> 
> For error subtype not supported by driver, the error
> message reported is incorrect or junk.
> 
> Fixes: 57c37b852f2c ("ml/cnxk: support firmware error code query")
> 
> Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>

Applied, thanks.
  

Patch

diff --git a/drivers/ml/cnxk/cn10k_ml_ops.c b/drivers/ml/cnxk/cn10k_ml_ops.c
index 5b77e47322..7d5eb97668 100644
--- a/drivers/ml/cnxk/cn10k_ml_ops.c
+++ b/drivers/ml/cnxk/cn10k_ml_ops.c
@@ -2210,7 +2210,10 @@  cn10k_ml_op_error_get(struct rte_ml_dev *dev, struct rte_ml_op *op, struct rte_m
 	/* Copy sub error message */
 	if (error_code->s.etype == ML_ETYPE_HW_NONFATAL) {
 		strcat(msg, " : ");
-		strcat(msg, ml_stype_db_hw_nf[error_code->s.stype].msg);
+		if (error_code->s.stype < PLT_DIM(ml_stype_db_hw_nf))
+			strcat(msg, ml_stype_db_hw_nf[error_code->s.stype].msg);
+		else
+			strcat(msg, "UNKNOWN ERROR");
 	}
 
 	if (error_code->s.etype == ML_ETYPE_DRIVER) {
@@ -2219,6 +2222,7 @@  cn10k_ml_op_error_get(struct rte_ml_dev *dev, struct rte_ml_op *op, struct rte_m
 	}
 
 	plt_strlcpy(error->message, msg, sizeof(error->message));
+	error->errcode = error_code->u64;
 
 	return 0;
 }