STRUCT NPC_PRIV_T(9)
β¨ struct npc_priv_t(9) β the NPC private structure β¨
okay so bestie, grab your matcha π because this is a page from the Kernel API Manual and it's literally the private structure for NPC. yes, the whole thing. let's get into it π
π NAME π
struct npc_priv_t β the NPC private structure. that's it, that's the name, she's private and she's iconic π
πΈ SYNOPSIS πΈ
struct npc_priv_t {
int bank_depth;
int num_banks;
int num_subbanks;
int subbank_depth;
unsigned long en_map[BITS_TO_LONGS( MAX_NUM_BANKS *
MAX_NUM_SUB_BANKS * MAX_SUBBANK_DEPTH)];
u8 kw;
struct npc_subbank *sb;
struct xarray xa_sb_used;
struct xarray xa_sb_free;
struct xarray *xa_pf2idx_map;
struct xarray xa_idx2pf_map;
struct xarray xa_pf_map;
struct xarray xa_pf2dfl_rmap;
struct xarray xa_idx2vidx_map;
struct xarray xa_vidx2idx_map;
struct list_head defrag_lh;
struct mutex lock;
int pf_cnt;
};
look at her. so many xarrays. so much main character energy π
π¦ Members π¦
bank_depthβ total entries in each bank. like, how many lil slots each bank has, fr fr.num_banksβ number of banks. the count. the headcount. πnum_subbanksβ number of subbanks. yes, subbanks exist, we love a nested situation.subbank_depthβ depth of subbank. it's giving layers on layers on layers π§en_mapβ enable/disable status. the on/off vibe check βkwβ Kex configured key type. note that it's au8, bestie, keep it smol.sbβ the subbank array. astruct npc_subbank *, pointing at all the subbank girlies.xa_sb_usedβ array of used subbanks. taken. spoken for. πxa_sb_freeβ array of free subbanks. single and ready to mingle π¦xa_pf2idx_mapβ PF to mcam index map. (also it's a pointer to astruct xarray, jsyk π)xa_idx2pf_mapβ mcam index to PF map. the reverse situation, we respect it.xa_pf_mapβ Pcifunc to index map. ok werk.xa_pf2dfl_rmapβ PF to default rule index map. the default rules, very demure.xa_idx2vidx_mapβ mcam index to virtual index map. virtual?? yes bestie, virtual.xa_vidx2idx_mapβ virtual index to mcam index map. the round trip we all deserve π₯defrag_lhβ defrag list head. astruct list_head, she's a linked list baddie.lockβ lock for defrag list. astruct mutex. no cap, do NOT touch the defrag list without her πpf_cntβ number of PFs. the final count. periodt.
π Description π
so this structure gets populated during probing time by reading HW csr registers. that's the whole lore: probing time, HW csr registers, structure filled in. genuinely obsessed with how simple that is πβ¨
π SEE ALSO π
- Kernel file
./drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h enum npc_subbank_flag(9)enum npc_dft_rule_id(9)struct npc_subbank(9)struct npc_defrag_show_node(9)
go read those too, iykyk π«Ά
and that's the page bestie π
sourced from ./drivers/net/ethernet/marvell..., dated October 2026 β go off, you now know the inner workings of struct npc_priv_t(9) fr fr πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms