提交 cf2e31f4 编写于 作者: H Huazhong Tan 提交者: Xie XiuQi

net: hns3: re-schedule reset task while VF reset fail

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

The VF reset may fail for some probabilistic reasons,
such as wait for hardware reset timeout, wait for mailbox
response timeout, so this patch tries to re-schedule the
reset task when the number of reset failing is under
HCLGEVF_RESET_MAX_FAIL_CNT. This patch also add a function
hclgevf_reset_err_handle() to handle the reset failing.

Feature or Bugfix:Bugfix
Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
Reviewed-by: Nlipeng <lipeng321@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 56798b02
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#define HCLGEVF_NAME "hclgevf" #define HCLGEVF_NAME "hclgevf"
#define HCLGEVF_RESET_MAX_FAIL_CNT 5
static int hclgevf_reset_hdev(struct hclgevf_dev *hdev); static int hclgevf_reset_hdev(struct hclgevf_dev *hdev);
static struct hnae3_ae_algo ae_algovf; static struct hnae3_ae_algo ae_algovf;
...@@ -1419,6 +1421,26 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev) ...@@ -1419,6 +1421,26 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev)
return ret; return ret;
} }
static void hclgevf_reset_err_handle(struct hclgevf_dev *hdev)
{
/* When VF reset failed, only the higher level reset asserted by PF
* can restore it, so re-initialize the command queue to receive
* this higher reset event.
*/
hclgevf_cmd_init(hdev);
hdev->rst_stats.rst_fail_cnt++;
dev_err(&hdev->pdev->dev, "failed to reset VF(%d)\n",
hdev->rst_stats.rst_fail_cnt);
if (hdev->rst_stats.rst_fail_cnt < HCLGEVF_RESET_MAX_FAIL_CNT)
set_bit(hdev->reset_type, &hdev->reset_pending);
if (hclgevf_is_reset_pending(hdev)) {
set_bit(HCLGEVF_RESET_PENDING, &hdev->reset_state);
hclgevf_reset_task_schedule(hdev);
}
}
static int hclgevf_reset(struct hclgevf_dev *hdev) static int hclgevf_reset(struct hclgevf_dev *hdev)
{ {
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev); struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
...@@ -1473,19 +1495,13 @@ static int hclgevf_reset(struct hclgevf_dev *hdev) ...@@ -1473,19 +1495,13 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
ae_dev->reset_type = HNAE3_NONE_RESET; ae_dev->reset_type = HNAE3_NONE_RESET;
hdev->rst_stats.rst_done_cnt++; hdev->rst_stats.rst_done_cnt++;
hdev->rst_stats.rst_fail_cnt = 0;
return ret; return ret;
err_reset_lock: err_reset_lock:
rtnl_unlock(); rtnl_unlock();
err_reset: err_reset:
/* When VF reset failed, only the higher level reset asserted by PF hclgevf_reset_err_handle(hdev);
* can restore it, so re-initialize the command queue to receive
* this higher reset event.
*/
hclgevf_cmd_init(hdev);
dev_err(&hdev->pdev->dev, "failed to reset VF\n");
if (hclgevf_is_reset_pending(hdev))
hclgevf_reset_task_schedule(hdev);
return ret; return ret;
} }
......
...@@ -175,6 +175,7 @@ struct hclgevf_rst_stats { ...@@ -175,6 +175,7 @@ struct hclgevf_rst_stats {
u32 flr_rst_cnt; /* the number of FLR */ u32 flr_rst_cnt; /* the number of FLR */
u32 vf_rst_cnt; /* the number of VF reset */ u32 vf_rst_cnt; /* the number of VF reset */
u32 rst_done_cnt; /* the number of sucessful reset */ u32 rst_done_cnt; /* the number of sucessful reset */
u32 rst_fail_cnt; /* the number of VF reset fail */
}; };
struct hclgevf_dev { struct hclgevf_dev {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册