public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: rkannoth@marvell.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	edumazet@google.com, sgoutham@marvell.com, andrew+netdev@lunn.ch,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, sumang@marvell.com,
	sbhatta@marvell.com, davem@davemloft.net
Subject: Re: [net-next,v8,02/13] octeontx2-af: npc: cn20k: KPM profile changes
Date: Wed,  4 Feb 2026 18:25:11 -0800	[thread overview]
Message-ID: <20260205022511.2270287-1-kuba@kernel.org> (raw)
In-Reply-To: <20260202074607.2535569-3-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: KPM profile changes

This patch adds support for the new KPM (Kangaroo Processing Module) profile
configuration in CN20K silicon. It groups 16 KPUs into 8 KPM profiles, where
each KPM contains two KPUs (KPM0 = KPU0 + KPU8, etc.).

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c

[ ... ]

> +static void
> +npc_config_kpmaction(struct rvu *rvu, int blkaddr,
> +		     const struct npc_kpu_profile_action *kpuaction,
> +		     int kpm, int entry, bool pkind)
> +{
> +	struct npc_kpm_action0 action0 = {0};
> +	struct npc_kpu_action1 action1 = {0};

[ ... ]

> +	action0.capture_ltype = kpuaction->ltype & 0xf;
> +	action0.capture_flags = kpuaction->flags & 0xf;
> +	action0.ptr_advance = kpuaction->ptr_advance;

The npc_kpm_action0 structure defines capture_flags as a 4-bit field, while
kpuaction->flags is a u8 (8 bits). KPU profiles use flag values such as
NPC_F_LA_U_HAS_IH_NIX (0x20), NPC_F_LA_U_HAS_HIGIG2 (0x40), and
NPC_F_LB_U_UNK_ETYPE (0x80), which exceed what 4 bits can represent.

Is this truncation intentional for the CN20K hardware register layout? If
so, will the parser functionality work correctly when these upper flag bits
are silently discarded?

This was raised by Jakub Kicinski in v6 review:
https://lore.kernel.org/all/20260129051303.376551-1-kuba@kernel.org/

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

[ ... ]

> @@ -1982,6 +1990,15 @@ static void rvu_npc_hw_init(struct rvu *rvu, int blkaddr)
>  	hw->npc_pkinds = (npc_const1 >> 12) & 0xFFULL;
>  	hw->npc_kpu_entries = npc_const1 & 0xFFFULL;
>  	hw->npc_kpus = (npc_const >> 8) & 0x1FULL;
> +	/* For Cn20k silicon, check if enhanced parser
> +	 * is present, then set the NUM_KPMS = NUM_KPUS / 2 and
> +	 * number of LDATA extractors per KEX.
> +	 */
> +	if (is_cn20k(rvu->pdev) && (npc_const1 & BIT_ULL(62))) {
> +		hw->npc_kpms = hw->npc_kpus / 2;
> +		hw->npc_kex_extr = (npc_const1 >> 36) & 0x3FULL;
> +	}

[ ... ]

> @@ -2116,7 +2133,10 @@ int rvu_npc_init(struct rvu *rvu)
>  		return -ENOMEM;
>
>  	/* Configure KPU profile */
> -	npc_parser_profile_init(rvu, blkaddr);
> +	if (is_cn20k(rvu->pdev))
> +		npc_cn20k_parser_profile_init(rvu, blkaddr);
> +	else
> +		npc_parser_profile_init(rvu, blkaddr);

In rvu_npc_hw_init(), hw->npc_kpms is set only when both is_cn20k() returns
true AND bit 62 is set in npc_const1:

    if (is_cn20k(rvu->pdev) && (npc_const1 & BIT_ULL(62))) {
        hw->npc_kpms = hw->npc_kpus / 2;

However, rvu_npc_init() calls npc_cn20k_parser_profile_init() based solely
on is_cn20k(), without checking for enhanced parser support.

If CN20K hardware exists without enhanced parser support (bit 62 not set),
npc_kpms will be 0. The npc_cn20k_parser_profile_init() function would then:

    for (idx = 0; idx < hw->npc_kpms; idx++)  /* loops 0 times */
        ...disable KPM entries...

    for (idx = 0; idx < hw->npc_kpus; idx++)
        rvu_write64(rvu, blkaddr, NPC_AF_KPUX_CFG(idx), 0x00);  /* disables all KPUs */

    npc_program_kpm_profile(rvu, blkaddr, hw->npc_kpms);  /* loops 0 times, never re-enables KPUs */

Should the condition at line 2136 match the condition at line 1997 to
ensure KPUs are not left disabled when enhanced parser support is absent?
-- 
pw-bot: cr

  reply	other threads:[~2026-02-05  2:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02  7:45 [PATCH net-next v8 00/13] NPC HW block support for cn20k Ratheesh Kannoth
2026-02-02  7:45 ` [PATCH net-next v8 01/13] octeontx2-af: npc: cn20k: Index management Ratheesh Kannoth
2026-02-04 16:45   ` [net-next,v8,01/13] " Simon Horman
2026-02-04 16:57   ` Simon Horman
2026-02-02  7:45 ` [PATCH net-next v8 02/13] octeontx2-af: npc: cn20k: KPM profile changes Ratheesh Kannoth
2026-02-05  2:25   ` Jakub Kicinski [this message]
2026-02-02  7:45 ` [PATCH net-next v8 03/13] octeontx2-af: npc: cn20k: Add default profile Ratheesh Kannoth
2026-02-02  7:45 ` [PATCH net-next v8 04/13] octeontx2-af: npc: cn20k: MKEX profile support Ratheesh Kannoth
2026-02-02  7:45 ` [PATCH net-next v8 05/13] octeontx2-af: npc: cn20k: Allocate default MCAM indexes Ratheesh Kannoth
2026-02-02  7:46 ` [PATCH net-next v8 06/13] octeontx2-af: npc: cn20k: Use common APIs Ratheesh Kannoth
2026-02-02  7:46 ` [PATCH net-next v8 07/13] octeontx2-af: npc: cn20k: Prepare for new SoC Ratheesh Kannoth
2026-02-02  7:46 ` [PATCH net-next v8 08/13] octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon Ratheesh Kannoth
2026-02-05  2:25   ` [net-next,v8,08/13] " Jakub Kicinski
2026-02-02  7:46 ` [PATCH net-next v8 09/13] octeontx2-af: npc: cn20k: virtual index support Ratheesh Kannoth
2026-02-05  2:25   ` [net-next,v8,09/13] " Jakub Kicinski
2026-02-24  6:20     ` Ratheesh Kannoth
2026-02-24 18:17       ` Jakub Kicinski
2026-02-02  7:46 ` [PATCH net-next v8 10/13] octeontx2-af: npc: cn20k: Allocate MCAM entry for flow installation Ratheesh Kannoth
2026-02-05  2:25   ` [net-next,v8,10/13] " Jakub Kicinski
2026-02-24  6:24     ` Ratheesh Kannoth
2026-02-02  7:46 ` [PATCH net-next v8 11/13] octeontx2-pf: cn20k: Add TC rules support Ratheesh Kannoth
2026-02-02  7:46 ` [PATCH net-next v8 12/13] octeontx2-af: npc: cn20k: add debugfs support Ratheesh Kannoth
2026-02-02  7:46 ` [PATCH net-next v8 13/13] octeontx2-af: npc: Use common structures Ratheesh Kannoth
2026-02-05  2:24 ` [PATCH net-next v8 00/13] NPC HW block support for cn20k 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=20260205022511.2270287-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rkannoth@marvell.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=sumang@marvell.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