patches for DPDK stable branches
 help / color / mirror / Atom feed
* patch 'net/hns3: fix residual MAC after setting default MAC' has been queued to stable release 19.11.12
@ 2022-02-25 17:14 christian.ehrhardt
  2022-02-25 17:14 ` patch 'net/hns3: fix secondary process reference count' " christian.ehrhardt
                   ` (55 more replies)
  0 siblings, 56 replies; 57+ messages in thread
From: christian.ehrhardt @ 2022-02-25 17:14 UTC (permalink / raw)
  To: Huisong Li; +Cc: Min Hu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 19.11.12

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/27/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/2f88c3970219ec1c172c183fdad7e06ee82ba220

Thanks.

Christian Ehrhardt <christian.ehrhardt@canonical.com>

---
From 2f88c3970219ec1c172c183fdad7e06ee82ba220 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Sat, 25 Dec 2021 18:53:41 +0800
Subject: [PATCH] net/hns3: fix residual MAC after setting default MAC

[ upstream commit 19e67d8ebced5cb12829f75c70e6c497b5925e82 ]

This problem occurs in the following scenarios:
1) reset is encountered when the adapter is running.
2) set a new default MAC address.

After the above two steps, the old default MAC address should be not
take effect. But the current behavior is contrary to that. This is due
to the change of the "default_addr_setted" in hw->mac from 'true' to
'false' after the reset. As a result, the old MAC address is not removed
when the new default MAC address is set. This variable controls whether
to delete the old default MAC address when setting the default MAC
address. It is only used when the mac_addr_set API is called for the
first time. In fact, when a unicast MAC address is deleted, if the
address isn't in the MAC address table, the driver doesn't return
failure. So this patch remove the redundant and troublesome variables to
resolve this problem.

Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 58 ++++++++++------------------------
 drivers/net/hns3/hns3_ethdev.h |  1 -
 2 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 157dd34d4f..a2676f84b0 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1545,7 +1545,7 @@ hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
 
 static int
 hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
-		  uint32_t idx, __attribute__ ((unused)) uint32_t pool)
+		  __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];
@@ -1576,8 +1576,6 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 		return ret;
 	}
 
-	if (idx == 0)
-		hw->mac.default_addr_setted = true;
 	rte_spinlock_unlock(&hw->lock);
 
 	return ret;
@@ -1642,35 +1640,18 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	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;
 
-	/* check if mac addr is valid */
-	if (!rte_is_valid_assigned_ether_addr(mac_addr)) {
-		rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-				      mac_addr);
-		hns3_err(hw, "Failed to set mac addr, addr(%s) invalid",
-			 mac_str);
-		return -EINVAL;
-	}
-
-	oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
-	default_addr_setted = hw->mac.default_addr_setted;
-	if (default_addr_setted && !!rte_is_same_ether_addr(mac_addr, oaddr))
-		return 0;
-
 	rte_spinlock_lock(&hw->lock);
-	if (default_addr_setted) {
-		ret = hns3_remove_uc_addr_common(hw, oaddr);
-		if (ret) {
-			rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      oaddr);
-			hns3_warn(hw, "Remove old uc mac address(%s) fail: %d",
-				  mac_str, ret);
-			rm_succes = false;
-		} else
-			rm_succes = true;
+	oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
+	ret = hns3_remove_uc_addr_common(hw, oaddr);
+	if (ret) {
+		rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
+					oaddr);
+		hns3_warn(hw, "Remove old uc mac address(%s) fail: %d",
+				mac_str, ret);
+		rte_spinlock_unlock(&hw->lock);
+		return ret;
 	}
 
 	ret = hns3_add_uc_addr_common(hw, mac_addr);
@@ -1689,7 +1670,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 
 	rte_ether_addr_copy(mac_addr,
 			    (struct rte_ether_addr *)hw->mac.mac_addr);
-	hw->mac.default_addr_setted = true;
 	rte_spinlock_unlock(&hw->lock);
 
 	return 0;
@@ -1705,16 +1685,12 @@ err_pause_addr_cfg:
 	}
 
 err_add_uc_addr:
-	if (rm_succes) {
-		ret_val = hns3_add_uc_addr_common(hw, oaddr);
-		if (ret_val) {
-			rte_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;
-		}
+	ret_val = hns3_add_uc_addr_common(hw, oaddr);
+	if (ret_val) {
+		rte_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);
 	}
 	rte_spinlock_unlock(&hw->lock);
 
@@ -2880,7 +2856,6 @@ hns3_get_board_configuration(struct hns3_hw *hw)
 	hw->rss_dis_flag = false;
 	memcpy(hw->mac.mac_addr, cfg.mac_addr, RTE_ETHER_ADDR_LEN);
 	hw->mac.phy_addr = cfg.phy_addr;
-	hw->mac.default_addr_setted = false;
 	hw->num_tx_desc = cfg.tqp_desc_num;
 	hw->num_rx_desc = cfg.tqp_desc_num;
 	hw->dcb_info.num_pg = 1;
