Netdev List
 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,
	kuba@kernel.org, andrew+netdev@lunn.ch, pabeni@redhat.com,
	edumazet@google.com, horms@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v35 net-next 6/8] net/nebula-matrix: dispatch: add mailbox RPCs for msix map, mailbox irq and vsi/eth id
Date: Mon, 23 Nov 2026 12:52:06 +0000	[thread overview]
Message-ID: <179543832604.3135.16730379200128130187@kernel.org> (raw)
In-Reply-To: <20261119113530.32107-7-illusion.wang@nebula-matrix.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message says "If the resource op is not installed the
  responder answers -EOPNOTSUPP." No code does this.
- [Low] The kernel-doc on struct nbl_dispatch_ops says the mailbox queue
  must be torn down before nbl_res_remove_leonis(), via…
- [Low] The concern was that when cfg_msix_map, set_mailbox_irq or
  destroy_msix_map fails with a lost ACK or timeout, the hardware stays…
- [Low] The concern was that on the control PF, local cfg_msix_map
  (reconfigure) and destroy_msix_map turn off the function's own mailbox…

--

net/nebula-matrix: dispatch: add mailbox RPCs for msix map, mailbox irq and vsi/eth id

This patch adds request and response handlers for five dispatch
operations: cfg_msix_map, destroy_msix_map, set_mailbox_irq, get_vsi_id
and get_eth_id. A control PF calls the resource helpers locally, and a
has_net PF forwards the op to the management PF over the mailbox channel.
The five responders are registered with the channel layer from
nbl_disp_setup_msg().

> requester can tell a protocol error from a failed operation.  If the
> resource op is not installed the responder answers -EOPNOTSUPP.  A peer

[Severity: Low]
Is this sentence accurate? None of the five responders has an "op not
installed" branch, and none of them sets err = -EOPNOTSUPP. For example,
nbl_disp_chan_cfg_msix_map_resp() calls the resource helper directly:

	ret = nbl_res_intr_cfg_msix_map(disp_mgt->res_mgt, src_id, ...);
	/* Forward the resource errno verbatim to the requester */
	if (ret)
		err = ret;

When the resource layer can't serve the request, the helpers return
-EINVAL:

nbl_res_intr_destroy_msix_map() {
	if (!intr_mgt)
		return -EINVAL;
    ...
}

On these paths, -EOPNOTSUPP only comes from nbl_res_func_id_to_bdf(),
where it means the func_id is not a PF present on this board.

If a msg_type has no registered handler, nbl_chan_recv_msg() logs an
error and returns without sending an ACK. The requester then times out
and never sees -EOPNOTSUPP:

	msg_handler = xa_load(&chan_mgt->handler_xa, msg_type);
	if (!msg_handler || !msg_handler->func) {
		dev_err_ratelimited(dev,
				    "No handler for msg_type: %u (srcid=%u, msgid=%u)\n",
				    msg_type, srcid, msgid);
		return;
	}

If nbl_disp_setup_msg() fails, nbl_disp_init() fails the probe, so the
device can never run with an op that is not installed. This is still
true at the end of the series.

Should this sentence be dropped, or is the -EOPNOTSUPP behaviour meant
to be implemented?

> 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
> index 58f6ac8343852..d256394a5cbb1 100644
> --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c

[ ... ]

> @@ -17,6 +174,326 @@ static int nbl_disp_init_module(struct nbl_dispatch_mgt *disp_mgt)
>  	return nbl_res_chip_init_module(disp_mgt->res_mgt);
>  }
>  

[ ... ]

> +/*
> + * Precondition: caller must disable mailbox IRQ_RDY and switch send_msg
> + * to the polling path before issuing this RPC. The responder rewrites
> + * the requester's mailbox MSI-X routing during the resource op, so the
> + * ACK cannot rely on interrupt wakeup while routing is in flux.
> + */
> +static int
> +nbl_disp_chan_cfg_msix_map_req(struct nbl_dispatch_mgt *disp_mgt,
> +			       u16 num_net_msix, u16 num_others_msix,
> +			       bool net_msix_mask_en)
> +{

[ ... ]

> +	nbl_chan_fill_send_info(&chan_send, common->mgt_pf,
> +				NBL_CHAN_MSG_CONFIGURE_MSIX_MAP,
> +				&param, sizeof(param),
> +				NULL, 0, 1);
> +	ret = chan_ops->send_msg(disp_mgt->chan_ops_tbl->priv, &chan_send);
> +	if (ret)
> +		return ret;
> +	return 0;
> +}

[Severity: Low]
Suppose send_msg() returns -ETIMEDOUT because the ACK was lost. Could
the responder already have committed the new map in
nbl_res_intr_cfg_msix_map() and armed the hardware? This helper only
passes the error up, so undoing the change is left to the caller. The
set_mailbox_irq and destroy_msix_map requests have the same issue.

