DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD
@ 2021-10-22  9:19 Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 01/14] net/hns3: rename adding multicast address function in PF Min Hu (Connor)
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

This patchset refactor MAC handling for hns3 PMD, including
unicast, multicast and operation for MAC address.

Huisong Li (14):
  net/hns3: rename adding multicast address function in PF
  net/hns3: rename adding unicast address function in PF
  net/hns3: rename removing multicast address function in PF
  net/hns3: extract a common interface to check duplicates
  net/hns3: remove redundant adding multicast MAC interface
  net/hns3: rename removing unicast address function in PF
  net/hns3: remove redundant multicast operation interface
  net/hns3: add hns3 HW ops structure to operate hardware
  net/hns3: use APIs in hns3 HW ops to config MAC features
  net/hns3: uniform to config all MAC and MC address
  net/hns3: uniform adding and removing MAC address API
  net/hns3: uniform common function to check multicast
  net/hns3: refactor hns3 set MC MAC addr list API for PF
  net/hns3: replace set MC MAC addr list API in VF

 drivers/net/hns3/hns3_ethdev.c    | 271 +++++++++------------------
 drivers/net/hns3/hns3_ethdev.h    |  21 +++
 drivers/net/hns3/hns3_ethdev_vf.c | 296 ++----------------------------
 3 files changed, 127 insertions(+), 461 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 01/14] net/hns3: rename adding multicast address function in PF
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 02/14] net/hns3: rename adding unicast " Min Hu (Connor)
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch renames hns3_add_mc_addr() to hns3_add_mc_mac_addr().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6b89bcef97..5fd73b082d 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -95,8 +95,8 @@ static int hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid,
 static int hns3_update_link_info(struct rte_eth_dev *eth_dev);
 static bool hns3_update_link_status(struct hns3_hw *hw);
 
-static int hns3_add_mc_addr(struct hns3_hw *hw,
-			    struct rte_ether_addr *mac_addr);
+static int hns3_add_mc_mac_addr(struct hns3_hw *hw,
+				struct rte_ether_addr *mac_addr);
 static int hns3_remove_mc_addr(struct hns3_hw *hw,
 			    struct rte_ether_addr *mac_addr);
 static int hns3_restore_fec(struct hns3_hw *hw);
@@ -1630,7 +1630,7 @@ hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 		}
 	}
 
-	ret = hns3_add_mc_addr(hw, mac_addr);
+	ret = hns3_add_mc_mac_addr(hw, mac_addr);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      mac_addr);
@@ -1826,7 +1826,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
 			continue;
 		if (rte_is_multicast_ether_addr(addr))
 			ret = del ? hns3_remove_mc_addr(hw, addr) :
-			      hns3_add_mc_addr(hw, addr);
+			      hns3_add_mc_mac_addr(hw, addr);
 		else
 			ret = del ? hns3_remove_uc_addr_common(hw, addr) :
 			      hns3_add_uc_addr_common(hw, addr);
@@ -1872,7 +1872,7 @@ hns3_update_desc_vfid(struct hns3_cmd_desc *desc, uint8_t vfid, bool clr)
 }
 
 static int
-hns3_add_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
+hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 {
 	struct hns3_cmd_desc desc[HNS3_MC_MAC_VLAN_OPS_DESC_NUM];
 	struct hns3_mac_vlan_tbl_entry_cmd req;
@@ -2156,7 +2156,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	/* Add mc mac addresses */
 	for (i = 0; i < add_addr_num; i++) {
 		addr = &add_addr_list[i];
-		ret = hns3_add_mc_addr(hw, addr);
+		ret = hns3_add_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
@@ -2188,7 +2188,7 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
 		if (del)
 			ret = hns3_remove_mc_addr(hw, addr);
 		else
-			ret = hns3_add_mc_addr(hw, addr);
+			ret = hns3_add_mc_mac_addr(hw, addr);
 		if (ret) {
 			err = ret;
 			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 02/14] net/hns3: rename adding unicast address function in PF
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 01/14] net/hns3: rename adding multicast address function in PF Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 03/14] net/hns3: rename removing multicast " Min Hu (Connor)
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch renames hns3_add_uc_addr() to hns3_add_uc_mac_addr().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 5fd73b082d..8311921f1d 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1540,7 +1540,7 @@ hns3_remove_mac_vlan_tbl(struct hns3_hw *hw,
 }
 
 static int
-hns3_add_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
+hns3_add_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 {
 	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
 	struct hns3_mac_vlan_tbl_entry_cmd req;
@@ -1678,7 +1678,7 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	if (rte_is_multicast_ether_addr(mac_addr))
 		ret = hns3_add_mc_addr_common(hw, mac_addr);
 	else
-		ret = hns3_add_uc_addr_common(hw, mac_addr);
+		ret = hns3_add_uc_mac_addr(hw, mac_addr);
 
 	if (ret) {
 		rte_spinlock_unlock(&hw->lock);
@@ -1768,7 +1768,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 		return ret;
 	}
 
-	ret = hns3_add_uc_addr_common(hw, mac_addr);
+	ret = hns3_add_uc_mac_addr(hw, mac_addr);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      mac_addr);
@@ -1799,7 +1799,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	}
 
 err_add_uc_addr:
-	ret_val = hns3_add_uc_addr_common(hw, oaddr);
+	ret_val = hns3_add_uc_mac_addr(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",
@@ -1829,7 +1829,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
 			      hns3_add_mc_mac_addr(hw, addr);
 		else
 			ret = del ? hns3_remove_uc_addr_common(hw, addr) :
-			      hns3_add_uc_addr_common(hw, addr);
+			      hns3_add_uc_mac_addr(hw, addr);
 
 		if (ret) {
 			err = ret;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 03/14] net/hns3: rename removing multicast address function in PF
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 01/14] net/hns3: rename adding multicast address function in PF Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 02/14] net/hns3: rename adding unicast " Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 04/14] net/hns3: extract a common interface to check duplicates Min Hu (Connor)
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch renames hns3_remove_mc_addr() to hns3_remove_mc_mac_addr().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 8311921f1d..2d80b8454c 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -97,8 +97,8 @@ static bool hns3_update_link_status(struct hns3_hw *hw);
 
 static int hns3_add_mc_mac_addr(struct hns3_hw *hw,
 				struct rte_ether_addr *mac_addr);
-static int hns3_remove_mc_addr(struct hns3_hw *hw,
-			    struct rte_ether_addr *mac_addr);
+static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,
+				   struct rte_ether_addr *mac_addr);
 static int hns3_restore_fec(struct hns3_hw *hw);
 static int hns3_query_dev_fec_info(struct hns3_hw *hw);
 static int hns3_do_stop(struct hns3_adapter *hns);
@@ -1646,7 +1646,7 @@ hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	int ret;
 
-	ret = hns3_remove_mc_addr(hw, mac_addr);
+	ret = hns3_remove_mc_mac_addr(hw, mac_addr);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      mac_addr);
@@ -1825,7 +1825,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
 		if (rte_is_zero_ether_addr(addr))
 			continue;
 		if (rte_is_multicast_ether_addr(addr))
