sync patches ranges from versoin 9 t0 17 from master branch Signed-off-by: speech_white <humin29@huawei.com>
118 lines
3.7 KiB
Diff
118 lines
3.7 KiB
Diff
From b84b0e518dc64f3aada5b30511db1c6f6fdb0694 Mon Sep 17 00:00:00 2001
|
|
From: Huisong Li <lihuisong@huawei.com>
|
|
Date: Fri, 22 Oct 2021 17:19:56 +0800
|
|
Subject: [PATCH 07/33] net/hns3: remove redundant multicast MAC interface
|
|
|
|
This patch removes hns3_add_mc_addr_common() in PF and
|
|
hns3vf_add_mc_addr_common() in VF.
|
|
|
|
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
|
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
|
---
|
|
drivers/net/hns3/hns3_ethdev.c | 31 ++++++++-----------------------
|
|
drivers/net/hns3/hns3_ethdev_vf.c | 30 ++++++++----------------------
|
|
2 files changed, 16 insertions(+), 45 deletions(-)
|
|
|
|
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
|
index f1346ee9f..7f4419c54 100644
|
|
--- a/drivers/net/hns3/hns3_ethdev.c
|
|
+++ b/drivers/net/hns3/hns3_ethdev.c
|
|
@@ -1632,25 +1632,6 @@ hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
|
|
return false;
|
|
}
|
|
|
|
-static int
|
|
-hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
|
-{
|
|
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
|
- int ret;
|
|
-
|
|
- if (hns3_find_duplicate_mc_addr(hw, mac_addr))
|
|
- return -EINVAL;
|
|
-
|
|
- ret = hns3_add_mc_mac_addr(hw, mac_addr);
|
|
- if (ret) {
|
|
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
|
- mac_addr);
|
|
- hns3_err(hw, "failed to add mc mac addr(%s), ret = %d",
|
|
- mac_str, ret);
|
|
- }
|
|
- return ret;
|
|
-}
|
|
-
|
|
static int
|
|
hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
|
{
|
|
@@ -1686,11 +1667,15 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
|
* using the rte_eth_dev_mac_addr_add API function to set MC mac address
|
|
* may affect the specifications of UC mac addresses.
|
|
*/
|
|
- if (rte_is_multicast_ether_addr(mac_addr))
|
|
- ret = hns3_add_mc_addr_common(hw, mac_addr);
|
|
- else
|
|
+ if (rte_is_multicast_ether_addr(mac_addr)) {
|
|
+ if (hns3_find_duplicate_mc_addr(hw, mac_addr)) {
|
|
+ rte_spinlock_unlock(&hw->lock);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ ret = hns3_add_mc_mac_addr(hw, mac_addr);
|
|
+ } else {
|
|
ret = hns3_add_uc_mac_addr(hw, mac_addr);
|
|
-
|
|
+ }
|
|
if (ret) {
|
|
rte_spinlock_unlock(&hw->lock);
|
|
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
|
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
|
index f60849606..92673d29b 100644
|
|
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
|
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
|
@@ -204,25 +204,6 @@ hns3vf_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
|
return ret;
|
|
}
|
|
|
|
-static int
|
|
-hns3vf_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
|
-{
|
|
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
|
- int ret;
|
|
-
|
|
- if (hns3_find_duplicate_mc_addr(hw, mac_addr))
|
|
- return -EINVAL;
|
|
-
|
|
- ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
|
|
- if (ret) {
|
|
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
|
- mac_addr);
|
|
- hns3_err(hw, "failed to add mc mac addr(%s), ret = %d",
|
|
- mac_str, ret);
|
|
- }
|
|
- return ret;
|
|
-}
|
|
-
|
|
static int
|
|
hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
|
__rte_unused uint32_t idx,
|
|
@@ -243,10 +224,15 @@ hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
|
* using the rte_eth_dev_mac_addr_add API function to set MC mac address
|
|
* may affect the specifications of UC mac addresses.
|
|
*/
|
|
- if (rte_is_multicast_ether_addr(mac_addr))
|
|
- ret = hns3vf_add_mc_addr_common(hw, mac_addr);
|
|
- else
|
|
+ if (rte_is_multicast_ether_addr(mac_addr)) {
|
|
+ if (hns3_find_duplicate_mc_addr(hw, mac_addr)) {
|
|
+ rte_spinlock_unlock(&hw->lock);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
|
|
+ } else {
|
|
ret = hns3vf_add_uc_mac_addr(hw, mac_addr);
|
|
+ }
|
|
|
|
rte_spinlock_unlock(&hw->lock);
|
|
if (ret) {
|
|
--
|
|
2.33.0
|
|
|