All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net,v2 0/4] fix some issues in Huawei hinic driver
@ 2022-10-19  9:57 Zhengchao Shao
  2022-10-19  9:57 ` [PATCH net,v2 1/4] net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() Zhengchao Shao
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Zhengchao Shao @ 2022-10-19  9:57 UTC (permalink / raw)
  To: netdev, davem, edumazet, kuba, pabeni
  Cc: keescook, gustavoars, gregkh, ast, peter.chen, bin.chen, luobin9,
	weiyongjun1, yuehaibing, shaozhengchao

Fix some issues in Huawei hinic driver. This patchset is compiled only,
not tested.

---
v2: remove cyclic release cmdq
---

Zhengchao Shao (4):
  net: hinic: fix incorrect assignment issue in
    hinic_set_interrupt_cfg()
  net: hinic: fix memory leak when reading function table
  net: hinic: fix the issue of CMDQ memory leaks
  net: hinic: fix the issue of double release MBOX callback of VF

 .../net/ethernet/huawei/hinic/hinic_debugfs.c  | 18 ++++++++++++------
 .../net/ethernet/huawei/hinic/hinic_hw_cmdq.c  |  2 +-
 .../net/ethernet/huawei/hinic/hinic_hw_dev.c   |  2 +-
 .../net/ethernet/huawei/hinic/hinic_sriov.c    |  1 -
 4 files changed, 14 insertions(+), 9 deletions(-)

-- 
2.17.1


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

* [PATCH net,v2 1/4] net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg()
  2022-10-19  9:57 [PATCH net,v2 0/4] fix some issues in Huawei hinic driver Zhengchao Shao
@ 2022-10-19  9:57 ` Zhengchao Shao
  2022-10-19  9:57 ` [PATCH net,v2 2/4] net: hinic: fix memory leak when reading function table Zhengchao Shao
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Zhengchao Shao @ 2022-10-19  9:57 UTC (permalink / raw)
  To: netdev, davem, edumazet, kuba, pabeni
  Cc: keescook, gustavoars, gregkh, ast, peter.chen, bin.chen, luobin9,
	weiyongjun1, yuehaibing, shaozhengchao

The value of lli_credit_cnt is incorrectly assigned, fix it.

Fixes: a0337c0dee68 ("hinic: add support to set and get irq coalesce")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
index 94f470556295..27795288c586 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
@@ -877,7 +877,7 @@ int hinic_set_interrupt_cfg(struct hinic_hwdev *hwdev,
 	if (err)
 		return -EINVAL;
 
-	interrupt_info->lli_credit_cnt = temp_info.lli_timer_cnt;
+	interrupt_info->lli_credit_cnt = temp_info.lli_credit_cnt;
 	interrupt_info->lli_timer_cnt = temp_info.lli_timer_cnt;
 
 	err = hinic_msg_to_mgmt(&pfhwdev->pf_to_mgmt, HINIC_MOD_COMM,
-- 
2.17.1


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

* [PATCH net,v2 2/4] net: hinic: fix memory leak when reading function table
  2022-10-19  9:57 [PATCH net,v2 0/4] fix some issues in Huawei hinic driver Zhengchao Shao
  2022-10-19  9:57 ` [PATCH net,v2 1/4] net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() Zhengchao Shao
@ 2022-10-19  9:57 ` Zhengchao Shao
  2022-10-19  9:57 ` [PATCH net,v2 3/4] net: hinic: fix the issue of CMDQ memory leaks Zhengchao Shao
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Zhengchao Shao @ 2022-10-19  9:57 UTC (permalink / raw)
  To: netdev, davem, edumazet, kuba, pabeni
  Cc: keescook, gustavoars, gregkh, ast, peter.chen, bin.chen, luobin9,
	weiyongjun1, yuehaibing, shaozhengchao

When the input parameter idx meets the expected case option in
hinic_dbg_get_func_table(), read_data is not released. Fix it.

