From: netdev-bot+sashiko@kernel.org
To: gongfan1@huawei.com
Cc: wudi234@huawei.com, tengpeisen@huawei.com,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
andrew+netdev@lunn.ch, ioana.ciornei@nxp.com,
maxime.chevallier@bootlin.com, mohsin.bashr@gmail.com,
dimitri.daskalakis1@gmail.com, hramamurthy@google.com,
larysa.zaremba@intel.com, vadim.fedorenko@linux.dev,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
zhoushuai28@huawei.com, wulike1@huawei.com
Subject: Re: [PATCH net-next v02 4/5] hinic3: Ensure the value of max_qps is greater than 1
Date: Sun, 15 Nov 2026 04:56:56 +0000 [thread overview]
Message-ID: <179471861630.2199510.18244494312107393478@kernel.org> (raw)
In-Reply-To: <1bfd52d6bdc2a7fc1b7eaa183293d4859ad7d94a.1794371175.git.gongfan1@huawei.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch has a Fixes: tag but changes no runtime behaviour.
- [Low] The subject "hinic3: Ensure the value of max_qps is greater than
1" does not match the code.
--
hinic3: Ensure the value of max_qps is greater than 1
This commit changes hinic3_func_max_qnum() so that the queue count it
returns is never below 1. It has a Fixes: tag for 17fcb3dc12bb and no
commit body.
> hinic3: Ensure the value of max_qps is greater than 1
[Severity: Low]
The subject doesn't match the code. The new expression in
hinic3_func_max_qnum() can still return 1:
return max_qps <= 1 ? 1 : max_qps;
So the guarantee is max_qps >= 1, not "greater than 1".
The rest of the driver also handles 1 as a valid value.
hinic3_try_to_enable_rss() in hinic3_rss.c skips RSS when max_qps is 1:
if (nic_dev->max_qps <= 1 ||
!hinic3_test_support(nic_dev, HINIC3_NIC_F_RSS))
goto err_reset_q_params;
The same function also sets nic_dev->max_qps = 1 on its own error paths.
Would "at least 1" or "non-zero" describe the change more accurately?
> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_hw_cfg.c b/drivers/net/ethernet/huawei/hinic3/hinic3_hw_cfg.c
> index c5dd53a8fa96c..65d3114548257 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_hw_cfg.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_hw_cfg.c
> @@ -267,7 +267,9 @@ bool hinic3_support_nic(struct hinic3_hwdev *hwdev)
>
> u16 hinic3_func_max_qnum(struct hinic3_hwdev *hwdev)
> {
> - return hwdev->cfg_mgmt->cap.nic_svc_cap.max_sqs;
> + u16 max_qps = hwdev->cfg_mgmt->cap.nic_svc_cap.max_sqs;
> +
> + return max_qps <= 1 ? 1 : max_qps;
[Severity: Medium]
Can max_sqs actually be 0 when this function is called? The only place
that writes it seems to be hinic3_parse_l2nic_res_cap():
nic_svc_cap->max_sqs = min(dev_cap->nic_max_sq_id + 1,
HINIC3_CFG_MAX_QP);
nic_max_sq_id is a u16, so the + 1 is evaluated as an int and cannot
wrap. HINIC3_CFG_MAX_QP is 256, so max_sqs always ends up between 1 and
256.
max_sqs keeps its zeroed value only when hinic3_support_nic() is false,
because hinic3_parse_dev_cap() then skips the L2NIC parse. In that case
hinic3_nic_probe() returns before it calls hinic3_func_max_qnum():
if (!hinic3_support_nic(hwdev)) {
dev_dbg(&adev->dev, "HW doesn't support nic\n");
return 0;
}
The other callers, hinic3_init_nicio_res() and hinic3_try_to_enable_rss(),
are only reached later in the same probe. hinic3_init_capability() also
runs only once.
If that's right, the clamp doesn't change any value that can reach it.
Even if 0 did reach this function, the old code would fail cleanly
instead of crashing. alloc_etherdev_mq(sizeof(*nic_dev), 0) returns NULL
and probe fails with -ENOMEM, and hinic3_alloc_qps() rejects
!qp_params->num_qps.
With this change, a 0 from firmware would instead give a device that
silently runs with one queue.
The patch has a Fixes: tag but no commit body. Could the commit message
describe the symptom or firmware condition this fixes, so stable
reviewers can check what bug it closes?
The next patch in the series, "hinic3: Ensure that the value of max_qps is
not changed", changes the RSS check to max_qps == 1 and relies on this
guarantee. The guarantee already seems to hold before this patch, though.
> }
>
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794371175.git.gongfan1%40huawei.com
next prev parent reply other threads:[~2026-11-15 4:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 4:15 [PATCH net-next v02 0/5] net: hinic3: Bugfix for later patch-set Fan Gong
2026-11-11 4:15 ` [PATCH net-next v02 1/5] hinic3: Solve an stall issue in hinic3_rx_poll() Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:15 ` [PATCH net-next v02 2/5] hinic3: Avoid concurrent updates on 32-bit systems Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:15 ` [PATCH net-next v02 3/5] hinic3: fix some checkpatchs Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:15 ` [PATCH net-next v02 4/5] hinic3: Ensure the value of max_qps is greater than 1 Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko [this message]
2026-11-11 4:15 ` [PATCH net-next v02 5/5] hinic3: Ensure that the value of max_qps is not changed Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:22 ` [PATCH net-next v02 0/5] net: hinic3: Bugfix for later patch-set netdev-bot+sinfo
2026-11-11 21:17 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179471861630.2199510.18244494312107393478@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dimitri.daskalakis1@gmail.com \
--cc=edumazet@google.com \
--cc=gongfan1@huawei.com \
--cc=horms@kernel.org \
--cc=hramamurthy@google.com \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tengpeisen@huawei.com \
--cc=vadim.fedorenko@linux.dev \
--cc=wudi234@huawei.com \
--cc=wulike1@huawei.com \
--cc=zhoushuai28@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox