[dpdk-stable] patch 'net/hns3: fix DCB configuration' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Sat Jun 12 01:04:24 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/14/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/0eafb399ba3a6bb5b016efdc27a1e56114f20893

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 0eafb399ba3a6bb5b016efdc27a1e56114f20893 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong at huawei.com>
Date: Sat, 15 May 2021 08:52:36 +0800
Subject: [PATCH] net/hns3: fix DCB configuration
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit 0b92fa1eb0648c489447853073d47e56b7717e74 ]

Currently, the DCB configuration takes effect in the dev_start stage, and
the mapping between TCs and queues are also updated in this stage.
However, the DCB configuration is delivered in the dev_configure stage.

If the configuration fails, it should be intercepted in this stage. If
the configuration succeeds, the user should be able to obtain the
corresponding updated information, such as the mapping between TCs and
queues. So this patch moves DCB configuration to dev_configure.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")

Signed-off-by: Huisong Li <lihuisong at huawei.com>
Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
---
 drivers/net/hns3/hns3_dcb.c    | 34 ++++-------------------
 drivers/net/hns3/hns3_dcb.h    |  2 +-
 drivers/net/hns3/hns3_ethdev.c | 51 ++++++++++++++++++++--------------
 3 files changed, 37 insertions(+), 50 deletions(-)

diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
index 69db900c93..15f5f05134 100644
--- a/drivers/net/hns3/hns3_dcb.c
+++ b/drivers/net/hns3/hns3_dcb.c
@@ -1573,7 +1573,7 @@ hns3_dcb_configure(struct hns3_adapter *hns)
 	int ret;
 
 	hns3_dcb_cfg_validate(hns, &num_tc, &map_changed);
-	if (map_changed || rte_atomic16_read(&hw->reset.resetting)) {
+	if (map_changed) {
 		ret = hns3_dcb_info_update(hns, num_tc);
 		if (ret) {
 			hns3_err(hw, "dcb info update failed: %d", ret);
@@ -1669,14 +1669,18 @@ hns3_dcb_init(struct hns3_hw *hw)
 	return 0;
 }
 
-static int
+int
 hns3_update_queue_map_configure(struct hns3_adapter *hns)
 {
 	struct hns3_hw *hw = &hns->hw;
+	enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode;
 	uint16_t nb_rx_q = hw->data->nb_rx_queues;
 	uint16_t nb_tx_q = hw->data->nb_tx_queues;
 	int ret;
 
+	if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG)
+		return 0;
+
 	ret = hns3_dcb_update_tc_queue_mapping(hw, nb_rx_q, nb_tx_q);
 	if (ret) {
 		hns3_err(hw, "failed to update tc queue mapping, ret = %d.",
@@ -1690,32 +1694,6 @@ hns3_update_queue_map_configure(struct hns3_adapter *hns)
 	return ret;
 }
 
-int
-hns3_dcb_cfg_update(struct hns3_adapter *hns)
-{
-	struct hns3_hw *hw = &hns->hw;
-	enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode;
-	int ret;
-
-	if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) {
-		ret = hns3_dcb_configure(hns);
-		if (ret)
-			hns3_err(hw, "Failed to config dcb: %d", ret);
-	} else {
-		/*
-		 * Update queue map without PFC configuration,
-		 * due to queues reconfigured by user.
-		 */
-		ret = hns3_update_queue_map_configure(hns);
-		if (ret)
-			hns3_err(hw,
-				 "Failed to update queue mapping configure: %d",
-				 ret);
-	}
-
-	return ret;
-}
-
 static void
 hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode)
 {
diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h
index 49e5ba70a5..0d167e75dc 100644
--- a/drivers/net/hns3/hns3_dcb.h
+++ b/drivers/net/hns3/hns3_dcb.h
@@ -207,7 +207,7 @@ int hns3_dcb_pfc_enable(struct rte_eth_dev *dev,
 int hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q,
 			     uint16_t nb_tx_q);
 
-int hns3_dcb_cfg_update(struct hns3_adapter *hns);
+int hns3_update_queue_map_configure(struct hns3_adapter *hns);
 int hns3_dcb_port_shaper_cfg(struct hns3_hw *hw);
 
 #endif /* _HNS3_DCB_H_ */
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 907fa43257..637e6134f9 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2191,24 +2191,6 @@ hns3_check_mq_mode(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-hns3_check_dcb_cfg(struct rte_eth_dev *dev)
-{
-	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-
-	if (!hns3_dev_dcb_supported(hw)) {
-		hns3_err(hw, "this port does not support dcb configurations.");
-		return -EOPNOTSUPP;
-	}
-
-	if (hw->current_fc_status == HNS3_FC_STATUS_MAC_PAUSE) {
-		hns3_err(hw, "MAC pause enabled, cannot config dcb info.");
-		return -EOPNOTSUPP;
-	}
-
-	return 0;
-}
-
 static int
 hns3_bind_ring_with_vector(struct hns3_hw *hw, uint16_t vector_id, bool en,
 			   enum hns3_ring_type queue_type, uint16_t queue_id)
@@ -2344,6 +2326,30 @@ hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf)
 	return 0;
 }
 
+static int
+hns3_setup_dcb(struct rte_eth_dev *dev)
+{
+	struct hns3_adapter *hns = dev->data->dev_private;
+	struct hns3_hw *hw = &hns->hw;
+	int ret;
+
+	if (!hns3_dev_dcb_supported(hw)) {
+		hns3_err(hw, "this port does not support dcb configurations.");
+		return -EOPNOTSUPP;
+	}
+
+	if (hw->current_fc_status == HNS3_FC_STATUS_MAC_PAUSE) {
+		hns3_err(hw, "MAC pause enabled, cannot config dcb info.");
+		return -EOPNOTSUPP;
+	}
+
+	ret = hns3_dcb_configure(hns);
+	if (ret)
+		hns3_err(hw, "failed to config dcb: %d", ret);
+
+	return ret;
+}
+
 static int
 hns3_dev_configure(struct rte_eth_dev *dev)
 {
@@ -2390,7 +2396,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
 		goto cfg_err;
 
 	if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) {
-		ret = hns3_check_dcb_cfg(dev);
+		ret = hns3_setup_dcb(dev);
 		if (ret)
 			goto cfg_err;
 	}
@@ -4870,9 +4876,12 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue)
 	struct hns3_hw *hw = &hns->hw;
 	int ret;
 
