Skip to contentSkip to conversation

bugfixes for hns3

PATCH In review Min Hu (Connor) 5 participants 14 messages Mar 23, 2021 – Mar 31, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bugfixes for hns3

This series added six bugfix patches.

Chengchang Tang (3):
net/hns3: fix TCP SEG and TCP CKSUM flag set net/hns3: fix Tx checksum for UDP packets with special port net/hns3: fix the long taskqueue pairs reset time

Huisong Li (3):
net/hns3: fix the reporting of undefined speed net/hns3: fix compiling error for using SVE algorithm net/hns3: fix link update when failed to get link info

 drivers/net/hns3/hns3_cmd.h          |   8 +-
 drivers/net/hns3/hns3_ethdev.c       |  58 ++++++++---
 drivers/net/hns3/hns3_ethdev.h       |  19 ++++
 drivers/net/hns3/hns3_ethdev_vf.c    |   5 +-
 drivers/net/hns3/hns3_rxtx.c         | 194 +++++++++++++++++++++++++++++++----
 drivers/net/hns3/hns3_rxtx.h         |  16 +++
 drivers/net/hns3/hns3_rxtx_vec_sve.c |   2 +-
 7 files changed, 265 insertions(+), 37 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 net/hns3: fix the reporting of undefined speed

From: Huisong Li <[email protected]>

There may be a case in future that the speed obtained from firmware is undefined(such as, 400G or other rate), and link status of device is up. At this case, PMD driver will reports 100Mbps to the user in the "hns3_dev_link_update" API, which is unreasonable. Besides, if the speed from firmware is zero, driver should report zero instead of 100Mbps.

Fixes 59fad0f32135 ("net/hns3: support link update operation")
---
 drivers/net/hns3/hns3_ethdev.c    | 5 ++++-
 drivers/net/hns3/hns3_ethdev_vf.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_ethdev.c +4 -1
index fba715b..410b241 100644
@@ -2725,7 +2725,10 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev,
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
-		new_link.link_speed = ETH_SPEED_NUM_100M;
+		if (mac->link_status)
+			new_link.link_speed = ETH_SPEED_NUM_UNKNOWN;
+		else
+			new_link.link_speed = ETH_SPEED_NUM_NONE;
 		break;
 	}
 
drivers/net/hns3/hns3_ethdev_vf.c +4 -1
index b121d7f..6e579b5 100644
@@ -2125,7 +2125,10 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
-		new_link.link_speed = ETH_SPEED_NUM_100M;
+		if (mac->link_status)
+			new_link.link_speed = ETH_SPEED_NUM_UNKNOWN;
+		else
+			new_link.link_speed = ETH_SPEED_NUM_NONE;
 		break;
 	}
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/6 net/hns3: fix compiling error for using SVE algorithm

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

The 'queue_full_cnt' stats have been encapsulated in 'dfx_stats'. However, the modification in the SVE algorithm is omitted. As a result, the driver fails to be compiled when the SVE algorithm is used.

Fixes 9b77f1fe303f ("net/hns3: encapsulate DFX stats in datapath")
---
 drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx_vec_sve.c +1 -1
index f8655fa..e1a1731 100644
@@ -439,7 +439,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue,
 
 	nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts);
 	if (unlikely(nb_pkts == 0)) {
-		txq->queue_full_cnt++;
+		txq->dfx_stats.queue_full_cnt++;
 		return 0;
 	}
 
Signature · 1 line
2.7.4
#3 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/hns3: fix compiling error for using SVE algorithm

Quoted 21 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

The 'queue_full_cnt' stats have been encapsulated in 'dfx_stats'. However, the modification in the SVE algorithm is omitted. As a result, the driver fails to be compiled when the SVE algorithm is used.

Fixes 9b77f1fe303f ("net/hns3: encapsulate DFX stats in datapath")
---
  drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx_vec_sve.c +0 -0
index f8655fa..e1a1731 100644

drivers/net/hns3/hns3_rxtx_vec_sve.c hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue, · line 445

Quoted 8 lines
drivers/net/hns3/hns3_rxtx_vec_sve.c +1 -1
@@ -439,7 +439,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue,
 
  	nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts);
  	if (unlikely(nb_pkts == 0)) {
-		txq->queue_full_cnt++;
+		txq->dfx_stats.queue_full_cnt++;
  		return 0;
  	}
 