-			ret = del ? hns3_remove_mc_addr(hw, addr) :
+			ret = del ? hns3_remove_mc_mac_addr(hw, addr) :
 			      hns3_add_mc_mac_addr(hw, addr);
 		else
 			ret = del ? hns3_remove_uc_addr_common(hw, addr) :
@@ -1921,7 +1921,7 @@ hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 }
 
 static int
-hns3_remove_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
+hns3_remove_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 {
 	struct hns3_mac_vlan_tbl_entry_cmd req;
 	struct hns3_cmd_desc desc[3];
@@ -2145,7 +2145,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	for (i = 0; i < rm_addr_num; i++) {
 		num = rm_addr_num - i - 1;
 		addr = &rm_addr_list[num];
-		ret = hns3_remove_mc_addr(hw, addr);
+		ret = hns3_remove_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
@@ -2186,7 +2186,7 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
 		if (!rte_is_multicast_ether_addr(addr))
 			continue;
 		if (del)
-			ret = hns3_remove_mc_addr(hw, addr);
+			ret = hns3_remove_mc_mac_addr(hw, addr);
 		else
 			ret = hns3_add_mc_mac_addr(hw, addr);
 		if (ret) {
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 04/14] net/hns3: extract a common interface to check duplicates
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (2 preceding siblings ...)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 03/14] net/hns3: rename removing multicast " Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 05/14] net/hns3: remove redundant adding multicast MAC interface Min Hu (Connor)
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

Extract a common interface for PF and VF to check whether the configured
multicast MAC address from rte_eth_dev_mac_addr_add() is the same as the
multicast MAC address from rte_eth_dev_set_mc_addr_list().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 25 ++++++++++++++++++-------
 drivers/net/hns3/hns3_ethdev.h    |  4 ++++
 drivers/net/hns3/hns3_ethdev_vf.c | 16 ++--------------
 3 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 2d80b8454c..1650ec77bb 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1609,27 +1609,38 @@ hns3_add_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 	return ret;
 }
 
-static int
-hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
+bool
+hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
 {
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	struct rte_ether_addr *addr;
-	int ret;
 	int i;
 
 	for (i = 0; i < hw->mc_addrs_num; i++) {
 		addr = &hw->mc_addrs[i];
-		/* Check if there are duplicate addresses */
-		if (rte_is_same_ether_addr(addr, mac_addr)) {
+		/* Check if there are duplicate addresses in mc_addrs[] */
+		if (rte_is_same_ether_addr(addr, mc_addr)) {
 			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      addr);
+					       addr);
 			hns3_err(hw, "failed to add mc mac addr, same addrs"
 				 "(%s) is added by the set_mc_mac_addr_list "
 				 "API", mac_str);
-			return -EINVAL;
+			return true;
 		}
 	}
 
+	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,
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index fa08fadc94..20999ce7ab 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -1048,6 +1048,10 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
 			  uint32_t link_speed, uint8_t link_duplex);
 void hns3_parse_devargs(struct rte_eth_dev *dev);
 void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
+
+bool hns3_find_duplicate_mc_addr(struct hns3_hw *hw,
+				struct rte_ether_addr *mc_addr);
+
 int hns3_restore_ptp(struct hns3_adapter *hns);
 int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
 				    struct rte_eth_conf *conf);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 8e5df05aa2..61489a537f 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -208,22 +208,10 @@ 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];
-	struct rte_ether_addr *addr;
 	int ret;
-	int i;
 
-	for (i = 0; i < hw->mc_addrs_num; i++) {
-		addr = &hw->mc_addrs[i];
-		/* Check if there are duplicate addresses */
-		if (rte_is_same_ether_addr(addr, mac_addr)) {
-			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      addr);
-			hns3_err(hw, "failed to add mc mac addr, same addrs"
-				 "(%s) is added by the set_mc_mac_addr_list "
-				 "API", mac_str);
-			return -EINVAL;
-		}
-	}
+	if (hns3_find_duplicate_mc_addr(hw, mac_addr))
+		return -EINVAL;
 
 	ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
 	if (ret) {
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 05/14] net/hns3: remove redundant adding multicast MAC interface
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (3 preceding siblings ...)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 04/14] net/hns3: extract a common interface to check duplicates Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 06/14] net/hns3: rename removing unicast address function in PF Min Hu (Connor)
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

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 1650ec77bb..eac89eacce 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 61489a537f..abb9211a09 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 06/14] net/hns3: rename removing unicast address function in PF
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (4 preceding siblings ...)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 05/14] net/hns3: remove redundant adding multicast MAC interface Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 07/14] net/hns3: remove redundant multicast operation interface Min Hu (Connor)
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch renames hns3_remove_uc_addr_common() to
hns3_remove_uc_mac_addr() in PF.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index eac89eacce..467aad0fb5 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1691,7 +1691,7 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 }
 
 static int
-hns3_remove_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
+hns3_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 {
 	struct hns3_mac_vlan_tbl_entry_cmd req;
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
@@ -1732,7 +1732,7 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
 	if (rte_is_multicast_ether_addr(mac_addr))
 		ret = hns3_remove_mc_addr_common(hw, mac_addr);
 	else
-		ret = hns3_remove_uc_addr_common(hw, mac_addr);
+		ret = hns3_remove_uc_mac_addr(hw, mac_addr);
 	rte_spinlock_unlock(&hw->lock);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
@@ -1753,7 +1753,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 
 	rte_spinlock_lock(&hw->lock);
 	oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
-	ret = hns3_remove_uc_addr_common(hw, oaddr);
+	ret = hns3_remove_uc_mac_addr(hw, oaddr);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      oaddr);
@@ -1785,7 +1785,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	return 0;
 
 err_pause_addr_cfg:
-	ret_val = hns3_remove_uc_addr_common(hw, mac_addr);
+	ret_val = hns3_remove_uc_mac_addr(hw, mac_addr);
 	if (ret_val) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      mac_addr);
@@ -1824,7 +1824,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
 			ret = del ? hns3_remove_mc_mac_addr(hw, addr) :
 			      hns3_add_mc_mac_addr(hw, addr);
 		else
-			ret = del ? hns3_remove_uc_addr_common(hw, addr) :
+			ret = del ? hns3_remove_uc_mac_addr(hw, addr) :
 			      hns3_add_uc_mac_addr(hw, addr);
 
 		if (ret) {
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 07/14] net/hns3: remove redundant multicast operation interface
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (5 preceding siblings ...)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 06/14] net/hns3: rename removing unicast address function in PF Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 08/14] net/hns3: add hns3 HW ops structure to operate hardware Min Hu (Connor)
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch removes redundant hns3_remove_mc_addr_common(), which can be
replaced by hns3_remove_mc_mac_addr().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 467aad0fb5..02d4b11029 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1632,22 +1632,6 @@ hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
 	return false;
 }
 
-static int
-hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
-{
-	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
-	int ret;
-
-	ret = hns3_remove_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 remove mc mac addr(%s), ret = %d",
-			 mac_str, ret);
-	}
-	return ret;
-}
-
 static int
 hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 		  __rte_unused uint32_t idx, __rte_unused uint32_t pool)
