From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C3505A0559; Tue, 17 Mar 2020 10:24:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E99531C0AC; Tue, 17 Mar 2020 10:24:21 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id D9AF01C06D for ; Tue, 17 Mar 2020 10:24:20 +0100 (CET) X-ASG-Debug-ID: 1584436938-0a3dd134b000180007-TfluYd Received: from mail.chinasoftinc.com (inccas001.ito.icss [10.168.0.51]) by incedge.chinasoftinc.com with ESMTP id 2MaHZDvBaIr0rcFi (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 17 Mar 2020 17:23:04 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.51 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS001.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 17 Mar 2020 17:13:14 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Tue, 17 Mar 2020 17:12:03 +0800 X-ASG-Orig-Subj: [PATCH 4/7] net/hns3: fix default error code of command interface Message-ID: <20200317091206.34928-5-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200317091206.34928-1-huwei013@chinasoftinc.com> References: <20200317091206.34928-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas001.ito.icss[10.168.0.51] X-Barracuda-Start-Time: 1584436982 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://incspam.chinasofti.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 2880 Subject: [dpdk-dev] [PATCH 4/7] net/hns3: fix default error code of command interface X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng 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 Signed-off-by: Wei Hu (Xavier) --- 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