nfp_net_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– nfp_net_alloc(9) β€” Kernel API Manual, but make it make sense πŸ’–

okay bestie, so this one is nfp_net_alloc, straight out of the kernel API manual, and it's literally the "build me a net device" function. Buckle up πŸŽ€


✨ NAME ✨

nfp_net_alloc β€” Allocate netdev and related structure

(yeah that's it, that's the whole name section, she's concise πŸ‘‘)


πŸ¦‹ SYNOPSIS πŸ¦‹

struct nfp_net * nfp_net_alloc (struct pci_dev *pdev , const struct
       nfp_dev_info *dev_info , void __iomem *ctrl_bar , bool needs_netdev ,
       unsigned int max_tx_rings , unsigned int max_rx_rings );

like, six things go in, one struct nfp_net * comes out, we love a function with commitment πŸ’…


🌸 ARGUMENTS 🌸

  • pdev β€” the PCI device. your actual physical friend in the machine πŸ’–
  • dev_info β€” the NFP ASIC params. the lore, the specs, the whole personality sheet.
  • ctrl_bar β€” PCI IOMEM with vNIC config memory. this is where the config brain lives, __iomem and all, no touching it with your bare pointers πŸ™ˆ
  • needs_netdev β€” a bool that answers the question of the day: are we allocating a netdev for this vNIC or not? yes/no, that's the vibe check.
  • max_tx_rings β€” Maximum number of TX rings supported by device. cap it, know it, respect it πŸ’€
  • max_rx_rings β€” Maximum number of RX rings supported by device. same energy, receiving side, iconic.

πŸ”₯ DESCRIPTION πŸ”₯

So what this function does is it allocates a netdev device and fills in the initial part of the struct nfp_net structure. like, first-pass setup, the beginning of the struct gets its little values, very main character energy.

And here's the twist, bestie: in case of control device, the nfp_net structure is allocated without the netdev. no netdev. none. that's the whole plot point for control devices β€” needs_netdev was there for a reason, slay 🌈


⭐ RETURN ⭐

Returns the NFP Net device structure β€” or ERR_PTR on error 😭 so bestie please, check it. don't be out here dereferencing without a vibe check, ERR_PTR is a trap not a gift πŸ’€

fr fr: an error comes back as ERR_PTR, not NULL. check properly, IS_ERR and all that. we don't rawdog error handling in this house πŸ™ˆ

🧚 SEE ALSO 🧚

the kernel file, held down loyally:

  • ./drivers/net/ethernet/netronome/nfp/nfp_net_common.c

and the whole friend group, alphabetically unbothered, all present and accounted for πŸ’œ:


and that's the page, diva 🫢 β€” source ./drivers/net/ethernet/netrono... (the footer got truncated, not me, iykyk 😭), dated October 2026, page still nfp_net_alloc(9) because she knows exactly who she is πŸ‘‘βœ¨

πŸ“¦ where this page comes from