Skip to content

Commit e233516

Browse files
Huazhong Tandavem330
authored andcommitted
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: a6d818e ("net: hns3: Add vport alive state checking support") Signed-off-by: Huazhong Tan <[email protected]> Signed-off-by: Peng Li <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d60070 commit e233516

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,9 +2031,15 @@ static int hclgevf_set_alive(struct hnae3_handle *handle, bool alive)
20312031
static int hclgevf_client_start(struct hnae3_handle *handle)
20322032
{
20332033
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
2034+
int ret;
2035+
2036+
ret = hclgevf_set_alive(handle, true);
2037+
if (ret)
2038+
return ret;
20342039

20352040
mod_timer(&hdev->keep_alive_timer, jiffies + 2 * HZ);
2036-
return hclgevf_set_alive(handle, true);
2041+
2042+
return 0;
20372043
}
20382044

20392045
static void hclgevf_client_stop(struct hnae3_handle *handle)
@@ -2075,6 +2081,10 @@ static void hclgevf_state_uninit(struct hclgevf_dev *hdev)
20752081
{
20762082
set_bit(HCLGEVF_STATE_DOWN, &hdev->state);
20772083

2084+
if (hdev->keep_alive_timer.function)
2085+
del_timer_sync(&hdev->keep_alive_timer);
2086+
if (hdev->keep_alive_task.func)
2087+
cancel_work_sync(&hdev->keep_alive_task);
20782088
if (hdev->service_timer.function)
20792089
del_timer_sync(&hdev->service_timer);
20802090
if (hdev->service_task.func)

0 commit comments

Comments
 (0)