Hi Connor,

This is a very obvious build error, I am concerned how this is released. Do you have any internal testing?

+ Aaron & Honnappa,

If we can have a build test in our public CI with SVE?

#4 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/hns3: fix compiling error for using SVE algorithm

Quoted 32 lines · Ferruh Yigit
Quoted 20 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

The 'queue_full_cnt' stats have been encapsulated in 'dfx_stats'. However, the modification in the SVE algorithm is omitted. As a result, the driver fails to be compiled when the SVE algorithm is used.

Fixes 9b77f1fe303f ("net/hns3: encapsulate DFX stats in datapath")
---
  drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx_vec_sve.c +0 -0
index f8655fa..e1a1731 100644

drivers/net/hns3/hns3_rxtx_vec_sve.c hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue, · line 445

Quoted 8 lines
drivers/net/hns3/hns3_rxtx_vec_sve.c +1 -1
@@ -439,7 +439,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue,
    	nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts);
  	if (unlikely(nb_pkts == 0)) {
-		txq->queue_full_cnt++;
+		txq->dfx_stats.queue_full_cnt++;
  		return 0;
  	}
 
 

Hi Connor,

Quoted 6 lines

This is a very obvious build error, I am concerned how this is released. Do you have any internal testing?

+ Aaron & Honnappa,

If we can have a build test in our public CI with SVE?

Maybe it's possible - we might need to expand the aarch64 cross builds with a bit of extra information. I'm not sure which compiler is needed, though. Currently, we install whatever ubuntu18.04 is providing - I don't know if it has the SVE extensions needed. Honnappa/ARM folks can provide more information that way - though I would expect it's just a setting that can be changed in the host_machine or properties section of the cross-config file.

If that's known (maybe we need to use the thunderx2 config or something else? I don't know too much about enabling compiler support for SVE), then we should probably hook it up.

#5 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/hns3: fix compiling error for using SVE algorithm

Quoted 16 lines · Aaron Conole
Quoted 6 lines · Ferruh Yigit

This is a very obvious build error, I am concerned how this is released. Do you have any internal testing?

+ Aaron & Honnappa,

If we can have a build test in our public CI with SVE?

Maybe it's possible - we might need to expand the aarch64 cross builds with a bit of extra information. I'm not sure which compiler is needed, though. Currently, we install whatever ubuntu18.04 is providing - I don't know if it has the SVE extensions needed. Honnappa/ARM folks can provide more information that way - though I would expect it's just a setting that can be changed in the host_machine or properties section of the cross-config file.

Quoted 3 lines

If that's known (maybe we need to use the thunderx2 config or something else? I don't know too much about enabling compiler support for SVE), then we should probably hook it up.

Last time I tried SVE builds, I needed a gcc 10 + tweaking cross compiler config.
http://inbox.dpdk.org/dev/CAJFAV8ywp0qA7qg7cGAhb1ULY72AwjZM6foDBej4roYNE8Oy5Q@mail.gmail.com/

Ruifeng had replied there was a gcc 10 for Ubuntu. Not sure how others compile with SVE.

Signature · 1 line
David Marchand
#6 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/hns3: fix compiling error for using SVE algorithm

<snip>

Quoted 23 lines

Subject: Re: [PATCH 2/6] net/hns3: fix compiling error for using SVE algorithm

Quoted 19 lines · Aaron Conole
Quoted 6 lines · Ferruh Yigit

This is a very obvious build error, I am concerned how this is released. Do you have any internal testing?

+ Aaron & Honnappa,

If we can have a build test in our public CI with SVE?

Maybe it's possible - we might need to expand the aarch64 cross builds with a bit of extra information. I'm not sure which compiler is needed, though. Currently, we install whatever ubuntu18.04 is providing - I don't know if it has the SVE extensions needed. Honnappa/ARM folks can provide more information that way - though I would expect it's just a setting that can be changed in the host_machine or properties section of the cross-config file.

If that's known (maybe we need to use the thunderx2 config or something else? I don't know too much about enabling compiler support for SVE), then we should probably hook it up.

Since, Kunpeng SoC has SVE enabled, we should have a Kunpeng config [1]. We could use that config to compile the code, through cross compile or through SoC target option for meson scripts[2].

