Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1317627yba; Thu, 18 Apr 2019 20:10:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzq4Rxbqnl0GFgVsV4JaeA8lLclm+/FeW1f5P2JxKgvJ2vWrkCgrVewbzlrvGkkgZvAG+NI X-Received: by 2002:aa7:818a:: with SMTP id g10mr1356352pfi.178.1555643401136; Thu, 18 Apr 2019 20:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555643401; cv=none; d=google.com; s=arc-20160816; b=pUO8+t7H37Gt+xP6h6ueNJN+clQdU4bCL4l6MFlVeBx3w2finPnXUHN+JPgj1wpg9a fDlCC8wZI06RXTjeF0Oi6CYg33XpozV1ONLWxRS2fehKJBgbEpZbXgUa7dAmHAWBNDaT +4pw+5VwiGdLsWBLFwqGw2EBoJB6QDt9mWSkvoLdfghVritypz8BbOLTaxzLHx7kqvMR 3AZi+DH7QPN58JMHv1zOipUXstaiz69FIol9/xFTErQQwofCCzWZmbSiVgj713H6D5v3 IDJvHWT/AxdPtlh55/Yv8qPT8StgzqKvBVBMDql34W9lFyn7yjk6O+V2mffJkKQZXtJU OGAQ== 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; bh=0DYzLNE1hbAu7MhbJeUXnuIuRDpW7QAfURPrnv94s0Q=; b=Z3bgTamtrg3g38rsIiB50K9UAzWmzjuXmu/xDFeaDdZsvtqBC3Wsny+eLr8gjmjSwW XeJIUEhY9Aeq31E3zPtXMv4f5yphs3orf6O3xIks3Mw/4ArFZlNgSsFaNtvmTE8vx+/C Wlpuh7lGg8w6a3f5hJui8KCHkwBfzIPvEvk/9XohEX5OfyN5T6EynruzIaAhVcMvwsPK 1wGD9s1JfdvLXCXFMjtF6/GWWVOTMoAh2gcUynuyFBODxJjqaY1/5vH8BWWKNHymryN9 5BfCjQVX1tHWvDiJkV2PFPJNAIZxAa6OfJzX1+zaJEZWjRmmCftDONl+IxiQ86ZToYhC st5w== 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 a3si4037153pfc.276.2019.04.18.20.09.46; Thu, 18 Apr 2019 20:10:01 -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 S1727268AbfDSDHH (ORCPT + 99 others); Thu, 18 Apr 2019 23:07:07 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:55082 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727205AbfDSDHG (ORCPT ); Thu, 18 Apr 2019 23:07:06 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B023CDBB5F06B90EC48A; Fri, 19 Apr 2019 11:07:04 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Fri, 19 Apr 2019 11:06:57 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan , Peng Li Subject: [PATCH net-next 02/12] net: hns3: add reset statistics for VF Date: Fri, 19 Apr 2019 11:05:37 +0800 Message-ID: <1555643147-52407-3-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555643147-52407-1-git-send-email-tanhuazhong@huawei.com> References: <1555643147-52407-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds some statistics for VF reset. Signed-off-by: Huazhong Tan Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 10 ++++++++-- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 11 ++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 2e277c9..ff2cdf9 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1415,9 +1415,11 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev) case HNAE3_VF_FUNC_RESET: ret = hclgevf_send_mbx_msg(hdev, HCLGE_MBX_RESET, 0, NULL, 0, true, NULL, sizeof(u8)); + hdev->rst_stats.vf_func_rst_cnt++; break; case HNAE3_FLR_RESET: set_bit(HNAE3_FLR_DOWN, &hdev->flr_state); + hdev->rst_stats.flr_rst_cnt++; break; default: break; @@ -1440,7 +1442,7 @@ static int hclgevf_reset(struct hclgevf_dev *hdev) * know if device is undergoing reset */ ae_dev->reset_type = hdev->reset_type; - hdev->reset_count++; + hdev->rst_stats.rst_cnt++; rtnl_lock(); /* bring down the nic to stop any ongoing TX/RX */ @@ -1466,6 +1468,8 @@ static int hclgevf_reset(struct hclgevf_dev *hdev) goto err_reset; } + hdev->rst_stats.hw_rst_done_cnt++; + rtnl_lock(); /* now, re-initialize the nic client and ae device*/ @@ -1484,6 +1488,7 @@ static int hclgevf_reset(struct hclgevf_dev *hdev) hdev->last_reset_time = jiffies; ae_dev->reset_type = HNAE3_NONE_RESET; + hdev->rst_stats.rst_done_cnt++; return ret; err_reset_lock: @@ -1803,6 +1808,7 @@ static enum hclgevf_evt_cause hclgevf_check_evt_cause(struct hclgevf_dev *hdev, set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state); cmdq_src_reg &= ~BIT(HCLGEVF_VECTOR0_RST_INT_B); *clearval = cmdq_src_reg; + hdev->rst_stats.vf_rst_cnt++; return HCLGEVF_VECTOR0_EVENT_RST; } @@ -2737,7 +2743,7 @@ static unsigned long hclgevf_ae_dev_reset_cnt(struct hnae3_handle *handle) { struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); - return hdev->reset_count; + return hdev->rst_stats.hw_rst_done_cnt; } static void hclgevf_get_link_mode(struct hnae3_handle *handle, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h index 49e5bec..d39c032 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -210,6 +210,15 @@ struct hclgevf_misc_vector { int vector_irq; }; +struct hclgevf_rst_stats { + u32 rst_cnt; /* the number of reset */ + u32 vf_func_rst_cnt; /* the number of VF function reset */ + u32 flr_rst_cnt; /* the number of FLR */ + u32 vf_rst_cnt; /* the number of VF reset */ + u32 rst_done_cnt; /* the number of reset completed */ + u32 hw_rst_done_cnt; /* the number of HW reset completed */ +}; + struct hclgevf_dev { struct pci_dev *pdev; struct hnae3_ae_dev *ae_dev; @@ -227,7 +236,7 @@ struct hclgevf_dev { #define HCLGEVF_RESET_REQUESTED 0 #define HCLGEVF_RESET_PENDING 1 unsigned long reset_state; /* requested, pending */ - unsigned long reset_count; /* the number of reset has been done */ + struct hclgevf_rst_stats rst_stats; u32 reset_attempts; u32 fw_version; -- 2.7.4