@@ -1730,7 +1714,7 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
 	rte_spinlock_lock(&hw->lock);
 
 	if (rte_is_multicast_ether_addr(mac_addr))
-		ret = hns3_remove_mc_addr_common(hw, mac_addr);
+		ret = hns3_remove_mc_mac_addr(hw, mac_addr);
 	else
 		ret = hns3_remove_uc_mac_addr(hw, mac_addr);
 	rte_spinlock_unlock(&hw->lock);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 08/14] net/hns3: add hns3 HW ops structure to operate hardware
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (6 preceding siblings ...)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 07/14] net/hns3: remove redundant multicast operation interface Min Hu (Connor)
@ 2021-10-22  9:19 ` Min Hu (Connor)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 09/14] net/hns3: use APIs in hns3 HW ops to config MAC features Min Hu (Connor)
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch adds hns3_hw_ops structure to operate hardware in PF and VF
driver.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 10 ++++++++++
 drivers/net/hns3/hns3_ethdev.h    | 13 +++++++++++++
 drivers/net/hns3/hns3_ethdev_vf.c | 10 ++++++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 02d4b11029..e1099f5df9 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -7436,6 +7436,15 @@ static const struct hns3_reset_ops hns3_reset_ops = {
 	.start_service       = hns3_start_service,
 };
 
+static void
+hns3_init_hw_ops(struct hns3_hw *hw)
+{
+	hw->ops.add_mc_mac_addr = hns3_add_mc_mac_addr;
+	hw->ops.del_mc_mac_addr = hns3_remove_mc_mac_addr;
+	hw->ops.add_uc_mac_addr = hns3_add_uc_mac_addr;
+	hw->ops.del_uc_mac_addr = hns3_remove_uc_mac_addr;
+}
+
 static int
 hns3_dev_init(struct rte_eth_dev *eth_dev)
 {
@@ -7488,6 +7497,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
 		goto err_init_reset;
 	hw->reset.ops = &hns3_reset_ops;
 
+	hns3_init_hw_ops(hw);
 	ret = hns3_init_pf(eth_dev);
 	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to init pf: %d", ret);
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 20999ce7ab..9d0a060720 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -428,6 +428,17 @@ struct hns3_reset_data {
 	struct hns3_wait_data *wait_data;
 };
 
+struct hns3_hw_ops {
+	int (*add_mc_mac_addr)(struct hns3_hw *hw,
+				struct rte_ether_addr *mac_addr);
+	int (*del_mc_mac_addr)(struct hns3_hw *hw,
+				struct rte_ether_addr *mac_addr);
+	int (*add_uc_mac_addr)(struct hns3_hw *hw,
+				struct rte_ether_addr *mac_addr);
+	int (*del_uc_mac_addr)(struct hns3_hw *hw,
+				struct rte_ether_addr *mac_addr);
+};
+
 #define HNS3_INTR_MAPPING_VEC_RSV_ONE		0
 #define HNS3_INTR_MAPPING_VEC_ALL		1
 
@@ -638,6 +649,8 @@ struct hns3_hw {
 	struct hns3_rss_filter_list flow_rss_list; /* flow RSS rule list */
 	struct hns3_flow_mem_list flow_list;
 
+	struct hns3_hw_ops ops;
+
 	/*
 	 * PMD setup and configuration is not thread safe. Since it is not
 	 * performance sensitive, it is better to guarantee thread-safety
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index abb9211a09..b5c6a696f3 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2894,6 +2894,15 @@ static const struct hns3_reset_ops hns3vf_reset_ops = {
 	.start_service       = hns3vf_start_service,
 };
 
+static void
+hns3vf_init_hw_ops(struct hns3_hw *hw)
+{
+	hw->ops.add_mc_mac_addr = hns3vf_add_mc_mac_addr;
+	hw->ops.del_mc_mac_addr = hns3vf_remove_mc_mac_addr;
+	hw->ops.add_uc_mac_addr = hns3vf_add_uc_mac_addr;
+	hw->ops.del_uc_mac_addr = hns3vf_remove_uc_mac_addr;
+}
+
 static int
 hns3vf_dev_init(struct rte_eth_dev *eth_dev)
 {
@@ -2938,6 +2947,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
 		goto err_init_reset;
 	hw->reset.ops = &hns3vf_reset_ops;
 
+	hns3vf_init_hw_ops(hw);
 	ret = hns3vf_init_vf(eth_dev);
 	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to init vf: %d", ret);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 09/14] net/hns3: use APIs in hns3 HW ops to config MAC features
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (7 preceding siblings ...)
  2021-10-22  9:19 ` [dpdk-dev] [PATCH 08/14] net/hns3: add hns3 HW ops structure to operate hardware Min Hu (Connor)
