diff options
author | 2017-11-02 20:45:23 +0800 | |
---|---|---|
committer | 2017-11-02 21:28:36 +0900 | |
commit | c6dc52130536d6d3d750bf1097b3bc897f7ef054 (patch) | |
tree | a355ee74148a6ebaa97fc3a4a882ff76a91edb5e /drivers/net/ethernet/hisilicon | |
parent | net: hns3: Fix a misuse to devm_free_irq (diff) | |
download | linux-c6dc52130536d6d3d750bf1097b3bc897f7ef054.tar.gz linux-c6dc52130536d6d3d750bf1097b3bc897f7ef054.tar.bz2 linux-c6dc52130536d6d3d750bf1097b3bc897f7ef054.zip |
net: hns3: hns3:fix a bug about statistic counter in reset process
All member of Struct hdev->hw_stats is initialized to 0 as hdev is
allocated by devm_kzalloc. But in reset process, hdev will not be
allocated 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>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 699983a954b2..c6ba89089ef3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4836,6 +4836,11 @@ err_hclge_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; @@ -4844,6 +4849,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"); |