PCI_IOV_INIT(9)

πŸ’– PCI_IOV_INIT πŸ’–

okay bestie, so this is a Kernel Developer's Manual page, PCI_IOV_INIT(9), and it's literally the glow-up moment where SR-IOV gets turned on for a PF device. no cap. let's get into it 🫢


✨ NAME ✨

PCI_IOV_INIT β€” enable SR-IOV on a PF device


🌸 SYNOPSIS 🌸

#include <sys/bus.h>
#include <machine/stdarg.h>
#include <sys/nv.h>
#include <dev/pci/pci_iov.h>

int
PCI_IOV_INIT(device_t dev, uint16_t num_vfs, const nvlist_t *pf_config);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the PCI_IOV_INIT() method gets called by the PCI Single-Root I/O Virtualization (SR-IOV) infrastucture when the user is like "hey. enable SR-IOV on this Physical Function (PF)." ✨ and the number of Virtual Functions (VFs) that are about to be created? that gets handed to this method in the num_vfs argument. it's giving headcount, fr fr.

now, if the driver asked for device-specific PF configuration parameters via a PF schema in its call to pci_iov_attach(9), those parameters will be available to you in the pf_config argument. πŸ‘‘

and here's the tea on what's guaranteed inside pf_config:

  • All configuration parameters that were either set as required parameters, or that had a default value set in the PF schema β€” those are guaranteed to be present in pf_config. locked in. πŸ’…
  • Configuration parameters that were neither set as required nor given a default value are optional, and they may or may not be present in pf_config. so like... check before you assume, bestie. πŸ™ˆ
  • pf_config will not contain any configuration parameters that were not specified in the PF schema. not one. periodt.
  • All configuration parameters will have the correct type, and they're all in the range of valid values specified in the schema. so you can trust the vibe. ⭐
and one more thing β€” if this method returns successfully, it will not be called again on the same device until after a call to PCI_IOV_UNINIT(9). so don't be out here expecting round two. 😭

πŸ”₯ RETURN VALUES πŸ”₯

Returns 0 on success β€” iconic, slay, we love to see it. otherwise an appropriate error is returned. πŸ˜”

and if this method returns an error? then the SR-IOV configuration will be aborted and no VFs will be created. like, zero. none. the whole thing just stops. no cap.


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Ryan Stone <rstone@FreeBSD.org>. thank you for your service, king πŸ«‘πŸ’œ


and that's the whole page, bestie β€” this one's from the Debian crew, dated May 28, 2015, and it's PCI_IOV_INIT(9) to the very end. go forth and enable SR-IOV responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from