@@ -4699,7 +4674,6 @@ hns3_do_stop(struct hns3_adapter *hns)
 		reset_queue = true;
 	} else
 		reset_queue = false;
-	hw->mac.default_addr_setted = false;
 	return hns3_stop_queues(hns, reset_queue);
 }
 
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 6c3ac6f8a9..be0fac4fd2 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -144,7 +144,6 @@ enum hns3_media_type {
 
 struct hns3_mac {
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
-	bool default_addr_setted; /* whether default addr(mac_addr) is set */
 	uint8_t media_type;
 	uint8_t phy_addr;
 	uint8_t link_duplex  : 1; /* ETH_LINK_[HALF/FULL]_DUPLEX */
-- 
2.35.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-25 16:58:44.339090435 +0100
+++ 0001-net-hns3-fix-residual-MAC-after-setting-default-MAC.patch	2022-02-25 16:58:44.168990350 +0100
@@ -1 +1 @@
-From 19e67d8ebced5cb12829f75c70e6c497b5925e82 Mon Sep 17 00:00:00 2001
+From 2f88c3970219ec1c172c183fdad7e06ee82ba220 Mon Sep 17 00:00:00 2001
@@ -3 +3 @@
-Date: Wed, 22 Sep 2021 11:41:51 +0800
+Date: Sat, 25 Dec 2021 18:53:41 +0800
@@ -5,0 +6,2 @@
+[ upstream commit 19e67d8ebced5cb12829f75c70e6c497b5925e82 ]
+
@@ -8 +10 @@
-2) set a new default MAC address
+2) set a new default MAC address.
@@ -23 +24,0 @@
-Cc: stable@dpdk.org
@@ -28 +29 @@
- drivers/net/hns3/hns3_ethdev.c | 38 ++++++++++------------------------
+ drivers/net/hns3/hns3_ethdev.c | 58 ++++++++++------------------------
@@ -30 +31 @@
- 2 files changed, 11 insertions(+), 28 deletions(-)
+ 2 files changed, 16 insertions(+), 43 deletions(-)
@@ -33 +34 @@
-index 7d37004972..5c8ac5754f 100644
+index 157dd34d4f..a2676f84b0 100644
@@ -36 +37 @@
-@@ -1651,7 +1651,7 @@ hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
+@@ -1545,7 +1545,7 @@ hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
@@ -40 +41 @@
--		  uint32_t idx, __rte_unused uint32_t pool)
+-		  uint32_t idx, __attribute__ ((unused)) uint32_t pool)
@@ -45 +46 @@
-@@ -1682,8 +1682,6 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
+@@ -1576,8 +1576,6 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
@@ -54 +55 @@
-@@ -1748,30 +1746,19 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
+@@ -1642,35 +1640,18 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
@@ -58,0 +60 @@
+-	bool rm_succes = false;
@@ -61,4 +63,9 @@
--	/*
--	 * It has been guaranteed that input parameter named mac_addr is valid
--	 * address in the rte layer of DPDK framework.
--	 */
+-	/* check if mac addr is valid */
+-	if (!rte_is_valid_assigned_ether_addr(mac_addr)) {
+-		rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
+-				      mac_addr);
+-		hns3_err(hw, "Failed to set mac addr, addr(%s) invalid",
+-			 mac_str);
+-		return -EINVAL;
+-	}
+-
@@ -74 +81 @@
--			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
+-			rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
@@ -77,0 +85,3 @@
+-			rm_succes = false;
+-		} else
+-			rm_succes = true;
@@ -81,2 +91,2 @@
-+		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-+				      oaddr);
++		rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
++					oaddr);
@@ -84,5 +94 @@
-+			  mac_str, ret);
- 
--			rte_spinlock_unlock(&hw->lock);
--			return ret;
--		}
++				mac_str, ret);
@@ -94 +100 @@
-@@ -1790,7 +1777,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
+@@ -1689,7 +1670,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
@@ -102,5 +108,20 @@
-@@ -1811,7 +1797,6 @@ err_add_uc_addr:
- 		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;
+@@ -1705,16 +1685,12 @@ err_pause_addr_cfg:
+ 	}
+ 
+ err_add_uc_addr:
+-	if (rm_succes) {
+-		ret_val = hns3_add_uc_addr_common(hw, oaddr);
+-		if (ret_val) {
+-			rte_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;
+-		}
++	ret_val = hns3_add_uc_addr_common(hw, oaddr);
++	if (ret_val) {
++		rte_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);
@@ -110 +131 @@
-@@ -3473,7 +3458,6 @@ hns3_get_board_configuration(struct hns3_hw *hw)
+@@ -2880,7 +2856,6 @@ hns3_get_board_configuration(struct hns3_hw *hw)
@@ -118,4 +139,4 @@
-@@ -5931,7 +5915,7 @@ hns3_do_stop(struct hns3_adapter *hns)
- 			return ret;
- 		}
- 	}
+@@ -4699,7 +4674,6 @@ hns3_do_stop(struct hns3_adapter *hns)
+ 		reset_queue = true;
+ 	} else
+ 		reset_queue = false;
@@ -123,2 +144 @@
-+
- 	return 0;
+ 	return hns3_stop_queues(hns, reset_queue);
@@ -128 +148 @@
-index 0e4e4269a1..243a4046ae 100644
+index 6c3ac6f8a9..be0fac4fd2 100644
@@ -131 +151 @@
-@@ -188,7 +188,6 @@ enum hns3_media_type {
+@@ -144,7 +144,6 @@ enum hns3_media_type {

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

end of thread, other threads:[~2022-02-25 17:18 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 17:14 patch 'net/hns3: fix residual MAC after setting default MAC' has been queued to stable release 19.11.12 christian.ehrhardt
2022-02-25 17:14 ` patch 'net/hns3: fix secondary process reference count' " christian.ehrhardt
2022-02-25 17:14 ` patch 'net/hns3: fix multi-process action register and unregister' " christian.ehrhardt
2022-02-25 17:14 ` patch 'net/hns3: unregister MP action on close for secondary' " christian.ehrhardt
2022-02-25 17:14 ` patch 'net/ice: build failure with make and GCC > 11' " christian.ehrhardt
2022-02-25 17:14 ` patch 'config/ppc: fix build with GCC >= 10' " christian.ehrhardt
2022-02-25 17:15 ` patch 'maintainers: update for stable branches' " christian.ehrhardt
2022-02-25 17:15 ` patch 'bus/ifpga: remove useless check while browsing devices' " christian.ehrhardt
2022-02-25 17:15 ` patch 'eal/linux: log hugepage create errors with filename' " christian.ehrhardt
2022-02-25 17:15 ` patch 'devtools: fix comment detection in forbidden token check' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/ixgbe: add vector Rx parameter " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/bnxt: fix xstats query' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/bonding: fix mode type mismatch' " christian.ehrhardt
2022-02-25 17:15 ` patch 'app/testpmd: fix dereference before null check' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/cxgbe: fix dangling pointer by mailbox access rework' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/mlx5: fix maximum packet headers size for TSO' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/nfp: remove useless range checks' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/sfc: validate queue span when parsing flow action RSS' " christian.ehrhardt
2022-02-25 17:15 ` patch 'raw/ifpga/base: fix SPI transaction' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/ice: fix link up when starting device' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/bnxt: handle ring cleanup in case of error' " christian.ehrhardt
2022-02-25 17:15 ` patch 'raw/ifpga/base: fix port feature ID' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/memif: remove unnecessary Rx interrupt stub' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/bonding: fix RSS with early configure' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/hns3: fix using enum as boolean' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/virtio: fix Tx queue 0 overriden by queue 128' " christian.ehrhardt
2022-02-25 17:15 ` patch 'vdpa/ifc: fix log info mismatch' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/virtio-user: check FD flags getting failure' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/mlx5: reject jump to root table' " christian.ehrhardt
2022-02-25 17:15 ` patch 'build: fix warning about using -Wextra flag' " christian.ehrhardt
2022-02-25 17:15 ` patch 'kni: fix ioctl signature' " christian.ehrhardt
2022-02-25 17:15 ` patch 'doc: fix KNI PMD name typo' " christian.ehrhardt
2022-02-25 17:15 ` patch 'ring: fix error code when creating ring' " christian.ehrhardt
2022-02-25 17:15 ` patch 'test/mem: fix error check' " christian.ehrhardt
2022-02-25 17:15 ` patch 'bus/dpaa: fix C++ include guard' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/cxgbe: remove useless " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/dpaa2: " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/hns3: fix max packet size rollback in PF' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/hns3: fix RSS key with null' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/ixgbe: check filter init failure' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/bonding: fix promiscuous and allmulticast state' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/bonding: fix reference count on mbufs' " christian.ehrhardt
2022-02-25 17:15 ` patch 'app/testpmd: fix bonding mode set' " christian.ehrhardt
2022-02-25 17:15 ` patch 'stack: fix stubs header export' " christian.ehrhardt
2022-02-25 17:15 ` patch 'ipsec: fix C++ include' " christian.ehrhardt
2022-02-25 17:15 ` patch 'table: " christian.ehrhardt
2022-02-25 17:15 ` patch 'vhost: " christian.ehrhardt
2022-02-25 17:15 ` patch 'test/mbuf: fix mbuf data content check' " christian.ehrhardt
2022-02-25 17:15 ` patch 'ipc: end multiprocess thread during cleanup' " christian.ehrhardt
2022-02-25 17:15 ` patch 'vfio: cleanup the multiprocess sync handle' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/memif: remove pointer deference before null check' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/sfc: do not push fast free offload to default TxQ config' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/sfc: demand Tx fast free offload on EF10 simple datapath' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/iavf: count continuous DD bits for Arm' " christian.ehrhardt
2022-02-25 17:15 ` patch 'net/mlx5: fix committed bucket size' " christian.ehrhardt
2022-02-25 17:15 ` patch 'compress/octeontx: fix null pointer dereference' " christian.ehrhardt
2022-02-25 17:15 ` patch 'raw/ntb: clear all valid doorbell bits on init' " christian.ehrhardt

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).