Subject: Re: [net-next,v5,06/13] octeontx2-af: npc: cn20k: Use common APIs

From: Jakub Kicinski <[email-masked]>
Date: Tue, 27 Jan 2026 18:29:24 -0800

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: Use common APIs

This patch updates the common NPC APIs to support both cn20k and previous
silicon variants by adding cn20k-specific register access and dispatching
to cn20k-specific routines for MCAM entry operations.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> index 246f3568a795..59988a54506a 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

[ ... ]

> @@ -2063,15 +2154,13 @@ static void rvu_npc_setup_interfaces(struct rvu *rvu, int blkaddr)
>  	struct npc_mcam *mcam = &rvu->hw->mcam;
>  	struct rvu_hwinfo *hw = rvu->hw;
>  	u64 nibble_ena, rx_kex, tx_kex;
> -	u64 *keyx_cfg;
> +	u64 *keyx_cfg, reg;
>  	u8 intf;
>
> -	if (is_cn20k(rvu->pdev)) {
> +	if (is_cn20k(rvu->pdev))
>  		keyx_cfg = mkex_extr->keyx_cfg;
> -		goto skip_miss_cntr;
> -	}
> -
> -	keyx_cfg = mkex->keyx_cfg;
> +	else
> +		keyx_cfg = mkex->keyx_cfg;
>
>  	/* Reserve last counter for MCAM RX miss action which is set to
>  	 * drop packet. This way we will know how many pkts didn't match
> @@ -2080,7 +2169,6 @@ static void rvu_npc_setup_interfaces(struct rvu *rvu, int blkaddr)
>  	mcam->counters.max--;
>  	mcam->rx_miss_act_cntr = mcam->counters.max;
                   ^^^^^^^^^^

Was the removal of "goto skip_miss_cntr" intentional for cn20k? Previously,
cn20k would skip the counter reservation here. Now cn20k reserves a counter
via mcam->counters.max-- but never programs NPC_AF_INTFX_MISS_STAT_ACT (due
to the "continue" later in the RX interface loop). This appears to waste
one counter on cn20k.

> -skip_miss_cntr:
>  	rx_kex = keyx_cfg[NIX_INTF_RX];
>  	tx_kex = keyx_cfg[NIX_INTF_TX];
>