Linux Documentation
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
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 v20 net-next 05/10] net/nebula-matrix: add common resource implementation
Date: Thu,  2 Jul 2026 11:42:44 +0200	[thread overview]
Message-ID: <20260702094244.111367-1-pabeni@redhat.com> (raw)
In-Reply-To: <20260630010718.4346-6-illusion.wang@nebula-matrix.com>

From: AI Reviewer <ai@example.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev/
---
net/nebula-matrix: add common resource implementation

The patch adds the common part of the resource layer for the Nebula Matrix
driver, including conversion relationships among vsi_id, func_id, eth_id,
and pf_id.

> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c
> new file mode 100644
> index 0000000000000..6742da7c66376
> --- /dev/null
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c
[ ... ]
> +int nbl_res_func_id_to_vsi_id(struct nbl_resource_mgt *res_mgt, u16 func_id,
> +			      u16 type, u16 *vsi_id)
> +{
[ ... ]
> +	nbl_res_pf_dev_vsi_type_to_hw_vsi_type(type, &dst_type);
> +	*vsi_id = vsi_info->serv_info[diff][dst_type].base_id;
> +	return 0;
> +}
[ ... ]
> +void nbl_res_pf_dev_vsi_type_to_hw_vsi_type(u16 src_type,
> +					    enum nbl_vsi_serv_type *dst_type)
> +{
> +	switch (src_type) {
> +	case NBL_VSI_DATA:
> +		*dst_type = NBL_VSI_SERV_PF_DATA_TYPE;
> +		break;
> +	default:
> +		WARN_ON_ONCE(1);

[Severity: High]
Can a malicious or buggy Virtual Function (VF) trigger this warning by
passing an invalid type?

Because nbl_res_pf_dev_vsi_type_to_hw_vsi_type() returns void, it cannot
propagate an error back to the caller. When an invalid type is processed,
nbl_res_func_id_to_vsi_id() silently defaults to NBL_VSI_SERV_PF_DATA_TYPE
and returns 0 for success.

Should this function return an error code so that nbl_res_func_id_to_vsi_id()
can properly reject the invalid type instead of reporting a false success?

> +		break;
> +	}
> +}
-- 
This is an AI-generated review.


  reply	other threads:[~2026-07-02  9:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  1:07 [PATCH v20 net-next 00/10] nbl driver for Nebulamatrix NICs illusion.wang
2026-06-30  1:07 ` [PATCH v20 net-next 01/10] net/nebula-matrix: add minimum nbl build framework illusion.wang
2026-06-30  1:07 ` [PATCH v20 net-next 02/10] net/nebula-matrix: add our driver architecture illusion.wang
2026-06-30  1:07 ` [PATCH v20 net-next 03/10] net/nebula-matrix: channel msg value and msg struct illusion.wang
2026-06-30  1:07 ` [PATCH v20 net-next 04/10] net/nebula-matrix: add channel layer illusion.wang
2026-07-02  9:42   ` Paolo Abeni
2026-06-30  1:07 ` [PATCH v20 net-next 05/10] net/nebula-matrix: add common resource implementation illusion.wang
2026-07-02  9:42   ` Paolo Abeni [this message]
2026-06-30  1:07 ` [PATCH v20 net-next 06/10] net/nebula-matrix: add intr " illusion.wang
2026-07-02  9:42   ` Paolo Abeni
2026-06-30  1:07 ` [PATCH v20 net-next 07/10] net/nebula-matrix: add vsi " illusion.wang
2026-06-30  1:07 ` [PATCH v20 net-next 08/10] net/nebula-matrix: add Dispatch layer implementation illusion.wang
2026-07-02  9:43   ` Paolo Abeni
2026-06-30  1:07 ` [PATCH v20 net-next 09/10] net/nebula-matrix: add common/ctrl dev init/remove operation illusion.wang
2026-07-02  9:43   ` Paolo Abeni
2026-06-30  1:07 ` [PATCH v20 net-next 10/10] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-07-02  9:43   ` Paolo Abeni

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=20260702094244.111367-1-pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --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=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