Skip to contentSkip to conversation

bugfix for hns3 PMD

PATCH In review Min Hu (Connor) 4 participants 16 messages May 7, 2021 – Jul 4, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bugfix for hns3 PMD

This patch set contains 6 bugfixes for hns3 PMD.

Chengwen Feng (5):
net/hns3: return code when PCI config space write fail net/hns3: fix logging info when clear all FDIR rules net/hns3: clear hash map when clear all FDIR rules net/hns3: fix out param not set when query FDIR counter
doc: add link status event pre-conditions

HongBo Zheng (1):
net/hns3: fix VF setting alive order problem

 doc/guides/nics/hns3.rst          | 10 ++++++++++
 drivers/net/hns3/hns3_ethdev_vf.c | 22 ++++++++++++++++------
 drivers/net/hns3/hns3_fdir.c      | 22 +++++++++++++++++-----
 drivers/net/hns3/hns3_flow.c      |  2 ++
 4 files changed, 45 insertions(+), 11 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 net/hns3: return code when PCI config space write fail

From: Chengwen Feng <[email protected]>

This patch returns error code when calling rte_pci_write_config() API.

Fixes 6dd32ded17d8 ("net/hns3: check PCI config space write")
---
 drivers/net/hns3/hns3_ethdev_vf.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/hns3/hns3_ethdev_vf.c +3 -0
index 6aa8a9b..71f3f95 100644
@@ -156,9 +156,12 @@ hns3vf_enable_msix(const struct rte_pci_device *device, bool op)
 		if (ret < 0) {
 			PMD_INIT_LOG(ERR, "failed to write PCI offset 0x%x",
 				    (pos + PCI_MSIX_FLAGS));
+			return -ENXIO;
 		}
+
 		return 0;
 	}
+
 	return -ENXIO;
 }
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/6 net/hns3: fix logging info when clear all FDIR rules

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

If clear FDIR rules fail, the error code was logged, but the error code was useless because it was the sum of all fail code.

This patch fixes it by log the success cnt and fail cnt.

Fixes fcba820d9b9e ("net/hns3: support flow director")
Fixes 8eed8acc812e ("net/hns3: add error code to some logs")
---
 drivers/net/hns3/hns3_fdir.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/net/hns3/hns3_fdir.c +13 -5
index 0ef0938..e116d87 100644
@@ -1026,6 +1026,8 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns)
 	struct hns3_fdir_info *fdir_info = &pf->fdir;
 	struct hns3_fdir_rule_ele *fdir_filter;
 	struct hns3_hw *hw = &hns->hw;
+	int succ_cnt = 0;
+	int fail_cnt = 0;
 	int ret = 0;
 
 	/* flush flow director */
@@ -1034,17 +1036,23 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns)
 	fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list);
 	while (fdir_filter) {
 		TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries);
-		ret += hns3_fd_tcam_config(hw, true,
-					   fdir_filter->fdir_conf.location,
-					   NULL, false);
+		ret = hns3_fd_tcam_config(hw, true,
+					  fdir_filter->fdir_conf.location,
+					  NULL, false);
+		if (ret == 0)
+			succ_cnt++;
+		else
+			fail_cnt++;
 		rte_free(fdir_filter);
 		fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list);
 	}
 
-	if (ret) {
-		hns3_err(hw, "Fail to delete FDIR filter, ret = %d", ret);
+	if (fail_cnt > 0) {
+		hns3_err(hw, "fail to delete all FDIR filter, success num = %d "
+			 "fail num = %d", succ_cnt, fail_cnt);
 		ret = -EIO;
 	}
+
 	return ret;
 }
 
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/6 net/hns3: clear hash map when clear all FDIR rules

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

The fdir hash map hold the pointers of fdir rule elements, it needs to be set to NULL when clear all fdir rules.

Fixes fcba820d9b9e ("net/hns3: support flow director")
---
 drivers/net/hns3/hns3_fdir.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/hns3/hns3_fdir.c +4 -0
