public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ratheesh Kannoth <rkannoth@marvell.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <sgoutham@marvell.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<andrew+netdev@lunn.ch>, Suman Ghosh <sumang@marvell.com>
Subject: Re: [PATCH v4 net 10/10] octeontx2-af: npc: cn20k: Reject missing default-rule MCAM indices
Date: Mon, 27 Apr 2026 15:43:16 +0530	[thread overview]
Message-ID: <ae82vNpsiqKQh18V@rkannoth-OptiPlex-7090> (raw)
In-Reply-To: <20260427063213.3937451-11-rkannoth@marvell.com>

On 2026-04-27 at 12:02:13, Ratheesh Kannoth (rkannoth@marvell.com) wrote:
> When cn20k default L2 rules are not installed,
> npc_cn20k_dft_rules_idx_get() leaves broadcast, multicast,
> promiscuous, and unicast slots at USHRT_MAX.
> npc_get_nixlf_mcam_index() previously returned that sentinel as a

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> index 5d349d131fdb..9e6c79d6fadf 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
[ ... ]
>> @@ -3897,6 +4006,14 @@ int rvu_mbox_handler_npc_read_base_steer_rule(struct rvu *rvu,
>>  	/* Read the default ucast entry if there is no pkt steering rule */
>>  	index = npc_get_nixlf_mcam_index(mcam, pcifunc, nixlf,
>>  					 NIXLF_UCAST_ENTRY);
>> +	if (index < 0) {
>> +		mutex_unlock(&mcam->lock);
>> +		dev_err(rvu->dev,
>> +			"%s: Error to get ucast entry for pcifunc=%#x\n",
>> +			__func__, pcifunc);
>> +		goto out;
>> +	}
>> +
>Should this path set rc before jumping to out?
>Looking at the surrounding function, rc is initialized to 0 and the out
>label simply returns rc:
>    int index, blkaddr, nixlf, rc = 0;
>    ...
>    out:
>        return rc;
>The adjacent nix_get_nixlf() failure path assigns rc before the goto,
>and other error paths in this file use return NPC_MCAM_INVALID_REQ.
>On this new error path rc stays 0, npc_read_mcam_entry() is skipped, and
>the handler returns success with rsp->entry left zero-filled. Would the
>requester be unable to distinguish this failure from a legitimate reply?
>Would assigning rc = NPC_MCAM_INVALID_REQ (or another negative errno)
>before goto out be more appropriate here?
>> read_entry:
>>  	/* Read the mcam entry */
>>  	npc_read_mcam_entry(rvu, mcam, blkaddr, index, &rsp->entry, &intf,

pw-bot: changes-requested

ACK. will set rc for this error path.

      reply	other threads:[~2026-04-27 10:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  6:32 [PATCH v4 net 0/10] octeontx2-af: npc: cn20k: MCAM fixes Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 01/10] octeontx2-af: npc: cn20k: Propagate MCAM key-type errors on cn20k Ratheesh Kannoth
2026-04-27  9:45   ` Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 02/10] octeontx2-af: npc: cn20k: Drop debugfs_create_file() error checks in init Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 03/10] octeontx2-af: npc: cn20k: Propagate errors in defrag MCAM alloc rollback Ratheesh Kannoth
2026-04-27  9:56   ` Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 04/10] octeontx2-af: npc: cn20k: Fix target map and rule Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 05/10] octeontx2-af: npc: cn20k: Clear MCAM entries by index and key width Ratheesh Kannoth
2026-04-27 10:01   ` Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 06/10] octeontx2-af: npc: cn20k: Fix bank value Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 07/10] octeontx2-af: npc: cn20k: Fix MCAM actions read Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 08/10] octeontx2-af: npc: cn20k: Initialize default-rule index outputs up front Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 09/10] octeontx2-af: npc: cn20k: Tear down default MCAM rules explicitly on free Ratheesh Kannoth
2026-04-27 10:09   ` Ratheesh Kannoth
2026-04-27  6:32 ` [PATCH v4 net 10/10] octeontx2-af: npc: cn20k: Reject missing default-rule MCAM indices Ratheesh Kannoth
2026-04-27 10:13   ` Ratheesh Kannoth [this message]

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=ae82vNpsiqKQh18V@rkannoth-OptiPlex-7090 \
    --to=rkannoth@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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