Skip to contentSkip to conversation

bugfixes for hns3 PMD

PATCH Applied Min Hu (Connor) 2 participants 11 messages Jun 13, 2021 – Jun 17, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bugfixes for hns3 PMD

This patch set contains 6 bugfixes for hns3 PMD.

Chengchang Tang (1):
net/hns3: fix VLAN strip log

HongBo Zheng (2):
net/hns3: modify max reset fail retry count
net/hns3: delete redundant blank lines

Huisong Li (3):
net/hns3: fix delay time for waiting to stop rxtx net/hns3: fix incorrect fake queue rollback net/hns3: fix config max queues to zero when fails

 drivers/net/hns3/hns3_ethdev.c    | 26 +++++++++++---------------
 drivers/net/hns3/hns3_ethdev_vf.c | 20 ++++++++++----------
 drivers/net/hns3/hns3_intr.c      |  4 ++--
 drivers/net/hns3/hns3_rxtx.c      |  3 +++
 4 files changed, 26 insertions(+), 27 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 net/hns3: modify max reset fail retry count

From: HongBo Zheng <[email protected]>

When the device is very busy, VF reset may have to be retried many times to succeed, leading to the current max reset fail retry count not enough.

This patch modify max reset fail retry count to 30 to enhance the reliability of reset function.

Fixes 2790c6464725 ("net/hns3: support device reset")
---
 drivers/net/hns3/hns3_intr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_intr.c +2 -2