@ 2021-10-22  9:20 ` Min Hu (Connor)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 10/14] net/hns3: uniform to config all MAC and MC address Min Hu (Connor)
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch uses APIs in hns3_hw_ops to configure MAC related features.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 32 +++++++++++++++----------------
 drivers/net/hns3/hns3_ethdev_vf.c | 27 +++++++++++++-------------
 2 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index e1099f5df9..dcdbb962eb 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1656,9 +1656,9 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 			rte_spinlock_unlock(&hw->lock);
 			return -EINVAL;
 		}
-		ret = hns3_add_mc_mac_addr(hw, mac_addr);
+		ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
 	} else {
-		ret = hns3_add_uc_mac_addr(hw, mac_addr);
+		ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
 	}
 	if (ret) {
 		rte_spinlock_unlock(&hw->lock);
@@ -1714,9 +1714,9 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
 	rte_spinlock_lock(&hw->lock);
 
 	if (rte_is_multicast_ether_addr(mac_addr))
-		ret = hns3_remove_mc_mac_addr(hw, mac_addr);
+		ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
 	else
-		ret = hns3_remove_uc_mac_addr(hw, mac_addr);
+		ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
 	rte_spinlock_unlock(&hw->lock);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
@@ -1737,7 +1737,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 
 	rte_spinlock_lock(&hw->lock);
 	oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
-	ret = hns3_remove_uc_mac_addr(hw, oaddr);
+	ret = hw->ops.del_uc_mac_addr(hw, oaddr);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      oaddr);
@@ -1748,7 +1748,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 		return ret;
 	}
 
-	ret = hns3_add_uc_mac_addr(hw, mac_addr);
+	ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
 	if (ret) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      mac_addr);
@@ -1769,7 +1769,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	return 0;
 
 err_pause_addr_cfg:
-	ret_val = hns3_remove_uc_mac_addr(hw, mac_addr);
+	ret_val = hw->ops.del_uc_mac_addr(hw, mac_addr);
 	if (ret_val) {
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      mac_addr);
@@ -1779,7 +1779,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	}
 
 err_add_uc_addr:
-	ret_val = hns3_add_uc_mac_addr(hw, oaddr);
+	ret_val = hw->ops.add_uc_mac_addr(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",
@@ -1805,11 +1805,11 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
 		if (rte_is_zero_ether_addr(addr))
 			continue;
 		if (rte_is_multicast_ether_addr(addr))
-			ret = del ? hns3_remove_mc_mac_addr(hw, addr) :
-			      hns3_add_mc_mac_addr(hw, addr);
+			ret = del ? ops->del_mc_mac_addr(hw, addr) :
+			      ops->add_mc_mac_addr(hw, addr);
 		else
-			ret = del ? hns3_remove_uc_mac_addr(hw, addr) :
-			      hns3_add_uc_mac_addr(hw, addr);
+			ret = del ? ops->del_uc_mac_addr(hw, addr) :
+			      ops->add_uc_mac_addr(hw, addr);
 
 		if (ret) {
 			err = ret;
@@ -2125,7 +2125,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	for (i = 0; i < rm_addr_num; i++) {
 		num = rm_addr_num - i - 1;
 		addr = &rm_addr_list[num];
-		ret = hns3_remove_mc_mac_addr(hw, addr);
+		ret = hw->ops.del_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
@@ -2136,7 +2136,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	/* Add mc mac addresses */
 	for (i = 0; i < add_addr_num; i++) {
 		addr = &add_addr_list[i];
-		ret = hns3_add_mc_mac_addr(hw, addr);
+		ret = hw->ops.add_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
@@ -2166,9 +2166,9 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
 		if (!rte_is_multicast_ether_addr(addr))
 			continue;
 		if (del)
-			ret = hns3_remove_mc_mac_addr(hw, addr);
+			ret = hw->ops.del_mc_mac_addr(hw, addr);
 		else
-			ret = hns3_add_mc_mac_addr(hw, addr);
+			ret = hw->ops.add_mc_mac_addr(hw, addr);
 		if (ret) {
 			err = ret;
 			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 b5c6a696f3..616b3ed6db 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -229,9 +229,9 @@ hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 			rte_spinlock_unlock(&hw->lock);
 			return -EINVAL;
 		}
-		ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
+		ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
 	} else {
-		ret = hns3vf_add_uc_mac_addr(hw, mac_addr);
+		ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
 	}
 
 	rte_spinlock_unlock(&hw->lock);
@@ -257,9 +257,9 @@ hns3vf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
 	rte_spinlock_lock(&hw->lock);
 
 	if (rte_is_multicast_ether_addr(mac_addr))
-		ret = hns3vf_remove_mc_mac_addr(hw, mac_addr);
+		ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
 	else
-		ret = hns3vf_remove_uc_mac_addr(hw, mac_addr);
+		ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
 
 	rte_spinlock_unlock(&hw->lock);
 	if (ret) {
@@ -326,9 +326,10 @@ hns3vf_set_default_mac_addr(struct rte_eth_dev *dev,
 static int
 hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del)
 {
+	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	struct hns3_hw *hw = &hns->hw;
+	struct hns3_hw_ops *ops = &hw->ops;
 	struct rte_ether_addr *addr;
-	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	int err = 0;
 	int ret;
 	int i;
@@ -338,11 +339,11 @@ hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del)
 		if (rte_is_zero_ether_addr(addr))
 			continue;
 		if (rte_is_multicast_ether_addr(addr))
-			ret = del ? hns3vf_remove_mc_mac_addr(hw, addr) :
-			      hns3vf_add_mc_mac_addr(hw, addr);
+			ret = del ? ops->del_mc_mac_addr(hw, addr) :
+			      ops->add_mc_mac_addr(hw, addr);
 		else
-			ret = del ? hns3vf_remove_uc_mac_addr(hw, addr) :
-			      hns3vf_add_uc_mac_addr(hw, addr);
+			ret = del ? ops->del_uc_mac_addr(hw, addr) :
+			      ops->add_uc_mac_addr(hw, addr);
 
 		if (ret) {
 			err = ret;
@@ -484,7 +485,7 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	for (i = 0; i < cur_addr_num; i++) {
 		num = cur_addr_num - i - 1;
 		addr = &hw->mc_addrs[num];
-		ret = hns3vf_remove_mc_mac_addr(hw, addr);
+		ret = hw->ops.del_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
@@ -496,7 +497,7 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	set_addr_num = (int)nb_mc_addr;
 	for (i = 0; i < set_addr_num; i++) {
 		addr = &mc_addr_set[i];
-		ret = hns3vf_add_mc_mac_addr(hw, addr);
+		ret = hw->ops.add_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
@@ -525,9 +526,9 @@ hns3vf_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
 		if (!rte_is_multicast_ether_addr(addr))
 			continue;
 		if (del)
-			ret = hns3vf_remove_mc_mac_addr(hw, addr);
+			ret = hw->ops.del_mc_mac_addr(hw, addr);
 		else
-			ret = hns3vf_add_mc_mac_addr(hw, addr);
+			ret = hw->ops.add_mc_mac_addr(hw, addr);
 		if (ret) {
 			err = ret;
 			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 10/14] net/hns3: uniform to config all MAC and MC address
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (8 preceding siblings ...)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 09/14] net/hns3: use APIs in hns3 HW ops to config MAC features Min Hu (Connor)
@ 2021-10-22  9:20 ` Min Hu (Connor)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 11/14] net/hns3: uniform adding and removing MAC address API Min Hu (Connor)
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

Currently, the interface logic for adding and deleting all MAC address and
multicast address in PF and VF driver is the same. This patch extracts two
common interfaces to configure them separately.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 32 ++++++-------
 drivers/net/hns3/hns3_ethdev.h    |  2 +
 drivers/net/hns3/hns3_ethdev_vf.c | 77 +++----------------------------
 3 files changed, 25 insertions(+), 86 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index dcdbb962eb..0431091f49 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1790,17 +1790,20 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	return ret;
 }
 
-static int
+int
 hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
 {
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	struct hns3_hw *hw = &hns->hw;
+	struct hns3_hw_ops *ops = &hw->ops;
 	struct rte_ether_addr *addr;
-	int err = 0;
-	int ret;
+	uint16_t mac_addrs_capa;
+	int ret = 0;
 	int i;
 
-	for (i = 0; i < HNS3_UC_MACADDR_NUM; i++) {
+	mac_addrs_capa =
+		hns->is_vf ? HNS3_VF_UC_MACADDR_NUM : HNS3_UC_MACADDR_NUM;
+	for (i = 0; i < mac_addrs_capa; i++) {
 		addr = &hw->data->mac_addrs[i];
 		if (rte_is_zero_ether_addr(addr))
 			continue;
@@ -1812,15 +1815,14 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
 			      ops->add_uc_mac_addr(hw, addr);
 
 		if (ret) {
-			err = ret;
 			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      addr);
-			hns3_err(hw, "failed to %s mac addr(%s) index:%d "
-				 "ret = %d.", del ? "remove" : "restore",
-				 mac_str, i, ret);
+					       addr);
+			hns3_err(hw, "failed to %s mac addr(%s) index:%d ret = %d.",
+				 del ? "remove" : "restore", mac_str, i, ret);
 		}
 	}
-	return err;
+
+	return ret;
 }
 
 static void
