octeontx2-af: Validate NIX maximum LFs correctly
Subbaraya Sundeep
maintainerPATCH v4 1/1 octeontx2-af: Validate NIX maximum LFs correctly
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.
---
v4 changes:
Rebased to latest net
v3 changes:
None, updated changelog
v2 changes:
Fixed AI review by updating error message
Updated comment to mention modifying NIXLFs has to be done prior to attaching NIXLFs to any PFs/VFs.
.../marvell/octeontx2/af/rvu_devlink.c | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +19 -8
@@ -1511,7 +1511,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 );
@@ -1519,14 +1521,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) {
Signature · 1 line
2.48.1
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 22 Jun 2026 04:30:53 +0530 you 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 <[email protected]>[...]
Here is the summary with links:
- [net,v4] octeontx2-af: Validate NIX maximum LFs correctly
https://git.kernel.org/netdev/net/c/1576d12a3986
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html