Creating Virtual Functions Using SR-IOV


SR-IOV mode allows partitioning of SR-IOV capability on Ethernet NIC resources logically, and exposes them to a virtual machine as a separate PCI function called a virtual function (VF).

This video demonstrates how to create virtual functions using SR-IOV mode.


Title: Creating Virtual Functions using SR-IOV

Hi, in this video you'll learn how to create virtual functions using SR-IOV mode. 
My name is Nancy Yadav, and this video is brought to you by CommuNICation Infrastructure Division from Intel. 

SR-IOV stands for Single Root input output Virtualization. 
SR-IOV mode allows partitioning of SR-IOV capability on Ethernet NIC resources logically, and exposes them to a virtual machine as a separate PCI function called a “Virtual Function”. In other words, SR-IOV allows sharing of 1 physical NIC port among multiple VMs. 

To do that: 
1. Make sure VT-D is <enabled> in BIOS configuration. Then, pass intel_iommu=on and iommu=pt in system grub confirguration file. 

Let's see how to do it:
- Once you've enabled vt-d in bios, and login into your system, check operating system version and kernel version, by using command uname. 
- Next pass iommu kernel parameters into grub file. The purpose of passing iommu in grub file is that IOMMU maps device "visible virtual addresses" to "physical addresses", without which sharing one physical NIC to multiple vms is not possible. To do that, open grub file and find your os & kernel version to locate where you need to add iommu paramaters. Then pass intel_iommu=on and iommu=pt, that stands for passthrough. and save file. 

2. If you're using OS desktop version, you can directy reboot it now. However if you're using OS server version, you've to first execute grub update command, and then reboot. The grub update command is update-grub. 

3. After reboot, type: 
"dmesg | grep Virtualization" to verify vt-d is ON. 
then type "cat /proc/cmdline", and cross-verify whether you see passed iommu parameters. 

4. Now we'll create virtual functions. Go to dpdk tool directory and check NIC devices status, by using dpdk-devbind tool. 
5. As we can see, there is no igb_uio driver. Now we'll go ahead and install igb_uio driver. You can install it from DPDk package, like I am doing.     
    Type modprobe uio and then insmod  igb_uio.ko file. 
    Check status again to ensure we see dpdk compatible igb_uio driver. 
6. Next, check virtual functions associated with selected NIC ports. This we can do by following commands.     
    cat /sys/bus/pci/devices/0000\:04\:00.0/SR-IOV_numvfs
    cat /sys/bus/pci/devices/0000\:04\:00.1/SR-IOV_numvfs
    As we can see there are zero virtual functions associated with these NIC ports. So, in next step we will create one virtual function for each NIC port. 
    echo 1 > /sys/bus/pci/devices/0000\:04\:00.0/SR-IOV_numvfs
    echo 1 > /sys/bus/pci/devices/0000\:04\:00.1/SR-IOV_numvfs
    Run dpdk-devbind tool, to check whether we can see newly created virtual functions.  
    ./ --st 
    As we can see now, two virtual functions created and ready to use for our dpdk application. 

Please Note:
Here I created one virtual function for each port of a physical NIC. You can create many virtual functions depending upon your requirement and the physical NIC that you're using. For example, if you're using Intel 82599 10 Gigabit Ethernet NIC, you can enable maximum of 63 Virtual Functions per port. Check you NIC speicifications to find out how many maximum vfs supported for your NIC. 
This completes this video on "Creating Virtual Functions using SR-IOV". In summary, you saw what SR-IOV means, and how you can use SR-IOV mode to Share one physical NIC port among multiple VMs. 

In subsequent videos, I'll show you how to bind newly created VFs to your DPDK application.  


:::: SCRIPT :::

1. uname -a 
2. Open grub 
    pass kernel paramaters to your grub file intel_iommu=on iommu=pt 
3. type: reboot   

4. dmesg | grep Virtualization

5. cat /proc/cmdline

6. cd /root/DPDK/dpdk-16.07    

    lspci | grep Eth 
    tools/ --st        
7.     modprobe uio 
    insmod igb_uio.ko 
    cat /sys/bus/pci/devices/0000\:04\:00.0/SR-IOV_numvfs
    cat /sys/bus/pci/devices/0000\:04\:00.1/SR-IOV_numvfs

    echo 1 > /sys/bus/pci/devices/0000\:04\:00.0/SR-IOV_numvfs
    echo 1 > /sys/bus/pci/devices/0000\:04\:00.1/SR-IOV_numvfs
    lspci | grep Eth  OR ./ --st 

Información sobre productos y desempeño


Los compiladores Intel pueden o no optimizar al mismo nivel para los microprocesadores que no son Intel en optimizaciones que no son exclusivas de los microprocesadores Intel. Estas optimizaciones incluyen los conjuntos de instrucciones SSE2, SSE3 y SSSE3, y otras optimizaciones. Intel no garantiza la disponibilidad, funcionalidad o eficacia de ninguna optimización en microprocesadores que no sean fabricados por Intel. Las optimizaciones dependientes del microprocesador en este producto fueron diseñadas para usarse con microprocesadores Intel. Ciertas optimizaciones no específicas de la microarquitectura Intel se reservan para los microprocesadores Intel. Consulte las guías de referencia y para el usuario para obtener más información acerca de los conjuntos de instrucciones específicos cubiertos por este aviso.

Revisión del aviso n.° 20110804