[1] http://patches.dpdk.org/project/dpdk/patch/[email protected]/
[2] http://patches.dpdk.org/project/dpdk/patch/[email protected]/

Quoted 11 lines

Last time I tried SVE builds, I needed a gcc 10 + tweaking cross compiler config.
http://inbox.dpdk.org/dev/CAJFAV8ywp0qA7qg7cGAhb1ULY72AwjZM6foDB
[email protected]/

Ruifeng had replied there was a gcc 10 for Ubuntu. Not sure how others compile with SVE.

--
David Marchand

#7 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/hns3: fix compiling error for using SVE algorithm

In reply to Ferruh Yigit
Quoted 32 lines · Ferruh Yigit
Quoted 20 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

The 'queue_full_cnt' stats have been encapsulated in 'dfx_stats'. However, the modification in the SVE algorithm is omitted. As a result, the driver fails to be compiled when the SVE algorithm is used.

Fixes 9b77f1fe303f ("net/hns3: encapsulate DFX stats in datapath")

---
  drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx_vec_sve.c +0 -0
index f8655fa..e1a1731 100644

drivers/net/hns3/hns3_rxtx_vec_sve.c hns3_xmit_fixed_burst_vec_sve(void *__restrict · line 445

Quoted 8 lines
drivers/net/hns3/hns3_rxtx_vec_sve.c +1 -1
@@ -439,7 +439,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict 
 tx_queue,
       nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts);
       if (unlikely(nb_pkts == 0)) {
-        txq->queue_full_cnt++;
+        txq->dfx_stats.queue_full_cnt++;
           return 0;
       }
 

Hi Connor,

Quoted 2 lines

This is a very obvious build error, I am concerned how this is released. Do you have any internal testing?

Hi Ferruh,
Well, we admit it is our mistake for this issue. Let me
describe the reason:
Firstly, we must declare that we have our inner CI system for
building and testing. While when we upstream the ""support SVE" patch,
our CI does not support SVE building. Instead we build and test SVE on
our local platform.
Then when we upstream the "encapsulate DFX stats in datapath"
patch, we only build it in CI(at that time, SVE building is still not supported), regardless of SVE building on local platform.
Now, SVE building is supported in our CI, So the building error
occurs.
We'll pay more attention to the issue in the future. Thanks.

Quoted 6 lines

+ Aaron & Honnappa,

If we can have a build test in our public CI with SVE?

.

#8 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/hns3: fix compiling error for using SVE algorithm

Quoted 36 lines · Min Hu (Connor)
Quoted 31 lines · Ferruh Yigit
Quoted 20 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

The 'queue_full_cnt' stats have been encapsulated in 'dfx_stats'. However, the modification in the SVE algorithm is omitted. As a result, the driver fails to be compiled when the SVE algorithm is used.

Fixes 9b77f1fe303f ("net/hns3: encapsulate DFX stats in datapath")

---
  drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx_vec_sve.c +0 -0
index f8655fa..e1a1731 100644

drivers/net/hns3/hns3_rxtx_vec_sve.c hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue, · line 444

Quoted 7 lines
drivers/net/hns3/hns3_rxtx_vec_sve.c +1 -1
@@ -439,7 +439,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue,
       nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts);
       if (unlikely(nb_pkts == 0)) {
-        txq->queue_full_cnt++;
+        txq->dfx_stats.queue_full_cnt++;
           return 0;
       }
 

Hi Connor,

Quoted 2 lines

This is a very obvious build error, I am concerned how this is released. Do you have any internal testing?

Quoted 13 lines

Hi Ferruh,
    Well, we admit it is our mistake for this issue. Let me
describe the reason:
    Firstly, we must declare that we have our inner CI system for
building and testing. While when we upstream the ""support SVE" patch,
our CI does not support SVE building. Instead we build and test SVE on
our local platform.
    Then when we upstream the "encapsulate DFX stats in datapath"
patch, we only build it in CI(at that time, SVE building is still not supported), regardless of SVE building on local platform.
    Now, SVE building is supported in our CI, So the building error
occurs.
    We'll pay more attention to the issue in the future. Thanks.

Good to hear your internal testing covers SVE now, thanks for clarification.