index e116d87..d043f57 100644
@@ -1033,6 +1033,10 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns)
 	/* flush flow director */
 	rte_hash_reset(fdir_info->hash_handle);
 
+	memset(fdir_info->hash_map, 0,
+	       sizeof(struct hns3_fdir_rule_ele *) *
+	       fdir_info->fd_cfg.rule_num[HNS3_FD_STAGE_1]);
+
 	fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list);
 	while (fdir_filter) {
 		TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries);
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/6 net/hns3: fix VF setting alive order problem

In reply to Min Hu (Connor)

From: HongBo Zheng <[email protected]>

Currently in the VF reset scenario, the VF performs the set alive operation before restoring the configuration completed, which may cause the hardware to work in an abnormal state.

This patch fix this problem by set VF alive after restoring the configuration completed.

Fixes a5475d61fa34 ("net/hns3: support VF")
---
 drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/hns3/hns3_ethdev_vf.c +13 -6
index 71f3f95..536ed46 100644
@@ -1891,12 +1891,6 @@ hns3vf_init_hardware(struct hns3_adapter *hns)
 		goto err_init_hardware;
 	}
 
-	ret = hns3vf_set_alive(hw, true);
-	if (ret) {
-		PMD_INIT_LOG(ERR, "Failed to VF send alive to PF: %d", ret);
-		goto err_init_hardware;
-	}
-
 	return 0;
 
 err_init_hardware:
@@ -1995,6 +1989,12 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev)
 
 	hns3_rss_set_default_args(hw);
 
+	ret = hns3vf_set_alive(hw, true);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to VF send alive to PF: %d", ret);
+		goto err_set_tc_queue;
+	}
+
 	return 0;
 
 err_set_tc_queue:
@@ -2706,6 +2706,13 @@ hns3vf_restore_conf(struct hns3_adapter *hns)
 		hns3_info(hw, "hns3vf dev restart successful!");
 	} else if (hw->adapter_state == HNS3_NIC_STOPPING)
 		hw->adapter_state = HNS3_NIC_CONFIGURED;
+
+	ret = hns3vf_set_alive(hw, true);
+	if (ret) {
+		hns3_err(hw, "failed to VF send alive to PF: %d", ret);
+		goto err_vlan_table;
+	}
+
 	return 0;
 
 err_vlan_table:
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/6 net/hns3: fix out param not set when query FDIR counter

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

The hardware doesn't support counting the number of bytes that through the fdir rule. Therefore, the corresponding out parameters (e.g. bytes_set/bytes) is set to zero.

Fixes fcba820d9b9e ("net/hns3: support flow director")
---
 drivers/net/hns3/hns3_flow.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/hns3/hns3_flow.c +2 -0
index 65c7f6e..82810e0 100644
@@ -223,6 +223,8 @@ hns3_counter_query(struct rte_eth_dev *dev, struct rte_flow *flow,
 	}
 	qc->hits_set = 1;
 	qc->hits = value;
+	qc->bytes_set = 0;
+	qc->bytes = 0;
 
 	return 0;
 }
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/6 doc: add link status event pre-conditions

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch adds link status event pre-conditions.

---
 doc/guides/nics/hns3.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
doc/guides/nics/hns3.rst +10 -0
index 4439df5..c3aded8 100644
@@ -115,6 +115,16 @@ Runtime Config Options
   For example::
   -a 0000:7d:00.0,dev_caps_mask=0xF
 
+Link status event Pre-conditions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.
+
 Driver compilation and testing
 ------------------------------
 
Signature · 1 line
2.7.4
#7 lore raw

Re: [dpdk-dev] [PATCH 6/6] doc: add link status event pre-conditions

Quoted 18 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch adds link status event pre-conditions.

---
 doc/guides/nics/hns3.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
doc/guides/nics/hns3.rst +0 -0
index 4439df5..c3aded8 100644
@@ -115,6 +115,16 @@ Runtime Config Options
   For example::
   -a 0000:7d:00.0,dev_caps_mask=0xF
 

doc/guides/nics/hns3.rst Runtime Config Options · line 127

