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>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [net-next,v4,09/13] octeontx2-af: npc: cn20k: virtual index support
Date: Sat, 17 Jan 2026 16:40:27 -0800	[thread overview]
Message-ID: <20260118004027.1044394-1-kuba@kernel.org> (raw)
In-Reply-To: <20260113101658.4144610-10-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: virtual index support

This patch adds virtual MCAM index allocation and improves CN20K MCAM
defragmentation. Virtual indexes allow the hardware to move mapped
MCAM entries internally while presenting stable indexes to callers.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> index d549e75b2cb0..334b80ebec69 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c

[ ... ]

> +static int npc_vidx_maps_add_entry(struct rvu *rvu, u16 mcam_idx, int pcifunc,
> +				   u16 *vidx)
> +{
> +	int rc, max, min;
> +	u32 id;
> +
> +	/* Virtual index start from maximum mcam index + 1 */
> +	max = npc_priv.bank_depth * 2 * 2 - 1;
> +	min = npc_priv.bank_depth * 2;
> +
> +	rc = xa_alloc(&npc_priv.xa_vidx2idx_map, &id,
> +		      xa_mk_value(mcam_idx),
> +		      XA_LIMIT(min, max), GFP_KERNEL);
> +	if (rc) {
> +		dev_err(rvu->dev,
> +			"%s: Failed to add to vidx2idx map (%u)\n",
> +			__func__, mcam_idx);
> +		return rc;
> +	}
> +
> +	rc = xa_insert(&npc_priv.xa_idx2vidx_map, mcam_idx,
> +		       xa_mk_value(id), GFP_KERNEL);
> +	if (rc) {
> +		dev_err(rvu->dev,
> +			"%s: Failed to add to idx2vidx map (%u)\n",
> +			__func__, mcam_idx);
> +		return rc;
                ^^^^^^^^^^

If xa_insert() fails here, the entry allocated by xa_alloc() in
xa_vidx2idx_map is not cleaned up. Should there be an xa_erase() call
to remove the allocated entry before returning the error?

> +	}
> +
> +	if (vidx)
> +		*vidx = id;
> +
> +	return 0;
> +}

[ ... ]

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> index 0f9953eaf1b0..cc83d4fc5724 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c

[ ... ]

> +static const struct devlink_param rvu_af_dl_param_defrag[] = {
> +	DEVLINK_PARAM_DRIVER(RVU_AF_DEVLINK_PARAM_ID_NPC_DEFRAG,
> +			     "npc_defrag", DEVLINK_PARAM_TYPE_STRING,
> +			     BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> +			     rvu_af_npc_defrag_feature_get,
> +			     rvu_af_npc_defrag,
> +			     rvu_af_npc_defrag_feature_validate),
> +};
> +
>  int rvu_register_dl(struct rvu *rvu)
>  {

[ ... ]

> +	if (is_cn20k(rvu->pdev)) {
> +		err = devlink_params_register(dl, rvu_af_dl_param_defrag,
> +					      ARRAY_SIZE(rvu_af_dl_param_defrag));
> +		if (err) {
> +			dev_err(rvu->dev,
> +				"devlink defrag params register failed with error %d",
> +				err);
> +			goto err_dl_exact_match;
> +		}
> +	}

The rvu_af_dl_param_defrag parameters are registered here for CN20K
devices, but rvu_unregister_dl() does not have a corresponding
devlink_params_unregister() call for these parameters. Should there be
a matching unregister call similar to the exact_match handling?

  reply	other threads:[~2026-01-18  0:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 10:16 [PATCH net-next v4 00/13] NPC HW block support for cn20k Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 01/13] octeontx2-af: npc: cn20k: Index management Ratheesh Kannoth
2026-01-18  0:39   ` Jakub Kicinski
2026-01-19  4:04     ` Ratheesh Kannoth
2026-01-18  0:40   ` [net-next,v4,01/13] " Jakub Kicinski
2026-01-19  4:00     ` Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 02/13] octeontx2-af: npc: cn20k: KPM profile changes Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 03/13] octeontx2-af: npc: cn20k: Add default profile Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 04/13] ocetontx2-af: npc: cn20k: MKEX profile support Ratheesh Kannoth
2026-01-18  0:40   ` [net-next,v4,04/13] " Jakub Kicinski
2026-01-19  4:17     ` Ratheesh Kannoth
2026-01-20  3:24     ` Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 05/13] octeontx2-af: npc: cn20k: Allocate default MCAM indexes Ratheesh Kannoth
2026-01-18  0:40   ` [net-next,v4,05/13] " Jakub Kicinski
2026-01-19  3:42     ` Ratheesh Kannoth
2026-01-19 17:32       ` Jakub Kicinski
2026-01-20  1:37         ` Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 06/13] octeontx2-af: npc: cn20k: Use common APIs Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 07/13] octeontx2-af: npc: cn20k: Prepare for new SoC Ratheesh Kannoth
2026-01-22  8:36   ` Simon Horman
2026-01-23 15:39     ` Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 08/13] octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 09/13] octeontx2-af: npc: cn20k: virtual index support Ratheesh Kannoth
2026-01-18  0:40   ` Jakub Kicinski [this message]
2026-01-19  3:39     ` [net-next,v4,09/13] " Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 10/13] octeontx2-af: npc: cn20k: Allocate MCAM entry for flow installation Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 11/13] octeontx2-pf: cn20k: Add TC rules support Ratheesh Kannoth
2026-01-18  0:40   ` [net-next,v4,11/13] " Jakub Kicinski
2026-01-19  3:39     ` Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 12/13] octeontx2-af: npc: cn20k: add debugfs support Ratheesh Kannoth
2026-01-13 10:16 ` [PATCH net-next v4 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=20260118004027.1044394-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rkannoth@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