blob: 339f5f13c3e0809594592c16cea32f27f5ec66aa [file] [log] [blame]
Nathan Skrzypczakf47122e2021-10-08 14:05:35 +02001Intel AVF device driver
2=======================
3
4Overview
5--------
6
7This plugins provides native device support for intel Adaptive Virtual
8Function (AVF). AVF is driver specification for current and future Intel
9Virtual Function devices. AVF defines communication channel between
10Physical Functions (PF) and VF. In essence, today this driver can be
11used only with Intel XL710 / X710 / XXV710 adapters.
12
13Prerequisites
14-------------
15
16- Driver requires newer i40e PF linux driver to be installed on the
17 system, which supports virtualchnl interface. This code is tested
18 with i40e driver version 2.4.6.
19
20- Driver requires MSI-X interrupt support, which is not supported by
21 uio_pci_generic driver, so vfio-pci needs to be used. On systems
22 without IOMMU vfio driver can still be used with recent kernels which
23 support no-iommu mode.
24
25Known issues
26------------
27
28This driver is still in experimental phase, however it shows very good
29performance numbers.
30
31Usage
32-----
33
34System setup
35~~~~~~~~~~~~
36
371. load VFIO driver
38
39::
40
41 sudo modprobe vfio-pci
42
432. (systems without IOMMU only) enable unsafe NOIOMMU mode
44
45::
46
47 echo Y | sudo tee /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
48
493. Create and bind SR-IOV virtual function(s)
50
51Following script creates VF, assigns MAC address and binds VF to
52vfio-pci
53
54.. code:: bash
55
56 #!/bin/bash
57
58 if [ $USER != "root" ] ; then
59 echo "Restarting script with sudo..."
60 sudo $0 ${*}
61 exit
62 fi
63
64 setup () {
65 cd /sys/bus/pci/devices/${1}
66 driver=$(basename $(readlink driver))
67 if [ "${driver}" != "i40e" ]; then
68 echo ${1} | tee driver/unbind
69 echo ${1} | tee /sys/bus/pci/drivers/i40e/bind
70 fi
71 ifname=$(basename net/*)
72 echo 0 | tee sriov_numvfs > /dev/null
73 echo 1 | tee sriov_numvfs > /dev/null
74 ip link set dev ${ifname} vf 0 mac ${2}
75 ip link show dev ${ifname}
76 vf=$(basename $(readlink virtfn0))
77 echo ${vf} | tee virtfn0/driver/unbind
78 echo vfio-pci | tee virtfn0/driver_override
79 echo ${vf} | sudo tee /sys/bus/pci/drivers/vfio-pci/bind
80 echo | tee virtfn0/driver_override
81 }
82
83 # Setup one VF on PF 0000:3b:00.0 and assign MAC address
84 setup 0000:3b:00.0 00:11:22:33:44:00
85 # Setup one VF on PF 0000:3b:00.1 and assign MAC address
86 setup 0000:3b:00.1 00:11:22:33:44:01
87
88Promisc mode
89~~~~~~~~~~~~
90
91In cases when interface is used in the L2 mode or promisc mode is needed
92for some other reason, trust needs to be set to “on” using the linux “ip
93link” utility.
94
95::
96
97 ip link set dev <PF inteface name> vf <VF id> trust on
98
99L2 spoofing check
100~~~~~~~~~~~~~~~~~
101
102By default Virtual Function is not allowed to send ethernet frames which
103have source MAC address different than address assigned to the VF. In
104some cases it is expected that VPP will send such frames (e.g. L2
105bridging, bonding, l2 cross-connect) and in such cases spoof check needs
106to be turned off by issuing following command:
107
108::
109
110 ip link set dev <PF inteface name> vf <VF id> spoofchk off
111
112Interface Creation
113~~~~~~~~~~~~~~~~~~
114
115Interfaces can be dynamically created by using following CLI:
116
117::
118
119 create interface avf 0000:3b:02.0
120 set int state avf-0/3b/2/0 up
121
122Interface Deletion
123~~~~~~~~~~~~~~~~~~
124
125Interface can be deleted with following CLI:
126
127::
128
129 delete interface avf <interface name>
130
131Interface Statistics
132~~~~~~~~~~~~~~~~~~~~
133
134Interface statistics can be displayed with
135``sh hardware-interface <if-name>`` command.