LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net 0/4] net: hns3: add some fixes for -net
@ 2021-11-26 12:03 Guangbin Huang
  2021-11-26 12:03 ` [PATCH net 1/4] net: hns3: fix VF RSS failed problem after PF enable multi-TCs Guangbin Huang
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Guangbin Huang @ 2021-11-26 12:03 UTC (permalink / raw)
  To: davem, kuba, wangjie125
  Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

This series adds some fixes for the HNS3 ethernet driver.

Guangbin Huang (1):
  net: hns3: fix VF RSS failed problem after PF enable multi-TCs

Hao Chen (2):
  net: hns3: add check NULL address for page pool
  net: hns3: fix one incorrect value of page pool info when queried by
    debugfs

Jie Wang (1):
  net: hns3: fix incorrect components info of ethtool --reset command

 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c        | 8 +++++++-
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c        | 4 ++++
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++--
 3 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.33.0


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

* [PATCH net 1/4] net: hns3: fix VF RSS failed problem after PF enable multi-TCs
  2021-11-26 12:03 [PATCH net 0/4] net: hns3: add some fixes for -net Guangbin Huang
@ 2021-11-26 12:03 ` Guangbin Huang
  2021-11-26 12:03 ` [PATCH net 2/4] net: hns3: add check NULL address for page pool Guangbin Huang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Guangbin Huang @ 2021-11-26 12:03 UTC (permalink / raw)
  To: davem, kuba, wangjie125
  Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

When PF is set to multi-TCs and configured mapping relationship between
priorities and TCs, the hardware will active these settings for this PF
and its VFs.

In this case when VF just uses one TC and its rx packets contain priority,
and if the priority is not mapped to TC0, as other TCs of VF is not valid,
hardware always put this kind of packets to the queue 0. It cause this kind
of packets of VF can not be used RSS function.

To fix this problem, set tc mode of all unused TCs of VF to the setting of
TC0, then rx packet with priority which map to unused TC will be direct to
TC0.

Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 25c419d40066..41afaeea881b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -703,9 +703,9 @@ static int hclgevf_set_rss_tc_mode(struct hclgevf_dev *hdev,  u16 rss_size)
 	roundup_size = ilog2(roundup_size);
 
 	for (i = 0; i < HCLGEVF_MAX_TC_NUM; i++) {
-		tc_valid[i] = !!(hdev->hw_tc_map & BIT(i));
+		tc_valid[i] = 1;
 		tc_size[i] = roundup_size;
-		tc_offset[i] = rss_size * i;
+		tc_offset[i] = (hdev->hw_tc_map & BIT(i)) ? rss_size * i : 0;
 	}
 
 	hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_RSS_TC_MODE, false);
-- 
2.33.0


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

* [PATCH net 2/4] net: hns3: add check NULL address for page pool
  2021-11-26 12:03 [PATCH net 0/4] net: hns3: add some fixes for -net Guangbin Huang
  2021-11-26 12:03 ` [PATCH net 1/4] net: hns3: fix VF RSS failed problem after PF enable multi-TCs Guangbin Huang
@ 2021-11-26 12:03 ` Guangbin Huang
  2021-11-26 12:03 ` [PATCH net 3/4] net: hns3: fix one incorrect value of page pool info when queried by debugfs Guangbin Huang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Guangbin Huang @ 2021-11-26 12:03 UTC (permalink / raw)
  To: davem, kuba, wangjie125
  Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Hao Chen <chenhao288@hisilicon.com>

When page pool is not enabled, its address value is still NULL and page
pool should not be accessed, so add a check for it.

Fixes: 850bfb912a6d ("net: hns3: debugfs add support dumping page pool info")
Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index 67364ab63a1f..fbb8a5f08222 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -1106,6 +1106,11 @@ hns3_dbg_page_pool_info(struct hnae3_handle *h, char *buf, int len)
 		return -EFAULT;
 	}
 
+	if (!priv->ring[h->kinfo.num_tqps].page_pool) {
+		dev_err(&h->pdev->dev, "page pool is not initialized\n");
+		return -EFAULT;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(page_pool_info_items); i++)
 		result[i] = &data_str[i][0];
 
-- 
2.33.0


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

* [PATCH net 3/4] net: hns3: fix one incorrect value of page pool info when queried by debugfs
  2021-11-26 12:03 [PATCH net 0/4] net: hns3: add some fixes for -net Guangbin Huang
  2021-11-26 12:03 ` [PATCH net 1/4] net: hns3: fix VF RSS failed problem after PF enable multi-TCs Guangbin Huang
  2021-11-26 12:03 ` [PATCH net 2/4] net: hns3: add check NULL address for page pool Guangbin Huang