index 6bdb17f..0b307fd 100644
@@ -2582,7 +2582,7 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels)
 static bool
 hns3_reset_err_handle(struct hns3_adapter *hns)
 {
-#define MAX_RESET_FAIL_CNT 5
+#define MAX_RESET_FAIL_CNT 30
 
 	struct hns3_hw *hw = &hns->hw;
 
@@ -2676,7 +2676,7 @@ hns3_reset_pre(struct hns3_adapter *hns)
 static int
 hns3_reset_post(struct hns3_adapter *hns)
 {
-#define TIMEOUT_RETRIES_CNT	5
+#define TIMEOUT_RETRIES_CNT	30
 	struct hns3_hw *hw = &hns->hw;
 	struct timeval tv_delta;
 	struct timeval tv;
Signature · 1 line
2.7.4
#2 lore raw

Re: [dpdk-dev] [PATCH 1/6] net/hns3: modify max reset fail retry count

Quoted 8 lines · Min Hu (Connor)

From: HongBo Zheng <[email protected]>

When the device is very busy, VF reset may have to be retried many times to succeed, leading to the current max reset fail retry count not enough.

This patch modify max reset fail retry count to 30 to enhance the reliability of reset function.

Drop "This patch", just "Modify ..."

Quoted 31 lines
Fixes 2790c6464725 ("net/hns3: support device reset")
---
  drivers/net/hns3/hns3_intr.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_intr.c +2 -2
index 6bdb17f..0b307fd 100644
@@ -2582,7 +2582,7 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels)
  static bool
  hns3_reset_err_handle(struct hns3_adapter *hns)
  {
-#define MAX_RESET_FAIL_CNT 5
+#define MAX_RESET_FAIL_CNT 30
 
  	struct hns3_hw *hw = &hns->hw;
 
@@ -2676,7 +2676,7 @@ hns3_reset_pre(struct hns3_adapter *hns)
  static int
  hns3_reset_post(struct hns3_adapter *hns)
  {
-#define TIMEOUT_RETRIES_CNT	5
+#define TIMEOUT_RETRIES_CNT	30
  	struct hns3_hw *hw = &hns->hw;
  	struct timeval tv_delta;
  	struct timeval tv;
#3 lore raw

PATCH 2/6 net/hns3: fix delay time for waiting to stop rxtx

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

When the primary process executes dev_stop or is being reset, the packet sending and receiving functions is changed. In this moment, the primary process requests secondary processes to change their Rx/Tx functions, and delays a period of time in case of crashes when queues are still in use. The delay time depends on the number of queues actually used, instead of the maximum number of queues supported by the device.

Fixes 23d4b61fee5d ("net/hns3: support multiple process")
---
 drivers/net/hns3/hns3_ethdev.c    | 4 ++--
 drivers/net/hns3/hns3_ethdev_vf.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/hns3/hns3_ethdev.c +2 -2
index 467d770..32719ff 100644
@@ -5897,7 +5897,7 @@ hns3_dev_stop(struct rte_eth_dev *dev)
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(dev);
 	/* Prevent crashes when queues are still in use. */
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) {
@@ -6513,7 +6513,7 @@ hns3_stop_service(struct hns3_adapter *hns)
 	rte_wmb();
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(eth_dev);
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (hns->hw.adapter_state == HNS3_NIC_STARTED ||
drivers/net/hns3/hns3_ethdev_vf.c +2 -2
index 1e94a1e..a198d07 100644
@@ -2109,7 +2109,7 @@ hns3vf_dev_stop(struct rte_eth_dev *dev)
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(dev);
 	/* Prevent crashes when queues are still in use. */
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) {
@@ -2560,7 +2560,7 @@ hns3vf_stop_service(struct hns3_adapter *hns)
 	rte_wmb();
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(eth_dev);
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (hw->adapter_state == HNS3_NIC_STARTED ||
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/6 net/hns3: fix incorrect fake queue rollback

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

When the device supports independent Rx/Tx queues, fake queues do not need to be created in unequal Rx/Tx queues case. However, dev_configure fails to be executed on the device supported independent Rx/Tx queues, the current rollback code logic contains the fake queue. As a result, the fake queue is created. When dev_configure is successfully called again, these fake queues still exists and are configured to the hardware.

Fixes fa29fe45a7b4 ("net/hns3: support queue start and stop")
---
 drivers/net/hns3/hns3_ethdev.c    | 11 ++++-------
 drivers/net/hns3/hns3_ethdev_vf.c | 11 ++++-------
 drivers/net/hns3/hns3_rxtx.c      |  3 +++
 3 files changed, 11 insertions(+), 14 deletions(-)
drivers/net/hns3/hns3_ethdev.c +4 -7
index 32719ff..7b0e938 100644
@@ -2497,13 +2497,10 @@ hns3_dev_configure(struct rte_eth_dev *dev)
 	 * work as usual. But these fake queues are imperceptible, and can not
 	 * be used by upper applications.
 	 */
-	if (!hns3_dev_indep_txrx_supported(hw)) {
-		ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
-		if (ret) {
-			hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.",
-				 ret);
-			return ret;
-		}
+	ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
+	if (ret) {
+		hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret);
+		return ret;
 	}
 
 	hw->adapter_state = HNS3_NIC_CONFIGURING;
drivers/net/hns3/hns3_ethdev_vf.c +4 -7
index a198d07..e4908de 100644
@@ -801,13 +801,10 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)
 	 * work as usual. But these fake queues are imperceptible, and can not
 	 * be used by upper applications.
 	 */
-	if (!hns3_dev_indep_txrx_supported(hw)) {
-		ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
-		if (ret) {
-			hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.",
-				 ret);
-			return ret;
-		}
+	ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
+	if (ret) {
+		hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret);
+		return ret;
 	}
 
 	hw->adapter_state = HNS3_NIC_CONFIGURING;
drivers/net/hns3/hns3_rxtx.c +3 -0
index 88d4fc0..0f80d16 100644
@@ -1617,6 +1617,9 @@ hns3_set_fake_rx_or_tx_queues(struct rte_eth_dev *dev, uint16_t nb_rx_q,
 	uint16_t q;
 	int ret;
 
+	if (hns3_dev_indep_txrx_supported(hw))
+		return 0;
+
 	/* Setup new number of fake RX/TX queues and reconfigure device. */
 	rx_need_add_nb_q = hw->cfg_max_queues - nb_rx_q;
 	tx_need_add_nb_q = hw->cfg_max_queues - nb_tx_q;
Signature · 1 line
2.7.4
#5 lore raw

PATCH 4/6 net/hns3: fix VLAN strip log

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

When the current VLAN stripping is set, the log print always prompts that the enabling fails, bug if may actually be the disabling failure.

Fixes 411d23b9eafb ("net/hns3: support VLAN")
---
 drivers/net/hns3/hns3_ethdev.c    | 3 ++-
 drivers/net/hns3/hns3_ethdev_vf.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_ethdev.c +2 -1
index 7b0e938..db96fbc 100644
@@ -640,7 +640,8 @@ hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable)
 
 	ret = hns3_set_vlan_rx_offload_cfg(hns, &rxvlan_cfg);
 	if (ret) {
-		hns3_err(hw, "enable strip rx vtag failed, ret =%d", ret);
+		hns3_err(hw, "%s strip rx vtag failed, ret = %d.",
+				enable ? "enable" : "disable", ret);
 		return ret;
 	}
 
drivers/net/hns3/hns3_ethdev_vf.c +2 -1
index e4908de..e0a0797 100644
@@ -1606,7 +1606,8 @@ hns3vf_en_hw_strip_rxvtag(struct hns3_hw *hw, bool enable)
 	ret = hns3_send_mbx_msg(hw, HNS3_MBX_SET_VLAN, HNS3_MBX_VLAN_RX_OFF_CFG,
 				&msg_data, sizeof(msg_data), false, NULL, 0);
 	if (ret)
-		hns3_err(hw, "vf enable strip failed, ret =%d", ret);
+		hns3_err(hw, "vf %s strip failed, ret = %d.",
+				enable ? "enable" : "disable", ret);
 
 	return ret;
 }
Signature · 1 line
2.7.4
#6 lore raw

PATCH 5/6 net/hns3: fix config max queues to zero when fails

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

The "cfg_max_queues" maintains configured max queue numbers from user, and is equal to the maximum of "nb_rx_queues" and "nb_tx_queues" in "dev->data".

From the ethdev layer framework, "nb_rx/tx_queues" in "dev->data" were set to zero in rte_eth_dev_configure() if ops.dev_configure in PMD fails to be executed, In addition, if ops.dev_configure in HNS3 PMD failed, the fake queues are also cleared on a device that does not support independent Rx/Tx queues.

Therefore, the "cfg_max_queues" should be also set to zero when dev_configure fails.

Fixes fa29fe45a7b4 ("net/hns3: support queue start and stop")
---
 drivers/net/hns3/hns3_ethdev.c    | 2 ++
 drivers/net/hns3/hns3_ethdev_vf.c | 2 ++
 2 files changed, 4 insertions(+)
drivers/net/hns3/hns3_ethdev.c +2 -0
index db96fbc..5f6daa9 100644
@@ -2501,6 +2501,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
 	ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
 	if (ret) {
 		hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret);
+		hw->cfg_max_queues = 0;
 		return ret;
 	}
 
