177. VFD as SRIOV Policy Manager Tests¶
VFD is SRIOV Policy Manager (daemon) running on the host allowing configuration not supported by kernel NIC driver, supports ixgbe and i40e drivers’ NIC. Run on the host for policy decisions w.r.t. what a VF can and can not do to the PF. Only the DPDK PF would provide a callback to implement these features, the normal kernel drivers would not have the callback so would not support the features. Allow passing information to application controlling PF when VF message box event received such as those listed below, so action could be taken based on host policy. Stop VM1 from asking for something that compromises VM2.
Multiple purposes:
set VF MAC anti-spoofing
set VF VLAN anti-spoofing
set TX loopback
set VF unicast promiscuous mode
set VF multicast promiscuous mode
set VF MTU
get/reset VF stats
set VF MAC address
set VF VLAN stripping
VF VLAN insertion
set VF broadcast mode
set VF VLAN tag
set VF VLAN filter
Set/reset the queue drop enable bit for all pools(only ixgbe support)
- Set/reset the enable drop bit in the split receive control register
(only ixgbe support)
VFD also includes VF to PF mailbox message management by APP. When PF receives mailbox messages from VF, PF should call the callback provided by APP to know if they’re permitted to be processed.
177.1. Prerequisites¶
Host PF in DPDK driver. Create 2 VFs from 1 PF with dpdk driver, take 82599 for example:
./usertools/dpdk-devbind.py -b igb_uio 81:00.0 echo 2 >/sys/bus/pci/devices/0000:81:00.0/max_vfs
Detach VFs from the host:
rmmod ixgbevf
Passthrough VF 81:10.0 to vm0 and passthrough VF 81:10.2 to vm1, start vm0 and vm1
Login vm0 and vm1, then bind VF0 device to igb_uio driver.
Start testpmd on host and vm0 in chained port topology:
./<build_target>/app/dpdk-testpmd -c f -n 4 -- -i --port-topology=chained
177.2. Test Case 1: Set VLAN insert for VF from PF¶
Disable vlan insert for VF0 from PF:
testpmd> set vf vlan insert 0 0 0
Start VF0 testpmd, set it in mac forwarding mode and enable verbose output
Send packet from tester to VF0 without vlan id
Stop VF0 testpmd and check VF0 can receive packet without any vlan id
Enable vlan insert and insert random vlan id (1~4095) for VF0 from PF:
testpmd> set vf vlan insert 0 0 id
Start VF0 testpmd
Send packet from tester to VF0 without vlan id
Stop VF0 testpmd and check VF0 can receive packet with configured vlan id
177.3. Test Case 2: Set VLAN strip for VF from PF¶
Disable vlan strip for all queues for VF0 from PF:
testpmd> set vf vlan stripq 0 0 off
Start VF0 testpmd, add rx vlan id as random 1~4095, set it in mac forwarding mode and enable verbose output:
testpmd> rx_vlan add id 0
Send packet from tester to VF0 with configured vlan id
Stop VF0 testpmd and check VF0 can receive packet with configured vlan id
Enable vlan strip for all queues for VF0 from PF:
testpmd> set vf vlan stripq 0 0 on
Start VF0 testpmd
Send packet from tester to VF0 with configured vlan id
Stop VF0 testpmd and check VF0 can receive packet without any vlan id
Remove vlan id on VF0
177.4. Test Case 3: Set VLAN antispoof for VF from PF¶
Disable vlan filter and strip from PF:
testpmd> vlan set filter off 0 testpmd> vlan set strip off 0
Add a random 1~4095 vlan id to set filter from PF for VF:
testpmd> rx_vlan add id port 0 vf 1
Disable vlan antispoof for VF from PF:
testpmd> set vf vlan antispoof 0 0 off
Disable vlan filter and strip on VF0
Start testpmd on VF0, set it in mac forwarding mode and enable print:
testpmd> set verbose 1
Send packets with matching/non-matching/no vlan id on tester port
Stop VF0 testpmd and check VF0 can receive and transmit packets with matching/non-matching/no vlan id
Enable mac antispoof and vlan antispoof for vf from PF:
testpmd> set vf mac antispoof 0 0 on testpmd> set vf vlan antispoof 0 0 on
Start VF0 testpmd
Send packets with matching/non-matching/no vlan id on tester port
Stop VF0 testpmd and check VF0 can receive all but only transmit packet with matching vlan id
177.5. Test Case 5: Set the MAC address for VF from PF¶
Set VF0 different MAC address from PF, such as A2:22:33:44:55:66
testpmd> set vf mac addr 0 0 A2:22:33:44:55:66
Stop VF0 testpmd and restart VF0 testpmd, check VF0 address is configured address A2:22:33:44:55:66
Set testpmd in mac forwarding mode and enable verbose output
Send packet from tester to VF0 configured address
Stop VF0 testpmd and check VF0 can receive packet
177.6. Test Case 6: Enable/disable tx loopback¶
Disable tx loopback for VF0 from PF:
testpmd> set tx loopback 0 off
Set VF0 in rxonly forwarding mode and start testpmd
Tcpdump on the tester port
Send 10 packets from VF1 to VF0
Stop VF0 testpmd, check VF0 can’t receive any packet but tester port could capture packet
Enable tx loopback for VF0 from PF:
testpmd> set tx loopback 0 on
Start VF0 testpmd
Send packet from VF1 to VF0
Stop VF0 testpmd, check VF0 can receive packet, but tester port can’t capture packet
177.7. Test Case 7: Set drop enable bit for all queues¶
Bind VF1 device to igb_uio driver and start testpmd in chained port topology with 1024 rx descriptor “–rxd=1024”
Disable drop enable bit for all queues from PF:
testpmd> set all queues drop 0 off
Only start VF1 to capture packet, set it in rxonly forwarding mode and enable verbose output
Send 2000 packets to VF0, packet number should be more than rx descriptor(1024) to make VF0 queue full of packets
Send 20 packets to VF1
Stop VF1 testpmd and check VF1 can’t receive packet
Enable drop enable bit for all queues from PF:
testpmd> set all queues drop 0 on
Start VF1 testpmd
Stop VF1 testpmd and check VF1 can receive original queue buffer 20 packets
Start VF1 testpmd
Send 20 packets to VF1
Stop VF1 testpmd and check VF1 can receive 20 packets
177.8. Test Case 8: Set split drop enable bit for VF from PF¶
Disable split drop enable bit for VF0 from PF:
testpmd> set vf split drop 0 0 off
Set VF0 and host in rxonly forwarding mode and start testpmd
Send a burst of 20000 packets to VF0 and check PF and VF0 can receive all packets
Enable split drop enable bit for VF0 from PF:
testpmd> set vf split drop 0 0 on
Send a burst of 20000 packets to VF0 and check some packets dropped on PF and VF0
177.9. Test Case 9: Show/Clear stats for VF from PF¶
Show stats output for VF0 from PF, and check RX/TX packets is 0:
testpmd> show vf stats 0 0
Set VF0 in mac forwarding mode and start testpmd
Send 10 packets to VF0 and check VF0 can receive 10 packets
Show stats for VF0 from PF, and check RX/TX packets is 10
Clear stats for VF0 from PF, and check PF and VF0 RX/TX packets is 0:
testpmd> clear vf stats 0 0 testpmd> show vf stats 0 0
177.10. Test Case 10: enhancement to identify VF MTU change¶
Set DPDK PF mtu size is 9000.
testpmd> port stop all testpmd> port config mtu 0 9000 testpmd> port start all
Set VF0 in mac forwarding mode and start testpmd
Default mtu size is 1500, send one packet with length bigger than default mtu size, such as 2000 from tester, check VF0 can receive but can’t transmit packet
Set VF0 mtu size as 3000, but need to stop then restart port to active mtu:
testpmd> port stop all testpmd> port config mtu 0 3000 testpmd> port start all testpmd> start
Send one packet with length 2000 from tester, check VF0 can receive and transmit packet
Send one packet with length bigger than configured mtu size, such as 5000 from tester, check VF0 can receive but can’t transmit packet
177.11. Test Case 11: Enable/disable vlan tag forwarding to VSIs¶
Disable VLAN tag for VF0 from PF:
testpmd> set vf vlan tag 0 0 off
Start VF0 testpmd, add rx vlan id as random 1~4095, set it in mac forwarding mode and enable verbose output
Send packet from tester to VF0 with vlan tag(vlan id should same as rx_vlan)
Stop VF0 testpmd and check VF0 can’t receive vlan tag packet
Enable VLAN tag for VF0 from PF:
testpmd> set vf vlan tag 0 0 on
Start VF0 testpmd
Send packet from tester to VF0 with vlan tag(vlan id should same as rx_vlan)
Stop VF0 testpmd and check VF0 can receive vlan tag packet
Remove vlan id on VF0
177.12. Test Case 12: Broadcast mode¶
Start testpmd on VF0, set it in rxonly mode and enable verbose output
Disable broadcast mode for VF0 from PF:
testpmd> set vf broadcast 0 0 off
Send packets from tester with broadcast address, ff:ff:ff:ff:ff:ff, and check VF0 can not receive the packet
Enable broadcast mode for VF0 from PF:
testpmd> set vf broadcast 0 0 on
Send packets from tester with broadcast address, ff:ff:ff:ff:ff:ff, and check VF0 can receive the packet
177.13. Test Case 13: Multicast mode¶
Start testpmd on VF0, set it in rxonly mode and enable verbose output
Disable promisc and multicast mode for VF0 from PF:
testpmd> set vf promisc 0 0 off testpmd> set vf allmulti 0 0 off
Send packet from tester to VF0 with multicast MAC, and check VF0 can not receive the packet
Enable multicast mode for VF0 from PF:
testpmd> set vf allmulti 0 0 on
Send packet from tester to VF0 with multicast MAC, and check VF0 can receive the packet
177.14. Test Case 14: Promisc mode¶
Start testpmd on VF0, set it in rxonly mode and enable verbose output
Disable promisc mode for VF from PF:
testpmd>set vf promisc 0 0 off
Send packet from tester to VF0 with random MAC, and check VF0 can not receive the packet
Send packet from tester to VF0 with correct MAC, and check VF0 can receive the packet
Enable promisc mode for VF from PF:
testpmd>set vf promisc 0 0 on
Send packet from tester to VF0 with random MAC, and the packet can be received by VF0
Send packet from tester to VF0 with correct MAC, and the packet can be received by VF0
177.15. Test Case 14: Set Vlan filter for VF from PF¶
Start VF0 testpmd, set it in rxonly forwarding mode, enable verbose output
Send packet without vlan id to random MAC, check VF0 can receive packet
Add vlan filter id as random 1~4095 for VF0 from PF:
testpmd> rx_vlan add id port 0 vf 1
Send packet from tester to VF0 with wrong vlan id to random MAC, check VF0 can’t receive packet
Send packet from tester to VF0 with configured vlan id to random MAC, check VF0 can receive packet
Remove vlan filter id for VF0 from PF:
testpmd> rx_vlan rm id port 0 vf 1
Send packet from tester to VF0 with wrong vlan id to random MAC, check VF0 can receive packet
Send packet from tester to VF0 with configured vlan id to random MAC, check VF0 can receive packet
Send packet without vlan id to random MAC, check VF0 can receive packet
177.16. Test Case 15: Ixgbe vf jumbo frame test¶
Default mtu size is 1500, send one packet with length bigger than default mtu size to VF0, such as 2000 from tester, check VF0 can’t receive packet
Set VF0 mtu size as 3000, but need to stop then restart port to active mtu:
testpmd> port stop all testpmd> port config mtu 0 3000 testpmd> port start all testpmd> start
Send one packet with length 2000 from tester to VF0, check VF0 can receive packet
Send one packet with length bigger than configured mtu size to VF0,such as 4000 from tester, check VF0 can’t receive packet
Quit VF0 testpmd, restart VF0 testpmd, send one packet with length 2000 from tester to VF0, check VF0 can receive packet
send one packet with length bigger than configured mtu size to VF0, such as 5000 from tester, check VF0 can’t receive packet
notes: only x550 and x540 support jumbo frames.