From: netdev-bot+sashiko@kernel.org
To: illusion.wang@nebula-matrix.com
Cc: dimon.zhao@nebula-matrix.com, alvin.wang@nebula-matrix.com,
sam.chen@nebula-matrix.com, netdev@vger.kernel.org,
andrew+netdev@lunn.ch, corbet@lwn.net, kuba@kernel.org,
horms@kernel.org, linux-doc@vger.kernel.org, pabeni@redhat.com,
vadim.fedorenko@linux.dev, lukas.bulwahn@redhat.com,
edumazet@google.com, enelsonmoore@gmail.com,
skhan@linuxfoundation.org, hkallweit1@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v28 net-next 04/10] net/nebula-matrix: add common resource implementation
Date: Thu, 17 Sep 2026 22:35:03 +0000 [thread overview]
Message-ID: <178968450348.22033.3494276717606346180@kernel.org> (raw)
In-Reply-To: <20260914123429.56596-5-illusion.wang@nebula-matrix.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:
Critical: 0 · High: 0 · Medium: 0 · Low: 2
- [Low] Misleading comment and (at this commit) write-only shared state
in nbl_res_ctrl_dev_sriov_info_init(): the comment asserts that…
- [Low] Dead state in struct nbl_eth_info:
nbl_res_ctrl_dev_setup_eth_info() (drivers/net/ethernet/nebula-…
--
net/nebula-matrix: add common resource implementation
This patch adds the chip-independent resource layer for the nbl driver,
including PF-count validation from the firmware k_pf_mask, per-PF BDF and
VSI base-id tables, eth port discovery, and the VSI/func/eth/PF conversion
helpers. All of the table setup runs only on the control PF during probe.
Two small observations below, both about state that has no reader at this
point in the series.
> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c
> new file mode 100644
> index 0000000000000..46180522295a3
> --- /dev/null
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c
> @@ -0,0 +1,335 @@
[ ... ]
> + /*
> + * Any subset of valid bitmap bits is accepted (e.g. 0/1, 0/2,
> + * 1/3, etc.). Firmware only needs to report the correct count
> + * of active ports; no hard-coded fixed bit positions required.
> + */
> + for (i = 0; i < NBL_MAX_ETHERNET; i++) {
> + if ((1 << i) & eth_bitmap) {
> + set_bit(i, eth_info->eth_bitmap);
> + eth_info->eth_id[eth_num] = i;
> + eth_info->logic_eth_id[i] = eth_num;
> + eth_num++;
> + }
> + }
> +
> + for (i = 0; i < res_mgt->common->max_pf; i++) {
> + eth_id = eth_info->eth_id[i];
> + eth_info->pf_bitmap[eth_id] |= BIT(i);
> + }
[Severity: Low]
This isn't a bug, but are eth_info->eth_bitmap, eth_info->logic_eth_id[]
and eth_info->pf_bitmap[] ever read?
Grepping the driver with the whole series applied, the only appearances of
these three members are the writes above plus the declaration in struct
nbl_eth_info. eth_info->eth_id[] is the only member of the three tables
that gets consumed, via nbl_res_get_eth_id().
The commit message describes this as building "the per-PF eth_id /
logic_eth_id lookup tables", but nbl_res_get_eth_id() recomputes the
logical id instead of reading the table it just built:
*eth_num = eth_info->eth_num;
*eth_id = eth_info->eth_id[rel_pf_id];
*logic_eth_id = rel_pf_id;
The two derivations agree for every layout the code accepts, because
max_pf == eth_num is enforced earlier, so the values are identical today.
Would it be clearer to either return eth_info->logic_eth_id[*eth_id] here,
or drop the unused members and the loops that fill them until a consumer
shows up?
> +static int nbl_res_ctrl_dev_sriov_info_init(struct nbl_resource_mgt *res_mgt)
> +{
[ ... ]
> + res_mgt->resource_info->sriov_info = sriov_info;
> + /*
> + * common->hw_bus supplies bus number for channel mailbox QINFO mapping.
> + * Execution order guarantee: this assignment runs before
> + * cfg_chan_qinfo_map_table(), only executed
> + * on control PF path.
> + */
> + common->hw_bus = hw_bus;
[Severity: Low]
Can this comment be verified at this point in the series?
At this commit nothing reads common->hw_bus outside of the loop just below,
and cfg_chan_qinfo_map_table() has no caller yet, so the ordering contract
the comment documents cannot be checked against the tree here. The readers
do arrive in the later patches of the series (nbl_res_intr_cfg_msix_map()
passes common->hw_bus to cfg_msix_map(), and nbl_dev_setup_chan_qinfo()
passes it to cfg_chan_qinfo_map_table()), and nbl_core_init() does call
nbl_res_init_leonis() before nbl_disp_init() and nbl_dev_init(), so the
ordering claim holds once the series is complete.
Would it make sense to move this comment to the patch that adds the
cfg_chan_qinfo_map_table() call, so the referenced consumer exists in the
same commit?
> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h
> new file mode 100644
> index 0000000000000..a3bc7b3aecdea
> --- /dev/null
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h
> @@ -0,0 +1,72 @@
[ ... ]
> +struct nbl_eth_info {
> + DECLARE_BITMAP(eth_bitmap, NBL_MAX_ETHERNET);
> + u8 pf_bitmap[NBL_MAX_ETHERNET];
> + u8 eth_num;
> + u8 resv[3];
> + u8 eth_id[NBL_MAX_ETHERNET];
> + u8 logic_eth_id[NBL_MAX_ETHERNET];
> +};
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260914123429.56596-1-illusion.wang%40nebula-matrix.com
next prev parent reply other threads:[~2026-09-17 22:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 12:34 [PATCH v28 net-next 00/10] nbl driver for Nebulamatrix NICs illusion.wang
2026-09-14 12:34 ` [PATCH v28 net-next 01/10] net/nebula-matrix: add minimum nbl build framework illusion.wang
2026-09-17 22:34 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 02/10] net/nebula-matrix: add core driver architecture and HW layer initialization illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 03/10] net/nebula-matrix: add channel layer illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 04/10] net/nebula-matrix: add common resource implementation illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko [this message]
2026-09-14 12:34 ` [PATCH v28 net-next 05/10] net/nebula-matrix: add intr " illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 06/10] net/nebula-matrix: add chip-wide hardware init/deinit implementation illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 07/10] net/nebula-matrix: dispatch: add control-level routing core infrastructure illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 08/10] net/nebula-matrix: dispatch: implement channel RPC framework and serialize hardware ops illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 09/10] net/nebula-matrix: add common/ctrl dev init/remove operation illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
2026-09-14 12:34 ` [PATCH v28 net-next 10/10] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-09-17 22:35 ` netdev-bot+sashiko
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=178968450348.22033.3494276717606346180@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alvin.wang@nebula-matrix.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=dimon.zhao@nebula-matrix.com \
--cc=edumazet@google.com \
--cc=enelsonmoore@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=illusion.wang@nebula-matrix.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sam.chen@nebula-matrix.com \
--cc=skhan@linuxfoundation.org \
--cc=vadim.fedorenko@linux.dev \
/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
all inboxes | Powered by JetHome®