@@ -2549,6 +2550,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 
 cfg_err:
+	hw->cfg_max_queues = 0;
 	(void)hns3_set_fake_rx_or_tx_queues(dev, 0, 0);
 	hw->adapter_state = HNS3_NIC_INITIALIZED;
 
drivers/net/hns3/hns3_ethdev_vf.c +2 -0
index e0a0797..e582503 100644
@@ -804,6 +804,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)
 	ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
 	if (ret) {
 		hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret);
+		hw->cfg_max_queues = 0;
 		return ret;
 	}
 
@@ -863,6 +864,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 
 cfg_err:
+	hw->cfg_max_queues = 0;
 	(void)hns3_set_fake_rx_or_tx_queues(dev, 0, 0);
 	hw->adapter_state = HNS3_NIC_INITIALIZED;
 
Signature · 1 line
2.7.4
#7 lore raw

PATCH 6/6 net/hns3: delete redundant blank lines

In reply to Min Hu (Connor)

From: HongBo Zheng <[email protected]>

Delete redundant blank lines to make:
1.Return value judgment follow the function call. 2.No blank lines at the end of a code block defined by braces.

---
 drivers/net/hns3/hns3_ethdev.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/hns3/hns3_ethdev.c +1 -5
index 5f6daa9..e515125 100644
@@ -253,8 +253,8 @@ static void
 hns3_clear_all_event_cause(struct hns3_hw *hw)
 {
 	uint32_t vector0_int_stats;
-	vector0_int_stats = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
 
+	vector0_int_stats = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
 	if (BIT(HNS3_VECTOR0_IMPRESET_INT_B) & vector0_int_stats)
 		hns3_warn(hw, "Probe during IMP reset interrupt");
 
@@ -3127,7 +3127,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc)
 	ext_rss_size_max = hns3_get_field(rte_le_to_cpu_32(req->param[2]),
 					       HNS3_CFG_EXT_RSS_SIZE_M,
 					       HNS3_CFG_EXT_RSS_SIZE_S);
-
 	/*
 	 * Field ext_rss_size_max obtained from firmware will be more flexible
 	 * for future changes and expansions, which is an exponent of 2, instead
@@ -3846,7 +3845,6 @@ hns3_drop_nopfc_buf_till_fit(struct hns3_hw *hw,
 	for (i = HNS3_MAX_TC_NUM - 1; i >= 0; i--) {
 		priv = &buf_alloc->priv_buf[i];
 		mask = BIT((uint8_t)i);
-
 		if (hw->hw_tc_map & mask &&
 		    !(hw->dcb_info.hw_pfc_map & mask)) {
 			/* Clear the no pfc TC private buffer */
