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, sumang@marvell.com,
	linux-kernel@vger.kernel.org, sbhatta@marvell.com,
	davem@davemloft.net, netdev@vger.kernel.org, pabeni@redhat.com,
	andrew+netdev@lunn.ch, sgoutham@marvell.com
Subject: Re: [net-next,v6,08/13] octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon
Date: Wed, 28 Jan 2026 21:13:05 -0800	[thread overview]
Message-ID: <20260129051306.376568-1-kuba@kernel.org> (raw)
In-Reply-To: <20260128071235.3577206-9-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 new mailboxes for CN20K silicon

This patch adds new mailboxes for CN20K silicon due to changes in
struct mcam_entry where the keyword arrays were increased from size 7
to 8, breaking backward compatibility.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> index d73e447bedca..000280a4181b 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c

[ ... ]

> @@ -1782,23 +1850,25 @@ static int npc_update_dmac_value(struct rvu *rvu, int npcblkaddr,
>  				 struct rvu_npc_mcam_rule *rule,
>  				 struct rvu_pfvf *pfvf)
>  {
> +	struct npc_cn20k_mcam_write_entry_req cn20k_wreq = { 0 };
>  	struct npc_mcam_write_entry_req write_req = { 0 };
> -	struct npc_mcam *mcam = &rvu->hw->mcam;
>  	struct mcam_entry_mdata mdata = { };
> +	struct npc_mcam *mcam = &rvu->hw->mcam;
> +	struct cn20k_mcam_entry *cn20k_entry;
>  	struct mcam_entry *entry;
>  	u8 intf, enable, hw_prio;
>  	struct msg_rsp rsp;
>  	int err;
>
> +	cn20k_entry = &cn20k_wreq.entry_data;
>  	entry = &write_req.entry_data;
> -
> -	npc_populate_mcam_mdata(rvu, &mdata, entry);
> +	npc_populate_mcam_mdata(rvu, &mdata, cn20k_entry, entry);
>
>  	ether_addr_copy(rule->packet.dmac, pfvf->mac_addr);
>
>  	if (is_cn20k(rvu->pdev))
>  		npc_cn20k_read_mcam_entry(rvu, npcblkaddr, rule->entry,
> -					  entry, &intf,
> +					  cn20k_entry, &intf,
>  					  &enable, &hw_prio);
>  	else
>  		npc_read_mcam_entry(rvu, mcam, npcblkaddr, rule->entry,
> @@ -1813,7 +1883,13 @@ static int npc_update_dmac_value(struct rvu *rvu, int npcblkaddr,
>  	write_req.intf = pfvf->nix_rx_intf;
>
>  	mutex_unlock(&mcam->lock);
> -	err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req, &rsp);
> +	if (is_cn20k(rvu->pdev))
> +		err = rvu_mbox_handler_npc_cn20k_mcam_write_entry(rvu,
> +								  &cn20k_wreq,
> +								  &rsp);

In the CN20K path, cn20k_wreq is passed to the handler but only
write_req fields were initialized above:

    write_req.hdr.pcifunc = rule->owner;
    write_req.entry = rule->entry;
    write_req.intf = pfvf->nix_rx_intf;

The cn20k_wreq.entry, cn20k_wreq.hdr.pcifunc, and cn20k_wreq.intf fields
remain zero-initialized. This causes the handler to write to MCAM entry 0
instead of rule->entry, potentially corrupting an unrelated MCAM entry
and leaving the intended rule unchanged.

Should cn20k_wreq.entry, cn20k_wreq.hdr.pcifunc, and cn20k_wreq.intf be
initialized similar to how write_req is set up in the non-CN20K path?

> +	else
> +		err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req,
> +							    &rsp);
>  	mutex_lock(&mcam->lock);
>
>  	return err;

  reply	other threads:[~2026-01-29  5:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28  7:12 [PATCH net-next v6 00/13] NPC HW block support for cn20k Ratheesh Kannoth
2026-01-28  7:12 ` [PATCH net-next v6 01/13] octeontx2-af: npc: cn20k: Index management Ratheesh Kannoth
2026-01-28 11:27   ` ALOK TIWARI
2026-01-29  5:13   ` [net-next,v6,01/13] " Jakub Kicinski
2026-01-29  5:23     ` Ratheesh Kannoth
2026-01-29 23:50       ` Jakub Kicinski
2026-01-28  7:12 ` [PATCH net-next v6 02/13] octeontx2-af: npc: cn20k: KPM profile changes Ratheesh Kannoth
2026-01-29  5:13   ` [net-next,v6,02/13] " Jakub Kicinski
2026-01-28  7:12 ` [PATCH net-next v6 03/13] octeontx2-af: npc: cn20k: Add default profile Ratheesh Kannoth
2026-01-28  7:12 ` [PATCH net-next v6 04/13] octeontx2-af: npc: cn20k: MKEX profile support Ratheesh Kannoth
2026-01-28  7:12 ` [PATCH net-next v6 05/13] octeontx2-af: npc: cn20k: Allocate default MCAM indexes Ratheesh Kannoth
2026-01-28  7:12 ` [PATCH net-next v6 06/13] octeontx2-af: npc: cn20k: Use common APIs Ratheesh Kannoth
2026-01-28  7:12 ` [PATCH net-next v6 07/13] octeontx2-af: npc: cn20k: Prepare for new SoC Ratheesh Kannoth
2026-01-28  7:12 ` [PATCH net-next v6 08/13] octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon Ratheesh Kannoth
2026-01-29  5:13   ` Jakub Kicinski [this message]
2026-01-28  7:12 ` [PATCH net-next v6 09/13] octeontx2-af: npc: cn20k: virtual index support Ratheesh Kannoth
2026-01-29  5:13   ` [net-next,v6,09/13] " Jakub Kicinski
2026-01-28  7:12 ` [PATCH net-next v6 10/13] octeontx2-af: npc: cn20k: Allocate MCAM entry for flow installation Ratheesh Kannoth
2026-01-29  5:13   ` [net-next,v6,10/13] " Jakub Kicinski
2026-01-28  7:12 ` [PATCH net-next v6 11/13] octeontx2-pf: cn20k: Add TC rules support Ratheesh Kannoth
2026-01-29  5:13   ` [net-next,v6,11/13] " Jakub Kicinski
2026-01-28  7:12 ` [PATCH net-next v6 12/13] octeontx2-af: npc: cn20k: add debugfs support Ratheesh Kannoth
2026-01-28  7:12 ` [PATCH net-next v6 13/13] octeontx2-af: npc: Use common structures Ratheesh Kannoth

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=20260129051306.376568-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