net: hns3: dump some debug information when reset fail
authorHuazhong Tan <tanhuazhong@huawei.com>
Thu, 31 Oct 2019 11:23:16 +0000 (19:23 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 Oct 2019 19:03:22 +0000 (12:03 -0700)
When reset fails, there is some information that will help for
finding out why does reset fail. and removes an unused
core_rst_cnt field in struct hclge_rst_stats.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index 0ccc8e7b19d074089c116154cc2571d379a90789..122ad92e7e95610f4c215cd548b617124b936545 100644 (file)
@@ -929,7 +929,7 @@ static void hclge_dbg_fd_tcam(struct hclge_dev *hdev)
        }
 }
 
-static void hclge_dbg_dump_rst_info(struct hclge_dev *hdev)
+void hclge_dbg_dump_rst_info(struct hclge_dev *hdev)
 {
        dev_info(&hdev->pdev->dev, "PF reset count: %u\n",
                 hdev->rst_stats.pf_rst_cnt);
@@ -945,8 +945,6 @@ static void hclge_dbg_dump_rst_info(struct hclge_dev *hdev)
                 hdev->rst_stats.hw_reset_done_cnt);
        dev_info(&hdev->pdev->dev, "reset count: %u\n",
                 hdev->rst_stats.reset_cnt);
-       dev_info(&hdev->pdev->dev, "reset count: %u\n",
-                hdev->rst_stats.reset_cnt);
        dev_info(&hdev->pdev->dev, "reset fail count: %u\n",
                 hdev->rst_stats.reset_fail_cnt);
        dev_info(&hdev->pdev->dev, "vector0 interrupt enable status: 0x%x\n",
@@ -961,6 +959,7 @@ static void hclge_dbg_dump_rst_info(struct hclge_dev *hdev)
                 hclge_read_dev(&hdev->hw, HCLGE_NIC_CSQ_DEPTH_REG));
        dev_info(&hdev->pdev->dev, "function reset status: 0x%x\n",
                 hclge_read_dev(&hdev->hw, HCLGE_FUN_RST_ING));
+       dev_info(&hdev->pdev->dev, "hdev state: 0x%lx\n", hdev->state);
 }
 
 static void hclge_dbg_get_m7_stats_info(struct hclge_dev *hdev)
index bf6bca26c337ad10812ae7429210d5ab7c65890b..19667c9b25ccf03a3eeb9726b41c9a8f2816c33f 100644 (file)
@@ -3669,6 +3669,9 @@ static bool hclge_reset_err_handle(struct hclge_dev *hdev)
        hclge_reset_handshake(hdev, true);
 
        dev_err(&hdev->pdev->dev, "Reset fail!\n");
+
+       hclge_dbg_dump_rst_info(hdev);
+
        return false;
 }
 
index 9e59f0e074be0e3dd77006b274ad48b11b6e390f..4386788dd2044391dc3d5298304db0cc81e225c6 100644 (file)
@@ -656,7 +656,6 @@ struct hclge_rst_stats {
        u32 hw_reset_done_cnt;  /* the number of HW reset has completed */
        u32 pf_rst_cnt;         /* the number of PF reset */
        u32 flr_rst_cnt;        /* the number of FLR */
-       u32 core_rst_cnt;       /* the number of CORE reset */
        u32 global_rst_cnt;     /* the number of GLOBAL */
        u32 imp_rst_cnt;        /* the number of IMP reset */
        u32 reset_cnt;          /* the number of reset */
@@ -1005,4 +1004,5 @@ int hclge_query_bd_num_cmd_send(struct hclge_dev *hdev,
 void hclge_report_hw_error(struct hclge_dev *hdev,
                           enum hnae3_hw_error_type type);
 void hclge_inform_vf_promisc_info(struct hclge_vport *vport);
+void hclge_dbg_dump_rst_info(struct hclge_dev *hdev);
 #endif
index 408e38644c609bbceb736b7e40ac36de68429223..c38eba899503b51368c9eedd14f1874618a1658b 100644 (file)
@@ -1549,6 +1549,33 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev)
        return ret;
 }
 
+static void hclgevf_dump_rst_info(struct hclgevf_dev *hdev)
+{
+       dev_info(&hdev->pdev->dev, "VF function reset count: %u\n",
+                hdev->rst_stats.vf_func_rst_cnt);
+       dev_info(&hdev->pdev->dev, "FLR reset count: %u\n",
+                hdev->rst_stats.flr_rst_cnt);
+       dev_info(&hdev->pdev->dev, "VF reset count: %u\n",
+                hdev->rst_stats.vf_rst_cnt);
+       dev_info(&hdev->pdev->dev, "reset done count: %u\n",
+                hdev->rst_stats.rst_done_cnt);
+       dev_info(&hdev->pdev->dev, "HW reset done count: %u\n",
+                hdev->rst_stats.hw_rst_done_cnt);
+       dev_info(&hdev->pdev->dev, "reset count: %u\n",
+                hdev->rst_stats.rst_cnt);
+       dev_info(&hdev->pdev->dev, "reset fail count: %u\n",
+                hdev->rst_stats.rst_fail_cnt);
+       dev_info(&hdev->pdev->dev, "vector0 interrupt enable status: 0x%x\n",
+                hclgevf_read_dev(&hdev->hw, HCLGEVF_MISC_VECTOR_REG_BASE));
+       dev_info(&hdev->pdev->dev, "vector0 interrupt status: 0x%x\n",
+                hclgevf_read_dev(&hdev->hw, HCLGEVF_VECTOR0_CMDQ_STAT_REG));
+       dev_info(&hdev->pdev->dev, "handshake status: 0x%x\n",
+                hclgevf_read_dev(&hdev->hw, HCLGEVF_CMDQ_TX_DEPTH_REG));
+       dev_info(&hdev->pdev->dev, "function reset status: 0x%x\n",
+                hclgevf_read_dev(&hdev->hw, HCLGEVF_RST_ING));
+       dev_info(&hdev->pdev->dev, "hdev state: 0x%lx\n", hdev->state);
+}
+
 static void hclgevf_reset_err_handle(struct hclgevf_dev *hdev)
 {
        /* recover handshake status with IMP when reset fail */
@@ -1563,6 +1590,8 @@ static void hclgevf_reset_err_handle(struct hclgevf_dev *hdev)
        if (hclgevf_is_reset_pending(hdev)) {
                set_bit(HCLGEVF_RESET_PENDING, &hdev->reset_state);
                hclgevf_reset_task_schedule(hdev);
+       } else {
+               hclgevf_dump_rst_info(hdev);
        }
 }