#9 lore raw

PATCH 3/6 net/hns3: fix TCP SEG and TCP CKSUM flag set

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

Currently, if the PKT_TX_TCP_SEG and PKT_TX_TCP_CKSUM set in the same time, hns3 PMD can not process the descriptors correctly.

This patch fix it by adding the processing of this situation.

Fixes fb6eb9009f41 ("net/hns3: fix Tx checksum with fixed header length")
---
 drivers/net/hns3/hns3_rxtx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/hns3/hns3_rxtx.c +1 -0
index ba30086..a76dfa5 100644
@@ -3372,6 +3372,7 @@ hns3_parse_l4_cksum_params(struct rte_mbuf *m, uint32_t *type_cs_vlan_tso_len)
 	uint32_t tmp;
 	/* Enable L4 checksum offloads */
 	switch (ol_flags & (PKT_TX_L4_MASK | PKT_TX_TCP_SEG)) {
+	case PKT_TX_TCP_CKSUM | PKT_TX_TCP_SEG:
 	case PKT_TX_TCP_CKSUM:
 	case PKT_TX_TCP_SEG:
 		tmp = *type_cs_vlan_tso_len;
Signature · 1 line
2.7.4
#10 lore raw

PATCH 4/6 net/hns3: fix Tx checksum for UDP packets with special port

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

For Kunpeng920 network engine, UDP packets with destination port 6081, 4789 or 4790 will be identified as tunnel packets. If the UDP CKSUM offload is set in the mbuf, and the TX tunnel mask is not set, the CKSUM of these packets will be wrong. In this case, the upper layer user may not identify the packet as a tunnel packet, and processes it as non-tunnel packet, and expect to offload the outer UDP CKSUM, so they may not fill the outer L2/L3 length to mbuf. However, the HW identifies these packet as tunnel packets and therefore offload the inner UDP CKSUM. As a result, the inner and outer UDP CKSUM are incorrect. And for non-tunnel UDP packets with preceding special destination port will also exist similar checksum error.

For the new generation Kunpeng930 network engine, the above errata have been fixed. Therefore, the concept of udp_cksum_mode is introduced. There are two udp_cksum_mode for hns3 PMD, HNS3_SPECIAL_PORT_HW_CKSUM_MODE means HW could solve the above problem. And in HNS3_SPECIAL_PORT_SW_CKSUM_MODE, hns3 PMD will check packets in the Tx prepare and perform the UDP CKSUM for such packets to avoid a checksum error.

Fixes bba636698316 ("net/hns3: support Rx/Tx and related operations")
---
 drivers/net/hns3/hns3_ethdev.c |  2 ++
 drivers/net/hns3/hns3_ethdev.h | 19 ++++++++++++
 drivers/net/hns3/hns3_rxtx.c   | 68 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/hns3/hns3_rxtx.h   | 16 ++++++++++
 4 files changed, 105 insertions(+)
drivers/net/hns3/hns3_ethdev.c +2 -0
index 410b241..c318350 100644
@@ -3129,6 +3129,7 @@ hns3_get_capability(struct hns3_hw *hw)
 		hw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN;
 		pf->tqp_config_mode = HNS3_FIXED_MAX_TQP_NUM_MODE;
 		hw->rss_info.ipv6_sctp_offload_supported = false;
+		hw->udp_cksum_mode = HNS3_SPECIAL_PORT_SW_CKSUM_MODE;
 		return 0;
 	}
 
@@ -3148,6 +3149,7 @@ hns3_get_capability(struct hns3_hw *hw)
 	hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN;
 	pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE;
 	hw->rss_info.ipv6_sctp_offload_supported = true;
+	hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE;
 
 	return 0;
 }
drivers/net/hns3/hns3_ethdev.h +19 -0
index 586979b..d35ca98 100644
@@ -47,6 +47,9 @@
 #define HNS3_UNLIMIT_PROMISC_MODE       0
 #define HNS3_LIMIT_PROMISC_MODE         1
 
+#define HNS3_SPECIAL_PORT_SW_CKSUM_MODE         0
+#define HNS3_SPECIAL_PORT_HW_CKSUM_MODE         1
+
 #define HNS3_UC_MACADDR_NUM		128
 #define HNS3_VF_UC_MACADDR_NUM		48
 #define HNS3_MC_MACADDR_NUM		128