-	ret = hns3_dcb_cfg_update(hns);
-	if (ret)
+	ret = hns3_update_queue_map_configure(hns);
+	if (ret) {
+		hns3_err(hw, "failed to update queue mapping configuration, ret = %d",
+			 ret);
 		return ret;
+	}
 
 	ret = hns3_init_queues(hns, reset_queue);
 	if (ret) {
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-06-12 06:54:00.847089400 +0800
+++ 0170-net-hns3-fix-DCB-configuration.patch	2021-06-12 06:53:56.670000000 +0800
@@ -1 +1 @@
-From 0b92fa1eb0648c489447853073d47e56b7717e74 Mon Sep 17 00:00:00 2001
+From 0eafb399ba3a6bb5b016efdc27a1e56114f20893 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit 0b92fa1eb0648c489447853073d47e56b7717e74 ]
@@ -16 +18,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
- drivers/net/hns3/hns3_dcb.c    | 35 ++++-----------------
+ drivers/net/hns3/hns3_dcb.c    | 34 ++++-------------------
@@ -23,2 +25,2 @@
- drivers/net/hns3/hns3_ethdev.c | 56 +++++++++++++++++++---------------
- 3 files changed, 38 insertions(+), 55 deletions(-)
+ drivers/net/hns3/hns3_ethdev.c | 51 ++++++++++++++++++++--------------
+ 3 files changed, 37 insertions(+), 50 deletions(-)
@@ -27 +29 @@
-index 8fcb284cf1..1cb6adb886 100644
+index 69db900c93..15f5f05134 100644
@@ -30 +32 @@
-@@ -1615,8 +1615,7 @@ hns3_dcb_configure(struct hns3_adapter *hns)
+@@ -1573,7 +1573,7 @@ hns3_dcb_configure(struct hns3_adapter *hns)
@@ -34,2 +36 @@
--	if (map_changed ||
--	    __atomic_load_n(&hw->reset.resetting,  __ATOMIC_RELAXED)) {
+-	if (map_changed || rte_atomic16_read(&hw->reset.resetting)) {
@@ -40 +41 @@
-@@ -1712,14 +1711,18 @@ hns3_dcb_init(struct hns3_hw *hw)
+@@ -1669,14 +1669,18 @@ hns3_dcb_init(struct hns3_hw *hw)
@@ -60 +61 @@
-@@ -1733,32 +1736,6 @@ hns3_update_queue_map_configure(struct hns3_adapter *hns)
+@@ -1690,32 +1694,6 @@ hns3_update_queue_map_configure(struct hns3_adapter *hns)
@@ -94 +95 @@
-index cd8d0b7bc8..f378bd46c6 100644
+index 49e5ba70a5..0d167e75dc 100644
@@ -103,3 +104,3 @@
- int hns3_port_shaper_update(struct hns3_hw *hw, uint32_t speed);
- int hns3_pg_shaper_rate_cfg(struct hns3_hw *hw, uint8_t pg_id, uint32_t rate);
- int hns3_pri_shaper_rate_cfg(struct hns3_hw *hw, uint8_t tc_no, uint32_t rate);
+ int hns3_dcb_port_shaper_cfg(struct hns3_hw *hw);
+ 
+ #endif /* _HNS3_DCB_H_ */
@@ -107 +108 @@
-index f49f220062..20491305e7 100644
+index 907fa43257..637e6134f9 100644
@@ -110 +111 @@
-@@ -2273,24 +2273,6 @@ hns3_check_mq_mode(struct rte_eth_dev *dev)
+@@ -2191,24 +2191,6 @@ hns3_check_mq_mode(struct rte_eth_dev *dev)
@@ -135 +136 @@
-@@ -2426,6 +2408,30 @@ hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf)
+@@ -2344,6 +2326,30 @@ hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf)
@@ -164 +165 @@
- hns3_check_link_speed(struct hns3_hw *hw, uint32_t link_speeds)
+ hns3_dev_configure(struct rte_eth_dev *dev)
@@ -166 +167 @@
-@@ -2506,7 +2512,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
+@@ -2390,7 +2396,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
@@ -175 +176 @@
-@@ -5574,14 +5580,14 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue)
+@@ -4870,9 +4876,12 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue)
@@ -188,6 +189 @@
--	/*
--	 * The hns3_dcb_cfg_update may configure TM module, so
--	 * hns3_tm_conf_update must called later.
--	 */
-+	/* Note: hns3_tm_conf_update must be called after configuring DCB. */
- 	ret = hns3_tm_conf_update(hw);
+ 	ret = hns3_init_queues(hns, reset_queue);
@@ -195 +190,0 @@
- 		PMD_INIT_LOG(ERR, "failed to update tm conf, ret = %d.", ret);


More information about the stable mailing list