Article View: linux.kernel.netdev
Article #16539Re: [PATCH net-next v02 4/5] hinic3: Ensure the value of max_qps is greater than 1
From: netdev-bot+sashiko
Date: Sun, 15 Nov 2026 04:56
Date: Sun, 15 Nov 2026 04:56
107 lines
12000 bytes
12000 bytes
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
Technical Details
Message-ID:
<179471861630.2199510.18244494312107393478@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363567-linux-kernel-netdev=dewy.ruReferences:
<1bfd52d6bdc2a7fc1b7eaa183293d4859ad7d94a.1794371175.git.gongfan1@huawei.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363567-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179471861630.2199510.18244494312107393478@kernel.org> References: <1bfd52d6bdc2a7fc1b7eaa183293d4859ad7d94a.1794371175.git.gongfan1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1732095"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:a/8ByYUa/YfvSUCfrPxnDLPuH0E= sha256:664nFPKdQIpOt5N9rI8NoJbqF2oiPBA5gfzEqFNUTQg= sha1:4CTe7zKARBz1OjO3abystVDl1cs= sha256:YTPo78/nfNX3T9yuzTSMoZyomXb9sZ9ihQ5fTqmjwGU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2C1E5125D3D; Sun, 15 Nov 2026 07:57:44 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2BPSLBMtZ1KR; Sun, 15 Nov 2026 07:57:40 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-363567-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 443C2125D3F; Sun, 15 Nov 2026 07:57:31 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 36ADC60D231; Sun, 15 Nov 2026 04:57:21 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794718619; b=20cpM9J4sm1COYq9IgtHCKxE9+vEYh6ikBnb6CRCSb5XddJC1LpJ5PD/TteHfXRcnaU5 KYzznLFgmlnbYhrBXqP4MldVesOc78ucWiWyUi5h/8p75t9vL8lrcanFBmyaIngbTvnnG oCKZA9g2wnE4A62hjH1IkRJ3764Kl1LaXO2/1YefH7Ub/PYpIS0Xpja+PZjE7+/4RY1bG 8G4SdqAk2Rns4w+4EdLFmLxnPuhijK71CGV5JlS36EwTqgUEo0KOmW3Z/o1oEvj3OzbUe Wq9wGhfMzXJdwN9P0ps5oe+r2YbP2JKhzXM4Fpnd0pU5oOhSeC8uPnVaIX+qVn4cBAg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794718619; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=umEF1V5naPnh8ERwF6yGhvvB2KlgnFk29EnM3cvuuGo=; b=ER9yNbmVYIOc1WKgkRV+evlC86Edm16msaraeU452pEb7sJp64bd5M524D1AdL/drcg+ GqEAQJIDy3HW9VL8fObdNNGiGEaV2qYgp8lmSgXQc7Ru27NmalXErCk0B7sJeQBSoo9RF 54AZBtv4DtipmPXORQW4SGkAphR97RGGWTOfNyf+fgLpzCiE5OCmPFa1Dgl5fwoEmF+3m BNjqB8Zy2b9/xx2O8Xqvw8/hQgn3qGYXn3tHbkOFLSNqSvBRwfhl/i4oCH+nj0Qa2oecD FpvFcxT34RY7IgTcLsy+AFe9YnI1u54FIxqLejRXlQTUhLmDluOFClg3IDC/Mvzm4GA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cG5NuuYW; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21B9360A2604; Sun, 15 Nov 2026 04:56:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cG5NuuYW X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794718618; b=WJQiqNm/ns2Xjs0S1WFoQ1F9HzmPPPweAAfEmRITiIfmyUbQcSL3h7xI0H+ZceWG9GIA hDfIJiq4HY079uLi2HBB8rqnvfuBdy8SA/jNSAbGuukaaJk6MvwvYFm6Sai7ib2HaHuN1 cAu04YtjE/+C0ObSolXdjVkd4cnFa+IPvBFeRg4Odqy7i09tjQknQrHUZ+6729tgjkvJ2 IdXGv7CsV+YrL59lHRF8TBJs8Wrh9TUEhG2oU0Wi9o7Btm4GGB+Db9kyo9Dd73Q1+1G3m umD2c4Z4NoT+t8vhbPp6rFWHWBrb4MjJHVYYdrnTY3L9CzPLKpjYD+LfSLywk0Hg4ww== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794718618; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=umEF1V5naPnh8ERwF6yGhvvB2KlgnFk29EnM3cvuuGo=; b=F0BWD/97MTvZZ+7/wnMSxhpWHe2/bgDqStSu2CfMk5zlPPD5MmXKmj91LLj7Bn9Jk6Tc HgxBScMltHBpqobHaAxsTRRiN829CRmamk9bt+7o/zMBp36JExFGBJhU9gvHexgXSAl1m 2uEtbqo9TyzQ7qsCGvOVXhz/2VgNuiggJrcUxp/y+QCfo+4GOkbp5FIcEhVtkIZpbiATF eOBFDcD50TbWlhv0Irt6Hhi2ZvSUK4x/gFkA0OLuxoySnNhalrtnk/cGa5h+S1xw9/ygB oOdzNVy0VDcipHW66/NCZUXvICmKVM9aFvtxkSsepMl9uttLHmyCAZQNsBkAqesPf2Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cG5NuuYW; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41318606A8B3; Sun, 15 Nov 2026 04:56:58 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB9081F000C6; Sun, 15 Nov 2026 04:56:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794718617; bh=umEF1V5naPnh8ERwF6yGhvvB2KlgnFk29EnM3cvuuGo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=cG5NuuYWiIGl/DlgwPlsR932Lygn7go3nbDe8hBNslFf7MPTlyCiov1BBBwvhJ5JH AlhGmwPBwj3YL9esOOtbevpDSDMPVzvsRYWOPJ7KsbxZs1oYRem/NxyYNDH6iBDeQL NnPEuTek3ZLNANe6VjIHU9dsScLlC8IzaCWBtycAkSPFbGwW6K74o1vYHl20z/Zvs0 f74y8fs7+5N/kZhCf20+01e5wMGvmomW40WX0obLHZ14jRa+bgBmOznVWO0Wf/uNNx +07kPMr4wu+syNB4fmjGaAVbfT7kHstUVCaWUpTn5c+sY91p3TpVnHPNO8qKV4Re6Y DgOGYviAkJvBA== X-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 X-In-Reply-To: <1bfd52d6bdc2a7fc1b7eaa183293d4859ad7d94a.1794371175.git.gongfan1@huawei.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list