Pcornel
Browse topics
Options
Recent
Favorites
Virtualization · Technical reference

Virtual Functions

Direct 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.

When to use this

Use this when creating and assigning SR-IOV virtual functions.

First 30 seconds

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.

Operational verification

PF config → VF → VM driver

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
virtualization-hardware
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformvirtualization-hardware
Key commandip link show enp65s0f0
Scope / prerequisiteUse this when creating and assigning SR-IOV virtual functions.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points
  • VF count set via sysfs or driver option.
  • VF settings (VLAN, MAC) from the PF.
  • Persist VFs across reboots.
Key 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
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).

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docvirtualization-hardware current

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%
Confirmation

Confirm action

Continue?