Netdev List
 help / color / mirror / Atom feed
From: Subbaraya Sundeep <sbhatta@marvell.com>
To: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<sgoutham@marvell.com>, <gakula@marvell.com>,
	<bbhushan2@marvell.com>, <rkannoth@marvell.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [net PATCH v2] octeontx2-af: Validate NIX maximum LFs correctly
Date: Wed, 17 Jun 2026 21:01:06 +0530	[thread overview]
Message-ID: <20260617153106.GA573886@kernel-ep2> (raw)
In-Reply-To: <1781709750-23218-1-git-send-email-sbhatta@marvell.com>

Missed the changelog. Will resend.

Thanks,
Sundeep

pw-bot: changes-requested

On 2026-06-17 at 20:52:30, Subbaraya Sundeep (sbhatta@marvell.com) wrote:
> NIX maximum number of LFs can be set via devlink command
> but that can be done before assigning any LFs to a PF/VF.
> The condition used to check whether any LFs are assigned is
> incorrect. This patch fixes that condition.
> 
> Fixes: dd7842878633 ("octeontx2-af: Add new devlink param to configure maximum usable NIX block LFs")
> Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
> ---
>  .../marvell/octeontx2/af/rvu_devlink.c        | 27 +++++++++++++------
>  1 file changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> index 6494a9ee2f0d..3b47ecb44d51 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> @@ -1510,7 +1510,9 @@ static int rvu_af_dl_nix_maxlf_validate(struct devlink *devlink, u32 id,
>  	struct rvu_devlink *rvu_dl = devlink_priv(devlink);
>  	struct rvu *rvu = rvu_dl->rvu;
>  	u16 max_nix0_lf, max_nix1_lf;
> -	struct npc_mcam *mcam;
> +	struct rvu_block *block;
> +	int blkaddr = 0;
> +	int free_lfs;
>  	u64 cfg;
>  
>  	cfg = rvu_read64(rvu, BLKADDR_NIX0, NIX_AF_CONST2);
> @@ -1518,14 +1520,23 @@ static int rvu_af_dl_nix_maxlf_validate(struct devlink *devlink, u32 id,
>  	cfg = rvu_read64(rvu, BLKADDR_NIX1, NIX_AF_CONST2);
>  	max_nix1_lf = cfg & 0xFFF;
>  
> -	/* Do not allow user to modify maximum NIX LFs while mcam entries
> -	 * have already been assigned.
> +	/* Do not allow user to modify maximum NIX LFs while NIX LFs
> +	 * have already been assigned. Note that modifying NIX LFs count
> +	 * can be done only before any LF attach requests from PFs and VFs
> +	 * and not later or concurrently.
>  	 */
> -	mcam = &rvu->hw->mcam;
> -	if (mcam->bmap_fcnt < mcam->bmap_entries) {
> -		NL_SET_ERR_MSG_MOD(extack,
> -				   "mcam entries have already been assigned, can't resize");
> -		return -EPERM;
> +	blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
> +	while (blkaddr) {
> +		block = &rvu->hw->block[blkaddr];
> +
> +		free_lfs = rvu_rsrc_free_count(&block->lf);
> +		if (free_lfs != block->lf.max) {
> +			NL_SET_ERR_MSG_MOD(extack,
> +					   "NIX LFs already assigned, can't resize");
> +			return -EPERM;
> +		}
> +
> +		blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
>  	}
>  
>  	if (max_nix0_lf && val.vu16 > max_nix0_lf) {
> -- 
> 2.48.1
> 

      reply	other threads:[~2026-06-17 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 15:22 [net PATCH v2] octeontx2-af: Validate NIX maximum LFs correctly Subbaraya Sundeep
2026-06-17 15:31 ` Subbaraya Sundeep [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=20260617153106.GA573886@kernel-ep2 \
    --to=sbhatta@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bbhushan2@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rkannoth@marvell.com \
    --cc=sgoutham@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