public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: "illusion.wang" <illusion.wang@nebula-matrix.com>,
	dimon.zhao@nebula-matrix.com, alvin.wang@nebula-matrix.com,
	sam.chen@nebula-matrix.com, netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, corbet@lwn.net, kuba@kernel.org,
	linux-doc@vger.kernel.org, lorenzo@kernel.org, horms@kernel.org,
	vadim.fedorenko@linux.dev, lukas.bulwahn@redhat.com,
	edumazet@google.com, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v7 net-next 06/11] net/nebula-matrix: add common resource implementation
Date: Thu, 12 Mar 2026 12:59:53 +0100	[thread overview]
Message-ID: <c74e2c3e-277f-4f6d-b136-45bb049de905@redhat.com> (raw)
In-Reply-To: <20260310120959.22015-7-illusion.wang@nebula-matrix.com>

On 3/10/26 1:09 PM, illusion.wang wrote:
> +int nbl_res_vsi_id_to_pf_id(struct nbl_resource_mgt *res_mgt, u16 vsi_id)
> +{
> +	struct nbl_vsi_info *vsi_info = res_mgt->resource_info->vsi_info;
> +	struct nbl_common_info *common = res_mgt->common;
> +	bool vsi_find = false;
> +	u32 pf_id = U32_MAX;
> +	int i, j;
> +
> +	for (i = 0; i < vsi_info->num; i++) {
> +		for (j = 0; j < NBL_VSI_SERV_MAX_TYPE; j++)
> +			if (vsi_id >= vsi_info->serv_info[i][j].base_id &&
> +			    (vsi_id < vsi_info->serv_info[i][j].base_id +
> +					      vsi_info->serv_info[i][j].num)) {
> +				vsi_find = true;
> +				break;
> +			}
> +
> +		if (vsi_find)
> +			break;
> +	}
> +
> +	if (vsi_find) {
> +		if (j >= NBL_VSI_SERV_PF_DATA_TYPE &&
> +		    j <= NBL_VSI_SERV_PF_DATA_TYPE)
> +			pf_id = i + common->mgt_pf;

AI review says:

This isn't a bug, but the condition checks if j is >=
NBL_VSI_SERV_PF_DATA_TYPE && j <= NBL_VSI_SERV_PF_DATA_TYPE, which is
unnecessarily complex. This is equivalent to checking if j ==
NBL_VSI_SERV_PF_DATA_TYPE.

The confusing comment was removed in v5, but the redundant comparison
logic remains. Could this be simplified to:

    if (j == NBL_VSI_SERV_PF_DATA_TYPE)

This was previously noted by Jakub Kicinski in v4 review.

Reference:
https://lore.kernel.org/netdev/20260207022455.4017894-1-kuba@kernel.org/


  reply	other threads:[~2026-03-12 11:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 12:09 [PATCH v7 net-next 00/11] nbl driver for Nebulamatrix NICs illusion.wang
2026-03-10 12:09 ` [PATCH v7 net-next 01/11] net/nebula-matrix: add minimum nbl build framework illusion.wang
2026-03-10 12:09 ` [PATCH v7 net-next 02/11] net/nebula-matrix: add our driver architecture illusion.wang
2026-03-10 12:09 ` [PATCH v7 net-next 03/11] net/nebula-matrix: add chip related definitions illusion.wang
2026-03-12 11:58   ` Paolo Abeni
2026-03-13  8:05     ` 回复:[PATCH " Illusion Wang
2026-03-13  9:36       ` Paolo Abeni
2026-03-10 12:09 ` [PATCH v7 net-next 04/11] net/nebula-matrix: channel msg value and msg struct illusion.wang
2026-03-10 12:09 ` [PATCH v7 net-next 05/11] net/nebula-matrix: add channel layer illusion.wang
2026-03-10 12:09 ` [PATCH v7 net-next 06/11] net/nebula-matrix: add common resource implementation illusion.wang
2026-03-12 11:59   ` Paolo Abeni [this message]
2026-03-10 12:09 ` [PATCH v7 net-next 07/11] net/nebula-matrix: add intr " illusion.wang
2026-03-10 12:09 ` [PATCH v7 net-next 08/11] net/nebula-matrix: add vsi " illusion.wang
2026-03-12 12:04   ` Paolo Abeni
2026-03-10 12:09 ` [PATCH v7 net-next 09/11] net/nebula-matrix: add Dispatch layer implementation illusion.wang
2026-03-12 12:10   ` Paolo Abeni
2026-03-10 12:09 ` [PATCH v7 net-next 10/11] net/nebula-matrix: add common/ctrl dev init/reinit operation illusion.wang
2026-03-12 12:14   ` Paolo Abeni
2026-03-10 12:09 ` [PATCH v7 net-next 11/11] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-03-12 12:15   ` 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=c74e2c3e-277f-4f6d-b136-45bb049de905@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=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=lorenzo@kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sam.chen@nebula-matrix.com \
    --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