DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 6/6] net/hns3: fix return value when clearing statistics fails
Date: Wed, 29 Apr 2020 19:13:28 +0800	[thread overview]
Message-ID: <20200429111328.64952-7-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200429111328.64952-1-huwei013@chinasoftinc.com>

From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>

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) <xavier.huwei@huawei.com>
---
 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


  parent reply	other threads:[~2020-04-29 11:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 11:13 [dpdk-dev] [PATCH 0/6] misc updates and bugfixes for hns3 PMD driver Wei Hu (Xavier)
2020-04-29 11:13 ` [dpdk-dev] [PATCH 1/6] net/hns3: get Tx abnormal errors in extend device statistics Wei Hu (Xavier)
2020-04-29 11:13 ` [dpdk-dev] [PATCH 2/6] net/hns3: print the detail ret value Wei Hu (Xavier)
2020-04-29 11:13 ` [dpdk-dev] [PATCH 3/6] net/hns3: get PCI revision id Wei Hu (Xavier)
2020-04-29 11:13 ` [dpdk-dev] [PATCH 4/6] net/hns3: fix VLAN pvid when configuring device Wei Hu (Xavier)
2020-04-29 11:13 ` [dpdk-dev] [PATCH 5/6] net/hns3: fix MSI-x interrupt number during initialization Wei Hu (Xavier)
2020-04-29 11:13 ` Wei Hu (Xavier) [this message]
2020-05-05  9:12 ` [dpdk-dev] [PATCH 0/6] misc updates and bugfixes 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=20200429111328.64952-7-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).