DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 4/7] net/hns3: fix default error code of command interface
Date: Tue, 17 Mar 2020 17:12:03 +0800	[thread overview]
Message-ID: <20200317091206.34928-5-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200317091206.34928-1-huwei013@chinasoftinc.com>

From: Chengwen Feng <fengchengwen@huawei.com>

Currently, the hns3 PMD driver can interact with firmware through command
to complete hardware configuration. The driver calls internal interface
function named hns3_cmd_send to issues command to the firmware, and check
the execution result of the command through desc_ret returned by firmware
to driver.

As the design of error code, when device is resetting hns3_cmd_send will
only return -EBUSY or -EIO. But we found that if desc_ret is in [12,65535],
for example the item doesn't exist when issuing the command to query some
table item, hns3_cmd_send also return -EIO. This phenomenon will affect the
processing logic for the return value.

The root cause as below:
When desc_ret is in [12,65535], in the static functin named
hns3_cmd_convert_err_code called by hns3_cmd_send, matches the default case
and return -EIO. And then hns3_cmd_send return -EIO.

This patch fixes it with the following modification.
1. Change the return value of the default case in the static function named
   hns3_cmd_convert_err_code from -EIO to -EREMOTEIO.
2. Modify the comment add errcode description of the internal interface
   function named hns3_cmd_send.

Fixes: 737f30e1c3ab ("net/hns3: support command interface with firmware")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_cmd.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c
index 5ec3dfe01..c85168b31 100644
--- a/drivers/net/hns3/hns3_cmd.c
+++ b/drivers/net/hns3/hns3_cmd.c
@@ -289,7 +289,7 @@ hns3_cmd_convert_err_code(uint16_t desc_ret)
 	case HNS3_CMD_INVALID:
 		return -EBADR;
 	default:
-		return -EIO;
+		return -EREMOTEIO;
 	}
 }
 
@@ -349,11 +349,23 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)
 
 /*
  * hns3_cmd_send - send command to command queue
- * @hw: pointer to the hw struct
- * @desc: prefilled descriptor for describing the command
- * @num : the number of descriptors to be sent
  *
- * This is the main send command for command queue, it
+ * @param hw
+ *   pointer to the hw struct
+ * @param desc
+ *   prefilled descriptor for describing the command
+ * @param num
+ *   the number of descriptors to be sent
+ * @return
+ *   - -EBUSY if detect device is in resetting
+ *   - -EIO   if detect cmd csq corrupted (due to reset) or
+ *            there is reset pending
+ *   - -ENOMEM/-ETIME/...(Non-Zero) if other error case
+ *   - Zero   if operation completed successfully
+ *
+ * Note -BUSY/-EIO only used in reset case
+ *
+ * Note this is the main send command for command queue, it
  * sends the queue, cleans the queue, etc
  */
 int
-- 
2.23.0


  parent reply	other threads:[~2020-03-17  9:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  9:11 [dpdk-dev] [PATCH 0/7] misc updates for hns3 PMD driver Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 1/7] net/hns3: remove redundant MAC addr check when setting MAC Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 2/7] net/hns3: modify inappropriate names Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 3/7] net/hns3: fix packets's offload features flags in Rx Wei Hu (Xavier)
2020-03-17  9:12 ` Wei Hu (Xavier) [this message]
2020-03-17  9:12 ` [dpdk-dev] [PATCH 5/7] net/hns3: fix crash when flushing RSS flow rules with FLR Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 6/7] net/hns3: fix configuring illeagl VLAN pvid Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 7/7] net/hns3: fix abnormal status after reset occurs repeatedly Wei Hu (Xavier)
2020-03-19  9:08 ` [dpdk-dev] [PATCH 0/7] misc updates for hns3 PMD driver Ferruh Yigit

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=20200317091206.34928-5-huwei013@chinasoftinc.com \
    --to=huwei013@chinasoftinc.com \
    --cc=dev@dpdk.org \
    /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).