190. VF VLAN Tests¶
The support of VLAN offload features by VF device consists in:
- the filtering of received VLAN packets
- VLAN header stripping by hardware in received [VLAN] packets
- VLAN header insertion by hardware in transmitted packets
190.1. Prerequisites¶
Create VF device from PF devices:
./dpdk_nic_bind.py --st 0000:87:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused= 0000:87:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused= If the drive support vf-vlan-pruning flag: ethtool --set-priv-flags ens259f0 vf-vlan-pruning on ethtool --set-priv-flags ens259f1 vf-vlan-pruning on echo 1 > /sys/bus/pci/devices/0000\:87\:00.0/sriov_numvfs echo 1 > /sys/bus/pci/devices/0000\:87\:00.1/sriov_numvfs ./dpdk_nic_bind.py --st 0000:87:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused= 0000:87:02.0 'XL710/X710 Virtual Function' unused= 0000:87:0a.0 'XL710/X710 Virtual Function' unused=
Detach VFs from the host, bind them to pci-stub driver:
/sbin/modprobe pci-stub using `lspci -nn|grep -i ethernet` got VF device id, for example "8086 154c", echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id echo 0000:87:02.0 > /sys/bus/pci/devices/0000:87:02.0/driver/unbind echo 0000:87:02.0 > /sys/bus/pci/drivers/pci-stub/bind echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id echo 0000:87:0a.0 > /sys/bus/pci/devices/0000:87:0a.0/driver/unbind echo 0000:87:0a.0 > /sys/bus/pci/drivers/pci-stub/bind
Passthrough VFs 87:02.0 & 87:0a.0 to vm0 and start vm0:
/usr/bin/qemu-system-x86_64 -name vm0 -enable-kvm \ -cpu host -smp 4 -m 2048 -drive file=/home/image/sriov-fc20-1.img -vnc :1 \ -device pci-assign,host=87:02.0,id=pt_0 \ -device pci-assign,host=87:0a.0,id=pt_1
Login vm0 and then bind VF devices to igb_uio driver.:
./tools/dpdk_nic_bind.py --bind=igb_uio 00:04.0 00:05.0
Start testpmd, set it in rxonly mode and enable verbose output:
if test IAVF, start up VF port:
dpdk-testpmd -c 0x0f -n 4 -a 00:04.0 -a 00:05.0 -- -i --portmask=0x3 testpmd> set fwd rxonly testpmd> set verbose 1 testpmd> start
Note
according to dpdk commit 5cbfb386aa3f4c49b3cd9579e4e928cc5ab08d35,if not add parameter “enable-hw-vlan”, the vlan offload should be disable.the avx2 behavior is not appropriate, the avx2 and avx512 shouldn’t have gap on vlan offload.this feature will be implemetned in the future.so add parameter “–enable-hw-vlan” in testpmd to test vlan strip.
if test DCF, set VF port to dcf and start up:
Enable kernel trust mode:
ip link set $PF_INTF vf 0 trust on
start testpmd with scalar path:
dpdk-testpmd -c 0x0f -n 4 -a 00:04.0,cap=dcf -a 00:05.0,cap=dcf --force-max-simd-bitwidth=64 -- -i --portmask=0x3
Note
make dcf as full feature pmd is dpdk22.07 feature, and only support E810 series nic. the dcf not support vlan offload and change the rx path in vector path when pmd is initialized, so we use the scalar path to start testpmd(use param “–force-max-simd-bitwidth=64”).
190.2. Test Case 1: Add port based vlan on VF¶
Linux network configuration tool only set pvid on VF devices.
Add pvid on VF0 from PF device:
ip link set $PF_INTF vf 0 vlan 2
Send packet with same vlan id and check VF can receive
Send packet without vlan and check VF can’t receive
Send packet with wrong vlan id and check Vf can’t receive
Check pf device show correct pvid setting:
ip link show ens259f0 ... vf 0 MAC 00:00:00:00:00:00, vlan 1, spoof checking on, link-state auto
190.3. Test Case 2: Remove port based vlan on VF¶
Remove added vlan from PF device:
ip link set $PF_INTF vf 0 vlan 0
Restart testpmd and send packet without vlan and check VF can receive
Set packet with vlan id 0 and check VF can receive
Set packet with random id 1-4095 and check VF can’t receive
190.4. Test Case 3: VF port based vlan tx¶
Add pvid on VF0 from PF device:
ip link set $PF_INTF vf 0 vlan 2
Start testpmd with mac forward mode:
testpmd> set fwd mac testpmd> start
Send packet from tester port1 and check packet received by tester port0:
Check port1 received packet with configured vlan 2
190.5. Test Case 3: VF tagged vlan tx¶
Start testpmd with full-featured tx code path and with mac forward mode:
dpdk-testpmd -c f -n 3 -- -i testpmd> set fwd mac testpmd> start
Add tx vlan offload on VF0, take care the first param is port:
testpmd> tx_vlan set 0 1
Send packet from tester port1 and check packet received by tester port0:
Check port- received packet with configured vlan 1
Rerun with step2-3 with random vlan and max vlan 4095
190.6. Test case4: VF tagged vlan rx¶
Make sure port based vlan disabled on VF0 and VF1
Start testpmd with rxonly mode and parameter “–enable-hw-vlan”:
testpmd> set fwd rxonly testpmd> set verbose 1 testpmd> start
Note
parameter “–enable-hw-vlan” not support nic: IXGBE_10G-82599_SFP.
Send packet without vlan and check packet received
Send packet with vlan 0 and check packet received
Add vlan on VF0 from VF driver:
testpmd> rx_vlan add 1 0
Send packet with vlan0/1 and check packet received
Rerun with step5-6 with random vlan and max vlan 4095
Remove vlan on VF0:
rx_vlan rm 1 0
Send packet with vlan 0 and check packet received
Send packet without vlan and check packet received
Send packet with vlan 1 and check packet can’t received
190.7. Test case5: VF Vlan strip test¶
Start testpmd with mac forward mode and parameter “–enable-hw-vlan”:
testpmd> set fwd mac testpmd> set verbose 1 testpmd> start
Note
parameter “–enable-hw-vlan” not support nic: IXGBE_10G-82599_SFP.
Add tagged vlan 1 on VF0:
testpmd> rx_vlan add 1 0
Disable VF0 vlan strip and sniff packet on tester port1:
testpmd> vlan set strip off 0
Set packet from tester port0 with vlan 1 and check sniffed packet has vlan
Enable vlan strip on VF0 and sniff packet on tester port1:
testpmd> vlan set strip on 0
Send packet from tester port0 with vlan 1 and check sniffed packet without vlan
Send packet from tester port0 with vlan 0 and check sniffed packet without vlan
Rerun with step 2-8 with random vlan and max vlan 4095