Use this when creating and assigning SR-IOV virtual functions.
Virtual Functions
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.
1. A Virtual Function is a lightweight PCIe function of an SR-IOV device.
2. Configure VLAN, MAC and spoof check on the PF.
3. Persist VF creation at boot.
4. Guest needs VF driver (iavf, mlx5).
5. Monitor per-VF counters.
PF config → VF → VM driver
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
ip link show enp65s0f0Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Checks Verify boundary
ip link show enp65s0f0 # lists vf 0..N with MAC/VLAN
lspci | grep 'Virtual Function'
Step 2 Common mistakes Narrow the fault
- VF MAC/VLAN not set on the host, so the guest can spoof addresses (
ip link set <pf> vf 0 mac … vlan 20 spoofchk on). - Guest lacks the VF driver.
- VF count lost after reboot — persist it with a udev rule or systemd unit.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- VF count set via sysfs or driver option.
- VF settings (VLAN, MAC) from the PF.
- Persist VFs across reboots.
echo 8 > /sys/class/net/<pf>/device/sriov_numvfs— create VFsip link show <pf>— VF MAC/VLAN/spoofchkip link set <pf> vf 0 vlan 20 mac <mac>— set VF config
ReferenceWhy it matters1 section · depth on demand
What a VF is
A physical function (PF) is the full PCIe device with all controls. Each virtual function (VF) is a lightweight PCIe function with its own queues and MAC address but limited configuration. VFs are passed to VMs, which load a VF driver (for example iavf for Intel, mlx5_core for NVIDIA/Mellanox) and send traffic directly to the NIC hardware.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Virtual Functions are created by the PF driver and appear as separate PCI devices (lspci | grep 'Virtual Function'). Each VF has its own MAC, queues and optional VLAN/rate limit, but shares the physical port bandwidth.
lspci -nn | grep -i 'virtual function'
qm set 120 --hostpci1 0000:3b:02.0 # assign one VF
ip link set ens1f0 vf 0 max_tx_rate 2000 # Mbit/s
Make VF creation persistent (systemd unit, udev rule or NIC-specific config), because sriov_numvfs resets on reboot. Guest needs the VF driver (e.g. iavf, mlx5_core).
VF limits
The number of VFs per port depends on the NIC (often 8–128). Each VF counts as a PCIe function for the VM and consumes NIC queues. Check sriov_totalvfs for the maximum.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in PCI & Device Passthrough → Virtual Functions. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/driver-api/vfio.html · confidence 94%