STRUCT NPC_PRIV_T(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 a u8, bestie, keep it smol.
  • sb β€” the subbank array. a struct 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 a struct 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. a struct list_head, she's a linked list baddie.
  • lock β€” lock for defrag list. a struct 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