Re: [PATCH net 6/7] net: hns3: fix VF reset fail issue

From: Jijie Shao
Date: Thu Nov 02 2023 - 08:17:14 EST


on 2023/11/2 18:45, Paolo Abeni wrote:
On Sat, 2023-10-28 at 10:59 +0800, Jijie Shao wrote:
-static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr)
+static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr,
+ bool need_dalay)
{
+#define HCLGEVF_RESET_DELAY 5
+
+ if (need_dalay)
+ mdelay(HCLGEVF_RESET_DELAY);
5ms delay in an interrupt handler is quite a lot. What about scheduling
a timer from the IH to clear the register when such delay is needed?

Thanks!

Paolo

Using timer in this case will complicate the code and make maintenance difficult.

We consider reducing the delay time by polling. For example,
the code cycles every 50 us to check whether the write register takes effect.
If yes, the function returns immediately. or the code cycles until 5 ms.

Is this method appropriate?

Thanks!
Jijie