All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: hns3: add two fixes for -net
@ 2022-03-30 13:45 Guangbin Huang
  2022-03-30 13:45 ` [PATCH net 1/2] net: hns3: fix the concurrency between functions reading debugfs Guangbin Huang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guangbin Huang @ 2022-03-30 13:45 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

This series adds two fixes for the HNS3 ethernet driver.

Guangbin Huang (1):
  net: hns3: fix software vlan talbe of vlan 0 inconsistent with
    hardware

Yufeng Mo (1):
  net: hns3: fix the concurrency between functions reading debugfs

 drivers/net/ethernet/hisilicon/hns3/hnae3.h       |  1 +
 .../net/ethernet/hisilicon/hns3/hns3_debugfs.c    | 15 +++++++++++----
 .../net/ethernet/hisilicon/hns3/hns3_debugfs.h    |  1 -
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c   |  6 +++---
 4 files changed, 15 insertions(+), 8 deletions(-)

-- 
2.33.0


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

* [PATCH net 1/2] net: hns3: fix the concurrency between functions reading debugfs
  2022-03-30 13:45 [PATCH net 0/2] net: hns3: add two fixes for -net Guangbin Huang
@ 2022-03-30 13:45 ` Guangbin Huang
  2022-03-30 13:45 ` [PATCH net 2/2] net: hns3: fix software vlan talbe of vlan 0 inconsistent with hardware Guangbin Huang
  2022-03-31 10:00 ` [PATCH net 0/2] net: hns3: add two fixes for -net patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Guangbin Huang @ 2022-03-30 13:45 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Yufeng Mo <moyufeng@huawei.com>

Currently, the debugfs mechanism is that all functions share a
global variable to save the pointer for obtaining data. When
different functions concurrently access the same file node,
repeated release exceptions occur. Therefore, the granularity
of the pointer for storing the obtained data is adjusted to be
private for each function.