Quoted 10 lines
doc/guides/nics/hns3.rst +10 -0
+Link status event Pre-conditions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.
+

I am not sure about documenting a not released kernel patch for the support, what about waiting kernel release for support?

cc'ed more people for comment.

#8 lore raw

Re: [dpdk-dev] [PATCH 6/6] doc: add link status event pre-conditions

Quoted 19 lines · Ferruh Yigit
Quoted 18 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch adds link status event pre-conditions.

---
  doc/guides/nics/hns3.rst | 10 ++++++++++
  1 file changed, 10 insertions(+)
doc/guides/nics/hns3.rst +0 -0
index 4439df5..c3aded8 100644
@@ -115,6 +115,16 @@ Runtime Config Options
    For example::
    -a 0000:7d:00.0,dev_caps_mask=0xF
 
Quoted 14 lines

doc/guides/nics/hns3.rst Runtime Config Options · line 127

Quoted 10 lines
doc/guides/nics/hns3.rst +10 -0
+Link status event Pre-conditions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.
+

I am not sure about documenting a not released kernel patch for the support, what about waiting kernel release for support?

OK, I will send v2 after 5.13 kernel released, thanks.

Quoted 3 lines

cc'ed more people for comment.
.

#9 lore raw

Re: [dpdk-dev] [PATCH 6/6] doc: add link status event pre-conditions

Quoted 24 lines · Min Hu (Connor)
Quoted 21 lines · Ferruh Yigit
Quoted 20 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch adds link status event pre-conditions.

---
  doc/guides/nics/hns3.rst | 10 ++++++++++

  1 file changed, 10 insertions(+)
doc/guides/nics/hns3.rst +0 -0
index 4439df5..c3aded8 100644
@@ -115,6 +115,16 @@ Runtime Config Options

    For example::
    -a 0000:7d:00.0,dev_caps_mask=0xF

doc/guides/nics/hns3.rst +3 -0
+Link status event Pre-conditions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Quoted 8 lines
Quoted 8 lines

doc/guides/nics/hns3.rst Runtime Config Options · line 125

Quoted 8 lines

+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version

doc/guides/nics/hns3.rst +3 -0
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_. 

the patch has been merged.

Quoted 6 lines
Quoted 6 lines

doc/guides/nics/hns3.rst Runtime Config Options · line 127

Quoted 2 lines
doc/guides/nics/hns3.rst +2 -0
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.
+

I am not sure about documenting a not released kernel patch for the support, what about waiting kernel release for support?

Hi, Ferruh, all,
5.13 kernel has released:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e

Quoted 1 line

OK, I will send v2 after 5.13 kernel released, thanks.

SO, I have sent v2, please check it. thanks.

Quoted 4 lines
Quoted 3 lines

cc'ed more people for comment.
.

.

#10 lore raw

PATCH v2 1/1 doc: add link status event pre-conditions

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch adds link status event pre-conditions.

---
v2:
* not modified, only waiting for 5.13 kernel released.

---
 doc/guides/nics/hns3.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
doc/guides/nics/hns3.rst +10 -0
index cf72810..c5c55d3 100644
@@ -115,6 +115,16 @@ Runtime Config Options
   For example::
   -a 0000:7d:00.0,dev_caps_mask=0xF
 
+Link status event Pre-conditions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.
+
 Driver compilation and testing
 ------------------------------
 
Signature · 1 line
2.7.4
#11 lore raw

Re: [dpdk-dev] [PATCH v2] doc: add link status event pre-conditions

Quoted 25 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch adds link status event pre-conditions.

---
v2:
* not modified, only waiting for 5.13 kernel released.

---
 doc/guides/nics/hns3.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
doc/guides/nics/hns3.rst +3 -0
index cf72810..c5c55d3 100644
@@ -115,6 +115,16 @@ Runtime Config Options
   For example::
   -a 0000:7d:00.0,dev_caps_mask=0xF
 
+Link status event Pre-conditions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+

doc/guides/nics/hns3.rst Runtime Config Options · line 130

Quoted 10 lines
doc/guides/nics/hns3.rst +7 -0
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.
+
 Driver compilation and testing
 ------------------------------
 

