* [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver
@ 2024-03-16 11:10 Jijie Shao
0 siblings, 0 replies; 7+ messages in thread
From: Jijie Shao @ 2024-03-16 11:10 UTC (permalink / raw)
To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni
Cc: michal.kubiak, shenjian15, wangjie125, liuyonglong, shaojijie,
netdev, linux-kernel
There are some bugfix for the HNS3 ethernet driver
---
changeLog:
v1 -> v2:
- Fixed some syntax errors in git messages and comments, suggested by Michal Kubiak
- Optimized the code by using a flag, suggested by Michal Kubiak
v1: https://lore.kernel.org/all/20240315100748.2913882-1-shaojijie@huawei.com/
---
Jian Shen (1):
net: hns3: mark unexcuted loopback test result as UNEXECUTED
Jie Wang (1):
net: hns3: fix index limit to support all queue stats
Yonglong Liu (1):
net: hns3: fix kernel crash when devlink reload during pf
initialization
.../hns3/hns3_common/hclge_comm_tqp_stats.c | 2 +-
.../net/ethernet/hisilicon/hns3/hns3_ethtool.c | 18 ++++++++++++++++--
.../hisilicon/hns3/hns3pf/hclge_devlink.c | 5 +++--
3 files changed, 20 insertions(+), 5 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver
@ 2025-12-11 2:37 Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 1/3] net: hns3: using the num_tqps in the vf driver to apply for resources Jijie Shao
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Jijie Shao @ 2025-12-11 2:37 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
Cc: shenjian15, liuyonglong, chenhao418, lantao5, huangdonghua3,
yangshuaisong, jonathan.cameron, salil.mehta, netdev,
linux-kernel, shaojijie
There are some bugfix for the HNS3 ethernet driver
Jian Shen (3):
net: hns3: using the num_tqps in the vf driver to apply for resources
net: hns3: using the num_tqps to check whether tqp_index is out of
range when vf get ring info from mbx
net: hns3: add VLAN id validation before using
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 4 ++--
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++--
3 files changed, 7 insertions(+), 4 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V2 net 1/3] net: hns3: using the num_tqps in the vf driver to apply for resources
2025-12-11 2:37 [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Jijie Shao
@ 2025-12-11 2:37 ` Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 2/3] net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx Jijie Shao
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jijie Shao @ 2025-12-11 2:37 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
Cc: shenjian15, liuyonglong, chenhao418, lantao5, huangdonghua3,
yangshuaisong, jonathan.cameron, salil.mehta, netdev,
linux-kernel, shaojijie
From: Jian Shen <shenjian15@huawei.com>
Currently, hdev->htqp is allocated using hdev->num_tqps, and kinfo->tqp
is allocated using kinfo->num_tqps. However, kinfo->num_tqps is set to
min(new_tqps, hdev->num_tqps); Therefore, kinfo->num_tqps may be smaller
than hdev->num_tqps, which causes some hdev->htqp[i] to remain
uninitialized in hclgevf_knic_setup().
Thus, this patch allocates hdev->htqp and kinfo->tqp using hdev->num_tqps,
ensuring that the lengths of hdev->htqp and kinfo->tqp are consistent
and that all elements are properly initialized.
Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
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 8fcf220a120d..70327a73dee3 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -368,12 +368,12 @@ static int hclgevf_knic_setup(struct hclgevf_dev *hdev)
new_tqps = kinfo->rss_size * num_tc;
kinfo->num_tqps = min(new_tqps, hdev->num_tqps);
- kinfo->tqp = devm_kcalloc(&hdev->pdev->dev, kinfo->num_tqps,
+ kinfo->tqp = devm_kcalloc(&hdev->pdev->dev, hdev->num_tqps,
sizeof(struct hnae3_queue *), GFP_KERNEL);
if (!kinfo->tqp)
return -ENOMEM;
- for (i = 0; i < kinfo->num_tqps; i++) {
+ for (i = 0; i < hdev->num_tqps; i++) {
hdev->htqp[i].q.handle = &hdev->nic;
hdev->htqp[i].q.tqp_index = i;
kinfo->tqp[i] = &hdev->htqp[i].q;
--
2.33.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V2 net 2/3] net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx
2025-12-11 2:37 [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 1/3] net: hns3: using the num_tqps in the vf driver to apply for resources Jijie Shao
@ 2025-12-11 2:37 ` Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 3/3] net: hns3: add VLAN id validation before using Jijie Shao
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jijie Shao @ 2025-12-11 2:37 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
Cc: shenjian15, liuyonglong, chenhao418, lantao5, huangdonghua3,
yangshuaisong, jonathan.cameron, salil.mehta, netdev,
linux-kernel, shaojijie
From: Jian Shen <shenjian15@huawei.com>
Currently, rss_size = num_tqps / tc_num. If tc_num is 1, then num_tqps
equals rss_size. However, if the tc_num is greater than 1, then rss_size
will be less than num_tqps, causing the tqp_index check for subsequent TCs
using rss_size to always fail.
This patch uses the num_tqps to check whether tqp_index is out of range,
instead of rss_size.
Fixes: 326334aad024 ("net: hns3: add a check for tqp_index in hclge_get_ring_chain_from_mbx()")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index c7ff12a6c076..b7d4e06a55d4 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -193,10 +193,10 @@ static int hclge_get_ring_chain_from_mbx(
return -EINVAL;
for (i = 0; i < ring_num; i++) {
- if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) {
+ if (req->msg.param[i].tqp_index >= vport->nic.kinfo.num_tqps) {
dev_err(&hdev->pdev->dev, "tqp index(%u) is out of range(0-%u)\n",
req->msg.param[i].tqp_index,
- vport->nic.kinfo.rss_size - 1U);
+ vport->nic.kinfo.num_tqps - 1U);
return -EINVAL;
}
}
--
2.33.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V2 net 3/3] net: hns3: add VLAN id validation before using
2025-12-11 2:37 [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 1/3] net: hns3: using the num_tqps in the vf driver to apply for resources Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 2/3] net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx Jijie Shao
@ 2025-12-11 2:37 ` Jijie Shao
2025-12-18 16:01 ` [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Paolo Abeni
2025-12-18 16:10 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 7+ messages in thread
From: Jijie Shao @ 2025-12-11 2:37 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
Cc: shenjian15, liuyonglong, chenhao418, lantao5, huangdonghua3,
yangshuaisong, jonathan.cameron, salil.mehta, netdev,
linux-kernel, shaojijie
From: Jian Shen <shenjian15@huawei.com>
Currently, the VLAN id may be used without validation when
receive a VLAN configuration mailbox from VF. The length of
vlan_del_fail_bmap is BITS_TO_LONGS(VLAN_N_VID). It may cause
out-of-bounds memory access once the VLAN id is bigger than
or equal to VLAN_N_VID.
Therefore, VLAN id needs to be checked to ensure it is within
the range of VLAN_N_VID.
Fixes: fe4144d47eef ("net: hns3: sync VLAN filter entries when kill VLAN ID failed")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
v1-> v2:
- Mentioning vlan_del_fail_bmap in commit message, suggested by Simon Horman.
v1: https://lore.kernel.org/all/20251209133825.3577343-4-shaojijie@huawei.com/
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index cf8abbe01840..c589baea7c77 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -10555,6 +10555,9 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
bool writen_to_tbl = false;
int ret = 0;
+ if (vlan_id >= VLAN_N_VID)
+ return -EINVAL;
+
/* When device is resetting or reset failed, firmware is unable to
* handle mailbox. Just record the vlan id, and remove it after
* reset finished.
--
2.33.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver
2025-12-11 2:37 [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Jijie Shao
` (2 preceding siblings ...)
2025-12-11 2:37 ` [PATCH V2 net 3/3] net: hns3: add VLAN id validation before using Jijie Shao
@ 2025-12-18 16:01 ` Paolo Abeni
2025-12-18 16:10 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 7+ messages in thread
From: Paolo Abeni @ 2025-12-18 16:01 UTC (permalink / raw)
To: Jijie Shao, davem, edumazet, kuba, andrew+netdev, horms
Cc: shenjian15, liuyonglong, chenhao418, lantao5, huangdonghua3,
yangshuaisong, jonathan.cameron, salil.mehta, netdev,
linux-kernel
On 12/11/25 3:37 AM, Jijie Shao wrote:
> There are some bugfix for the HNS3 ethernet driver
Next time you should include some actual contents in the cover letter,
i.e. very briefly describing the nature of the issue addressed here.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver
2025-12-11 2:37 [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Jijie Shao
` (3 preceding siblings ...)
2025-12-18 16:01 ` [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Paolo Abeni
@ 2025-12-18 16:10 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-12-18 16:10 UTC (permalink / raw)
To: Jijie Shao
Cc: davem, edumazet, kuba, pabeni, andrew+netdev, horms, shenjian15,
liuyonglong, chenhao418, lantao5, huangdonghua3, yangshuaisong,
jonathan.cameron, salil.mehta, netdev, linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Thu, 11 Dec 2025 10:37:34 +0800 you wrote:
> There are some bugfix for the HNS3 ethernet driver
>
> Jian Shen (3):
> net: hns3: using the num_tqps in the vf driver to apply for resources
> net: hns3: using the num_tqps to check whether tqp_index is out of
> range when vf get ring info from mbx
> net: hns3: add VLAN id validation before using
>
> [...]
Here is the summary with links:
- [V2,net,1/3] net: hns3: using the num_tqps in the vf driver to apply for resources
https://git.kernel.org/netdev/net/c/c2a16269742e
- [V2,net,2/3] net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx
https://git.kernel.org/netdev/net/c/d180c11aa8a6
- [V2,net,3/3] net: hns3: add VLAN id validation before using
https://git.kernel.org/netdev/net/c/6ef935e65902
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] 7+ messages in thread
end of thread, other threads:[~2025-12-18 16:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11 2:37 [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 1/3] net: hns3: using the num_tqps in the vf driver to apply for resources Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 2/3] net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx Jijie Shao
2025-12-11 2:37 ` [PATCH V2 net 3/3] net: hns3: add VLAN id validation before using Jijie Shao
2025-12-18 16:01 ` [PATCH V2 net 0/3] There are some bugfix for the HNS3 ethernet driver Paolo Abeni
2025-12-18 16:10 ` patchwork-bot+netdevbpf
-- strict thread matches above, loose matches on Subject: below --
2024-03-16 11:10 Jijie Shao
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).