STRUCT NFP_PF(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct nfp_pf (9) πŸ’–

okay bestie, so this is a page from the Kernel API Manual β€” yes, the real one, section 9, we're in kernel-doc territory now β€” and it's literally all about struct nfp_pf, the NFP PF-specific device structure. that's it, that's the whole vibe. NFP PF device lore. pull up a chair 🫢


✨ NAME ✨

struct nfp_pf β€” the NFP PF-specific device structure. like, the big one. the main character struct for a physical function on an NFP. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

struct nfp_pf {
    struct pci_dev *pdev;
    const struct nfp_dev_info *dev_info;
    struct nfp_cpp *cpp;
    struct nfp_app *app;
    struct nfp_cpp_area *data_vnic_bar;
    struct nfp_cpp_area *ctrl_vnic_bar;
    struct nfp_cpp_area *qc_area;
    struct nfp_cpp_area *mac_stats_bar;
    u8 __iomem *mac_stats_mem;
    struct nfp_cpp_area *vf_cfg_bar;
    u8 __iomem *vf_cfg_mem;
    struct nfp_cpp_area *vfcfg_tbl2_area;
    u8 __iomem *vfcfg_tbl2;
    const struct nfp_rtsym *mbox;
    struct msix_entry *irq_entries;
    unsigned int limit_vfs;
    unsigned int num_vfs;
    bool fw_loaded;
    bool unload_fw_on_remove;
    struct nfp_net *ctrl_vnic;
    const struct nfp_mip *mip;
    struct nfp_rtsym_table *rtbl;
    struct nfp_hwinfo *hwinfo;
    struct nfp_dumpspec *dumpspec;
    u32 dump_flag;
    u32 dump_len;
    struct nfp_eth_table *eth_tbl;
    struct nfp_nsp_identify *nspi;
    struct device *hwmon_dev;
    struct dentry *ddir;
    unsigned int max_data_vnics;
    unsigned int num_vnics;
    struct list_head vnics;
    struct list_head ports;
    struct workqueue_struct *wq;
    struct work_struct port_refresh_work;
    struct nfp_shared_buf *shared_bufs;
    unsigned int num_shared_bufs;
 };

no cap, that's a lot of fields. we're gonna go through every single one, because we are thorough in this house πŸ’…


🌈 MEMBERS 🌈

here's the member-by-member rundown, and bestie I did not skip a single one:

  • pdev β€” backpointer to the PCI device. it's the "who do I belong to" of the whole struct 🫢
  • dev_info β€” NFP ASIC params. the silicon's little ID card ✨
  • cpp β€” pointer to the CPP handle.
  • app β€” pointer to the APP handle.
  • data_vnic_bar β€” pointer to the CPP area for the data vNICs' BARs.
  • ctrl_vnic_bar β€” pointer to the CPP area for the ctrl vNIC's BAR.
  • qc_area β€” pointer to the CPP area for the queues. queues need a home too πŸ₯Ί
  • mac_stats_bar β€” pointer to the CPP area for the MAC stats.
  • mac_stats_mem β€” pointer to mapped MAC stats area.
  • vf_cfg_bar β€” pointer to the CPP area for the VF configuration BAR.
  • vf_cfg_mem β€” pointer to mapped VF configuration area.
  • vfcfg_tbl2_area β€” pointer to the CPP area for the VF config table.
  • vfcfg_tbl2 β€” pointer to mapped VF config table.
  • mbox β€” RTSym of per-PCI PF mailbox (under devlink lock). πŸ“¬ note the lock, it's important, iykyk
  • irq_entries β€” array of MSI-X entries for all vNICs.
  • limit_vfs β€” number of VFs supported by firmware (~0 for PCI limit). yes literally ~0, that's the special "just use the PCI limit" value πŸ‘€
  • num_vfs β€” number of SR-IOV VFs enabled.
  • fw_loaded β€” is the firmware loaded? the eternal question πŸ’€
  • unload_fw_on_remove β€” do we need to unload firmware on driver removal? (it's a bool named like a full sentence and honestly, love that for it)
  • ctrl_vnic β€” pointer to the control vNIC if available.
  • mip β€” MIP handle.
  • rtbl β€” RTsym table.
  • hwinfo β€” HWInfo table.
  • dumpspec β€” debug dump specification. for when things go πŸ“‰ and we need the receipts
  • dump_flag β€” store dump flag between set_dump and get_dump_flag. it's literally just holding onto the flag between those two calls, king behavior πŸ‘‘
  • dump_len β€” store dump length between set_dump and get_dump_flag. same deal, but the length ✨
  • eth_tbl β€” NSP ETH table.
  • nspi β€” NSP identification info.
  • hwmon_dev β€” pointer to hwmon device. lowercase "pointer" in the original, we respect it πŸŽ€
  • ddir β€” per-device debugfs directory.
  • max_data_vnics β€” number of data vNICs app firmware supports.
  • num_vnics β€” number of vNICs spawned.
  • vnics β€” linked list of vNIC structures (struct nfp_net).
  • ports β€” linked list of port structures (struct nfp_port).
  • wq β€” workqueue for running works which need to grab lock. lock-grabbing works, go do your thing πŸ”₯
  • port_refresh_work β€” work entry for taking netdevs out.
  • shared_bufs β€” array of shared buffer structures if FW has any SBs.
  • num_shared_bufs β€” number of elements in shared_bufs.

🌸 DESCRIPTION 🌸

so here's the one (1) rule of this struct's mutable era: fields which may change after probe are protected by the devlink instance lock. that's the whole description. that's the tea. β˜• (the page does say "proble" instead of "probe" β€” we stan a typo, but yeah, it means probe πŸ’€)

⚠️ bestie please take the devlink instance lock seriously. the fields that can change after probe are guarded by it β€” this is the kind of caveat that's lowkey boring until it's 3am and everything is on fire 😭

πŸ¦‹ SEE ALSO πŸ¦‹

  • Kernel file ./drivers/net/ethernet/netronome/nfp/nfp_main.h
  • struct nfp_dumpspec(9)

and that's the page!! no notes, ate, periodt πŸ’…

sign-off time πŸŽ€ β€” this lil beauty came from ./drivers/net/ethernet/netrono... (yes it's truncated in the footer, that's just how the footer do) and it's dated October 2026. future-coded documentation, obsessed. πŸŒˆβ­πŸ’œ

πŸ“¦ where this page comes from