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

Srikanth Yalavarthi syalavarthi at marvell.com
Thu Mar 16 18:22:15 CET 2023


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 at marvell.com>
---

v2:
* updated commit message

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

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;
 }
-- 
2.17.1



More information about the dev mailing list