pci_sriov_set_totalvfs(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ pci_sriov_set_totalvfs ✨

okay bestie, this is a page from the Kernel API Manual (section 9), and it's genuinely one of the shorter ones so we can absolutely get through it together πŸ’–


🌸 NAME 🌸

pci_sriov_set_totalvfs β€” reduce the TotalVFs available (yes that's it, that's the whole vibe β€” we're turning the VF count down, not up πŸ”»)


πŸŽ€ SYNOPSIS πŸŽ€

int pci_sriov_set_totalvfs (struct pci_dev *dev , u16 numvfs );

so it takes a struct pci_dev * and a u16, and hands you back an int. cute, concise, no notes πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the PCI PF device 🫢 (the Physical Function, the main character of this whole situation)
  • numvfs β€” the number that should be used for TotalVFs supported πŸ”’ like, the new cap you're setting

🌈 DESCRIPTION 🌈

okay so listen β€” this should be called from the PF driver's probe routine, and it must be called with the device's mutex held πŸ”’ (fr fr, hold that lock, don't be out here raw-dogging shared state)

Now for the returns, and ngl this part is giving ✨ decision tree ✨:

  • Returns 0 if the PF is an SRIOV-capable device and the value of numvfs is valid βœ… slay, you did it
  • If it's not a PF β†’ <red>-ENOSYS</red> 😭
  • If numvfs is invalid β†’ <red>-EINVAL</red> πŸ™ˆ
  • If VFs are already enabled β†’ <red>-EBUSY</red> πŸ’€ too late bestie, they're already out there living their lives
heads up: call it early, from probe, mutex in hand. Once those VFs are enabled the door is closed and you get -EBUSY πŸšͺπŸ”

🧚 SEE ALSO 🧚

Kernel file ./drivers/pci/iov.c β€” that's where the magic lives πŸ“βœ¨

and the whole friend group πŸ‘‘:

like okay, go read all of them, I'll wait πŸ“


and that's the whole page!! mwah πŸ’‹ this one lives in ./drivers/pci, dated October 2026, and it's filed under pci_sriov_set_totalvfs(9) β€” go forth and cap those TotalVFs responsibly, bestie 🫢🌟

πŸ“¦ where this page comes from