I've added extra empty lines before new section and changed prefix to net/hns3 since doc sounds very misleading for me here.

net/hns3: add link status event pre-conditions

Add link status event pre-conditions in the driver documentation.

Applied, thanks.

@Thomas I'm not 100% sure about such links in the
documentation. Please, double-check.

#12 lore raw

Re: [dpdk-dev] [PATCH v2] doc: add link status event pre-conditions

02/07/2021 10:55, Andrew Rybchenko:

Quoted 8 lines · Min Hu (Connor)
Quoted 7 lines

From: Chengwen Feng <[email protected]>

doc/guides/nics/hns3.rst +6 -0
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.

[...]

Quoted 2 lines

@Thomas I'm not 100% sure about such links in the
documentation. Please, double-check.

Not sure to understand what you are not 100% sure. Please could you elaborate?

#13 lore raw

Re: [dpdk-dev] [PATCH v2] doc: add link status event pre-conditions

Quoted 10 lines · Thomas Monjalon

02/07/2021 10:55, Andrew Rybchenko:

Quoted 8 lines · Min Hu (Connor)
Quoted 7 lines

From: Chengwen Feng <[email protected]>

doc/guides/nics/hns3.rst +6 -0
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.

[...]

Quoted 6 lines
Quoted 2 lines

@Thomas I'm not 100% sure about such links in the
documentation. Please, double-check.

Not sure to understand what you are not 100% sure. Please could you elaborate?

I think you replied my question. My goal was just to draw your attention to it. Sometimes it is undesirable to have links to the external resources which could disappear and it would make the documentation broken. I hope it is not the case.

#14 lore raw

Re: [dpdk-dev] [PATCH v2] doc: add link status event pre-conditions

02/07/2021 14:58, Andrew Rybchenko:

Quoted 18 lines · Thomas Monjalon
Quoted 10 lines

02/07/2021 10:55, Andrew Rybchenko:

Quoted 8 lines · Min Hu (Connor)
Quoted 7 lines

From: Chengwen Feng <[email protected]>

doc/guides/nics/hns3.rst +6 -0
+Firmware 1.8.0.0 and later versions support reporting link changes to the PF.
+Therefore, to use the LSC for the PF driver, ensure that the firmware version
+also supports reporting link changes.
+If the VF driver needs to support LSC, special patch must be added:
+`<https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/hisilicon/hns3?h=next-20210428&id=18b6e31f8bf4ac7af7b057228f38a5a530378e4e>`_.
+Note: The patch has been uploaded to 5.13 of the Linux kernel mainline.

[...]

Quoted 6 lines
Quoted 2 lines

@Thomas I'm not 100% sure about such links in the
documentation. Please, double-check.

Not sure to understand what you are not 100% sure. Please could you elaborate?

Quoted 5 lines

I think you replied my question. My goal was just to draw your attention to it. Sometimes it is undesirable to have links to the external resources which could disappear and it would make the documentation broken. I hope it is not the case.

In this case, there is no better source than kernel.org :)

#15 lore raw
In reply to Min Hu (Connor)
Quoted 9 lines · Min Hu (Connor)

This patch set contains 6 bugfixes for hns3 PMD.

Chengwen Feng (5):
net/hns3: return code when PCI config space write fail net/hns3: fix logging info when clear all FDIR rules net/hns3: clear hash map when clear all FDIR rules net/hns3: fix out param not set when query FDIR counter
doc: add link status event pre-conditions

Quoted 9 lines

HongBo Zheng (1):
net/hns3: fix VF setting alive order problem

 doc/guides/nics/hns3.rst          | 10 ++++++++++
 drivers/net/hns3/hns3_ethdev_vf.c | 22 ++++++++++++++++------
 drivers/net/hns3/hns3_fdir.c      | 22 +++++++++++++++++-----
 drivers/net/hns3/hns3_flow.c      |  2 ++
 4 files changed, 45 insertions(+), 11 deletions(-)

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

Since 6/6 is a doc patch it has more time and it can be sent separately.