@@ -3932,7 +3930,6 @@ hns3_only_alloc_priv_buff(struct hns3_hw *hw,
 			COMPENSATE_HALF_MPS_NUM * half_mps;
 	min_rx_priv = roundup(min_rx_priv, HNS3_BUF_SIZE_UNIT);
 	rx_priv = rounddown(rx_priv, HNS3_BUF_SIZE_UNIT);
-
 	if (rx_priv < min_rx_priv)
 		return false;
 
@@ -6299,7 +6296,6 @@ hns3_is_reset_pending(struct hns3_adapter *hns)
 
 	hns3_check_event_cause(hns, NULL);
 	reset = hns3_get_reset_level(hns, &hw->reset.pending);
-
 	if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET &&
 	    hw->reset.level < reset) {
 		hns3_warn(hw, "High level reset %d is pending", reset);
Signature · 1 line
2.7.4
#8 lore raw
In reply to Min Hu (Connor)
Quoted 14 lines · Min Hu (Connor)

This patch set contains 6 bugfixes for hns3 PMD.

Chengchang Tang (1):
net/hns3: fix VLAN strip log

HongBo Zheng (2):
net/hns3: modify max reset fail retry count
net/hns3: delete redundant blank lines

Huisong Li (3):
net/hns3: fix delay time for waiting to stop rxtx net/hns3: fix incorrect fake queue rollback net/hns3: fix config max queues to zero when fails

Quoted 6 lines
  drivers/net/hns3/hns3_ethdev.c    | 26 +++++++++++---------------
  drivers/net/hns3/hns3_ethdev_vf.c | 20 ++++++++++----------
  drivers/net/hns3/hns3_intr.c      |  4 ++--
  drivers/net/hns3/hns3_rxtx.c      |  3 +++
  4 files changed, 26 insertions(+), 27 deletions(-)

LGTM, I can apply minor style notes for 1/6 on patch series applying.

#9 lore raw
Quoted 22 lines · Andrew Rybchenko
Quoted 14 lines · Min Hu (Connor)

This patch set contains 6 bugfixes for hns3 PMD.

Chengchang Tang (1):
   net/hns3: fix VLAN strip log

HongBo Zheng (2):
   net/hns3: modify max reset fail retry count
   net/hns3: delete redundant blank lines

Huisong Li (3):
   net/hns3: fix delay time for waiting to stop rxtx net/hns3: fix incorrect fake queue rollback net/hns3: fix config max queues to zero when fails

Quoted 6 lines

  drivers/net/hns3/hns3_ethdev.c    | 26 +++++++++++--------------- drivers/net/hns3/hns3_ethdev_vf.c | 20 ++++++++++---------- drivers/net/hns3/hns3_intr.c      |  4 ++-- drivers/net/hns3/hns3_rxtx.c      |  3 +++

  4 files changed, 26 insertions(+), 27 deletions(-)
Quoted 2 lines

LGTM, I can apply minor style notes for 1/6 on patch series applying.

Thanks.

Quoted 1 line

.

#10 lore raw
Quoted 25 lines · Min Hu (Connor)
Quoted 22 lines · Andrew Rybchenko
Quoted 20 lines · Min Hu (Connor)

This patch set contains 6 bugfixes for hns3 PMD.

Chengchang Tang (1):
   net/hns3: fix VLAN strip log

HongBo Zheng (2):
   net/hns3: modify max reset fail retry count
   net/hns3: delete redundant blank lines

Huisong Li (3):
   net/hns3: fix delay time for waiting to stop rxtx net/hns3: fix incorrect fake queue rollback net/hns3: fix config max queues to zero when fails

  drivers/net/hns3/hns3_ethdev.c    | 26 +++++++++++--------------- drivers/net/hns3/hns3_ethdev_vf.c | 20 ++++++++++---------- drivers/net/hns3/hns3_intr.c      |  4 ++-- drivers/net/hns3/hns3_rxtx.c      |  3 +++

  4 files changed, 26 insertions(+), 27 deletions(-)
Quoted 3 lines
Quoted 2 lines

LGTM, I can apply minor style notes for 1/6 on patch series applying.

Thanks.

Applied, thanks.