DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD
@ 2021-05-15  0:52 Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 1/6] net/hns3: fix check of Rx/Tx queue numbers Min Hu (Connor)
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Min Hu (Connor) @ 2021-05-15  0:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

This patch set contains six bugfixes for hns3 PMD.

Huisong Li (6):
  net/hns3: fix check of Rx/Tx queue numbers
  net/hns3: fix requested FC mode roolback
  net/hns3: remove meaningless packet buffer rollback
  net/hns3: fix DCB configuration
  net/hns3: fix DCB cannot be reconfigured
  net/hns3: fix link speed when VF device is down

 drivers/net/hns3/hns3_dcb.c       | 85 +++++++++++++++++++++++----------------
 drivers/net/hns3/hns3_dcb.h       |  2 +-
 drivers/net/hns3/hns3_ethdev.c    | 84 ++++++++++++++------------------------
 drivers/net/hns3/hns3_ethdev_vf.c | 20 +++------
 4 files changed, 88 insertions(+), 103 deletions(-)

-- 
2.7.4


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

* [dpdk-dev] [PATCH 1/6] net/hns3: fix check of Rx/Tx queue numbers
  2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
@ 2021-05-15  0:52 ` Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 2/6] net/hns3: fix requested FC mode roolback Min Hu (Connor)
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Min Hu (Connor) @ 2021-05-15  0:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

The Rx/Tx queue numbers should be greater than TC number, this patch adds
this check for PF before updating the mapping between TC and queue.

Fixes: a951c1ed3ab5 ("net/hns3: support different numbers of Rx and Tx queues")
Fixes: 76d794566d43 ("net/hns3: maximize queue number")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
index 30e59e8..ab307f1 100644
--- a/drivers/net/hns3/hns3_dcb.c
+++ b/drivers/net/hns3/hns3_dcb.c
@@ -727,6 +727,18 @@ hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, uint16_t nb_tx_q)
 {
 	int ret;
 
+	if (nb_rx_q < hw->num_tc) {
+		hns3_err(hw, "number of Rx queues(%u) is less than number of TC(%u).",
+			 nb_rx_q, hw->num_tc);
+		return -EINVAL;
+	}
+
+	if (nb_tx_q < hw->num_tc) {
+		hns3_err(hw, "number of Tx queues(%u) is less than number of TC(%u).",
+			 nb_tx_q, hw->num_tc);
+		return -EINVAL;
+	}
+
 	ret = hns3_set_rss_size(hw, nb_rx_q);
 	if (ret)
 		return ret;
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 536ed46..c649616 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1498,18 +1498,6 @@ hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q,
 {
 	struct hns3_hw *hw = &hns->hw;
 
-	if (nb_rx_q < hw->num_tc) {
-		hns3_err(hw, "number of Rx queues(%u) is less than tcs(%u).",
-			 nb_rx_q, hw->num_tc);
-		return -EINVAL;
-	}
-
-	if (nb_tx_q < hw->num_tc) {
-		hns3_err(hw, "number of Tx queues(%u) is less than tcs(%u).",
-			 nb_tx_q, hw->num_tc);
-		return -EINVAL;
-	}
-
 	return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q);
 }
 
-- 
2.7.4


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

* [dpdk-dev] [PATCH 2/6] net/hns3: fix requested FC mode roolback
  2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 1/6] net/hns3: fix check of Rx/Tx queue numbers Min Hu (Connor)
@ 2021-05-15  0:52 ` Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 3/6] net/hns3: remove meaningless packet buffer rollback Min Hu (Connor)
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Min Hu (Connor) @ 2021-05-15  0:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

Currently, the "requested_fc_mode" lacks rollback when enabling link
FC or PFC fails. For example, it encounters a reset. This may result
in incorrect FC mode after a reset.

Fixes: d4fdb71a0e7b ("net/hns3: fix flow control mode")
Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
index ab307f1..bea4115 100644
--- a/drivers/net/hns3/hns3_dcb.c
+++ b/drivers/net/hns3/hns3_dcb.c
@@ -1760,6 +1760,30 @@ hns3_dcb_cfg_update(struct hns3_adapter *hns)
 	return ret;
 }
 
