From: Jakub Kicinski <kuba@kernel.org>
To: rkannoth@marvell.com
Cc: Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, chuck.lever@oracle.com,
jiri@resnulli.us, netdev@vger.kernel.org,
donald.hunter@gmail.com, saeedm@nvidia.com, sgoutham@marvell.com,
edumazet@google.com, davem@davemloft.net, matttbe@kernel.org,
horms@kernel.org, cjubran@nvidia.com, pabeni@redhat.com,
shshitrit@nvidia.com
Subject: Re: [v4,net-next,3/5] octeontx2-af: npc: cn20k: add subbank search order control
Date: Mon, 16 Mar 2026 20:32:05 -0700 [thread overview]
Message-ID: <20260317033205.646930-1-kuba@kernel.org> (raw)
In-Reply-To: <20260312022754.2029595-4-rkannoth@marvell.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.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
octeontx2-af: npc: cn20k: add subbank search order control
CN20K NPC MCAM is split into 32 subbanks that are searched in a
predefined order during allocation. Lower-numbered subbanks have
higher priority than higher-numbered ones. Add a runtime devlink
parameter "srch_order" (DEVLINK_PARAM_TYPE_U32_ARRAY) to control the
order in which subbanks are searched during MCAM allocation.
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> index e854b85ced9e..348a72c4ee43 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> @@ -3809,6 +3809,93 @@ static void npc_unlock_all_subbank(void)
> mutex_unlock(&npc_priv.sb[i].lock);
> }
>
> +int npc_cn20k_search_order_set(struct rvu *rvu,
> + u32 arr[MAX_NUM_SUB_BANKS], int cnt)
> +{
[ ... ]
> +fail_used:
> + npc_unlock_all_subbank();
> + mutex_unlock(&mcam->lock);
> +
> + return rc;
> +}
> +
> +const u32 *npc_cn20k_search_order_get(bool *restricted_order, u32 *sz)
> +{
> + *restricted_order = restrict_valid;
> + *sz = npc_priv.num_subbanks;
> + return subbank_srch_order;
> +}
^^^^^^^^^^^^^^^^^^^
Is there a type mismatch here? The function signature declares the return
type as 'const u32 *' but returns 'subbank_srch_order', which appears to be
declared as 'static int *' elsewhere in the code. While the values stored
(0-31 for subbank indices) fit within both int and u32, and sizeof(int) ==
sizeof(u32) on all kernel-supported architectures, this conversion between
signed and unsigned pointer types is technically incompatible.
The callers rvu_af_dl_npc_srch_order_get() and
rvu_af_dl_npc_srch_order_validate() treat the returned pointer as a u32
array:
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c:rvu_af_dl_npc_srch_order_get()
{
const u32 *order;
...
order = npc_cn20k_search_order_get(&restricted_order, &sz);
...
for (int i = 0; i < sz; i++)
ctx->val.u32arr.val[i] = order[i];
}
Should subbank_srch_order be declared as 'static u32 *' instead of 'static
int *', or should the function return type be changed to 'const int *' to
match the actual type?
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h
> index 004a556c7b90..b168ecfbc5c8 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h
> @@ -343,5 +343,7 @@ int npc_cn20k_defrag(struct rvu *rvu);
[ ... ]
--
pw-bot: cr
next prev parent reply other threads:[~2026-03-17 3:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 2:27 [PATCH v4 net-next 0/5] octeontx2-af: npc: Enhancements Ratheesh Kannoth
2026-03-12 2:27 ` [PATCH v4 net-next 1/5] octeontx2-af: npc: cn20k: debugfs enhancements Ratheesh Kannoth
2026-03-12 2:27 ` [PATCH v4 net-next 2/5] devlink: Implement devlink param multi attribute nested data values Ratheesh Kannoth
2026-03-17 3:36 ` Jakub Kicinski
2026-03-17 13:22 ` Jiri Pirko
2026-03-18 2:31 ` Ratheesh Kannoth
2026-03-12 2:27 ` [PATCH v4 net-next 3/5] octeontx2-af: npc: cn20k: add subbank search order control Ratheesh Kannoth
2026-03-17 3:32 ` Jakub Kicinski [this message]
2026-03-12 2:27 ` [PATCH v4 net-next 4/5] octeontx2-af: npc: cn20k: dynamically allocate and free default MCAM entries Ratheesh Kannoth
2026-03-12 2:27 ` [PATCH v4 net-next 5/5] octeontx2-af: npc: Support for custom KPU profile from filesystem Ratheesh Kannoth
2026-03-17 3:32 ` [v4,net-next,5/5] " Jakub Kicinski
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=20260317033205.646930-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=cjubran@nvidia.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=matttbe@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=saeedm@nvidia.com \
--cc=sgoutham@marvell.com \
--cc=shshitrit@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.