Skip to content

Commit 65e98bb

Browse files
Jijie Shaodavem330
authored andcommitted
net: hns3: fix VF reset fail issue
Currently the reset process in hns3 and firmware watchdog init process is asynchronous. We think firmware watchdog initialization is completed before VF clear the interrupt source. However, firmware initialization may not complete early. So VF will receive multiple reset interrupts and fail to reset. So we add delay before VF interrupt source and 5 ms delay is enough to avoid second reset interrupt. Fixes: 427900d ("net: hns3: fix the timing issue of VF clearing interrupt sources") Signed-off-by: Jijie Shao <shaojijie@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dbd2f3b commit 65e98bb

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,8 +1981,18 @@ static enum hclgevf_evt_cause hclgevf_check_evt_cause(struct hclgevf_dev *hdev,
19811981
return HCLGEVF_VECTOR0_EVENT_OTHER;
19821982
}
19831983

1984+
static void hclgevf_reset_timer(struct timer_list *t)
1985+
{
1986+
struct hclgevf_dev *hdev = from_timer(hdev, t, reset_timer);
1987+
1988+
hclgevf_clear_event_cause(hdev, HCLGEVF_VECTOR0_EVENT_RST);
1989+
hclgevf_reset_task_schedule(hdev);
1990+
}
1991+
19841992
static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data)
19851993
{
1994+
#define HCLGEVF_RESET_DELAY 5
1995+
19861996
enum hclgevf_evt_cause event_cause;
19871997
struct hclgevf_dev *hdev = data;
19881998
u32 clearval;
@@ -1994,7 +2004,8 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data)
19942004

19952005
switch (event_cause) {
19962006
case HCLGEVF_VECTOR0_EVENT_RST:
1997-
hclgevf_reset_task_schedule(hdev);
2007+
mod_timer(&hdev->reset_timer,
2008+
jiffies + msecs_to_jiffies(HCLGEVF_RESET_DELAY));
19982009
break;
19992010
case HCLGEVF_VECTOR0_EVENT_MBX:
20002011
hclgevf_mbx_handler(hdev);
@@ -2937,6 +2948,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
29372948
HCLGEVF_DRIVER_NAME);
29382949

29392950
hclgevf_task_schedule(hdev, round_jiffies_relative(HZ));
2951+
timer_setup(&hdev->reset_timer, hclgevf_reset_timer, 0);
29402952

29412953
return 0;
29422954

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct hclgevf_dev {
219219
enum hnae3_reset_type reset_level;
220220
unsigned long reset_pending;
221221
enum hnae3_reset_type reset_type;
222+
struct timer_list reset_timer;
222223

223224
#define HCLGEVF_RESET_REQUESTED 0
224225
#define HCLGEVF_RESET_PENDING 1

0 commit comments

Comments
 (0)