@@ -2151,14 +2153,13 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
+int
 hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
 {
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	struct hns3_hw *hw = &hns->hw;
 	struct rte_ether_addr *addr;
-	int err = 0;
-	int ret;
+	int ret = 0;
 	int i;
 
 	for (i = 0; i < hw->mc_addrs_num; i++) {
@@ -2170,14 +2171,13 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
 		else
 			ret = hw->ops.add_mc_mac_addr(hw, addr);
 		if (ret) {
-			err = ret;
 			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 					      addr);
-			hns3_dbg(hw, "%s mc mac addr: %s failed for pf: ret = %d",
+			hns3_dbg(hw, "failed to %s mc mac addr: %s ret = %d",
 				 del ? "Remove" : "Restore", mac_str, ret);
 		}
 	}
-	return err;
+	return ret;
 }
 
 static int
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 9d0a060720..0a58db5bc6 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -1064,6 +1064,8 @@ void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
 
 bool hns3_find_duplicate_mc_addr(struct hns3_hw *hw,
 				struct rte_ether_addr *mc_addr);
+int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
+int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
 
 int hns3_restore_ptp(struct hns3_adapter *hns);
 int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 616b3ed6db..7034434530 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -323,40 +323,6 @@ hns3vf_set_default_mac_addr(struct rte_eth_dev *dev,
 	return ret;
 }
 
-static int
-hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del)
-{
-	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
-	struct hns3_hw *hw = &hns->hw;
-	struct hns3_hw_ops *ops = &hw->ops;
-	struct rte_ether_addr *addr;
-	int err = 0;
-	int ret;
-	int i;
-
-	for (i = 0; i < HNS3_VF_UC_MACADDR_NUM; i++) {
-		addr = &hw->data->mac_addrs[i];
-		if (rte_is_zero_ether_addr(addr))
-			continue;
-		if (rte_is_multicast_ether_addr(addr))
-			ret = del ? ops->del_mc_mac_addr(hw, addr) :
-			      ops->add_mc_mac_addr(hw, addr);
-		else
-			ret = del ? ops->del_uc_mac_addr(hw, addr) :
-			      ops->add_uc_mac_addr(hw, addr);
-
-		if (ret) {
-			err = ret;
-			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      addr);
-			hns3_err(hw, "failed to %s mac addr(%s) index:%d "
-				 "ret = %d.", del ? "remove" : "restore",
-				 mac_str, i, ret);
-		}
-	}
-	return err;
-}
-
 static int
 hns3vf_add_mc_mac_addr(struct hns3_hw *hw,
 		       struct rte_ether_addr *mac_addr)
@@ -511,35 +477,6 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
-hns3vf_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
-{
-	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
-	struct hns3_hw *hw = &hns->hw;
-	struct rte_ether_addr *addr;
-	int err = 0;
-	int ret;
-	int i;
-
-	for (i = 0; i < hw->mc_addrs_num; i++) {
-		addr = &hw->mc_addrs[i];
-		if (!rte_is_multicast_ether_addr(addr))
-			continue;
-		if (del)
-			ret = hw->ops.del_mc_mac_addr(hw, addr);
-		else
-			ret = hw->ops.add_mc_mac_addr(hw, addr);
-		if (ret) {
-			err = ret;
-			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      addr);
-			hns3_err(hw, "Failed to %s mc mac addr: %s for vf: %d",
-				 del ? "Remove" : "Restore", mac_str, ret);
-		}
-	}
-	return err;
-}
-
 static int
 hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc,
 			bool en_uc_pmc, bool en_mc_pmc)
@@ -2048,7 +1985,7 @@ hns3vf_do_stop(struct hns3_adapter *hns)
 		hns3_dev_release_mbufs(hns);
 
 	if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) {
-		hns3vf_configure_mac_addr(hns, true);
+		hns3_configure_all_mac_addr(hns, true);
 		ret = hns3_reset_all_tqps(hns);
 		if (ret) {
 			hns3_err(hw, "failed to reset all queues ret = %d",
@@ -2143,7 +2080,7 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
 	hns3_reset_abort(hns);
 	hw->adapter_state = HNS3_NIC_CLOSED;
 	rte_eal_alarm_cancel(hns3vf_keep_alive_handler, eth_dev);
-	hns3vf_configure_all_mc_mac_addr(hns, true);
+	hns3_configure_all_mc_mac_addr(hns, true);
 	hns3vf_remove_all_vlan_table(hns);
 	hns3vf_uninit_vf(eth_dev);
 	hns3_free_all_queues(eth_dev);
@@ -2572,7 +2509,7 @@ hns3vf_stop_service(struct hns3_adapter *hns)
 	 * required to delete the entries.
 	 */
 	if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0)
-		hns3vf_configure_all_mc_mac_addr(hns, true);
+		hns3_configure_all_mc_mac_addr(hns, true);
 	rte_spinlock_unlock(&hw->lock);
 
 	return 0;
@@ -2658,11 +2595,11 @@ hns3vf_restore_conf(struct hns3_adapter *hns)
 	if (ret)
 		return ret;
 
-	ret = hns3vf_configure_mac_addr(hns, false);
+	ret = hns3_configure_all_mac_addr(hns, false);
 	if (ret)
 		return ret;
 
-	ret = hns3vf_configure_all_mc_mac_addr(hns, false);
+	ret = hns3_configure_all_mc_mac_addr(hns, false);
 	if (ret)
 		goto err_mc_mac;
 
@@ -2703,9 +2640,9 @@ hns3vf_restore_conf(struct hns3_adapter *hns)
 	return 0;
 
 err_vlan_table:
-	hns3vf_configure_all_mc_mac_addr(hns, true);
+	hns3_configure_all_mc_mac_addr(hns, true);
 err_mc_mac:
-	hns3vf_configure_mac_addr(hns, true);
+	hns3_configure_all_mac_addr(hns, true);
 	return ret;
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 11/14] net/hns3: uniform adding and removing MAC address API
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (9 preceding siblings ...)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 10/14] net/hns3: uniform to config all MAC and MC address Min Hu (Connor)
@ 2021-10-22  9:20 ` Min Hu (Connor)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 12/14] net/hns3: uniform common function to check multicast Min Hu (Connor)
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

The code logic of adding and removing MAC address in PF and VF is the same.
This patch extracts two common interfaces to add and remove them
separately.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 11 ++---
 drivers/net/hns3/hns3_ethdev.h    |  5 ++-
 drivers/net/hns3/hns3_ethdev_vf.c | 70 +------------------------------
 3 files changed, 9 insertions(+), 77 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 0431091f49..a52cede528 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1609,7 +1609,7 @@ hns3_add_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 	return ret;
 }
 
-bool
+static bool
 hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
 {
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
@@ -1632,7 +1632,7 @@ hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
 	return false;
 }
 
-static int
+int
 hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 		  __rte_unused uint32_t idx, __rte_unused uint32_t pool)
 {
@@ -1660,17 +1660,14 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	} else {
 		ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
 	}
+	rte_spinlock_unlock(&hw->lock);
 	if (ret) {
-		rte_spinlock_unlock(&hw->lock);
 		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
 				      mac_addr);
 		hns3_err(hw, "failed to add mac addr(%s), ret = %d", mac_str,
 			 ret);
-		return ret;
 	}
 
-	rte_spinlock_unlock(&hw->lock);
-
 	return ret;
 }
 
@@ -1702,7 +1699,7 @@ hns3_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 	return ret;
 }
 
-static void
+void
 hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 0a58db5bc6..c5b9c17002 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -1062,10 +1062,11 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
 void hns3_parse_devargs(struct rte_eth_dev *dev);
 void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
 
-bool hns3_find_duplicate_mc_addr(struct hns3_hw *hw,
-				struct rte_ether_addr *mc_addr);
 int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
 int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
+int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
+		__rte_unused uint32_t idx, __rte_unused uint32_t pool);
+void hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx);
 
 int hns3_restore_ptp(struct hns3_adapter *hns);
 int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 7034434530..25300b23fc 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -204,72 +204,6 @@ hns3vf_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 	return ret;
 }
 
-static int
-hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
-		    __rte_unused uint32_t idx,
-		    __rte_unused uint32_t pool)
-{
-	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
-	int ret;
-
-	rte_spinlock_lock(&hw->lock);
-
-	/*
-	 * In hns3 network engine adding UC and MC mac address with different
-	 * commands with firmware. We need to determine whether the input
-	 * address is a UC or a MC address to call different commands.
-	 * By the way, it is recommended calling the API function named
-	 * rte_eth_dev_set_mc_addr_list to set the MC mac address, because
-	 * 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)) {
-		if (hns3_find_duplicate_mc_addr(hw, mac_addr)) {
-			rte_spinlock_unlock(&hw->lock);
-			return -EINVAL;
-		}
-		ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
-	} else {
-		ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
-	}
-
-	rte_spinlock_unlock(&hw->lock);
-	if (ret) {
-		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-				      mac_addr);
-		hns3_err(hw, "failed to add mac addr(%s), ret = %d", mac_str,
-			 ret);
-	}
-
-	return ret;
-}
-
-static void
-hns3vf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
-{
-	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	/* index will be checked by upper level rte interface */
-	struct rte_ether_addr *mac_addr = &dev->data->mac_addrs[idx];
-	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
-	int ret;
-
-	rte_spinlock_lock(&hw->lock);
-
-	if (rte_is_multicast_ether_addr(mac_addr))
-		ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
-	else
-		ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
-
-	rte_spinlock_unlock(&hw->lock);
-	if (ret) {
-		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-				      mac_addr);
-		hns3_err(hw, "failed to remove mac addr(%s), ret = %d",
-			 mac_str, ret);
-	}
-}
-
 static int
 hns3vf_set_default_mac_addr(struct rte_eth_dev *dev,
 			    struct rte_ether_addr *mac_addr)
@@ -2805,8 +2739,8 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {
 	.txq_info_get       = hns3_txq_info_get,
 	.rx_burst_mode_get  = hns3_rx_burst_mode_get,
 	.tx_burst_mode_get  = hns3_tx_burst_mode_get,
-	.mac_addr_add       = hns3vf_add_mac_addr,
-	.mac_addr_remove    = hns3vf_remove_mac_addr,
+	.mac_addr_add       = hns3_add_mac_addr,
+	.mac_addr_remove    = hns3_remove_mac_addr,
 	.mac_addr_set       = hns3vf_set_default_mac_addr,
 	.set_mc_addr_list   = hns3vf_set_mc_mac_addr_list,
 	.link_update        = hns3vf_dev_link_update,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 12/14] net/hns3: uniform common function to check multicast
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (10 preceding siblings ...)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 11/14] net/hns3: uniform adding and removing MAC address API Min Hu (Connor)
@ 2021-10-22  9:20 ` Min Hu (Connor)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 13/14] net/hns3: refactor hns3 set MC MAC addr list API for PF Min Hu (Connor)
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch uniforms a common function to check multicast address validity
for PF and VF.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 12 ++++--
 drivers/net/hns3/hns3_ethdev.h    |  4 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 66 +------------------------------
 3 files changed, 12 insertions(+), 70 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index a52cede528..af956854b1 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1947,13 +1947,15 @@ hns3_remove_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 	return ret;
 }
 