+static void
+hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode)
+{
+	switch (mode) {
+	case RTE_FC_NONE:
+		hw->requested_fc_mode = HNS3_FC_NONE;
+		break;
+	case RTE_FC_RX_PAUSE:
+		hw->requested_fc_mode = HNS3_FC_RX_PAUSE;
+		break;
+	case RTE_FC_TX_PAUSE:
+		hw->requested_fc_mode = HNS3_FC_TX_PAUSE;
+		break;
+	case RTE_FC_FULL:
+		hw->requested_fc_mode = HNS3_FC_FULL;
+		break;
+	default:
+		hw->requested_fc_mode = HNS3_FC_NONE;
+		hns3_warn(hw, "fc_mode(%u) exceeds member scope and is "
+			  "configured to RTE_FC_NONE", mode);
+		break;
+	}
+}
+
 /*
  * hns3_dcb_pfc_enable - Enable priority flow control
  * @dev: pointer to ethernet device
@@ -1772,6 +1796,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	enum hns3_fc_status fc_status = hw->current_fc_status;
+	enum hns3_fc_mode old_fc_mode = hw->requested_fc_mode;
 	uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map;
 	uint8_t pfc_en = hw->dcb_info.pfc_en;
 	uint8_t priority = pfc_conf->priority;
@@ -1779,6 +1804,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
 	int ret, status;
 
 	pf->pause_time = pfc_conf->fc.pause_time;
+	hns3_get_fc_mode(hw, pfc_conf->fc.mode);
 	hw->current_fc_status = HNS3_FC_STATUS_PFC;
 	hw->dcb_info.pfc_en |= BIT(priority);
 	hw->dcb_info.hw_pfc_map =
@@ -1800,6 +1826,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
 	return 0;
 
 pfc_setup_fail:
+	hw->requested_fc_mode = old_fc_mode;
 	hw->current_fc_status = fc_status;
 	pf->pause_time = pause_time;
 	hw->dcb_info.pfc_en = pfc_en;
@@ -1822,11 +1849,13 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	enum hns3_fc_mode old_fc_mode = hw->requested_fc_mode;
 	enum hns3_fc_status fc_status = hw->current_fc_status;
 	uint16_t pause_time = pf->pause_time;
 	int ret;
 
 	pf->pause_time = fc_conf->pause_time;
+	hns3_get_fc_mode(hw, fc_conf->mode);
 
 	/*
 	 * In fact, current_fc_status is HNS3_FC_STATUS_NONE when mode
@@ -1846,6 +1875,7 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	return 0;
 
 setup_fc_fail:
+	hw->requested_fc_mode = old_fc_mode;
 	hw->current_fc_status = fc_status;
 	pf->pause_time = pause_time;
 
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 0589e3f..f49f220 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -6059,30 +6059,6 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	return 0;
 }
 
-static void
-hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode)
-{
-	switch (mode) {
-	case RTE_FC_NONE:
-		hw->requested_fc_mode = HNS3_FC_NONE;
-		break;
-	case RTE_FC_RX_PAUSE:
-		hw->requested_fc_mode = HNS3_FC_RX_PAUSE;
-		break;
-	case RTE_FC_TX_PAUSE:
-		hw->requested_fc_mode = HNS3_FC_TX_PAUSE;
-		break;
-	case RTE_FC_FULL:
-		hw->requested_fc_mode = HNS3_FC_FULL;
-		break;
-	default:
-		hw->requested_fc_mode = HNS3_FC_NONE;
-		hns3_warn(hw, "fc_mode(%u) exceeds member scope and is "
-			  "configured to RTE_FC_NONE", mode);
-		break;
-	}
-}
-
 static int
 hns3_check_fc_autoneg_valid(struct hns3_hw *hw, uint8_t autoneg)
 {
@@ -6156,8 +6132,6 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		return -EOPNOTSUPP;
 	}
 
-	hns3_get_fc_mode(hw, fc_conf->mode);
-
 	rte_spinlock_lock(&hw->lock);
 	ret = hns3_fc_enable(dev, fc_conf);
 	rte_spinlock_unlock(&hw->lock);
@@ -6204,8 +6178,6 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev,
 		return -EOPNOTSUPP;
 	}
 
-	hns3_get_fc_mode(hw, pfc_conf->fc.mode);
-
 	rte_spinlock_lock(&hw->lock);
 	ret = hns3_dcb_pfc_enable(dev, pfc_conf);
 	rte_spinlock_unlock(&hw->lock);
-- 
2.7.4


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

* [dpdk-dev] [PATCH 3/6] net/hns3: remove meaningless packet buffer rollback
  2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 1/6] net/hns3: fix check of Rx/Tx queue numbers Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 2/6] net/hns3: fix requested FC mode roolback Min Hu (Connor)
@ 2021-05-15  0:52 ` Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 4/6] net/hns3: fix DCB configuration Min Hu (Connor)
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Min Hu (Connor) @ 2021-05-15  0:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

Packet buffer allocation and hardware pause configuration fail normally
when a reset occurs. If the execution fails, rollback of the packet buffer
still fails. So this rollback is meaningless.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
index bea4115..8fcb284 100644
--- a/drivers/net/hns3/hns3_dcb.c
+++ b/drivers/net/hns3/hns3_dcb.c
@@ -1543,7 +1543,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 	enum hns3_fc_status fc_status = hw->current_fc_status;
 	enum hns3_fc_mode requested_fc_mode = hw->requested_fc_mode;
 	uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map;
-	int ret, status;
+	int ret;
 
 	if (pf->tx_sch_mode != HNS3_FLAG_TC_BASE_SCH_MODE &&
 	    pf->tx_sch_mode != HNS3_FLAG_VNET_BASE_SCH_MODE)
@@ -1568,7 +1568,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 
 		ret = hns3_buffer_alloc(hw);
 		if (ret)
-			return ret;
+			goto buffer_alloc_fail;
 
 		hw->current_fc_status = HNS3_FC_STATUS_PFC;
 		hw->requested_fc_mode = HNS3_FC_FULL;
@@ -1594,10 +1594,9 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 pfc_setup_fail:
 	hw->requested_fc_mode = requested_fc_mode;
 	hw->current_fc_status = fc_status;
+
+buffer_alloc_fail:
 	hw->dcb_info.hw_pfc_map = hw_pfc_map;
-	status = hns3_buffer_alloc(hw);
-	if (status)
-		hns3_err(hw, "recover packet buffer fail! status = %d", status);
 
 	return ret;
 }
@@ -1801,7 +1800,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
 	uint8_t pfc_en = hw->dcb_info.pfc_en;
 	uint8_t priority = pfc_conf->priority;
 	uint16_t pause_time = pf->pause_time;
-	int ret, status;
+	int ret;
 
 	pf->pause_time = pfc_conf->fc.pause_time;
 	hns3_get_fc_mode(hw, pfc_conf->fc.mode);
@@ -1831,9 +1830,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
 	pf->pause_time = pause_time;
 	hw->dcb_info.pfc_en = pfc_en;
 	hw->dcb_info.hw_pfc_map = hw_pfc_map;
-	status = hns3_buffer_alloc(hw);
-	if (status)
-		hns3_err(hw, "recover packet buffer fail: %d", status);
 
 	return ret;
 }
-- 
2.7.4


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

* [dpdk-dev] [PATCH 4/6] net/hns3: fix DCB configuration
  2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
                   ` (2 preceding siblings ...)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 3/6] net/hns3: remove meaningless packet buffer rollback Min Hu (Connor)
@ 2021-05-15  0:52 ` Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 5/6] net/hns3: fix DCB cannot be reconfigured Min Hu (Connor)
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Min Hu (Connor) @ 2021-05-15  0:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_dcb.c    | 35 +++++---------------------
 drivers/net/hns3/hns3_dcb.h    |  2 +-
 drivers/net/hns3/hns3_ethdev.c | 56 +++++++++++++++++++++++-------------------
 3 files changed, 38 insertions(+), 55 deletions(-)

diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
index 8fcb284..1cb6adb 100644
--- a/drivers/net/hns3/hns3_dcb.c
+++ b/drivers/net/hns3/hns3_dcb.c
@@ -1615,8 +1615,7 @@ hns3_dcb_configure(struct hns3_adapter *hns)
 	int ret;
 
 	hns3_dcb_cfg_validate(hns, &num_tc, &map_changed);
-	if (map_changed ||
-	    __atomic_load_n(&hw->reset.resetting,  __ATOMIC_RELAXED)) {
+	if (map_changed) {
 		ret = hns3_dcb_info_update(hns, num_tc);
 		if (ret) {
 			hns3_err(hw, "dcb info update failed: %d", ret);
@@ -1712,14 +1711,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.",
@@ -1733,32 +1736,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 cd8d0b7..f378bd4 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_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);
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f49f220..2049130 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2274,24 +2274,6 @@ hns3_check_mq_mode(struct rte_eth_dev *dev)
 }
 
 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)
 {
@@ -2427,6 +2409,30 @@ hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf)
 }
 
 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_check_link_speed(struct hns3_hw *hw, uint32_t link_speeds)
 {
 	int ret;
@@ -2506,7 +2512,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;
 	}
@@ -5574,14 +5580,14 @@ 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;
+	}
 
-	/*
-	 * 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);
 	if (ret) {
 		PMD_INIT_LOG(ERR, "failed to update tm conf, ret = %d.", ret);
-- 
2.7.4


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

* [dpdk-dev] [PATCH 5/6] net/hns3: fix DCB cannot be reconfigured
  2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
                   ` (3 preceding siblings ...)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 4/6] net/hns3: fix DCB configuration Min Hu (Connor)
@ 2021-05-15  0:52 ` Min Hu (Connor)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 6/6] net/hns3: fix link speed when VF device is down Min Hu (Connor)
  2021-05-18 10:41 ` [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Ferruh Yigit
  6 siblings, 0 replies; 8+ messages in thread
From: Min Hu (Connor) @ 2021-05-15  0:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

Whether the enable bit of the pfc ("pfc_en") is changed is one of the
conditions for reconfiguring the DCB. Currently, pfc_en is not rolled back
when DCB configuration fails. This patch fixes it.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
index 1cb6adb..90c0d04 100644
--- a/drivers/net/hns3/hns3_dcb.c
+++ b/drivers/net/hns3/hns3_dcb.c
@@ -1543,6 +1543,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 	enum hns3_fc_status fc_status = hw->current_fc_status;
 	enum hns3_fc_mode requested_fc_mode = hw->requested_fc_mode;
 	uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map;
+	uint8_t pfc_en = hw->dcb_info.pfc_en;
 	int ret;
 
 	if (pf->tx_sch_mode != HNS3_FLAG_TC_BASE_SCH_MODE &&
@@ -1596,6 +1597,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 	hw->current_fc_status = fc_status;
 
 buffer_alloc_fail:
+	hw->dcb_info.pfc_en = pfc_en;
 	hw->dcb_info.hw_pfc_map = hw_pfc_map;
 
 	return ret;
-- 
2.7.4


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

* [dpdk-dev] [PATCH 6/6] net/hns3: fix link speed when VF device is down
  2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
                   ` (4 preceding siblings ...)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 5/6] net/hns3: fix DCB cannot be reconfigured Min Hu (Connor)
@ 2021-05-15  0:52 ` Min Hu (Connor)
  2021-05-18 10:41 ` [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Ferruh Yigit
  6 siblings, 0 replies; 8+ messages in thread
From: Min Hu (Connor) @ 2021-05-15  0:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

When the port is link down state, it is meaningless to display the
port link speed. It should be an undefined state.

Fixes: 59fad0f32135 ("net/hns3: support link update operation")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index c649616..41dd8ee 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2205,16 +2205,18 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
 	case ETH_SPEED_NUM_200G:
-		new_link.link_speed = mac->link_speed;
+		if (mac->link_status)
+			new_link.link_speed = mac->link_speed;
 		break;
 	default:
 		if (mac->link_status)
 			new_link.link_speed = ETH_SPEED_NUM_UNKNOWN;
-		else
-			new_link.link_speed = ETH_SPEED_NUM_NONE;
 		break;
 	}
 
+	if (!mac->link_status)
+		new_link.link_speed = ETH_SPEED_NUM_NONE;
+
 	new_link.link_duplex = mac->link_duplex;
 	new_link.link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link.link_autoneg =
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD
  2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
                   ` (5 preceding siblings ...)
  2021-05-15  0:52 ` [dpdk-dev] [PATCH 6/6] net/hns3: fix link speed when VF device is down Min Hu (Connor)
@ 2021-05-18 10:41 ` Ferruh Yigit
  6 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2021-05-18 10:41 UTC (permalink / raw)
  To: Min Hu (Connor), dev

On 5/15/2021 1:52 AM, Min Hu (Connor) wrote:
> This patch set contains six bugfixes for hns3 PMD.
> 
> Huisong Li (6):
>   net/hns3: fix check of Rx/Tx queue numbers
>   net/hns3: fix requested FC mode roolback
>   net/hns3: remove meaningless packet buffer rollback
>   net/hns3: fix DCB configuration
>   net/hns3: fix DCB cannot be reconfigured
>   net/hns3: fix link speed when VF device is down
> 

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

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

end of thread, other threads:[~2021-05-18 10:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15  0:52 [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Min Hu (Connor)
2021-05-15  0:52 ` [dpdk-dev] [PATCH 1/6] net/hns3: fix check of Rx/Tx queue numbers Min Hu (Connor)
2021-05-15  0:52 ` [dpdk-dev] [PATCH 2/6] net/hns3: fix requested FC mode roolback Min Hu (Connor)
2021-05-15  0:52 ` [dpdk-dev] [PATCH 3/6] net/hns3: remove meaningless packet buffer rollback Min Hu (Connor)
2021-05-15  0:52 ` [dpdk-dev] [PATCH 4/6] net/hns3: fix DCB configuration Min Hu (Connor)
2021-05-15  0:52 ` [dpdk-dev] [PATCH 5/6] net/hns3: fix DCB cannot be reconfigured Min Hu (Connor)
2021-05-15  0:52 ` [dpdk-dev] [PATCH 6/6] net/hns3: fix link speed when VF device is down Min Hu (Connor)
2021-05-18 10:41 ` [dpdk-dev] [PATCH 0/6] bugfix for hns3 PMD Ferruh Yigit

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git