pci_sriov_set_totalvfs(9)
β¨ 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
0if the PF is an SRIOV-capable device and the value ofnumvfsis valid β slay, you did it - If it's not a PF β
<red>-ENOSYS</red>π - If
numvfsis 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 π:
pci_iov_get_pf_drvdata(9)pci_iov_init(9)pci_iov_release(9)pci_iov_remove(9)pci_iov_update_resource(9)pci_sriov_resource_alignment(9)pci_restore_iov_state(9)pci_vf_drivers_autoprobe(9)pci_iov_bus_range(9)pci_enable_sriov(9)pci_disable_sriov(9)pci_num_vf(9)pci_vfs_assigned(9)pci_sriov_get_totalvfs(9)pci_sriov_configure_simple(9)pci_iov_vf_bar_set_size(9)pci_iov_vf_bar_get_sizes(9)
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
- 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