-static int
+int
 hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
 			   struct rte_ether_addr *mc_addr_set,
 			   uint32_t nb_mc_addr)
 {
+	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	struct rte_ether_addr *addr;
+	uint16_t mac_addrs_capa;
 	uint32_t i;
 	uint32_t j;
 
@@ -1993,12 +1995,14 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
 		 * Check if there are duplicate addresses between mac_addrs
 		 * and mc_addr_set
 		 */
-		for (j = 0; j < HNS3_UC_MACADDR_NUM; j++) {
+		mac_addrs_capa = hns->is_vf ? HNS3_VF_UC_MACADDR_NUM :
+					      HNS3_UC_MACADDR_NUM;
+		for (j = 0; j < mac_addrs_capa; j++) {
 			if (rte_is_same_ether_addr(addr,
 						   &hw->data->mac_addrs[j])) {
 				hns3_ether_format_addr(mac_str,
-						      RTE_ETHER_ADDR_FMT_SIZE,
-						      addr);
+						       RTE_ETHER_ADDR_FMT_SIZE,
+						       addr);
 				hns3_err(hw, "failed to set mc mac addr, "
 					 "addrs invalid. addrs(%s) has already "
 					 "configured in mac_addr add API",
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index c5b9c17002..762f03124f 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -1061,7 +1061,9 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
 			  uint32_t link_speed, uint8_t link_duplex);
 void hns3_parse_devargs(struct rte_eth_dev *dev);
 void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
-
+int hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
+			struct rte_ether_addr *mc_addr_set,
+			uint32_t nb_mc_addr);
 int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
 int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
 int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 25300b23fc..484ff24145 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -299,70 +299,6 @@ hns3vf_remove_mc_mac_addr(struct hns3_hw *hw,
 	return ret;
 }
 
-static int
-hns3vf_set_mc_addr_chk_param(struct hns3_hw *hw,
-			     struct rte_ether_addr *mc_addr_set,
-			     uint32_t nb_mc_addr)
-{
-	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
-	struct rte_ether_addr *addr;
-	uint32_t i;
-	uint32_t j;
-
-	if (nb_mc_addr > HNS3_MC_MACADDR_NUM) {
-		hns3_err(hw, "failed to set mc mac addr, nb_mc_addr(%u) "
-			 "invalid. valid range: 0~%d",
-			 nb_mc_addr, HNS3_MC_MACADDR_NUM);
-		return -EINVAL;
-	}
-
-	/* Check if input mac addresses are valid */
-	for (i = 0; i < nb_mc_addr; i++) {
-		addr = &mc_addr_set[i];
-		if (!rte_is_multicast_ether_addr(addr)) {
-			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      addr);
-			hns3_err(hw,
-				 "failed to set mc mac addr, addr(%s) invalid.",
-				 mac_str);
-			return -EINVAL;
-		}
-
-		/* Check if there are duplicate addresses */
-		for (j = i + 1; j < nb_mc_addr; j++) {
-			if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) {
-				hns3_ether_format_addr(mac_str,
-						      RTE_ETHER_ADDR_FMT_SIZE,
-						      addr);
-				hns3_err(hw, "failed to set mc mac addr, "
-					 "addrs invalid. two same addrs(%s).",
-					 mac_str);
-				return -EINVAL;
-			}
-		}
-
-		/*
-		 * Check if there are duplicate addresses between mac_addrs
-		 * and mc_addr_set
-		 */
-		for (j = 0; j < HNS3_VF_UC_MACADDR_NUM; j++) {
-			if (rte_is_same_ether_addr(addr,
-						   &hw->data->mac_addrs[j])) {
-				hns3_ether_format_addr(mac_str,
-						      RTE_ETHER_ADDR_FMT_SIZE,
-						      addr);
-				hns3_err(hw, "failed to set mc mac addr, "
-					 "addrs invalid. addrs(%s) has already "
-					 "configured in mac_addr add API",
-					 mac_str);
-				return -EINVAL;
-			}
-		}
-	}
-
-	return 0;
-}
-
 static int
 hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 			    struct rte_ether_addr *mc_addr_set,
