[10/11] net/hns3: fix VF reset after MBX failed

Message ID 1612355037-48768-11-git-send-email-oulijun@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Series critical bugfixes for hns3 |


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Lijun Ou Feb. 3, 2021, 12:23 p.m. UTC
  From: Chengchang Tang <tangchengchang@huawei.com>

Currently, during the VF reset, the VF will send a MBX to inform
PF to reset it and the disable command bit will be set whether
the MBX is successful. Generally, multiple reset attempts are made
after a failure. However, because the command is disabled, all
subsequent reset will all fail.

This patch disable the command only after the MBX message is

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
 drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 4f9da4a..a607bd3 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2404,15 +2404,17 @@  static int
 hns3vf_prepare_reset(struct hns3_adapter *hns)
 	struct hns3_hw *hw = &hns->hw;
-	int ret = 0;
+	int ret;
 	if (hw->reset.level == HNS3_VF_FUNC_RESET) {
 		ret = hns3_send_mbx_msg(hw, HNS3_MBX_RESET, 0, NULL,
 					0, true, NULL, 0);
+		if (ret)
+			return ret;
 	__atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED);
-	return ret;
+	return 0;
 static int