DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Srikanth Yalavarthi <syalavarthi@marvell.com>,
	Prince Takkar <ptakkar@marvell.com>
Cc: <dev@dpdk.org>, <sshankarnara@marvell.com>, <aprabhu@marvell.com>
Subject: [PATCH v2 1/1] ml/cnxk: fix reporting of incorrect error info
Date: Thu, 16 Mar 2023 10:22:15 -0700	[thread overview]
Message-ID: <20230316172215.20067-1-syalavarthi@marvell.com> (raw)
In-Reply-To: <20230311115045.23320-1-syalavarthi@marvell.com>

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(-)

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


  parent reply	other threads:[~2023-03-16 17:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11 11:50 [PATCH] ml/cnxk: fix updating error code and message Srikanth Yalavarthi
2023-03-16 17:01 ` Thomas Monjalon
2023-03-16 17:23   ` [EXT] " Srikanth Yalavarthi
2023-03-16 17:22 ` Srikanth Yalavarthi [this message]
2023-03-19 16:51   ` [PATCH v2 1/1] ml/cnxk: fix reporting of incorrect error info Thomas Monjalon

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=20230316172215.20067-1-syalavarthi@marvell.com \
    --to=syalavarthi@marvell.com \
    --cc=aprabhu@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ptakkar@marvell.com \
    --cc=sshankarnara@marvell.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).