@ 2021-11-26 12:03 ` Guangbin Huang
  2021-11-26 12:03 ` [PATCH net 4/4] net: hns3: fix incorrect components info of ethtool --reset command Guangbin Huang
  2021-11-26 19:40 ` [PATCH net 0/4] net: hns3: add some fixes for -net patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Guangbin Huang @ 2021-11-26 12:03 UTC (permalink / raw)
  To: davem, kuba, wangjie125
  Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Hao Chen <chenhao288@hisilicon.com>

Currently, when user queries page pool info by debugfs command
"cat page_pool_info", the cnt of allocated page for page pool may be
incorrect because of memory inconsistency problem caused by compiler
optimization.

So this patch uses READ_ONCE() to read value of pages_state_hold_cnt to
fix this problem.

Fixes: 850bfb912a6d ("net: hns3: debugfs add support dumping page pool info")
Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index fbb8a5f08222..081295bff765 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -1081,7 +1081,8 @@ static void hns3_dump_page_pool_info(struct hns3_enet_ring *ring,
 	u32 j = 0;
 
 	sprintf(result[j++], "%u", index);
-	sprintf(result[j++], "%u", ring->page_pool->pages_state_hold_cnt);
+	sprintf(result[j++], "%u",
+		READ_ONCE(ring->page_pool->pages_state_hold_cnt));
 	sprintf(result[j++], "%u",
 		atomic_read(&ring->page_pool->pages_state_release_cnt));
 	sprintf(result[j++], "%u", ring->page_pool->p.pool_size);
-- 
2.33.0


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

* [PATCH net 4/4] net: hns3: fix incorrect components info of ethtool --reset command
  2021-11-26 12:03 [PATCH net 0/4] net: hns3: add some fixes for -net Guangbin Huang
                   ` (2 preceding siblings ...)
  2021-11-26 12:03 ` [PATCH net 3/4] net: hns3: fix one incorrect value of page pool info when queried by debugfs Guangbin Huang
@ 2021-11-26 12:03 ` Guangbin Huang
  2021-11-26 19:40 ` [PATCH net 0/4] net: hns3: add some fixes for -net patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Guangbin Huang @ 2021-11-26 12:03 UTC (permalink / raw)
  To: davem, kuba, wangjie125
  Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Jie Wang <wangjie125@huawei.com>

Currently, HNS3 driver doesn't clear the reset flags of components after
successfully executing reset, it causes userspace info of
"Components reset" and "Components not reset" is incorrect.

So fix this problem by clear corresponding reset flag after reset process.

Fixes: ddccc5e368a3 ("net: hns3: add support for triggering reset by ethtool")
Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index c8442b86df94..c9b4568d7a8d 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -987,6 +987,7 @@ static int hns3_set_reset(struct net_device *netdev, u32 *flags)
 	struct hnae3_ae_dev *ae_dev = pci_get_drvdata(h->pdev);
 	const struct hnae3_ae_ops *ops = h->ae_algo->ops;
 	const struct hns3_reset_type_map *rst_type_map;
+	enum ethtool_reset_flags rst_flags;
 	u32 i, size;
 
 	if (ops->ae_dev_resetting && ops->ae_dev_resetting(h))
@@ -1006,6 +1007,7 @@ static int hns3_set_reset(struct net_device *netdev, u32 *flags)
 	for (i = 0; i < size; i++) {
 		if (rst_type_map[i].rst_flags == *flags) {
 			rst_type = rst_type_map[i].rst_type;
+			rst_flags = rst_type_map[i].rst_flags;
 			break;
 		}
 	}
@@ -1021,6 +1023,8 @@ static int hns3_set_reset(struct net_device *netdev, u32 *flags)
 
 	ops->reset_event(h->pdev, h);
 
+	*flags &= ~rst_flags;
+
 	return 0;
 }
 
-- 
2.33.0


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

* Re: [PATCH net 0/4] net: hns3: add some fixes for -net
  2021-11-26 12:03 [PATCH net 0/4] net: hns3: add some fixes for -net Guangbin Huang
                   ` (3 preceding siblings ...)
  2021-11-26 12:03 ` [PATCH net 4/4] net: hns3: fix incorrect components info of ethtool --reset command Guangbin Huang
@ 2021-11-26 19:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-26 19:40 UTC (permalink / raw)
  To: Guangbin Huang
  Cc: davem, kuba, wangjie125, netdev, linux-kernel, lipeng321, chenhao288

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 26 Nov 2021 20:03:14 +0800 you wrote:
> This series adds some fixes for the HNS3 ethernet driver.
> 
> Guangbin Huang (1):
>   net: hns3: fix VF RSS failed problem after PF enable multi-TCs
> 
> Hao Chen (2):
>   net: hns3: add check NULL address for page pool
>   net: hns3: fix one incorrect value of page pool info when queried by
>     debugfs
> 
> [...]

Here is the summary with links:
  - [net,1/4] net: hns3: fix VF RSS failed problem after PF enable multi-TCs
    https://git.kernel.org/netdev/net/c/8d2ad993aa05
  - [net,2/4] net: hns3: add check NULL address for page pool
    https://git.kernel.org/netdev/net/c/b8af344cfea1
  - [net,3/4] net: hns3: fix one incorrect value of page pool info when queried by debugfs
    https://git.kernel.org/netdev/net/c/9c1479174870
  - [net,4/4] net: hns3: fix incorrect components info of ethtool --reset command
    https://git.kernel.org/netdev/net/c/82229c4dbb8a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-11-26 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 12:03 [PATCH net 0/4] net: hns3: add some fixes for -net Guangbin Huang
2021-11-26 12:03 ` [PATCH net 1/4] net: hns3: fix VF RSS failed problem after PF enable multi-TCs Guangbin Huang
2021-11-26 12:03 ` [PATCH net 2/4] net: hns3: add check NULL address for page pool Guangbin Huang
2021-11-26 12:03 ` [PATCH net 3/4] net: hns3: fix one incorrect value of page pool info when queried by debugfs Guangbin Huang
2021-11-26 12:03 ` [PATCH net 4/4] net: hns3: fix incorrect components info of ethtool --reset command Guangbin Huang
2021-11-26 19:40 ` [PATCH net 0/4] net: hns3: add some fixes for -net patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).