Add bugfixes for hns3 PMD to sync upstream branch. Signed-off-by: speech_white <humin29@huawei.com>
75 lines
2.4 KiB
Diff
75 lines
2.4 KiB
Diff
From 203d961619952ef99fda300b73c3a3c1edd725d3 Mon Sep 17 00:00:00 2001
|
|
From: Chengchang Tang <tangchengchang@huawei.com>
|
|
Date: Sat, 17 Jul 2021 10:02:49 +0800
|
|
Subject: [PATCH 17/26] net/hns3: fix residual MAC address entry
|
|
|
|
Currently, even if we fail to remove the origin MAC address from the HW,
|
|
the set_default_mac will go on, and add the new MAC address to the HW.
|
|
Eventually cause the original MAC address entry to remain in the HW, and
|
|
users may receive unexpected packets.
|
|
|
|
This patch make set_default_mac return directly to failure if deleting
|
|
the original MAC address fails, simplifying the behavior of the driver
|
|
and solving the problem of residual MAC address entry.
|
|
|
|
Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations")
|
|
Cc: stable@dpdk.org
|
|
|
|
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
|
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
|
---
|
|
drivers/net/hns3/hns3_ethdev.c | 22 +++++++++-------------
|
|
1 file changed, 9 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
|
index b2ee831..ce7aa95 100644
|
|
--- a/drivers/net/hns3/hns3_ethdev.c
|
|
+++ b/drivers/net/hns3/hns3_ethdev.c
|
|
@@ -1748,7 +1748,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
|
struct rte_ether_addr *oaddr;
|
|
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
|
bool default_addr_setted;
|
|
- bool rm_succes = false;
|
|
int ret, ret_val;
|
|
|
|
/*
|
|
@@ -1768,9 +1767,10 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
|
oaddr);
|
|
hns3_warn(hw, "Remove old uc mac address(%s) fail: %d",
|
|
mac_str, ret);
|
|
- rm_succes = false;
|
|
- } else
|
|
- rm_succes = true;
|
|
+
|
|
+ rte_spinlock_unlock(&hw->lock);
|
|
+ return ret;
|
|
+ }
|
|
}
|
|
|
|
ret = hns3_add_uc_addr_common(hw, mac_addr);
|
|
@@ -1805,16 +1805,12 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
|
}
|
|
|
|
err_add_uc_addr:
|
|
- if (rm_succes) {
|
|
- ret_val = hns3_add_uc_addr_common(hw, oaddr);
|
|
- if (ret_val) {
|
|
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
|
- oaddr);
|
|
- hns3_warn(hw,
|
|
- "Failed to restore old uc mac addr(%s): %d",
|
|
+ ret_val = hns3_add_uc_addr_common(hw, oaddr);
|
|
+ if (ret_val) {
|
|
+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr);
|
|
+ hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d",
|
|
mac_str, ret_val);
|
|
- hw->mac.default_addr_setted = false;
|
|
- }
|
|
+ hw->mac.default_addr_setted = false;
|
|
}
|
|
rte_spinlock_unlock(&hw->lock);
|
|
|
|
--
|
|
2.7.4
|
|
|