net: hns3: add reset statistics for VF

This patch adds some statistics for VF reset.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Huazhong Tan 2019-04-19 11:05:37 +08:00 committed by David S. Miller
parent f02eb82dfe
commit c88a6e7d88
2 changed files with 18 additions and 3 deletions

View File

@ -1415,9 +1415,11 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev)
case HNAE3_VF_FUNC_RESET: case HNAE3_VF_FUNC_RESET:
ret = hclgevf_send_mbx_msg(hdev, HCLGE_MBX_RESET, 0, NULL, ret = hclgevf_send_mbx_msg(hdev, HCLGE_MBX_RESET, 0, NULL,
0, true, NULL, sizeof(u8)); 0, true, NULL, sizeof(u8));
hdev->rst_stats.vf_func_rst_cnt++;
break; break;
case HNAE3_FLR_RESET: case HNAE3_FLR_RESET:
set_bit(HNAE3_FLR_DOWN, &hdev->flr_state); set_bit(HNAE3_FLR_DOWN, &hdev->flr_state);
hdev->rst_stats.flr_rst_cnt++;
break; break;
default: default:
break; break;
@ -1440,7 +1442,7 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
* know if device is undergoing reset * know if device is undergoing reset
*/ */
ae_dev->reset_type = hdev->reset_type; ae_dev->reset_type = hdev->reset_type;
hdev->reset_count++; hdev->rst_stats.rst_cnt++;
rtnl_lock(); rtnl_lock();
/* bring down the nic to stop any ongoing TX/RX */ /* 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; goto err_reset;
} }
hdev->rst_stats.hw_rst_done_cnt++;
rtnl_lock(); rtnl_lock();
/* now, re-initialize the nic client and ae device*/ /* 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; hdev->last_reset_time = jiffies;
ae_dev->reset_type = HNAE3_NONE_RESET; ae_dev->reset_type = HNAE3_NONE_RESET;
hdev->rst_stats.rst_done_cnt++;
return ret; return ret;
err_reset_lock: 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); set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state);
cmdq_src_reg &= ~BIT(HCLGEVF_VECTOR0_RST_INT_B); cmdq_src_reg &= ~BIT(HCLGEVF_VECTOR0_RST_INT_B);
*clearval = cmdq_src_reg; *clearval = cmdq_src_reg;
hdev->rst_stats.vf_rst_cnt++;
return HCLGEVF_VECTOR0_EVENT_RST; 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); 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, static void hclgevf_get_link_mode(struct hnae3_handle *handle,

View File

@ -210,6 +210,15 @@ struct hclgevf_misc_vector {
int vector_irq; 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 hclgevf_dev {
struct pci_dev *pdev; struct pci_dev *pdev;
struct hnae3_ae_dev *ae_dev; struct hnae3_ae_dev *ae_dev;
@ -227,7 +236,7 @@ struct hclgevf_dev {
#define HCLGEVF_RESET_REQUESTED 0 #define HCLGEVF_RESET_REQUESTED 0
#define HCLGEVF_RESET_PENDING 1 #define HCLGEVF_RESET_PENDING 1
unsigned long reset_state; /* requested, pending */ 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 reset_attempts;
u32 fw_version; u32 fw_version;