Pcornel
Virtualization · PCI & Device Passthrough

Virtual Functions

Cheat sheet · https://pcornel.dk/topic.php?topic=3552

Back to the Topic

Answer

Virtual functions (VFs) are the SR-IOV instances a physical function creates, for example echo 8 > /sys/class/net/<if>/device/sriov_numvfs. Each VF has its own PCI address and can be assigned to a VM or container.

Remember

  • VF count set via sysfs or driver option.
  • VF settings (VLAN, MAC) from the PF.
  • Persist VFs across reboots.

First checks

  • echo 8 > /sys/class/net/<pf>/device/sriov_numvfs — create VFs
  • ip link show <pf> — VF MAC/VLAN/spoofchk
  • ip link set <pf> vf 0 vlan 20 mac <mac> — set VF config

Commands

ip link set <pf> vf 0 mac … vlan 20 spoofchk on

Verify in this order

PF config → VF → VM driver

Where it usually breaks

First mismatch in host capability/IOMMU/NUMA → hypervisor allocation/mapping → virtual hardware model → guest driver/enumeration → workload use; preserve identity/native error/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3552

Confirmation

Confirm action

Continue?