mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 07/10] net/nebula-matrix: dispatch: add control-level routing core infrastructure
Date: Thu, 17 Sep 2026 22:35:08 +0000	[thread overview]
Message-ID: <178968450819.22033.4902172279323184978@kernel.org> (raw)
In-Reply-To: <20260914123429.56596-8-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: 1 · Low: 1

- [Medium] New channel response enum (NBL_CHAN_RESP_OK/ERR/UNIMPLEMENTED,
  extended with PERM_DENY later in the series) uses positive wire…
- [Low] The comment in the (empty) nbl_disp_remove() bases dispatch
  teardown safety on facts that do not exist at this commit: it says…

--

net/nebula-matrix: dispatch: add control-level routing core infrastructure

This adds the dispatch layer skeleton: allocation of the dispatch
management structure and ops table, init_module/deinit_module wrappers
around the resource ops, and a ctrl_lvl bitmask that enables the MGT
level on the Control PF only.  It also adds forward declarations of
channel wire structures and a channel response enum for a later RPC
framework.

> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_channel.h b/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_channel.h
> index 61dd97c779ef6..58a9fa97fbf39 100644
> --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_channel.h
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_channel.h
> @@ -7,12 +7,19 @@
>  #define _NBL_DEF_CHANNEL_H_
>  
>  #include <linux/types.h>
> +#include <linux/build_bug.h>
>  
>  struct nbl_channel_mgt;
>  struct nbl_adapter;
>  
>  typedef void (*nbl_chan_resp)(void *, u16, u16, void *, u32);
>  
> +enum {
> +	NBL_CHAN_RESP_OK = 0,
> +	NBL_CHAN_RESP_ERR = 1,
> +	NBL_CHAN_RESP_UNIMPLEMENTED = 2,
> +};
> +

[Severity: Medium]
Can these positive response codes ever be observed by a sender?  The ACK
receive path in nbl_chan_recv_ack_msg() rewrites any positive remote
status:

drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.c:
	raw_err = (s32)le32_to_cpu(*(__le32 *)&payload[NBL_CHAN_ACK_RET_POS]);
	if (raw_err > 0 || raw_err < -MAX_ERRNO)
		raw_err = -EREMOTEIO;

	WRITE_ONCE(wait_head->ack_err, raw_err);

nbl_chan_send_msg() returns exactly that clamped value, so a caller can
only ever see 0 or a negative errno, never NBL_CHAN_RESP_ERR (1) or
NBL_CHAN_RESP_UNIMPLEMENTED (2).

The follow-up patch in the series ("net/nebula-matrix: dispatch:
implement channel RPC framework and serialize hardware ops") both puts
these codes on the wire via nbl_disp_chan_*_resp() ->
nbl_chan_fill_ack_info(..., err, ...) and then switches on them after
send_msg(), for example in nbl_disp_chan_get_eth_id_req():

	ret = chan_ops->send_msg(disp_mgt->chan_ops_tbl->priv, &chan_send);
	if (ret < 0)
		return ret;
	switch (ret) {
	case NBL_CHAN_RESP_OK:
		break;
	case NBL_CHAN_RESP_UNIMPLEMENTED:
		return -EOPNOTSUPP;
	case NBL_CHAN_RESP_ERR:
		return -EREMOTEIO;
	case NBL_CHAN_RESP_PERM_DENY:
		return -EPERM;

Are all the non-OK arms dead code, given "if (ret < 0) return ret;"
fires first for the clamped -EREMOTEIO?  A peer answering "unimplemented"
or "permission denied" would then be reported to the requester as
-EREMOTEIO instead of -EOPNOTSUPP / -EPERM.

Would it make sense to either encode these response codes as
non-positive values (or in a dedicated payload field), or to let the
clamp in nbl_chan_recv_ack_msg() pass the defined response codes
through?

[ ... ]

> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c
> new file mode 100644
> index 0000000000000..b7f404b319fac
> --- /dev/null
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c
> @@ -0,0 +1,124 @@

[ ... ]

> +void nbl_disp_remove(struct nbl_adapter *adapter)
> +{
> +	/*
> +	 * All dispatch objects are allocated via devm.
> +	 * Dispatch message handlers are not explicitly unregistered here.
> +	 * Safety relies on dev layer shutting down mailbox channel queue
> +	 * before nbl_res_remove_leonis(), so responders cannot run after
> +	 * resource layer is torn down. Channel layer nbl_chan_remove_common()
> +	 * finalizes cleanup at device teardown.
> +	 */
> +}

[Severity: Low]
This isn't a bug, but does this comment describe code that exists at this
commit?

There is no dev layer yet (no nbl_core/nbl_dev.o in the Makefile and no
nbl_dev_init()/nbl_dev_remove() call in nbl_main.c), so nothing shuts
down the mailbox channel queue before nbl_res_remove_leonis().

This patch also registers no channel handlers at all (no
chan_ops->register_msg() call in nbl_dispatch.c), so there are no
responders that the "not explicitly unregistered here" sentence could
refer to.

Both premises do hold at the end of the series, where nbl_core_remove()
calls nbl_dev_remove() first and nbl_dev_remove_common_dev() tears down
the mailbox queue before the resource layer, and nbl_disp_setup_msg()
registers the responders.  Would it be clearer to move this comment to
the patch that actually registers the handlers?

Related to the same staging question: nbl_disp_refresh_ctrl_ops()
installs init_module/deinit_module

> +	if (test_bit(NBL_DISP_CTRL_LVL_MGT, disp_mgt->ctrl_lvl)) {
> +		disp_ops->init_module = nbl_disp_init_module;
> +		disp_ops->deinit_module = nbl_disp_deinit_module;
> +	}

but is there any caller of these ops at this commit?  The first callers,
nbl_dev_setup_ctrl_dev() and nbl_dev_remove_ctrl_dev(), arrive with the
later dev-layer patch, so the "dispatch management flow" the commit
message mentions appears inert here.

[ ... ]

> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c
> index 1aafed2d46d71..5d5c0bbf418c8 100644
> --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c
> @@ -59,6 +66,7 @@ struct nbl_adapter *nbl_core_init(struct pci_dev *pdev,
>  
>  void nbl_core_remove(struct nbl_adapter *adapter)
>  {
> +	nbl_disp_remove(adapter);
>  	nbl_res_remove_leonis(adapter);
>  	nbl_chan_remove_common(adapter);
>  	nbl_hw_remove_leonis(adapter);

Here the channel layer is removed after the resource layer, which is the
opposite order from the one the nbl_disp_remove() comment relies on.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260914123429.56596-1-illusion.wang%40nebula-matrix.com

  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
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 [this message]
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=178968450819.22033.4902172279323184978@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®