Nothing calls these helpers in this patch. Later in the series,
"net/nebula-matrix: add common dev start/stop operation" handles this.
nbl_dev_start() jumps to err_destroy_map on any cfg_msix_map, get_vsi_id
or get_eth_id failure, and that path always calls
nbl_dev_destroy_msix_map(). A failed set_mailbox_irq enable goes through
err_free_irq -> err_destroy_map. So this looks resolved by the end of
the series.

[ ... ]

> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h b/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h
> index c90dd4e119160..f73d32ec2c8a9 100644
> --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h

[ ... ]

> @@ -31,16 +32,54 @@ enum {
>   *               mailbox DMA before calling it.
>   *               Returns void.  Control-PF exclusive, same NULL rule as
>   *               @init_module.
> + * @cfg_msix_map: configure function msix mapping table.  On a non-control
> + *               PF this is an RPC, and the caller must have cleared
> + *               NBL_CHAN_IRQ_RDY and switched the channel to its polling
> + *               send path first: the responder rewrites this function's
> + *               mailbox MSI-X routing, so the ACK cannot depend on the
> + *               interrupt being reprogrammed.
> + * @destroy_msix_map: tear down msix mapping resource.  Same caller
> + *               precondition as @cfg_msix_map.

[Severity: Low]
As written, the IRQ_RDY/polling precondition seems to apply only to a
non-control PF. On the control PF, nbl_disp_cfg_msix_map() and
nbl_disp_destroy_msix_map() call the resource layer directly.

A reconfiguration (had_config) in nbl_res_intr_cfg_msix_map() turns off
the function's own mailbox routing and does not restore it:

	if (had_config) {
		...
		ret = __nbl_res_intr_set_mailbox_irq(intr_mgt, res_mgt, func_id,
						     0, false);

Destroy does the same. If NBL_CHAN_IRQ_RDY were still set at that point,
could the control PF stop receiving mailbox interrupts?

This isn't reached anywhere in the series:

- The control PF's only cfg_msix_map is the first configuration in
  nbl_dev_start(), where had_config is false.
- Its destroy_msix_map runs in nbl_dev_stop() after
  nbl_dev_disable_mailbox_irq() has cleared IRQ_RDY.
- When a peer is reconfigured, nbl_dev_start() calls
  set_mailbox_irq(true) to re-arm routing before IRQ_RDY is set.

Could the kernel-doc say that the precondition also applies to the local
path? It could also say that mailbox routing stays disabled until
set_mailbox_irq() re-arms it.

[ ... ]

>   * These callbacks are not dispatch-layer setup/teardown: the dispatch
> - * structures are devm-allocated in nbl_disp_init(), and nbl_disp_remove()
> - * only documents why no explicit teardown is needed. They forward
> + * structures are devm-allocated in nbl_disp_init(), so nbl_disp_remove()
> + * has nothing to undo. The five responders registered by
> + * nbl_disp_setup_msg() live in the channel layer's handler xarray and go
> + * away with it, so they need no explicit unregistration either. Nothing
> + * can enter them until a mailbox queue is running, and a queue must be
> + * torn down before nbl_res_remove_leonis() runs: nbl_chan_teardown_queue()
> + * stops the RX path and nbl_chan_remove_common() frees the handler nodes,
> + * so once the resource layer starts disappearing there is no responder
> + * left that could still be running, or be entered. They forward

[Severity: Low]
This isn't a bug, but the ordering described here doesn't match
nbl_core_remove(). The handler nodes are freed after the resource layer
is removed:

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);
}

Also, nothing calls ->teardown_queue in this patch.

The RX-stop part does hold at the end of the series.
"net/nebula-matrix: add common/ctrl dev init/remove operation" makes
nbl_dev_remove() the first step of nbl_core_remove(). That path calls
nbl_dev_remove_common_dev()->nbl_dev_remove_chan_queue()->teardown_queue()
before nbl_res_remove_leonis() runs.

Could the comment be reworded so it doesn't say nbl_chan_remove_common()
runs before nbl_res_remove_leonis()?

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

  reply	other threads:[~2026-11-23 12:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 11:35 [PATCH v35 net-next 0/8] nbl driver for Nebulamatrix NICs illusion.wang
2026-11-19 11:35 ` [PATCH v35 net-next 1/8] net/nebula-matrix: add channel layer illusion.wang
2026-11-23 12:51   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 2/8] net/nebula-matrix: add common resource implementation illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 3/8] net/nebula-matrix: add intr " illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 5/8] net/nebula-matrix: dispatch: add control-level routing core infrastructure illusion.wang
2026-11-19 11:35 ` [PATCH v35 net-next 6/8] net/nebula-matrix: dispatch: add mailbox RPCs for msix map, mailbox irq and vsi/eth id illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko [this message]
2026-11-19 11:35 ` [PATCH v35 net-next 7/8] net/nebula-matrix: add common/ctrl dev init/remove operation illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 8/8] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-11-23 12:52   ` 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=179543832604.3135.16730379200128130187@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alvin.wang@nebula-matrix.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=dimon.zhao@nebula-matrix.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=illusion.wang@nebula-matrix.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sam.chen@nebula-matrix.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