Subject: Re: [PATCH net-next v3 09/13] octeontx2-af: npc: cn20k: virtual index support

From: Jakub Kicinski <[email-masked]>
Date: Sat, 10 Jan 2026 14:52:52 -0800

On Fri, 9 Jan 2026 11:18:24 +0530 Ratheesh Kannoth wrote:
> This patch adds support for virtual MCAM index allocation and
> improves CN20K MCAM defragmentation handling. A new field is
> introduced in the non-ref, non-contiguous MCAM allocation mailbox
> request to indicate that virtual indexes should be returned instead
> of physical ones. Virtual indexes allow the hardware to move mapped
> MCAM entries internally, enabling defragmentation and preventing
> scattered allocations across subbanks. The patch also enhances
> defragmentation by treating non-ref, non-contiguous allocations as
> ideal candidates for packing sparsely used regions, which can free
> up subbanks for potential x2 or x4 configuration. All such
> allocations are tracked and always returned as virtual indexes so
> they remain stable even when entries are moved during defrag.
> During defragmentation, MCAM entries may shift between subbanks,
> but their virtual indexes remain unchanged. Additionally, this
> update fixes an issue where entry statistics were not being
> restored correctly after defragmentation.

Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'xa_idx2vidx_map' not described in 'npc_priv_t'
Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'xa_vidx2idx_map' not described in 'npc_priv_t'
Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'defrag_lh' not described in 'npc_priv_t'
Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'lock' not described in 'npc_priv_t'
Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'xa_idx2vidx_map' not described in 'npc_priv_t'
Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'xa_vidx2idx_map' not described in 'npc_priv_t'
Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'defrag_lh' not described in 'npc_priv_t'
Warning: drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h:203 struct member 'lock' not described in 'npc_priv_t'