mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 20:31:34 +07:00
net: hns3: Prevent to request reset frequently
Netdevice reset should not be requested frequently, a new one must wait a moment since there may be some work not completed. Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6d4fab3953
commit
9de0b86f64
@ -2819,7 +2819,10 @@ static void hclge_clear_reset_cause(struct hclge_dev *hdev)
|
|||||||
|
|
||||||
static void hclge_reset(struct hclge_dev *hdev)
|
static void hclge_reset(struct hclge_dev *hdev)
|
||||||
{
|
{
|
||||||
|
struct hnae3_handle *handle;
|
||||||
|
|
||||||
/* perform reset of the stack & ae device for a client */
|
/* perform reset of the stack & ae device for a client */
|
||||||
|
handle = &hdev->vport[0].nic;
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
|
hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
|
||||||
|
|
||||||
@ -2836,6 +2839,7 @@ static void hclge_reset(struct hclge_dev *hdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hclge_notify_client(hdev, HNAE3_UP_CLIENT);
|
hclge_notify_client(hdev, HNAE3_UP_CLIENT);
|
||||||
|
handle->last_reset_time = jiffies;
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2849,8 +2853,13 @@ static void hclge_reset_event(struct hnae3_handle *handle)
|
|||||||
* know this if last reset request did not occur very recently (watchdog
|
* know this if last reset request did not occur very recently (watchdog
|
||||||
* timer = 5*HZ, let us check after sufficiently large time, say 4*5*Hz)
|
* timer = 5*HZ, let us check after sufficiently large time, say 4*5*Hz)
|
||||||
* In case of new request we reset the "reset level" to PF reset.
|
* In case of new request we reset the "reset level" to PF reset.
|
||||||
|
* And if it is a repeat reset request of the most recent one then we
|
||||||
|
* want to make sure we throttle the reset request. Therefore, we will
|
||||||
|
* not allow it again before 3*HZ times.
|
||||||
*/
|
*/
|
||||||
if (time_after(jiffies, (handle->last_reset_time + 4 * 5 * HZ)))
|
if (time_before(jiffies, (handle->last_reset_time + 3 * HZ)))
|
||||||
|
return;
|
||||||
|
else if (time_after(jiffies, (handle->last_reset_time + 4 * 5 * HZ)))
|
||||||
handle->reset_level = HNAE3_FUNC_RESET;
|
handle->reset_level = HNAE3_FUNC_RESET;
|
||||||
|
|
||||||
dev_info(&hdev->pdev->dev, "received reset event , reset type is %d",
|
dev_info(&hdev->pdev->dev, "received reset event , reset type is %d",
|
||||||
@ -2862,8 +2871,6 @@ static void hclge_reset_event(struct hnae3_handle *handle)
|
|||||||
|
|
||||||
if (handle->reset_level < HNAE3_GLOBAL_RESET)
|
if (handle->reset_level < HNAE3_GLOBAL_RESET)
|
||||||
handle->reset_level++;
|
handle->reset_level++;
|
||||||
|
|
||||||
handle->last_reset_time = jiffies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hclge_reset_subtask(struct hclge_dev *hdev)
|
static void hclge_reset_subtask(struct hclge_dev *hdev)
|
||||||
|
Loading…
Reference in New Issue
Block a user