This section describes how to configure SR-IOV.
Enabling Virtual Functions Through sysfs
You can enable VFs through sysfs:
- Use the following command to enable
VFs:
For example to enable two VFs on the eth8 PF:echo <numvfs> > /sys/class/net/<interface>/device/sriov_numvfsecho 2 > /sys/class/net/eth8/device/sriov_numvfs - Use the following command to view the enabled
VFs:
For example to view the enabled VFs on the eth8 PF:cat /sys/class/net/<interface>/device/sriov_totalvfscat /sys/class/net/eth8/device/sriov_totalvfs
Enabling Virtual Functions with Module Options
You can instead use the AMD Solarflare net driver
module option max_vfs to enable VFs. This is useful if the kernel
does not provide VF control via sysfs.
You should set the max_vfs module option in a
user-created file (for example sfc.conf) in the /etc/modprobe.d directory. Its value applies to all adapters:
- You can set it to a single integer for all adapter PFs to have the same number of VFs. For
example:
options sfc max_vfs=4 - You can set it to a comma separated list to have different numbers of VFs per PF. For
example:
options sfc max_vfs=2,4,8The first VF count is assigned to the PF with the lowest index (that is, the lowest MAC address), then the next VF count to the PF with the next highest MAC address, and so on.
Reload the sfc driver following any changes to its module options:
modprobe -r sfc
modprobe sfc
Assigning VLAN Tags
You can dynamically assigned VLAN tags to VFs using libvirt commands, or using the ip command:
ip link vf NUM [mac LLADDR] [vlan VLANID]
To ensure VLAN tags persist after reboot, you can configure them in the VM XML file.
Using OpenOnload in a Virtual Machine
Onload users should refer to the Onload User Guide (UG1586) for further information about using Onload in a KVM.
When Onload and the sfc net driver have been installed in the guest, the sfc
driver module option num_vis is used to allocate the required
number of virtual interfaces. One VI is needed for each Onload stack using a VF.
You should enable driver module options in a user-created file (for example sfc.conf) in the /etc/modprobe.d directory.
options sfc num_vis=<num>
Reload the driver after setting/changing this value:
# onload_tool reload