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>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next,v7,01/13] octeontx2-af: npc: cn20k: Index management
Date: Fri, 30 Jan 2026 19:33:20 -0800	[thread overview]
Message-ID: <20260131033320.1013816-1-kuba@kernel.org> (raw)
In-Reply-To: <20260129083339.264386-2-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: Index management

This patch adds MCAM index management for CN20K silicon, implementing
contiguous and non-contiguous allocation schemes across the new subbank
architecture with reference, limit, and priority parameters.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> new file mode 100644
> index 000000000000..de3d5ad762d1
> --- /dev/null
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c

[ ... ]

> +static int __npc_subbank_alloc(struct rvu *rvu, struct npc_subbank *sb,
> +			       int key_type, int ref, int limit, int prio,
> +			       bool contig, int count, u16 *mcam_idx,
> +			       int idx_sz, bool max_alloc, int *alloc_cnt)
> +{
> +	int cnt, t, b, i, blkaddr;
> +	bool new_sub_bank = false;
> +	unsigned long *bmap;
> +	u16 *save = NULL;
> +	int sidx, eidx;
> +	bool diffbank;
> +	int bw, bfree;
> +	int rc = 0;
> +	bool ret;

[ ... ]

> +	/* Mark new subbank bank as used */
> +	if (new_sub_bank) {
> +		blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
> +		if (blkaddr < 0) {
> +			dev_err(rvu->dev,
> +				"%s: NPC block not implemented\n", __func__);
> +			goto err;
                        ^^^^^^^^

When rvu_get_blkaddr() fails here, the code jumps to the err label but rc
is still 0 from initialization. Every other error path in this function
sets rc before going to err. Should rc be set to blkaddr (or another error
code) before the goto?

> +		}
> +
> +		rc =  __npc_subbank_mark_used(rvu, sb, key_type);

[ ... ]

> +err:
> +	kfree(save);
> +	return rc;
> +}

[ ... ]

> +static void npc_subbank_init(struct rvu *rvu, struct npc_subbank *sb, int idx)
> +{
> +	mutex_init(&sb->lock);

[ ... ]

> +void npc_cn20k_deinit(struct rvu *rvu)
> +{
> +	int i;
> +
> +	xa_destroy(&npc_priv.xa_sb_used);
> +	xa_destroy(&npc_priv.xa_sb_free);
> +	xa_destroy(&npc_priv.xa_idx2pf_map);
> +	xa_destroy(&npc_priv.xa_pf_map);
> +
> +	for (i = 0; i < npc_priv.pf_cnt; i++)
> +		xa_destroy(&npc_priv.xa_pf2idx_map[i]);
> +
> +	kfree(npc_priv.xa_pf2idx_map);
> +	kfree(npc_priv.sb);

The subbank mutexes are initialized in npc_subbank_init() but are not
destroyed here. Is mutex_destroy() needed for each sb->lock before freeing
npc_priv.sb? The same issue applies to the fail2 error path in
npc_priv_init().

> +	kfree(subbank_srch_order);
> +}
-- 
pw-bot: cr

  reply	other threads:[~2026-01-31  3:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29  8:33 [PATCH net-next v7 00/13] NPC HW block support for cn20k Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 01/13] octeontx2-af: npc: cn20k: Index management Ratheesh Kannoth
2026-01-31  3:33   ` Jakub Kicinski [this message]
2026-01-29  8:33 ` [PATCH net-next v7 02/13] octeontx2-af: npc: cn20k: KPM profile changes Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 03/13] octeontx2-af: npc: cn20k: Add default profile Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 04/13] octeontx2-af: npc: cn20k: MKEX profile support Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 05/13] octeontx2-af: npc: cn20k: Allocate default MCAM indexes Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 06/13] octeontx2-af: npc: cn20k: Use common APIs Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 07/13] octeontx2-af: npc: cn20k: Prepare for new SoC Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 08/13] octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 09/13] octeontx2-af: npc: cn20k: virtual index support Ratheesh Kannoth
2026-01-31  3:33   ` [net-next,v7,09/13] " Jakub Kicinski
2026-02-02  4:11     ` Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 10/13] octeontx2-af: npc: cn20k: Allocate MCAM entry for flow installation Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 11/13] octeontx2-pf: cn20k: Add TC rules support Ratheesh Kannoth
2026-01-31  3:33   ` [net-next,v7,11/13] " Jakub Kicinski
2026-01-29  8:33 ` [PATCH net-next v7 12/13] octeontx2-af: npc: cn20k: add debugfs support Ratheesh Kannoth
2026-01-29  8:33 ` [PATCH net-next v7 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=20260131033320.1013816-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