@@ -376,7 +312,7 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 	int ret;
 	int i;
 
-	ret = hns3vf_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
+	ret = hns3_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
 	if (ret)
 		return ret;
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 13/14] net/hns3: refactor hns3 set MC MAC addr list API for PF
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (11 preceding siblings ...)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 12/14] net/hns3: uniform common function to check multicast Min Hu (Connor)
@ 2021-10-22  9:20 ` Min Hu (Connor)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 14/14] net/hns3: replace set MC MAC addr list API in VF Min Hu (Connor)
  2021-11-01 17:45 ` [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Ferruh Yigit
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

Currently, when configuring a group of multicast MAC addresses, the PF
driver reorder mc_addr array in hw struct to remove multicast MAC addresses
that are not in mc_addr_set array from user and then adds new multicast MAC
addresses. Actually, it can be simplified by removing all previous MAC
addresses and then adding new MAC addresses.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 112 ++++-----------------------------
 1 file changed, 11 insertions(+), 101 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index af956854b1..f627f494b6 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2015,94 +2015,15 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
 	return 0;
 }
 
-static void
-hns3_set_mc_addr_calc_addr(struct hns3_hw *hw,
-			   struct rte_ether_addr *mc_addr_set,
-			   int mc_addr_num,
-			   struct rte_ether_addr *reserved_addr_list,
-			   int *reserved_addr_num,
-			   struct rte_ether_addr *add_addr_list,
-			   int *add_addr_num,
-			   struct rte_ether_addr *rm_addr_list,
-			   int *rm_addr_num)
-{
-	struct rte_ether_addr *addr;
-	int current_addr_num;
-	int reserved_num = 0;
-	int add_num = 0;
-	int rm_num = 0;
-	int num;
-	int i;
-	int j;
-	bool same_addr;
-
-	/* Calculate the mc mac address list that should be removed */
-	current_addr_num = hw->mc_addrs_num;
-	for (i = 0; i < current_addr_num; i++) {
-		addr = &hw->mc_addrs[i];
-		same_addr = false;
-		for (j = 0; j < mc_addr_num; j++) {
-			if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) {
-				same_addr = true;
-				break;
-			}
-		}
-
-		if (!same_addr) {
-			rte_ether_addr_copy(addr, &rm_addr_list[rm_num]);
-			rm_num++;
-		} else {
-			rte_ether_addr_copy(addr,
-					    &reserved_addr_list[reserved_num]);
-			reserved_num++;
-		}
-	}
-
-	/* Calculate the mc mac address list that should be added */
-	for (i = 0; i < mc_addr_num; i++) {
-		addr = &mc_addr_set[i];
-		same_addr = false;
-		for (j = 0; j < current_addr_num; j++) {
-			if (rte_is_same_ether_addr(addr, &hw->mc_addrs[j])) {
-				same_addr = true;
-				break;
-			}
-		}
-
-		if (!same_addr) {
-			rte_ether_addr_copy(addr, &add_addr_list[add_num]);
-			add_num++;
-		}
-	}
-
-	/* Reorder the mc mac address list maintained by driver */
-	for (i = 0; i < reserved_num; i++)
-		rte_ether_addr_copy(&reserved_addr_list[i], &hw->mc_addrs[i]);
-
-	for (i = 0; i < rm_num; i++) {
-		num = reserved_num + i;
-		rte_ether_addr_copy(&rm_addr_list[i], &hw->mc_addrs[num]);
-	}
-
-	*reserved_addr_num = reserved_num;
-	*add_addr_num = add_num;
-	*rm_addr_num = rm_num;
-}
-
 static int
 hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 			  struct rte_ether_addr *mc_addr_set,
 			  uint32_t nb_mc_addr)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_ether_addr reserved_addr_list[HNS3_MC_MACADDR_NUM];
-	struct rte_ether_addr add_addr_list[HNS3_MC_MACADDR_NUM];
-	struct rte_ether_addr rm_addr_list[HNS3_MC_MACADDR_NUM];
 	struct rte_ether_addr *addr;
-	int reserved_addr_num;
-	int add_addr_num;
-	int rm_addr_num;
-	int mc_addr_num;
+	int cur_addr_num;
+	int set_addr_num;
 	int num;
 	int ret;
 	int i;
@@ -2113,40 +2034,29 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 		return ret;
 
 	rte_spinlock_lock(&hw->lock);
-
-	/*
-	 * Calculate the mc mac address lists those should be removed and be
-	 * added, Reorder the mc mac address list maintained by driver.
-	 */
-	mc_addr_num = (int)nb_mc_addr;
-	hns3_set_mc_addr_calc_addr(hw, mc_addr_set, mc_addr_num,
-				   reserved_addr_list, &reserved_addr_num,
-				   add_addr_list, &add_addr_num,
-				   rm_addr_list, &rm_addr_num);
-
-	/* Remove mc mac addresses */
-	for (i = 0; i < rm_addr_num; i++) {
-		num = rm_addr_num - i - 1;
-		addr = &rm_addr_list[num];
+	cur_addr_num = hw->mc_addrs_num;
+	for (i = 0; i < cur_addr_num; i++) {
+		num = cur_addr_num - i - 1;
+		addr = &hw->mc_addrs[num];
 		ret = hw->ops.del_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
 		}
+
 		hw->mc_addrs_num--;
 	}
 
-	/* Add mc mac addresses */
-	for (i = 0; i < add_addr_num; i++) {
-		addr = &add_addr_list[i];
+	set_addr_num = (int)nb_mc_addr;
+	for (i = 0; i < set_addr_num; i++) {
+		addr = &mc_addr_set[i];
 		ret = hw->ops.add_mc_mac_addr(hw, addr);
 		if (ret) {
 			rte_spinlock_unlock(&hw->lock);
 			return ret;
 		}
 
-		num = reserved_addr_num + i;
-		rte_ether_addr_copy(addr, &hw->mc_addrs[num]);
+		rte_ether_addr_copy(addr, &hw->mc_addrs[hw->mc_addrs_num]);
 		hw->mc_addrs_num++;
 	}
 	rte_spinlock_unlock(&hw->lock);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 14/14] net/hns3: replace set MC MAC addr list API in VF
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (12 preceding siblings ...)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 13/14] net/hns3: refactor hns3 set MC MAC addr list API for PF Min Hu (Connor)
@ 2021-10-22  9:20 ` Min Hu (Connor)
  2021-11-01 17:45 ` [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Ferruh Yigit
  14 siblings, 0 replies; 16+ messages in thread
From: Min Hu (Connor) @ 2021-10-22  9:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas

From: Huisong Li <lihuisong@huawei.com>

This patch removes hns3vf_set_mc_mac_addr_list() and uses
hns3_set_mc_mac_addr_list() to do this.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    |  4 +--
 drivers/net/hns3/hns3_ethdev.h    |  7 ++---
 drivers/net/hns3/hns3_ethdev_vf.c | 50 +------------------------------
 3 files changed, 6 insertions(+), 55 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f627f494b6..96b559fc1f 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1947,7 +1947,7 @@ hns3_remove_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 	return ret;
 }
 
