[v2,1/1] ml/cnxk: fix reporting of incorrect error info
Checks
Commit Message
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
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.
@@ -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;
}