Received: by 10.223.164.221 with SMTP id h29csp2060724wrb; Thu, 2 Nov 2017 05:22:30 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R6J1Al3wETPUFX9jtRrD9ejN57sMqvLqGykIwFVUjJsUWw8th4GiJVjD4sFLSPY2nj0D+u X-Received: by 10.84.135.3 with SMTP id 3mr3011370pli.147.1509625350551; Thu, 02 Nov 2017 05:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509625350; cv=none; d=google.com; s=arc-20160816; b=G5zLp1zqIllGg+avRAF6UOrE67K6gl7BuwZOI1g7Z2FBHnG9WU7XrjljQ2M9AzLGoc Aqsza2exskjJpFzDddA8vnd9CUuEy4TfTX2gAHto+/rGDpVGz4GSiz4cJ8YRlPS5cqxR xTNrI3hrGCEdhFKi8crAEv7NBNUzVJqd0L202FCvG9UumEWiP6l6Fsn1cIpJGqFRLz/1 QQmtPRHVofQcPY73w2xp7Gj7yNMUwa5B3xdo55tcdana50f1fA8LlGVY4j/ZOn1dYS68 mF4YVJrxJ02f+8mjP+BfLGdBnZZyrvZrnuzmnEIUJ9hyd5tX5Dqh/LQKdxveq5z74KKi p8Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=U+PAlhDHPoX/BIfzA8WprVCmXahRIz822LUjkzhrE7w=; b=vJ6JtFjk8KGhCwgVEK0dD6cO1npcyinl/0zkkqdz+6LdbL0Oz1A3w7t0NlFdwIBty8 DSh9h3J2RXIGncfLNh160+DjBSfIangi3BC3UVCC8lAnx6K3gRvYEbXFW7JVWsd9ewKq w2tUOz4q0gk5hy3cDjwpHUYjOdh1CfLl3KrcXvWF08eNPQT+VIXsReYEy1N1fbfZpByD HbFSuZEkNwLLQ/n9EyDJ03rZ0F2W+Xs7PMJ0OHQxP55UJqD7oQbYZCkhX2sN1SVbLhUk WSj+v76fPn0fxUHfREhRYzFzscFLc139b44pH8O9mPKmERYdxzvjLil1mhfRPisXIC7d NM2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si3196767pgs.613.2017.11.02.05.21.58; Thu, 02 Nov 2017 05:22:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755048AbdKBMTr (ORCPT + 96 others); Thu, 2 Nov 2017 08:19:47 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:51500 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754916AbdKBMTJ (ORCPT ); Thu, 2 Nov 2017 08:19:09 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id EB3EED3889E30; Thu, 2 Nov 2017 20:18:50 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Thu, 2 Nov 2017 20:17:49 +0800 From: Lipeng To: CC: , , , , Subject: [PATCH V2 net-next 9/9] net: hns3: hns3:fix a bug about statistic counter in reset process Date: Thu, 2 Nov 2017 20:45:23 +0800 Message-ID: <1509626723-18619-10-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509626723-18619-1-git-send-email-lipeng321@huawei.com> References: <1509626723-18619-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: qumingguang 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 Signed-off-by: Lipeng Signed-off-by: Yunsheng Lin --- 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 699983a..c6ba890 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 @@ 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; @@ -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"); -- 1.9.1 From 1582968533985064532@xxx Thu Nov 02 15:27:14 +0000 2017 X-GM-THRID: 1582968533985064532 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread