]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
octeontx2-af: npc: cn20k: Index management
authorRatheesh Kannoth <rkannoth@marvell.com>
Tue, 24 Feb 2026 07:59:57 +0000 (13:29 +0530)
committerJakub Kicinski <kuba@kernel.org>
Sat, 28 Feb 2026 18:29:25 +0000 (10:29 -0800)
commit1396771b0b7741d517d591cfb63333d3f97a8f6d
treef8094e3906c45e83209cb9b265e61cb790b70ae8
parentded4a02e7d0497c91ec8665e904c7dc817922993
octeontx2-af: npc: cn20k: Index management

In CN20K silicon, the MCAM is divided vertically into two banks.
Each bank has a depth of 8192.

The MCAM is divided horizontally into 32 subbanks, with each subbank
having a depth of 256.

Each subbank can accommodate either x2 keys or x4 keys. x2 keys are
256 bits in size, and x4 keys are 512 bits in size.

    Bank1                   Bank0
    |-----------------------------|
    |               |             | subbank 31 { depth 256 }
    |               |             |
    |-----------------------------|
    |               |             | subbank 30
    |               |             |
    ------------------------------
    ...............................

    |-----------------------------|
    |               |             | subbank 0
    |               |             |
    ------------------------------|

This patch implements the following allocation schemes in NPC.
The allocation API accepts reference (ref), limit, contig, priority,
and count values. For example, specifying ref=100, limit=200,
contig=1, priority=LOW, and count=20 will allocate 20 contiguous
MCAM entries between entries 100 and 200.

1. Contiguous allocation with ref, limit, and priority.
2. Non-contiguous allocation with ref, limit, and priority.
3. Non-contiguous allocation without ref.
4. Contiguous allocation without ref.

Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
Link: https://patch.msgid.link/20260224080009.4147301-2-rkannoth@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/af/Makefile
drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c
drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.h
drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c [new file with mode: 0644]
drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h [new file with mode: 0644]
drivers/net/ethernet/marvell/octeontx2/af/cn20k/reg.h
drivers/net/ethernet/marvell/octeontx2/af/common.h
drivers/net/ethernet/marvell/octeontx2/af/mbox.h
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c