Fixes: 5215e16244ee ("hinic: add support to query function table")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 .../net/ethernet/huawei/hinic/hinic_debugfs.c  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c b/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c
index 19eb839177ec..061952c6c21a 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c
@@ -85,6 +85,7 @@ static int hinic_dbg_get_func_table(struct hinic_dev *nic_dev, int idx)
 	struct tag_sml_funcfg_tbl *funcfg_table_elem;
 	struct hinic_cmd_lt_rd *read_data;
 	u16 out_size = sizeof(*read_data);
+	int ret = ~0;
 	int err;
 
 	read_data = kzalloc(sizeof(*read_data), GFP_KERNEL);
@@ -111,20 +112,25 @@ static int hinic_dbg_get_func_table(struct hinic_dev *nic_dev, int idx)
 
 	switch (idx) {
 	case VALID:
-		return funcfg_table_elem->dw0.bs.valid;
+		ret = funcfg_table_elem->dw0.bs.valid;
+		break;
 	case RX_MODE:
-		return funcfg_table_elem->dw0.bs.nic_rx_mode;
+		ret = funcfg_table_elem->dw0.bs.nic_rx_mode;
+		break;
 	case MTU:
-		return funcfg_table_elem->dw1.bs.mtu;
+		ret = funcfg_table_elem->dw1.bs.mtu;
+		break;
 	case RQ_DEPTH:
-		return funcfg_table_elem->dw13.bs.cfg_rq_depth;
+		ret = funcfg_table_elem->dw13.bs.cfg_rq_depth;
+		break;
 	case QUEUE_NUM:
-		return funcfg_table_elem->dw13.bs.cfg_q_num;
+		ret = funcfg_table_elem->dw13.bs.cfg_q_num;
+		break;
 	}
 
 	kfree(read_data);
 
