Subject: Re: [PATCH v2 net 01/11] octeontx2-af: npc: cn20k: Propagate MCAM key-type errors on cn20k

From: Simon Horman <[email-masked]>
Date: Thu, 23 Apr 2026 11:01:47 +0100

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: Propagate MCAM key-type errors on cn20k

This patch converts several cn20k NPC functions from void to int return
types to propagate MCAM key-type lookup errors. It adds error checking
for npc_mcam_idx_2_key_type() and threads these errors through the
cn20k MCAM handlers.

Link: https://lore.kernel.org/netdev/[email-masked]/

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> index 7291fdb89b03..18d70f4527d1 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c

[ ... ]

> @@ -1415,9 +1435,9 @@ int rvu_mbox_handler_npc_cn20k_mcam_alloc_and_write_entry(struct rvu *rvu,
>  	else
>  		nix_intf = pfvf->nix_rx_intf;
>
> -	npc_cn20k_config_mcam_entry(rvu, blkaddr, entry, nix_intf,
> -				    &req->entry_data, req->enable_entry,
> -				    req->hw_prio, req->req_kw_type);
> +	rc = npc_cn20k_config_mcam_entry(rvu, blkaddr, entry, nix_intf,
> +					 &req->entry_data, req->enable_entry,
> +					 req->hw_prio, req->req_kw_type);
>
>  	mutex_unlock(&mcam->lock);
>
>  	rsp->entry = entry_rsp.entry;
>  	return 0;

Does this function need to return rc instead of 0? If
npc_cn20k_config_mcam_entry() fails (for example, due to an invalid key
type), the function still returns success to the caller. The mailbox
response indicates the entry was successfully allocated and configured,
but the hardware entry may be in an undefined state.

[ ... ]