SR-IOV in firmware
Video 094 of 140 in Virtualization Foundations, in the unit “Firmware settings that matter on a virtualization host”. 3:05, with English and Hindi audio.
Some network cards can present themselves as several smaller cards, and each small card can belong to a different virtual machine. The feature is called SR-IOV, and firmware switches it on. This article explains what SR-IOV is, why a busy database may benefit from it, what it costs, and how to check from Linux whether a card supports it.
What you will learn
- SR-IOV lets one physical network card offer several virtual cards.
- The firmware switch turns the feature on, and a virtual card can go to one virtual machine.
- A virtual machine tied to a virtual card is harder to move live to another host.
- Each card can make only as many virtual cards as its hardware allows.
- Check the card's SR-IOV file from Linux, and check the IOMMU setting too.
What SR-IOV is
SR-IOV stands for single root I/O virtualisation. It is a standard that lets one physical network card share itself out. The standard's full name is Single Root I/O Virtualization. Each small card the physical card presents is called a virtual function, or VF.
Why a busy database may want it
At Harbor Point, the warehouse database is busy all day, and every query waits on the network. Usually, its packets pass through the hypervisor's virtual switch, which costs processor time on every packet. With SR-IOV, the virtual machine gets a virtual function. It talks to the card more directly, and usually with less delay.
One card, many small cards
With SR-IOV off, the card is just one card, and the hypervisor shares it out in software. Turn the setting on in firmware, and the card can make small virtual cards of its own. Each virtual card can then be given straight to one virtual machine.
The card is still one piece of hardware. Its virtual cards share its ports, so the total speed stays within that one card.
Check a card from Linux
Linux shows what a network card can do through a small file for each card. The file holds the largest number of virtual cards that card can make. In the example below, the card is named ens1f0, and the number 64 is only an example.
cat /sys/class/net/ens1f0/device/sriov_totalvfscat /sys/class/net/eth1/device/sriov_totalvfsNote: On a card without SR-IOV support, the same file does not exist, and cat reports that it is missing.
What SR-IOV costs
- Harder live moves: a machine tied to a virtual card is harder to move live to another host, because that card is real hardware.
- A fixed limit: each card can make only so many virtual cards, and the hardware sets the limit.
- The IOMMU: SR-IOV usually needs the IOMMU setting on as well, so check both settings together.
Check two network cards for SR-IOV
You need a Linux host with at least one network card. Replace the card names with your own, such as ens1f0.
Show how many virtual cards the first card can make.
cat /sys/class/net/ens1f0/device/sriov_totalvfsWhat you should see: The file holds one number, the largest count of virtual cards this card can make. The example shows 64.
Check a second card. A card without SR-IOV support has no such file.
cat /sys/class/net/eth1/device/sriov_totalvfsWhat you should see: A card without SR-IOV support has no such file, so cat reports that it is missing.
Terms
- SR-IOV
- Single root I/O virtualisation: a standard that lets one physical network card present several virtual cards.
- Virtual function
- One of the small virtual cards that an SR-IOV network card presents, and which can be given to one virtual machine.
Check yourself
What is a virtual function?
A small virtual card that an SR-IOV network card presents, and which can be given straight to one virtual machine.
What does the sriov_totalvfs file show?
The largest number of virtual cards the card can make. A missing file means the card has no SR-IOV support.
What else should you check together with SR-IOV?
The IOMMU setting, because SR-IOV usually depends on it as well.
Previous: The IOMMU setting: VT-d or AMD-Vi. Next: Hyper-threading on or off in firmware.