@@ -567,6 +570,22 @@ struct hns3_hw {
 	uint8_t drop_stats_mode;
 
 	uint8_t max_non_tso_bd_num; /* max BD number of one non-TSO packet */
+	/*
+	 * udp checksum mode.
+	 * value range:
+	 *      HNS3_SPECIAL_PORT_HW_CKSUM_MODE/HNS3_SPECIAL_PORT_SW_CKSUM_MODE
+	 *
+	 *  - HNS3_SPECIAL_PORT_SW_CKSUM_MODE
+	 *     In this mode, HW can not do checksum for special UDP port like
+	 *     4789, 4790, 6081 for non-tunnel UDP packets and UDP tunnel
+	 *     packets without the PKT_TX_TUNEL_MASK in the mbuf. So, PMD need
+	 *     do the checksum for these packets to avoid a checksum error.
+	 *
+	 *  - HNS3_SPECIAL_PORT_HW_CKSUM_MODE
+	 *     In this mode, HW does not have the preceding problems and can
+	 *     directly calculate the checksum of these UDP packets.
+	 */
+	uint8_t udp_cksum_mode;
 
 	struct hns3_port_base_vlan_config port_base_vlan_cfg;
 	/*
drivers/net/hns3/hns3_rxtx.c +68 -0

92 lines not on this page · raw message

drivers/net/hns3/hns3_rxtx.h +16 -0
index ab2b05a..2a51c71 100644
@@ -466,6 +466,22 @@ struct hns3_tx_queue {
 	 */
 	uint8_t tso_mode;
 	/*
+	 * udp checksum mode.
+	 * value range:
+	 *      HNS3_SPECIAL_PORT_HW_CKSUM_MODE/HNS3_SPECIAL_PORT_SW_CKSUM_MODE
+	 *
+	 *  - HNS3_SPECIAL_PORT_SW_CKSUM_MODE
+	 *     In this mode, HW can not do checksum for special UDP port like
+	 *     4789, 4790, 6081 for non-tunnel UDP packets and UDP tunnel
+	 *     packets without the PKT_TX_TUNEL_MASK in the mbuf. So, PMD need
+	 *     do the checksum for these packets to avoid a checksum error.
+	 *
+	 *  - HNS3_SPECIAL_PORT_HW_CKSUM_MODE
+	 *     In this mode, HW does not have the preceding problems and can
+	 *     directly calculate the checksum of these UDP packets.
+	 */
+	uint8_t udp_cksum_mode;
+	/*
 	 * The minimum length of the packet supported by hardware in the Tx
 	 * direction.
 	 */
Signature · 1 line
2.7.4
#11 lore raw

PATCH 5/6 net/hns3: fix link update when failed to get link info

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

In the "hns3_dev_link_update" API, the link information of the port is obtained first, and then 'dev_link' in dev->data is updated. When the driver is resetting or fails to obtain link info, the current driver still reports the previous link info to the user. This may cause that the dev->data->dev_link may be inconsistent with the hw link status.

Therefore, the link status consistency between the hardware, driver, and framework can be ensured in this interface regardless of whether the driver is normal or abnormal.

Fixes 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
---
 drivers/net/hns3/hns3_ethdev.c | 55 +++++++++++++++++++++++++++++-------------
 1 file changed, 38 insertions(+), 17 deletions(-)
drivers/net/hns3/hns3_ethdev.c +38 -17
index c318350..951f724 100644
@@ -2698,20 +2698,22 @@ hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
 }
 
 static int
