From 3bad5cf6b0a315e41563340ec2c069dedd8f4986 Mon Sep 17 00:00:00 2001
From: Dengdui Huang <huangdengdui@huawei.com>
Date: Mon, 27 Nov 2023 21:39:02 +0800
Subject: [PATCH 396/397] net/hns3: fix reset event status

[ upstream commit b59a0cbec866a8d4f7d1938b6826f7961c75c9fd ]

The function hns3_clear_reset_event is used to clear PF
reset status, The VF shouldn't use it.

This patch fixes it.

Fixes: 1eee1ea75c0e ("net/hns3: fix IMP or global reset")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/hns3/hns3_intr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
index ce8a28e2f9..9d8dddfcc9 100644
--- a/drivers/net/hns3/hns3_intr.c
+++ b/drivers/net/hns3/hns3_intr.c
@@ -2727,7 +2727,8 @@ hns3_reset_post(struct hns3_adapter *hns)
 		/* IMP will wait ready flag before reset */
 		hns3_notify_reset_ready(hw, false);
 		hns3_clear_reset_level(hw, &hw->reset.pending);
-		hns3_clear_reset_event(hw);
+		if (!hns->is_vf)
+			hns3_clear_reset_event(hw);
 		__atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED);
 		hw->reset.attempts = 0;
 		hw->reset.stats.success_cnt++;
@@ -2776,7 +2777,8 @@ hns3_reset_fail_handle(struct hns3_adapter *hns)
 	struct timeval tv;
 
 	hns3_clear_reset_level(hw, &hw->reset.pending);
-	hns3_clear_reset_event(hw);
+	if (!hns->is_vf)
+		hns3_clear_reset_event(hw);
 	if (hns3_reset_err_handle(hns)) {
 		hw->reset.stage = RESET_STAGE_PREWAIT;
 		hns3_schedule_reset(hns);
-- 
2.33.0