-	return ~0;
+	return ret;
 }
 
 static ssize_t hinic_dbg_cmd_read(struct file *filp, char __user *buffer, size_t count,
-- 
2.17.1


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

* [PATCH net,v2 3/4] net: hinic: fix the issue of CMDQ memory leaks
  2022-10-19  9:57 [PATCH net,v2 0/4] fix some issues in Huawei hinic driver Zhengchao Shao
  2022-10-19  9:57 ` [PATCH net,v2 1/4] net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() Zhengchao Shao
  2022-10-19  9:57 ` [PATCH net,v2 2/4] net: hinic: fix memory leak when reading function table Zhengchao Shao
@ 2022-10-19  9:57 ` Zhengchao Shao
  2022-10-19  9:57 ` [PATCH net,v2 4/4] net: hinic: fix the issue of double release MBOX callback of VF Zhengchao Shao
  2022-10-21  5:10 ` [PATCH net,v2 0/4] fix some issues in Huawei hinic driver patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Zhengchao Shao @ 2022-10-19  9:57 UTC (permalink / raw)
  To: netdev, davem, edumazet, kuba, pabeni
  Cc: keescook, gustavoars, gregkh, ast, peter.chen, bin.chen, luobin9,
	weiyongjun1, yuehaibing, shaozhengchao

When hinic_set_cmdq_depth() fails in hinic_init_cmdqs(), the cmdq memory is
not released correctly. Fix it.

Fixes: 72ef908bb3ff ("hinic: add three net_device_ops of vf")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
index 78190e88cd75..d39eec9c62bf 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
@@ -924,7 +924,7 @@ int hinic_init_cmdqs(struct hinic_cmdqs *cmdqs, struct hinic_hwif *hwif,
 
 err_set_cmdq_depth:
 	hinic_ceq_unregister_cb(&func_to_io->ceqs, HINIC_CEQ_CMDQ);
-
+	free_cmdq(&cmdqs->cmdq[HINIC_CMDQ_SYNC]);
 err_cmdq_ctxt:
 	hinic_wqs_cmdq_free(&cmdqs->cmdq_pages, cmdqs->saved_wqs,
 			    HINIC_MAX_CMDQ_TYPES);
-- 
2.17.1


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

* [PATCH net,v2 4/4] net: hinic: fix the issue of double release MBOX callback of VF
  2022-10-19  9:57 [PATCH net,v2 0/4] fix some issues in Huawei hinic driver Zhengchao Shao
                   ` (2 preceding siblings ...)
  2022-10-19  9:57 ` [PATCH net,v2 3/4] net: hinic: fix the issue of CMDQ memory leaks Zhengchao Shao
@ 2022-10-19  9:57 ` Zhengchao Shao
  2022-10-21  5:10 ` [PATCH net,v2 0/4] fix some issues in Huawei hinic driver patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Zhengchao Shao @ 2022-10-19  9:57 UTC (permalink / raw)
  To: netdev, davem, edumazet, kuba, pabeni
  Cc: keescook, gustavoars, gregkh, ast, peter.chen, bin.chen, luobin9,
	weiyongjun1, yuehaibing, shaozhengchao

In hinic_vf_func_init(), if VF fails to register information with PF
through the MBOX, the MBOX callback function of VF is released once. But
it is released again in hinic_init_hwdev(). Remove one.

Fixes: 7dd29ee12865 ("hinic: add sriov feature support")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
index a5f08b969e3f..f7e05b41385b 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
@@ -1174,7 +1174,6 @@ int hinic_vf_func_init(struct hinic_hwdev *hwdev)
 			dev_err(&hwdev->hwif->pdev->dev,
 				"Failed to register VF, err: %d, status: 0x%x, out size: 0x%x\n",
 				err, register_info.status, out_size);
-			hinic_unregister_vf_mbox_cb(hwdev, HINIC_MOD_L2NIC);
 			return -EIO;
 		}
 	} else {
-- 
2.17.1


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

* Re: [PATCH net,v2 0/4] fix some issues in Huawei hinic driver
  2022-10-19  9:57 [PATCH net,v2 0/4] fix some issues in Huawei hinic driver Zhengchao Shao
                   ` (3 preceding siblings ...)
  2022-10-19  9:57 ` [PATCH net,v2 4/4] net: hinic: fix the issue of double release MBOX callback of VF Zhengchao Shao
@ 2022-10-21  5:10 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-21  5:10 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: netdev, davem, edumazet, kuba, pabeni, keescook, gustavoars,
	gregkh, ast, peter.chen, bin.chen, luobin9, weiyongjun1,
	yuehaibing

Hello:

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

On Wed, 19 Oct 2022 17:57:50 +0800 you wrote:
> Fix some issues in Huawei hinic driver. This patchset is compiled only,
> not tested.
> 
> ---
> v2: remove cyclic release cmdq
> ---
> 
> [...]

Here is the summary with links:
  - [net,v2,1/4] net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg()
    https://git.kernel.org/netdev/net/c/c0605cd6750f
  - [net,v2,2/4] net: hinic: fix memory leak when reading function table
    https://git.kernel.org/netdev/net/c/4c1f602df895
  - [net,v2,3/4] net: hinic: fix the issue of CMDQ memory leaks
    https://git.kernel.org/netdev/net/c/363cc87767f6
  - [net,v2,4/4] net: hinic: fix the issue of double release MBOX callback of VF
    https://git.kernel.org/netdev/net/c/8ec2f4c6b2e1

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:[~2022-10-21  5:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19  9:57 [PATCH net,v2 0/4] fix some issues in Huawei hinic driver Zhengchao Shao
2022-10-19  9:57 ` [PATCH net,v2 1/4] net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() Zhengchao Shao
2022-10-19  9:57 ` [PATCH net,v2 2/4] net: hinic: fix memory leak when reading function table Zhengchao Shao
2022-10-19  9:57 ` [PATCH net,v2 3/4] net: hinic: fix the issue of CMDQ memory leaks Zhengchao Shao
2022-10-19  9:57 ` [PATCH net,v2 4/4] net: hinic: fix the issue of double release MBOX callback of VF Zhengchao Shao
2022-10-21  5:10 ` [PATCH net,v2 0/4] fix some issues in Huawei hinic driver 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.