Commit e233516e authored by Huazhong Tan's avatar Huazhong Tan Committed by David S. Miller

net: hns3: fix keep_alive_timer not stop problem

When hclgevf_client_start() fails or VF driver unloaded, there is
nobody to disable keep_alive_timer.

So this patch fixes them.

Fixes: a6d818e3 ("net: hns3: Add vport alive state checking support")
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7d600706
...@@ -2031,9 +2031,15 @@ static int hclgevf_set_alive(struct hnae3_handle *handle, bool alive) ...@@ -2031,9 +2031,15 @@ static int hclgevf_set_alive(struct hnae3_handle *handle, bool alive)
static int hclgevf_client_start(struct hnae3_handle *handle) static int hclgevf_client_start(struct hnae3_handle *handle)
{ {
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
int ret;
ret = hclgevf_set_alive(handle, true);
if (ret)
return ret;
mod_timer(&hdev->keep_alive_timer, jiffies + 2 * HZ); mod_timer(&hdev->keep_alive_timer, jiffies + 2 * HZ);
return hclgevf_set_alive(handle, true);
return 0;
} }
static void hclgevf_client_stop(struct hnae3_handle *handle) static void hclgevf_client_stop(struct hnae3_handle *handle)
...@@ -2075,6 +2081,10 @@ static void hclgevf_state_uninit(struct hclgevf_dev *hdev) ...@@ -2075,6 +2081,10 @@ static void hclgevf_state_uninit(struct hclgevf_dev *hdev)
{ {
set_bit(HCLGEVF_STATE_DOWN, &hdev->state); set_bit(HCLGEVF_STATE_DOWN, &hdev->state);
if (hdev->keep_alive_timer.function)
del_timer_sync(&hdev->keep_alive_timer);
if (hdev->keep_alive_task.func)
cancel_work_sync(&hdev->keep_alive_task);
if (hdev->service_timer.function) if (hdev->service_timer.function)
del_timer_sync(&hdev->service_timer); del_timer_sync(&hdev->service_timer);
if (hdev->service_task.func) if (hdev->service_task.func)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment