From: Huazhong Tan tanhuazhong@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
When synchronizes with VFs fail before PF function reset, PF driver should go on its function reset, otherwise it can not run normally anymore. So, hclge_func_reset_sync_vf() should not affect the processing of PF reset, this patch modifies its return type to void.
Also, synchronizes some codes from kernel-dev branch.
Signed-off-by: Huazhong Tan tanhuazhong@huawei.com Reviewed-by: Jian Shen shenjian15@huawei.com Reviewed-by: Yunsheng Lin linyunsheng@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 33 ++++++++-------------- 1 file changed, 11 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 4762939..4168567 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -37,7 +37,8 @@
#define HCLGE_RESET_MAX_FAIL_CNT 5 #define HCLGE_RESET_SYNC_TIME 100 -#define HCLGE_RESET_SYNC_CNT 300 +#define HCLGE_PF_RESET_SYNC_TIME 20 +#define HCLGE_PF_RESET_SYNC_CNT 1500
#define HCLGE_LINK_STATUS_MS 10
@@ -3373,7 +3374,7 @@ static void hclge_mailbox_service_task(struct hclge_dev *hdev) clear_bit(HCLGE_STATE_MBX_HANDLING, &hdev->state); }
-static int hclge_func_reset_sync_vf(struct hclge_dev *hdev) +static void hclge_func_reset_sync_vf(struct hclge_dev *hdev) { struct hclge_pf_rst_sync_cmd *req; struct hclge_desc desc; @@ -3393,21 +3394,19 @@ static int hclge_func_reset_sync_vf(struct hclge_dev *hdev) */ if (ret == -EOPNOTSUPP) { msleep(HCLGE_RESET_SYNC_TIME); - return 0; + return; } else if (ret) { dev_err(&hdev->pdev->dev, "sync with VF fail %d!\n", ret); - return ret; + return; } else if (req->all_vf_ready) { - return 0; + return; } - msleep(HCLGE_RESET_SYNC_TIME); - cnt++; + msleep(HCLGE_PF_RESET_SYNC_TIME); hclge_cmd_reuse_desc(&desc, true); - } while (cnt < HCLGE_RESET_SYNC_CNT); + } while (cnt++ < HCLGE_PF_RESET_SYNC_CNT);
- dev_err(&hdev->pdev->dev, "sync with VF timeout!\n"); - return -ETIME; + dev_warn(&hdev->pdev->dev, "sync with VF timeout!\n"); }
int hclge_func_reset_cmd(struct hclge_dev *hdev, int func_id) @@ -3559,12 +3558,7 @@ static int hclge_reset_prepare_wait(struct hclge_dev *hdev)
switch (hdev->reset_type) { case HNAE3_FUNC_RESET: - /* to confirm whether all running VF is ready - * before request PF reset - */ - ret = hclge_func_reset_sync_vf(hdev); - if (ret) - return ret; + hclge_func_reset_sync_vf(hdev);
ret = hclge_func_reset_cmd(hdev, 0); if (ret) { @@ -3582,12 +3576,7 @@ static int hclge_reset_prepare_wait(struct hclge_dev *hdev) hdev->rst_stats.pf_rst_cnt++; break; case HNAE3_FLR_RESET: - /* to confirm whether all running VF is ready - * before request PF reset - */ - ret = hclge_func_reset_sync_vf(hdev); - if (ret) - return ret; + hclge_func_reset_sync_vf(hdev); break; case HNAE3_IMP_RESET: if (handle && handle->ae_algo->ops->handle_imp_error)