public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: rkannoth@marvell.com
Cc: Simon Horman <horms@kernel.org>,
	cjubran@nvidia.com, edumazet@google.com, donald.hunter@gmail.com,
	shshitrit@nvidia.com, netdev@vger.kernel.org, matttbe@kernel.org,
	jiri@resnulli.us, chuck.lever@oracle.com, saeedm@nvidia.com,
	kuba@kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, sgoutham@marvell.com, pabeni@redhat.com
Subject: Re: [v2,net-next,4/5] octeontx2-af: npc: cn20k: dynamically allocate and free default MCAM entries
Date: Fri,  6 Mar 2026 14:28:05 +0000	[thread overview]
Message-ID: <20260306142803.500805-3-horms@kernel.org> (raw)
In-Reply-To: <20260304043032.3661647-5-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: dynamically allocate and free default MCAM entries

This commit improves MCAM utilization by tying default entry lifetime to
NIX LF usage. Default entries are allocated when NIX LF is allocated and
freed when NIX LF is freed, with a new flag to allow the kernel PF driver
to retain entries across suspend/resume.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> index badfa1d64252..0fb2d71116f4 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c

[ ... ]

> @@ -1684,6 +1685,12 @@ int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu,
>  	if (is_sdp_pfvf(rvu, pcifunc))
>  		intf = NIX_INTF_TYPE_SDP;
>
> +	if (is_cn20k(rvu->pdev)) {
> +		rc = npc_cn20k_dft_rules_alloc(rvu, pcifunc);
> +		if (rc)
> +			goto free_dft;
> +	}
> +
>  	err = nix_interface_init(rvu, pcifunc, intf, nixlf, rsp,
>  				 !!(req->flags & NIX_LF_LBK_BLK_SEL));
>  	if (err)

Does this leak the cn20k default MCAM entries if nix_interface_init()
fails? The npc_cn20k_dft_rules_alloc() call succeeds and allocates entries
into the xa_pf2dfl_rmap xarray and hardware MCAM slots. When
nix_interface_init() subsequently fails, the error path jumps to 'free_mem'
rather than 'free_dft', skipping npc_cn20k_dft_rules_free().

> @@ -1699,6 +1706,10 @@ int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu,
>
>  	goto exit;
>
> +free_dft:
> +	if (is_cn20k(rvu->pdev))
> +		npc_cn20k_dft_rules_free(rvu, pcifunc);
> +
>  free_mem:
>  	nix_ctx_free(rvu, pfvf);
>  	rc = -ENOMEM;

The free_dft cleanup path exists and would handle the release, so should
the nix_interface_init() failure case use 'goto free_dft' instead?

  reply	other threads:[~2026-03-06 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  4:30 [PATCH v2 net-next 0/5] octeontx2-af: npc: Enhancements Ratheesh Kannoth
2026-03-04  4:30 ` [PATCH v2 net-next 1/5] octeontx2-af: npc: cn20k: debugfs enhancements Ratheesh Kannoth
2026-03-04  4:30 ` [PATCH v2 net-next 2/5] devlink: Implement devlink param multi attribute nested data values Ratheesh Kannoth
2026-03-04  4:30 ` [PATCH v2 net-next 3/5] octeontx2-af: npc: cn20k: add subbank search order control Ratheesh Kannoth
2026-03-06 14:24   ` Simon Horman
2026-03-04  4:30 ` [PATCH v2 net-next 4/5] octeontx2-af: npc: cn20k: dynamically allocate and free default MCAM entries Ratheesh Kannoth
2026-03-06 14:28   ` Simon Horman [this message]
2026-03-04  4:30 ` [PATCH v2 net-next 5/5] octeontx2-af: Add support for loading custom KPU profile from filesystem 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=20260306142803.500805-3-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=cjubran@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matttbe@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rkannoth@marvell.com \
    --cc=saeedm@nvidia.com \
    --cc=sgoutham@marvell.com \
    --cc=shshitrit@nvidia.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