netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lipeng <lipeng321@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,
	<salil.mehta@huawei.com>, <lipeng321@huawei.com>
Subject: [PATCH net-next 9/9] net: hns3: hns3:fix a bug about statistic counter in reset process
Date: Wed, 1 Nov 2017 22:47:22 +0800	[thread overview]
Message-ID: <1509547642-51110-10-git-send-email-lipeng321@huawei.com> (raw)
In-Reply-To: <1509547642-51110-1-git-send-email-lipeng321@huawei.com>

From: qumingguang <qumingguang@huawei.com>

All member of Struct hdev->hw_stats is initialized 0 as hdev is alloced by
devm_kzalloc. But in reset process, hdev will not be alloced again, so need
clear hdev->hw_stats in reset process, otherwise the statistic will be
wrong after reset. This patch set all of the statistic counters to zero
after reset.

Signed-off-by: qumingguang <qumingguang@huawei.com>
Signed-off-by: Lipeng <lipeng321@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 141c758..dff9cbd 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -4838,6 +4838,11 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 	return ret;
 }
 
+static void hclge_stats_clear(struct hclge_dev *hdev)
+{
+	memset(&hdev->hw_stats, 0, sizeof(hdev->hw_stats));
+}
+
 static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
 {
 	struct hclge_dev *hdev = ae_dev->priv;
@@ -4846,6 +4851,8 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
 
 	set_bit(HCLGE_STATE_DOWN, &hdev->state);
 
+	hclge_stats_clear(hdev);
+
 	ret = hclge_cmd_init(hdev);
 	if (ret) {
 		dev_err(&pdev->dev, "Cmd queue init failed\n");
-- 
1.9.1

      parent reply	other threads:[~2017-11-01 14:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 14:47 [PATCH net-next 0/9] net: hns3: add support for reset Lipeng
2017-11-01 14:47 ` [PATCH net-next 1/9] net: hns3: Refactor the mapping of tqp to vport Lipeng
2017-11-01 14:47 ` [PATCH net-next 2/9] net: hns3: Refactor mac_init function Lipeng
2017-11-01 14:47 ` [PATCH net-next 3/9] net: hns3: Refactor the initialization of command queue Lipeng
2017-11-02  3:31   ` Yunsheng Lin
2017-11-01 14:47 ` [PATCH net-next 4/9] net: hns3: Add support for misc interrupt Lipeng
2017-11-01 14:47 ` [PATCH net-next 5/9] net: hns3: Add reset process in hclge_main Lipeng
2017-11-01 14:47 ` [PATCH net-next 6/9] net: hns3: Add timeout process in hns3_enet Lipeng
2017-11-01 14:47 ` [PATCH net-next 7/9] net: hns3: Add reset interface implementation in client Lipeng
2017-11-01 14:47 ` [PATCH net-next 8/9] net: hns3: Fix a misuse to devm_free_irq Lipeng
2017-11-01 14:47 ` Lipeng [this message]

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=1509547642-51110-10-git-send-email-lipeng321@huawei.com \
    --to=lipeng321@huawei.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.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).