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 BA4F9A00BE; Wed, 29 Apr 2020 13:14:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 551701DA6C; Wed, 29 Apr 2020 13:14:06 +0200 (CEST) Received: from mail.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id 77CAB1DA4E for ; Wed, 29 Apr 2020 13:13:59 +0200 (CEST) Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Wed, 29 Apr 2020 19:13:40 +0800 From: "Wei Hu (Xavier)" To: Date: Wed, 29 Apr 2020 19:13:28 +0800 Message-ID: <20200429111328.64952-7-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200429111328.64952-1-huwei013@chinasoftinc.com> References: <20200429111328.64952-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [114.119.4.74] Subject: [dpdk-dev] [PATCH 6/6] net/hns3: fix return value when clearing statistics fails 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: "Wei Hu (Xavier)" Since the return value of the '.stats_reset' and '.xstats_reset' callback function is int, when failing to issue command to firmware to execute clear statistics, the relevant callback function should return non-zero value. Fixes: 8839c5e202f3 ("net/hns3: support device stats") Cc: stable@dpdk.org Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_stats.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c index ad276206c..d2467a484 100644 --- a/drivers/net/hns3/hns3_stats.c +++ b/drivers/net/hns3/hns3_stats.c @@ -527,6 +527,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) if (ret) { hns3_err(hw, "Failed to reset RX No.%d queue stat: %d", i, ret); + return ret; } hns3_cmd_setup_basic_desc(&desc_reset, HNS3_OPC_QUERY_TX_STATUS, @@ -537,6 +538,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) if (ret) { hns3_err(hw, "Failed to reset TX No.%d queue stat: %d", i, ret); + return ret; } } @@ -571,7 +573,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) return 0; } -static void +static int hns3_mac_stats_reset(__rte_unused struct rte_eth_dev *dev) { struct hns3_adapter *hns = dev->data->dev_private; @@ -580,10 +582,14 @@ hns3_mac_stats_reset(__rte_unused struct rte_eth_dev *dev) int ret; ret = hns3_query_update_mac_stats(dev); - if (ret) + if (ret) { hns3_err(hw, "Clear Mac stats fail : %d", ret); + return ret; + } memset(mac_stats, 0, sizeof(struct hns3_mac_stats)); + + return 0; } /* This function calculates the number of xstats based on the current config */ @@ -979,9 +985,13 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_pf *pf = &hns->pf; + int ret; /* Clear tqp stats */ - (void)hns3_stats_reset(dev); + ret = hns3_stats_reset(dev); + if (ret) + return ret; + /* Clear reset stats */ memset(&hns->hw.reset.stats, 0, sizeof(struct hns3_reset_stats)); @@ -989,7 +999,10 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) return 0; /* HW registers are cleared on read */ - hns3_mac_stats_reset(dev); + ret = hns3_mac_stats_reset(dev); + if (ret) + return ret; + /* Clear error stats */ memset(&pf->abn_int_stats, 0, sizeof(struct hns3_err_msix_intr_stats)); -- 2.23.0