提交 6a804d0a 编写于 作者: Y Yonglong Liu 提交者: Laibin Qiu

net: hns3: fix keep alive can not resume problem when system busy

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5S7WZ
CVE: NA

----------------------------

Currently, VF send keep alive to PF every 2s, and PF detect the
keep alive for 8s, some case, the work queue may schedule late,
cause keep alive lost, then the mac setting from PF may not
affect to the VF, and the keep alive can not resume, only reset
VF or reload VF driver can resume.

This patch adds keep alive resume mechanism, and adds some debug
print for this case.

When link status change between keep alive lost and resume, the
link status of VF may not the same as the PF, so adds push link
status to VF to avoid this case.
Signed-off-by: NYonglong Liu <liuyonglong@huawei.com>
Reviewed-by: Nli yongxin <liyongxin1@huawei.com>
Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
上级 01334116
......@@ -4046,7 +4046,12 @@ static void hclge_update_vport_alive(struct hclge_dev *hdev)
* receive a vf's alive msg for 8s, regards the vf is offline
*/
if (time_after(jiffies, vport->last_active_jiffies + 8 * HZ))
clear_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state);
if (test_and_clear_bit(HCLGE_VPORT_STATE_ALIVE,
&vport->state))
dev_info(&hdev->pdev->dev,
"VF %u keep alive lost!",
vport->vport_id -
HCLGE_VF_VPORT_START_NUM);
/* If vf is not alive, set to default value */
if (!test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state))
......@@ -7090,8 +7095,8 @@ int hclge_vport_start(struct hclge_vport *vport)
{
struct hclge_dev *hdev = vport->back;
set_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state);
vport->last_active_jiffies = jiffies;
set_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state);
if (test_bit(vport->vport_id, hdev->vport_config_block)) {
if (vport->vport_id) {
......
......@@ -639,7 +639,29 @@ static int hclge_reset_vf(struct hclge_vport *vport)
static void hclge_vf_keep_alive(struct hclge_vport *vport)
{
struct hclge_dev *hdev = vport->back;
int ret;
vport->last_active_jiffies = jiffies;
if (!test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) {
set_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state);
dev_info(&hdev->pdev->dev, "VF %u keep alive resume!",
vport->vport_id - HCLGE_VF_VPORT_START_NUM);
/* if vf support push link, need to push link status after keep
* alive restore, because the vf will not fetch the link status
* of it's own.
*/
ret = hclge_push_vf_link_status(vport);
if (ret) {
dev_err(&hdev->pdev->dev,
"failed to push link status to vf%u, ret=%d\n",
vport->vport_id - HCLGE_VF_VPORT_START_NUM,
ret);
}
}
}
static int hclge_set_vf_mtu(struct hclge_vport *vport,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册