Fixes: 5e69ea7ee2a6 ("net: hns3: refactor the debugfs process")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h       |  1 +
 .../net/ethernet/hisilicon/hns3/hns3_debugfs.c    | 15 +++++++++++----
 .../net/ethernet/hisilicon/hns3/hns3_debugfs.h    |  1 -
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index d44dd7091fa1..79c64f4e67d2 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -845,6 +845,7 @@ struct hnae3_handle {
 	struct dentry *hnae3_dbgfs;
 	/* protects concurrent contention between debugfs commands */
 	struct mutex dbgfs_lock;
+	char **dbgfs_buf;
 
 	/* Network interface message level enabled bits */
 	u32 msg_enable;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index f726a5b70f9e..44d9b560b337 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -1227,7 +1227,7 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
 		return ret;
 
 	mutex_lock(&handle->dbgfs_lock);
-	save_buf = &hns3_dbg_cmd[index].buf;
+	save_buf = &handle->dbgfs_buf[index];
 
 	if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state) ||
 	    test_bit(HNS3_NIC_STATE_RESETTING, &priv->state)) {
@@ -1332,6 +1332,13 @@ int hns3_dbg_init(struct hnae3_handle *handle)
 	int ret;
 	u32 i;
 
+	handle->dbgfs_buf = devm_kcalloc(&handle->pdev->dev,
+					 ARRAY_SIZE(hns3_dbg_cmd),
+					 sizeof(*handle->dbgfs_buf),
+					 GFP_KERNEL);
+	if (!handle->dbgfs_buf)
+		return -ENOMEM;
+
 	hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry =
 				debugfs_create_dir(name, hns3_dbgfs_root);
 	handle->hnae3_dbgfs = hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry;
@@ -1380,9 +1387,9 @@ void hns3_dbg_uninit(struct hnae3_handle *handle)
 	u32 i;
 
 	for (i = 0; i < ARRAY_SIZE(hns3_dbg_cmd); i++)
-		if (hns3_dbg_cmd[i].buf) {
-			kvfree(hns3_dbg_cmd[i].buf);
-			hns3_dbg_cmd[i].buf = NULL;
+		if (handle->dbgfs_buf[i]) {
+			kvfree(handle->dbgfs_buf[i]);
+			handle->dbgfs_buf[i] = NULL;
 		}
 
 	mutex_destroy(&handle->dbgfs_lock);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h
index 83aa1450ab9f..97578eabb7d8 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h
@@ -49,7 +49,6 @@ struct hns3_dbg_cmd_info {
 	enum hnae3_dbg_cmd cmd;
 	enum hns3_dbg_dentry_type dentry;
 	u32 buf_len;
-	char *buf;
 	int (*init)(struct hnae3_handle *handle, unsigned int cmd);
 };
 
-- 
2.33.0


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

* [PATCH net 2/2] net: hns3: fix software vlan talbe of vlan 0 inconsistent with hardware
  2022-03-30 13:45 [PATCH net 0/2] net: hns3: add two fixes for -net Guangbin Huang
  2022-03-30 13:45 ` [PATCH net 1/2] net: hns3: fix the concurrency between functions reading debugfs Guangbin Huang
@ 2022-03-30 13:45 ` Guangbin Huang
  2022-03-31 10:00 ` [PATCH net 0/2] net: hns3: add two fixes for -net patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Guangbin Huang @ 2022-03-30 13:45 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

When user delete vlan 0, as driver will not delete vlan 0 for hardware in
function hclge_set_vlan_filter_hw(), so vlan 0 in software vlan talbe should
not be deleted.

Fixes: fe4144d47eef ("net: hns3: sync VLAN filter entries when kill VLAN ID failed")
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 2a5e6a241d52..8cebb180c812 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -10323,11 +10323,11 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
 	}
 
 	if (!ret) {
-		if (is_kill)
-			hclge_rm_vport_vlan_table(vport, vlan_id, false);
-		else
+		if (!is_kill)
 			hclge_add_vport_vlan_table(vport, vlan_id,
 						   writen_to_tbl);
+		else if (is_kill && vlan_id != 0)
+			hclge_rm_vport_vlan_table(vport, vlan_id, false);
 	} else if (is_kill) {
 		/* when remove hw vlan filter failed, record the vlan id,
 		 * and try to remove it from hw later, to be consistence
-- 
2.33.0


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

* Re: [PATCH net 0/2] net: hns3: add two fixes for -net
  2022-03-30 13:45 [PATCH net 0/2] net: hns3: add two fixes for -net Guangbin Huang
  2022-03-30 13:45 ` [PATCH net 1/2] net: hns3: fix the concurrency between functions reading debugfs Guangbin Huang
  2022-03-30 13:45 ` [PATCH net 2/2] net: hns3: fix software vlan talbe of vlan 0 inconsistent with hardware Guangbin Huang
@ 2022-03-31 10:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-31 10:00 UTC (permalink / raw)
  To: Guangbin Huang; +Cc: davem, kuba, netdev, linux-kernel, lipeng321, chenhao288

Hello:

This series was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 30 Mar 2022 21:45:04 +0800 you wrote:
> This series adds two fixes for the HNS3 ethernet driver.
> 
> Guangbin Huang (1):
>   net: hns3: fix software vlan talbe of vlan 0 inconsistent with
>     hardware
> 
> Yufeng Mo (1):
>   net: hns3: fix the concurrency between functions reading debugfs
> 
> [...]

Here is the summary with links:
  - [net,1/2] net: hns3: fix the concurrency between functions reading debugfs
    https://git.kernel.org/netdev/net/c/9c9a04212fa3
  - [net,2/2] net: hns3: fix software vlan talbe of vlan 0 inconsistent with hardware
    https://git.kernel.org/netdev/net/c/7ed258f12ec5

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] 4+ messages in thread

end of thread, other threads:[~2022-03-31 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 13:45 [PATCH net 0/2] net: hns3: add two fixes for -net Guangbin Huang
2022-03-30 13:45 ` [PATCH net 1/2] net: hns3: fix the concurrency between functions reading debugfs Guangbin Huang
2022-03-30 13:45 ` [PATCH net 2/2] net: hns3: fix software vlan talbe of vlan 0 inconsistent with hardware Guangbin Huang
2022-03-31 10:00 ` [PATCH net 0/2] net: hns3: add two fixes for -net patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.