2017年12月21日 星期四

SRIOV under linux (3.8 later kernel)

SRIOV under linux (3.8 later kernel)

If you meet error when set SRIOV under linux
"unknown parameter max_vfs"
Please check if your OS kernel is 3.8 later

Step:
1. Enable VT-d & SRIOV function in BIOS setup
2. Boot to Linux OS
3. Enable IOMMU support for Linux kernels (If you ignore this step, you will meet host doesn't support passthrough  of host PCI device)
Add "intel_iommu=on
#vim /etc/default/grub


4.Update grub configuration
Legacy mode:
#grub2-mkconfig -o /boot/grub2/grub.cfg
UEFI mode:
#grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

4. Reboot system
5. Update NIC driver ixgbe(Intel X550)
6. use sysfs to enable VFs.
enable VFs => echo $num_vf_enabled > /sys/class/net/$dev/device/sriov_numvfs  
disable VFs => echo 0 > /sys/class/net/$dev/device/sriov_numvfs

For example:
#echo 8 > /sys/class/net/enp175s0f0/device/sriov_numvfs
(Use command "ifconfig -a" to check "enp175s0f0" device name)

If you want to create VF every boot, add into rc.local file
#vim /etc/rc.d/rc.local
add
echo 8 > /sys/class/net/enp175s0f0/device/sriov_numvfs 

On Linux Kernel version 3.8.x and above, the maximum number of VFs supported by the adapter
can be queried by reading the sriov_totalvfs parameter via sysfs interface.
#cat /sys/class/net/device name/device/sriov_totalvfs


7. #lspci   (Check if you can see Ethernet Virtual fuction)
8. Block virtual device in host  (Make VF available for VirtualMachine (VM) assignment)
 #vim /lib/modprobe.d/dist-blacklist.conf
add
blacklist ixgbevf

9.Configure PCI-passthrough on virt-manager
   Add pci device to VM (Not network device)

10.Tried to install vf driver in VM guest
Intel=> VF driver
Broamcom= > Same as physical driver, but please use source driver, make then make install


Reference:
https://www.intel.com/content/www/us/en/embedded/products/networking/xl710-sr-iov-config-guide-gbe-linux-brief.html





沒有留言:

張貼留言