-int
+static int
 hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
 			   struct rte_ether_addr *mc_addr_set,
 			   uint32_t nb_mc_addr)
@@ -2015,7 +2015,7 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
 	return 0;
 }
 
-static int
+int
 hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
 			  struct rte_ether_addr *mc_addr_set,
 			  uint32_t nb_mc_addr)
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 762f03124f..d3b97bfe28 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -1061,15 +1061,14 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
 			  uint32_t link_speed, uint8_t link_duplex);
 void hns3_parse_devargs(struct rte_eth_dev *dev);
 void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
-int hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
-			struct rte_ether_addr *mc_addr_set,
-			uint32_t nb_mc_addr);
 int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
 int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
 int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 		__rte_unused uint32_t idx, __rte_unused uint32_t pool);
 void hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx);
-
+int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
+			struct rte_ether_addr *mc_addr_set,
+							uint32_t nb_mc_addr);
 int hns3_restore_ptp(struct hns3_adapter *hns);
 int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
 				    struct rte_eth_conf *conf);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 484ff24145..ab92c4f88f 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -299,54 +299,6 @@ hns3vf_remove_mc_mac_addr(struct hns3_hw *hw,
 	return ret;
 }
 
-static int
-hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
-			    struct rte_ether_addr *mc_addr_set,
-			    uint32_t nb_mc_addr)
-{
-	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_ether_addr *addr;
-	int cur_addr_num;
-	int set_addr_num;
-	int num;
-	int ret;
-	int i;
-
-	ret = hns3_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
-	if (ret)
-		return ret;
-
-	rte_spinlock_lock(&hw->lock);
-	cur_addr_num = hw->mc_addrs_num;
-	for (i = 0; i < cur_addr_num; i++) {
-		num = cur_addr_num - i - 1;
-		addr = &hw->mc_addrs[num];
-		ret = hw->ops.del_mc_mac_addr(hw, addr);
-		if (ret) {
-			rte_spinlock_unlock(&hw->lock);
-			return ret;
-		}
-
-		hw->mc_addrs_num--;
-	}
-
-	set_addr_num = (int)nb_mc_addr;
-	for (i = 0; i < set_addr_num; i++) {
-		addr = &mc_addr_set[i];
-		ret = hw->ops.add_mc_mac_addr(hw, addr);
-		if (ret) {
-			rte_spinlock_unlock(&hw->lock);
-			return ret;
-		}
-
-		rte_ether_addr_copy(addr, &hw->mc_addrs[hw->mc_addrs_num]);
-		hw->mc_addrs_num++;
-	}
-	rte_spinlock_unlock(&hw->lock);
-
-	return 0;
-}
-
 static int
 hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc,
 			bool en_uc_pmc, bool en_mc_pmc)
@@ -2678,7 +2630,7 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {
 	.mac_addr_add       = hns3_add_mac_addr,
 	.mac_addr_remove    = hns3_remove_mac_addr,
 	.mac_addr_set       = hns3vf_set_default_mac_addr,
-	.set_mc_addr_list   = hns3vf_set_mc_mac_addr_list,
+	.set_mc_addr_list   = hns3_set_mc_mac_addr_list,
 	.link_update        = hns3vf_dev_link_update,
 	.rss_hash_update    = hns3_dev_rss_hash_update,
 	.rss_hash_conf_get  = hns3_dev_rss_hash_conf_get,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD
  2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
                   ` (13 preceding siblings ...)
  2021-10-22  9:20 ` [dpdk-dev] [PATCH 14/14] net/hns3: replace set MC MAC addr list API in VF Min Hu (Connor)
@ 2021-11-01 17:45 ` Ferruh Yigit
  14 siblings, 0 replies; 16+ messages in thread
From: Ferruh Yigit @ 2021-11-01 17:45 UTC (permalink / raw)
  To: Min Hu (Connor), dev; +Cc: thomas

On 10/22/2021 10:19 AM, Min Hu (Connor) wrote:
> This patchset refactor MAC handling for hns3 PMD, including
> unicast, multicast and operation for MAC address.
> 
> Huisong Li (14):
>    net/hns3: rename adding multicast address function in PF
>    net/hns3: rename adding unicast address function in PF
>    net/hns3: rename removing multicast address function in PF
>    net/hns3: extract a common interface to check duplicates
>    net/hns3: remove redundant adding multicast MAC interface
>    net/hns3: rename removing unicast address function in PF
>    net/hns3: remove redundant multicast operation interface
>    net/hns3: add hns3 HW ops structure to operate hardware
>    net/hns3: use APIs in hns3 HW ops to config MAC features
>    net/hns3: uniform to config all MAC and MC address
>    net/hns3: uniform adding and removing MAC address API
>    net/hns3: uniform common function to check multicast
>    net/hns3: refactor hns3 set MC MAC addr list API for PF
>    net/hns3: replace set MC MAC addr list API in VF
> 

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-11-01 18:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22  9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 01/14] net/hns3: rename adding multicast address function in PF Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 02/14] net/hns3: rename adding unicast " Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 03/14] net/hns3: rename removing multicast " Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 04/14] net/hns3: extract a common interface to check duplicates Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 05/14] net/hns3: remove redundant adding multicast MAC interface Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 06/14] net/hns3: rename removing unicast address function in PF Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 07/14] net/hns3: remove redundant multicast operation interface Min Hu (Connor)
2021-10-22  9:19 ` [dpdk-dev] [PATCH 08/14] net/hns3: add hns3 HW ops structure to operate hardware Min Hu (Connor)
2021-10-22  9:20 ` [dpdk-dev] [PATCH 09/14] net/hns3: use APIs in hns3 HW ops to config MAC features Min Hu (Connor)
2021-10-22  9:20 ` [dpdk-dev] [PATCH 10/14] net/hns3: uniform to config all MAC and MC address Min Hu (Connor)
2021-10-22  9:20 ` [dpdk-dev] [PATCH 11/14] net/hns3: uniform adding and removing MAC address API Min Hu (Connor)
2021-10-22  9:20 ` [dpdk-dev] [PATCH 12/14] net/hns3: uniform common function to check multicast Min Hu (Connor)
2021-10-22  9:20 ` [dpdk-dev] [PATCH 13/14] net/hns3: refactor hns3 set MC MAC addr list API for PF Min Hu (Connor)
2021-10-22  9:20 ` [dpdk-dev] [PATCH 14/14] net/hns3: replace set MC MAC addr list API in VF Min Hu (Connor)
2021-11-01 17:45 ` [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).