-hns3_dev_link_update(struct rte_eth_dev *eth_dev,
-		     __rte_unused int wait_to_complete)
+hns3_update_port_link_info(struct rte_eth_dev *eth_dev)
 {
-	struct hns3_adapter *hns = eth_dev->data->dev_private;
-	struct hns3_hw *hw = &hns->hw;
-	struct hns3_mac *mac = &hw->mac;
-	struct rte_eth_link new_link;
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
 
-	if (!hns3_is_reset_pending(hns)) {
-		hns3_update_link_status(hw);
-		hns3_update_link_info(eth_dev);
-	}
+	(void)hns3_update_link_status(hw);
+
+	return hns3_update_link_info(eth_dev);
+}
+
+static void
+hns3_setup_linkstatus(struct rte_eth_dev *eth_dev,
+		      struct rte_eth_link *new_link)
+{
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct hns3_mac *mac = &hw->mac;
 
-	memset(&new_link, 0, sizeof(new_link));
 	switch (mac->link_speed) {
 	case ETH_SPEED_NUM_10M:
 	case ETH_SPEED_NUM_100M:
@@ -2722,20 +2724,39 @@ hns3_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;
+		new_link->link_speed = mac->link_speed;
 		break;
 	default:
 		if (mac->link_status)
-			new_link.link_speed = ETH_SPEED_NUM_UNKNOWN;
+			new_link->link_speed = ETH_SPEED_NUM_UNKNOWN;
 		else
-			new_link.link_speed = ETH_SPEED_NUM_NONE;
+			new_link->link_speed = ETH_SPEED_NUM_NONE;
 		break;
 	}
 
-	new_link.link_duplex = mac->link_duplex;
-	new_link.link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
-	new_link.link_autoneg =
+	new_link->link_duplex = mac->link_duplex;
+	new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
+	new_link->link_autoneg =
 	    !(eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED);
+}
+
+static int
+hns3_dev_link_update(struct rte_eth_dev *eth_dev,
+		     __rte_unused int wait_to_complete)
+{
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct hns3_mac *mac = &hw->mac;
+	struct rte_eth_link new_link;
+	int ret;
+
+	ret = hns3_update_port_link_info(eth_dev);
+	if (ret) {
+		mac->link_status = ETH_LINK_DOWN;
+		hns3_err(hw, "failed to get port link info, ret = %d.", ret);
+	}
+
+	memset(&new_link, 0, sizeof(new_link));
+	hns3_setup_linkstatus(eth_dev, &new_link);
 
 	return rte_eth_linkstatus_set(eth_dev, &new_link);
 }
Signature · 1 line
2.7.4
#12 lore raw

PATCH 6/6 net/hns3: fix the long taskqueue pairs reset time

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

Currently, the queue reset process needs to be performed one by one, which is inefficient. However, the queues reset in the same function is almost at the same stage. To optimize the queue reset process, a new function has been added to the firmware command HNS3_OPC_CFG_RST_TRIGGER to reset all queues in the same function at a time. And the related queue reset MBX message is adjusted in the same way too.

Fixes bba636698316 ("net/hns3: support Rx/Tx and related operations")
---
 drivers/net/hns3/hns3_cmd.h  |   8 ++-
 drivers/net/hns3/hns3_rxtx.c | 125 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 114 insertions(+), 19 deletions(-)
drivers/net/hns3/hns3_cmd.h +7 -1
index 939bbc2..2e911ef 100644
@@ -933,10 +933,16 @@ struct hns3_reset_tqp_queue_cmd {
 
 #define HNS3_CFG_RESET_MAC_B		3
 #define HNS3_CFG_RESET_FUNC_B		7
+#define HNS3_CFG_RESET_RCB_B		1
 struct hns3_reset_cmd {
 	uint8_t mac_func_reset;
 	uint8_t fun_reset_vfid;
-	uint8_t rsv[22];
+	uint8_t fun_reset_rcb;
+	uint8_t rsv1;
+	uint16_t fun_reset_rcb_vqid_start;
+	uint16_t fun_reset_rcb_vqid_num;
+	uint8_t fun_reset_rcb_return_status;
+	uint8_t rsv2[15];
 };
 
 #define HNS3_QUERY_DEV_SPECS_BD_NUM		4
drivers/net/hns3/hns3_rxtx.c +107 -18

156 lines not on this page · raw message

Signature · 1 line
2.7.4
#13 lore raw
In reply to Min Hu (Connor)
Quoted 7 lines · Min Hu (Connor)

This series added six bugfix patches.

Chengchang Tang (3):
net/hns3: fix TCP SEG and TCP CKSUM flag set net/hns3: fix Tx checksum for UDP packets with special port net/hns3: fix the long taskqueue pairs reset time

Quoted 5 lines

Huisong Li (3):
net/hns3: fix the reporting of undefined speed net/hns3: fix compiling error for using SVE algorithm net/hns3: fix link update when failed to get link info

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