test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio
@ 2018-11-28  7:01 zhao,meijuan
  2018-11-28  7:01 ` [dts] [PATCH V2 2/2] test_plans/vf " zhao,meijuan
  2018-11-28  8:26 ` [dts] [PATCH V2 1/2] tests/vf " Tu, Lijuan
  0 siblings, 2 replies; 4+ messages in thread
From: zhao,meijuan @ 2018-11-28  7:01 UTC (permalink / raw)
  To: dts; +Cc: zhao,meijuan

Signed-off-by: zhao,meijuan <meijuanx.zhao@intel.com>
---
 tests/TestSuite_vf_macfilter.py | 51 +++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 15 deletions(-)

diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py
index f0de169..bf94016 100644
--- a/tests/TestSuite_vf_macfilter.py
+++ b/tests/TestSuite_vf_macfilter.py
@@ -13,13 +13,14 @@ VM_CORES_MASK = 'all'
 class TestVfMacFilter(TestCase):
 
     supported_vf_driver = ['pci-stub', 'vfio-pci']
+    vf0_wrongmac = "00:11:22:33:48:55"
+    vf0_setmac = "00:11:22:33:44:55"
 
     def set_up_all(self):
         self.dut_ports = self.dut.get_ports(self.nic)
         self.verify(len(self.dut_ports) > 1, "Insufficient ports")
         self.vm0 = None
         self.pf0_vf0_mac = "00:12:34:56:78:01"
-        self.iplinkset = True
 
         # set vf assign method and vf driver
         self.vf_driver = self.get_suite_cfg()['vf_driver']
@@ -36,14 +37,14 @@ class TestVfMacFilter(TestCase):
 
         self.setup_2pf_2vf_1vm_env_flag = 0
 
-    def setup_2pf_2vf_1vm_env(self, driver='default'):
+    def setup_2pf_2vf_1vm_env(self, driver='default',set_mac):
 
         self.used_dut_port_0 = self.dut_ports[0]
         self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 1, driver=driver)
         self.sriov_vfs_port_0 = self.dut.ports_info[self.used_dut_port_0]['vfs_port']
         pf_intf0 = self.dut.ports_info[0]['port'].get_interface_name()
         
-        if self.iplinkset: 
+        if set_mac: 
             self.dut.send_expect("ip link set %s vf 0 mac %s" %(pf_intf0, self.pf0_vf0_mac), "#")
        
         self.used_dut_port_1 = self.dut_ports[1]
@@ -124,15 +125,17 @@ class TestVfMacFilter(TestCase):
 ###### send the packets with wrong MAC address to VF, check if the VF will not RX the packets.
  
     def test_kernel_2pf_2vf_1vm_iplink_macfilter(self):
+        self.setup_2pf_2vf_1vm_env(driver='',True)
+        self.result_verify_iplink(True)
 
-        self.setup_2pf_2vf_1vm_env(driver='')
-
+    def result_verify_iplink(self,set_mac):
+        if set_mac == False:
+            self.host_testpmd.execute_cmd('set vf mac addr 0 0 %s' % self.pf0_vf0_mac)
         self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
         self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         # Get VF's MAC
         pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
-        vf0_wrongmac = "00:11:22:33:48:55"
         self.vm0_testpmd.execute_cmd('set promisc all off')
         self.vm0_testpmd.execute_cmd('set fwd mac')
         self.vm0_testpmd.execute_cmd('start')
@@ -147,18 +150,19 @@ class TestVfMacFilter(TestCase):
         src_mac = self.tester.get_mac(tx_port)
         pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
         
-        print "\nfirst send packets to the kernel PF set MAC, expected result is RX packets=TX packets\n"
+        print "\nfirst send packets to the PF set MAC, expected result is RX packets=TX packets\n"
         result1 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
 	print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')   
         self.verify(result1 != False, "VF0 failed to forward packets to VF1")
         
         print "\nSecondly, negative test, send packets to a wrong MAC, expected result is RX packets=0\n"
-        dst_mac = vf0_wrongmac
+        dst_mac = self.vf0_wrongmac
         pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
         result2 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
         print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
         self.verify(result2 != True, "VF0 failed to forward packets to VF1")
 
+
 #######2. test case for kernel pf and dpdk vf 2pf_2vf_1vm MAC filter scenario.
 ####### kernel pf will not set MAC address and the VF will get a random generated MAC
 ####### in the testpmd in VM, and then add VF mac address in the testpmd,for example, VF_MAC1
@@ -168,19 +172,36 @@ class TestVfMacFilter(TestCase):
 
     def test_kernel_2pf_2vf_1vm_mac_add_filter(self):
 
-        self.iplinkset = False
-        self.setup_2pf_2vf_1vm_env(driver='')
+        self.setup_2pf_2vf_1vm_env(driver='',False)
+        self.send_packet_and_verify()
+
+#######3. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter scenario.
+####### kernel pf will not set MAC address and the VF will get a random generated MAC
+####### in the testpmd in VM, and then add VF mac address in the testpmd,for example, VF_MAC1
+####### then send packets to the VF with the random generated MAC and the new added VF_MAC1
+####### and the expected result is that all packets can be RXed and TXed. What's more, send
+####### packets with a wrong MAC address to the VF will not received by the VF.
+    def test_dpdk_2pf_2vf_1vm_mac_add_filter(self):
+        self.setup_2pf_2vf_1vm_env(driver='igb_uio',False)
+        self.send_packet_and_verify()
+
+######4. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter scenario
+###### dpdk pf will first run 'set vf mac addr 0 0 xx:xx:xx:xx:xx:xx, then
+###### in the vm, send packets with this MAC to VF, check if the MAC filter works. Also
+###### send the packets with wrong MAC address to VF, check if the VF will not RX the packets.
+    def test_dpdk_2pf_2vf_1vm_iplink_macfilter(self):
+        self.setup_2pf_2vf_1vm_env(driver='igb_uio',False)
+        self.result_verify_iplink(False)
 
+    def send_packet_and_verify(self):
         self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
         self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         
         # Get VF0 port MAC address
         pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
-        vf0_setmac = "00:11:22:33:44:55"
-        vf0_wrongmac = "00:11:22:33:48:55"
         self.vm0_testpmd.execute_cmd('set promisc all off')
-        ret = self.vm0_testpmd.execute_cmd('mac_addr add 0 %s' %vf0_setmac)
+        ret = self.vm0_testpmd.execute_cmd('mac_addr add 0 %s' %self.vf0_setmac)
         # check the operation is supported or not.
         print ret 
  
@@ -203,14 +224,14 @@ class TestVfMacFilter(TestCase):
         self.verify(result1 != False, "VF0 failed to forward packets to VF1")
         
         print "\nsecondly, send packets to the new added MAC, expected result is RX packets=TX packets\n"
-        dst_mac = vf0_setmac
+        dst_mac = self.vf0_setmac
         pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
         result2 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
         print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
         self.verify(result2 != False, "VF0 failed to forward packets to VF1")
 
         print "\nThirdly, negative test, send packets to a wrong MAC, expected result is RX packets=0\n"
-        dst_mac = vf0_wrongmac
+        dst_mac = self.vf0_wrongmac
         pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
         result3 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
         print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
-- 
2.17.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dts] [PATCH V2 2/2] test_plans/vf macfilter: add dpdk pf test scenorio
  2018-11-28  7:01 [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio zhao,meijuan
@ 2018-11-28  7:01 ` zhao,meijuan
  2018-11-28  8:28   ` Tu, Lijuan
  2018-11-28  8:26 ` [dts] [PATCH V2 1/2] tests/vf " Tu, Lijuan
  1 sibling, 1 reply; 4+ messages in thread
From: zhao,meijuan @ 2018-11-28  7:01 UTC (permalink / raw)
  To: dts; +Cc: zhao,meijuan

Signed-off-by: zhao,meijuan <meijuanx.zhao@intel.com>
---
 test_plans/vf_macfilter_test_plan.rst | 190 ++++++++++++++++++++++++--
 1 file changed, 182 insertions(+), 8 deletions(-)

diff --git a/test_plans/vf_macfilter_test_plan.rst b/test_plans/vf_macfilter_test_plan.rst
index 221c05e..715c66d 100644
--- a/test_plans/vf_macfilter_test_plan.rst
+++ b/test_plans/vf_macfilter_test_plan.rst
@@ -39,7 +39,7 @@ Test Case 1: test_kernel_2pf_2vf_1vm_iplink_macfilter
 
 1. Get the pci device id of DUT, for example::
 
-      ./dpdk_nic_bind.py --st
+      ./usertools/dpdk-devbind.py -s
 
       0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
       0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
@@ -49,7 +49,7 @@ Test Case 1: test_kernel_2pf_2vf_1vm_iplink_macfilter
       echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/sriov_numvfs
       echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/sriov_numvfs
 
-      ./dpdk_nic_bind.py --st
+      ./usertools/dpdk-devbind.py -s
       0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
       0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
       0000:81:02.0 'XL710/X710 Virtual Function' unused=
@@ -76,7 +76,7 @@ Test Case 1: test_kernel_2pf_2vf_1vm_iplink_macfilter
       virsh nodedev-detach pci_0000_81_02_0;
       virsh nodedev-detach pci_0000_81_0a_0;
 
-      ./dpdk_nic_bind.py --st
+      ./usertools/dpdk-devbind.py -s
 
       0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
       0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
@@ -96,7 +96,7 @@ Test Case 1: test_kernel_2pf_2vf_1vm_iplink_macfilter
    bind them to igb_uio driver, and then start testpmd, enable CRC strip,
    disable promisc mode,set it in mac forward mode::
 
-      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
+      ./usertools/dpdk-devbind.py --bind=igb_uio 00:06.0 00:07.0
       ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0 -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
 
       testpmd> port stop all
@@ -119,7 +119,7 @@ Test Case 2: test_kernel_2pf_2vf_1vm_mac_add_filter
 
 1. Get the pci device id of DUT, for example::
 
-      ./dpdk_nic_bind.py --st
+      ./usertools/dpdk-devbind.py -s
 
       0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
       0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
@@ -129,7 +129,7 @@ Test Case 2: test_kernel_2pf_2vf_1vm_mac_add_filter
       echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/sriov_numvfs
       echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/sriov_numvfs
 
-      ./dpdk_nic_bind.py --st
+      ./usertools/dpdk-devbind.py -s
       0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
       0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
       0000:81:02.0 'XL710/X710 Virtual Function' unused=
@@ -154,7 +154,7 @@ Test Case 2: test_kernel_2pf_2vf_1vm_mac_add_filter
       virsh nodedev-detach pci_0000_81_02_0;
       virsh nodedev-detach pci_0000_81_0a_0;
 
-      ./dpdk_nic_bind.py --st
+      ./usertools/dpdk-devbind.py -s
 
       0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
       0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
@@ -174,7 +174,7 @@ Test Case 2: test_kernel_2pf_2vf_1vm_mac_add_filter
    bind them to igb_uio driver, and then start testpmd, enable CRC strip on
    VF, disable promisc mode, add a new MAC to VF0 and then start::
 
-      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
+      ./usertools/dpdk-devbind.py --bind=igb_uio 00:06.0 00:07.0
       ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0 -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
 
       testpmd> port stop all
@@ -199,3 +199,177 @@ Test Case 2: test_kernel_2pf_2vf_1vm_mac_add_filter
 8. Use scapy to send 100 random packets with a wrong MAC to VF0, verify the
    packets can't be received by one VF and can be forward to another VF
    correctly.
+
+Test Case 3: test_dpdk_2pf_2vf_1vm_mac_add_filter
+===================================================
+
+1. Get the pci device id of DUT, bind them to igb_uio,for example::
+
+      ./usertools/dpdk-devbind.py -s
+
+      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
+      ./usertools/dpdk-devbind.py --bind=igb_uio 0000:81:00.0 0000:81:00.1
+      
+
+2. Create 2 VFs from 2 PFs, and don't set the VF MAC address at PF0::
+
+      echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/max_vfs
+      echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/max_vfs
+
+      ./usertools/dpdk-devbind.py -s
+      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+'  drv=igb_uio unused=i40e
+      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+'  drv=igb_uio unused=i40e
+      0000:81:02.0 'XL710/X710 Virtual Function' unused=
+      0000:81:0a.0 'XL710/X710 Virtual Function' unused=
+
+3. Start testpmd::
+
+      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4 -b 0000:81:02.0 -b 0000:81:0a.0 -- -i
+
+4. Detach VFs from the host, bind them to pci-stub driver::
+
+      /sbin/modprobe pci-stub
+
+      using `lspci -nn|grep -i ethernet` to get VF device id, for example "8086 154c",
+
+      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+      echo 0000:81:02.0 > /sys/bus/pci/devices/0000:08:02.0/driver/unbind
+      echo 0000:81:02.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+      echo 0000:81:0a.0 > /sys/bus/pci/devices/0000:08:0a.0/driver/unbind
+      echo 0000:81:0a.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+   or using the following more easy way::
+
+      virsh nodedev-detach pci_0000_81_02_0;
+      virsh nodedev-detach pci_0000_81_0a_0;
+
+      ./dpdk_nic_bind.py --st
+
+      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
+      0000:81:02.0 'XL710/X710 Virtual Function' if= drv=pci-stub unused=
+      0000:81:0a.0 'XL710/X710 Virtual Function' if= drv=pci-stub unused=
+
+   it can be seen that VFs 81:02.0 & 81:0a.0 's driver is pci-stub.
+5. Passthrough VFs 81:02.0 & 81: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=81:02.0,id=pt_0 \
+      -device pci-assign,host=81:0a.0,id=pt_1
+
+6. login vm0, got VFs pci device id in vm0, assume they are 00:06.0 & 00:07.0,
+   bind them to igb_uio driver, and then start testpmd, enable CRC strip on
+   VF, disable promisc mode, add a new MAC to VF0 and then start::
+
+      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
+      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0 -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
+
+      testpmd> port stop all
+      testpmd> port config all crc-strip on
+      testpmd> port start all
+      testpmd> set promisc all off
+      testpmd> mac_addr add 0 00:11:22:33:44:55
+      testpmd> set fwd mac
+      testpmd> start
+
+   Note: In Jan, 2016, i40e doesn't support mac_addr add operation, so the
+   case will be failed for FVL/Fort park NICs.
+
+7. Use scapy to send 100 random packets with current VF0's MAC, verify the
+   packets can be received by one VF and can be forward to another VF
+   correctly.
+
+8. Use scapy to send 100 random packets with new added VF0's MAC, verify the
+   packets can be received by one VF and can be forward to another VF
+   correctly.
+
+9. Use scapy to send 100 random packets with a wrong MAC to VF0, verify the
+   packets can't be received by one VF and can be forward to another VF
+   correctly.
+Test Case 4: test_dpdk_2pf_2vf_1vm_iplink_macfilter
+===================================================
+
+1. Get the pci device id of DUT, bind them to igb_uio,for example::
+
+      ./usertools/dpdk-devbind.py -s
+
+      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
+      ./usertools/dpdk-devbind.py --bind=igb_uio 0000:81:00.0 0000:81:00.1
+
+
+2. Create 2 VFs from 2 PFs, and set the VF MAC address at PF0::
+
+      echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/max_vfs
+      echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/max_vfs
+
+      ./usertools/dpdk-devbind.py -s
+      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+'  drv=igb_uio unused=i40e
+      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+'  drv=igb_uio unused=i40e
+      0000:81:02.0 'XL710/X710 Virtual Function' unused=
+      0000:81:0a.0 'XL710/X710 Virtual Function' unused=
+
+3. Start testpmd::
+
+      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4 -b 0000:81:02.0 -b 0000:81:0a.0 -- -i
+      testpmd>set vf mac addr 0 0 00:11:22:33:44:55
+
+4. Detach VFs from the host, bind them to pci-stub driver::
+
+      /sbin/modprobe pci-stub
+
+      using `lspci -nn|grep -i ethernet` to get VF device id, for example "8086 154c",
+
+      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+      echo 0000:81:02.0 > /sys/bus/pci/devices/0000:08:02.0/driver/unbind
+      echo 0000:81:02.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+      echo 0000:81:0a.0 > /sys/bus/pci/devices/0000:08:0a.0/driver/unbind
+      echo 0000:81:0a.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+   or using the following more easy way::
+
+      virsh nodedev-detach pci_0000_81_02_0;
+      virsh nodedev-detach pci_0000_81_0a_0;
+
+      ./dpdk_nic_bind.py --st
+
+      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
+      0000:81:02.0 'XL710/X710 Virtual Function' if= drv=pci-stub unused=
+      0000:81:0a.0 'XL710/X710 Virtual Function' if= drv=pci-stub unused=
+
+   it can be seen that VFs 81:02.0 & 81:0a.0 's driver is pci-stub.
+5. Passthrough VFs 81:02.0 & 81: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=81:02.0,id=pt_0 \
+      -device pci-assign,host=81:0a.0,id=pt_1
+
+6. Login vm0, got VFs pci device id in vm0, assume they are 00:06.0 & 00:07.0,
+   bind them to igb_uio driver, and then start testpmd, enable CRC strip,
+   disable promisc mode,set it in mac forward mode::
+
+      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
+      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0 -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
+
+      testpmd> port stop all
+      testpmd> port config all crc-strip on
+      testpmd> port start all
+      testpmd> set promisc all off
+      testpmd> set fwd mac
+      testpmd> start
+
+7. Use scapy to send 100 random packets with ip link set MAC to VF, verify the
+   packets can be received by one VF and can be forward to another VF
+   correctly.
+
+8. Also use scapy to send 100 random packets with a wrong MAC to VF, verify
+   the packets can't be received by one VF and can be forward to another VF
+   correctly.
-- 
2.17.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio
  2018-11-28  7:01 [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio zhao,meijuan
  2018-11-28  7:01 ` [dts] [PATCH V2 2/2] test_plans/vf " zhao,meijuan
@ 2018-11-28  8:26 ` Tu, Lijuan
  1 sibling, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2018-11-28  8:26 UTC (permalink / raw)
  To: Zhao, MeijuanX, dts; +Cc: Zhao, MeijuanX

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhao,meijuan
> Sent: Wednesday, November 28, 2018 3:01 PM
> To: dts@dpdk.org
> Cc: Zhao, MeijuanX <meijuanx.zhao@intel.com>
> Subject: [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio
> 
> Signed-off-by: zhao,meijuan <meijuanx.zhao@intel.com>
> ---
>  tests/TestSuite_vf_macfilter.py | 51 +++++++++++++++++++++++----------
>  1 file changed, 36 insertions(+), 15 deletions(-)
> 
> diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py
> index f0de169..bf94016 100644
> --- a/tests/TestSuite_vf_macfilter.py
> +++ b/tests/TestSuite_vf_macfilter.py
> @@ -13,13 +13,14 @@ VM_CORES_MASK = 'all'
>  class TestVfMacFilter(TestCase):
> 
>      supported_vf_driver = ['pci-stub', 'vfio-pci']
> +    vf0_wrongmac = "00:11:22:33:48:55"
> +    vf0_setmac = "00:11:22:33:44:55"
> 
>      def set_up_all(self):
>          self.dut_ports = self.dut.get_ports(self.nic)
>          self.verify(len(self.dut_ports) > 1, "Insufficient ports")
>          self.vm0 = None
>          self.pf0_vf0_mac = "00:12:34:56:78:01"
> -        self.iplinkset = True
> 
>          # set vf assign method and vf driver
>          self.vf_driver = self.get_suite_cfg()['vf_driver'] @@ -36,14 +37,14
> @@ class TestVfMacFilter(TestCase):
> 
>          self.setup_2pf_2vf_1vm_env_flag = 0
> 
> -    def setup_2pf_2vf_1vm_env(self, driver='default'):
> +    def setup_2pf_2vf_1vm_env(self, driver='default',set_mac):
> 
>          self.used_dut_port_0 = self.dut_ports[0]
>          self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 1,
> driver=driver)
>          self.sriov_vfs_port_0 =
> self.dut.ports_info[self.used_dut_port_0]['vfs_port']
>          pf_intf0 = self.dut.ports_info[0]['port'].get_interface_name()
> 
> -        if self.iplinkset:
> +        if set_mac:
>              self.dut.send_expect("ip link set %s vf 0 mac %s" %(pf_intf0,
> self.pf0_vf0_mac), "#")
> 
>          self.used_dut_port_1 = self.dut_ports[1] @@ -124,15 +125,17
> @@ class TestVfMacFilter(TestCase):
>  ###### send the packets with wrong MAC address to VF, check if the VF will
> not RX the packets.
> 
>      def test_kernel_2pf_2vf_1vm_iplink_macfilter(self):
> +        self.setup_2pf_2vf_1vm_env(driver='',True)
> +        self.result_verify_iplink(True)
> 
> -        self.setup_2pf_2vf_1vm_env(driver='')
> -
> +    def result_verify_iplink(self,set_mac):
> +        if set_mac == False:
> +            self.host_testpmd.execute_cmd('set vf mac addr 0 0 %s' %
> + self.pf0_vf0_mac)
>          self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
>          self.vm0_testpmd = PmdOutput(self.vm_dut_0)
>          self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
>          # Get VF's MAC
>          pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
> -        vf0_wrongmac = "00:11:22:33:48:55"
>          self.vm0_testpmd.execute_cmd('set promisc all off')
>          self.vm0_testpmd.execute_cmd('set fwd mac')
>          self.vm0_testpmd.execute_cmd('start')
> @@ -147,18 +150,19 @@ class TestVfMacFilter(TestCase):
>          src_mac = self.tester.get_mac(tx_port)
>          pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
> 
> -        print "\nfirst send packets to the kernel PF set MAC, expected
> result is RX packets=TX packets\n"
> +        print "\nfirst send packets to the PF set MAC, expected result is
> RX packets=TX packets\n"
>          result1 = self.tester.check_random_pkts(tgen_ports, pktnum=100,
> allow_miss=False, params=pkt_param)
>  	print "\nshow port stats in testpmd for double check: \n",
> self.vm0_testpmd.execute_cmd('show port stats all')
>          self.verify(result1 != False, "VF0 failed to forward packets to
> VF1")
> 
>          print "\nSecondly, negative test, send packets to a wrong MAC,
> expected result is RX packets=0\n"
> -        dst_mac = vf0_wrongmac
> +        dst_mac = self.vf0_wrongmac
>          pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
>          result2 = self.tester.check_random_pkts(tgen_ports, pktnum=100,
> allow_miss=False, params=pkt_param)
>          print "\nshow port stats in testpmd for double check: \n",
> self.vm0_testpmd.execute_cmd('show port stats all')
>          self.verify(result2 != True, "VF0 failed to forward packets to VF1")
> 
> +
>  #######2. test case for kernel pf and dpdk vf 2pf_2vf_1vm MAC filter
> scenario.
>  ####### kernel pf will not set MAC address and the VF will get a random
> generated MAC  ####### in the testpmd in VM, and then add VF mac
> address in the testpmd,for example, VF_MAC1 @@ -168,19 +172,36 @@
> class TestVfMacFilter(TestCase):
> 
>      def test_kernel_2pf_2vf_1vm_mac_add_filter(self):
> 
> -        self.iplinkset = False
> -        self.setup_2pf_2vf_1vm_env(driver='')
> +        self.setup_2pf_2vf_1vm_env(driver='',False)
> +        self.send_packet_and_verify()
> +
> +#######3. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter
> scenario.
> +####### kernel pf will not set MAC address and the VF will get a random
> +generated MAC ####### in the testpmd in VM, and then add VF mac
> address
> +in the testpmd,for example, VF_MAC1 ####### then send packets to the VF
> +with the random generated MAC and the new added VF_MAC1 #######
> and the
> +expected result is that all packets can be RXed and TXed. What's more, send
> ####### packets with a wrong MAC address to the VF will not received by
> the VF.
> +    def test_dpdk_2pf_2vf_1vm_mac_add_filter(self):
> +        self.setup_2pf_2vf_1vm_env(driver='igb_uio',False)
> +        self.send_packet_and_verify()
> +
> +######4. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter
> +scenario ###### dpdk pf will first run 'set vf mac addr 0 0
> +xx:xx:xx:xx:xx:xx, then ###### in the vm, send packets with this MAC to
> +VF, check if the MAC filter works. Also ###### send the packets with wrong
> MAC address to VF, check if the VF will not RX the packets.
> +    def test_dpdk_2pf_2vf_1vm_iplink_macfilter(self):
> +        self.setup_2pf_2vf_1vm_env(driver='igb_uio',False)
> +        self.result_verify_iplink(False)
> 
> +    def send_packet_and_verify(self):
>          self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
>          self.vm0_testpmd = PmdOutput(self.vm_dut_0)
>          self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
> 
>          # Get VF0 port MAC address
>          pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
> -        vf0_setmac = "00:11:22:33:44:55"
> -        vf0_wrongmac = "00:11:22:33:48:55"
>          self.vm0_testpmd.execute_cmd('set promisc all off')
> -        ret = self.vm0_testpmd.execute_cmd('mac_addr add
> 0 %s' %vf0_setmac)
> +        ret = self.vm0_testpmd.execute_cmd('mac_addr add 0 %s'
> + %self.vf0_setmac)
>          # check the operation is supported or not.
>          print ret
> 
> @@ -203,14 +224,14 @@ class TestVfMacFilter(TestCase):
>          self.verify(result1 != False, "VF0 failed to forward packets to
> VF1")
> 
>          print "\nsecondly, send packets to the new added MAC, expected
> result is RX packets=TX packets\n"
> -        dst_mac = vf0_setmac
> +        dst_mac = self.vf0_setmac
>          pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
>          result2 = self.tester.check_random_pkts(tgen_ports, pktnum=100,
> allow_miss=False, params=pkt_param)
>          print "\nshow port stats in testpmd for double check: \n",
> self.vm0_testpmd.execute_cmd('show port stats all')
>          self.verify(result2 != False, "VF0 failed to forward packets to
> VF1")
> 
>          print "\nThirdly, negative test, send packets to a wrong MAC,
> expected result is RX packets=0\n"
> -        dst_mac = vf0_wrongmac
> +        dst_mac = self.vf0_wrongmac
>          pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
>          result3 = self.tester.check_random_pkts(tgen_ports, pktnum=100,
> allow_miss=False, params=pkt_param)
>          print "\nshow port stats in testpmd for double check: \n",
> self.vm0_testpmd.execute_cmd('show port stats all')
> --
> 2.17.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V2 2/2] test_plans/vf macfilter: add dpdk pf test scenorio
  2018-11-28  7:01 ` [dts] [PATCH V2 2/2] test_plans/vf " zhao,meijuan
@ 2018-11-28  8:28   ` Tu, Lijuan
  0 siblings, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2018-11-28  8:28 UTC (permalink / raw)
  To: Zhao, MeijuanX, dts; +Cc: Zhao, MeijuanX

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhao,meijuan
> Sent: Wednesday, November 28, 2018 3:01 PM
> To: dts@dpdk.org
> Cc: Zhao, MeijuanX <meijuanx.zhao@intel.com>
> Subject: [dts] [PATCH V2 2/2] test_plans/vf macfilter: add dpdk pf test
> scenorio
> 
> Signed-off-by: zhao,meijuan <meijuanx.zhao@intel.com>
> ---
>  test_plans/vf_macfilter_test_plan.rst | 190 ++++++++++++++++++++++++--
>  1 file changed, 182 insertions(+), 8 deletions(-)
> 
> diff --git a/test_plans/vf_macfilter_test_plan.rst
> b/test_plans/vf_macfilter_test_plan.rst
> index 221c05e..715c66d 100644
> --- a/test_plans/vf_macfilter_test_plan.rst
> +++ b/test_plans/vf_macfilter_test_plan.rst
> @@ -39,7 +39,7 @@ Test Case 1: test_kernel_2pf_2vf_1vm_iplink_macfilter
> 
>  1. Get the pci device id of DUT, for example::
> 
> -      ./dpdk_nic_bind.py --st
> +      ./usertools/dpdk-devbind.py -s
> 
>        0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
>        0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused= @@ -49,7 +49,7 @@ Test Case 1:
> test_kernel_2pf_2vf_1vm_iplink_macfilter
>        echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/sriov_numvfs
>        echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/sriov_numvfs
> 
> -      ./dpdk_nic_bind.py --st
> +      ./usertools/dpdk-devbind.py -s
>        0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
>        0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused=
>        0000:81:02.0 'XL710/X710 Virtual Function' unused= @@ -76,7
> +76,7 @@ Test Case 1: test_kernel_2pf_2vf_1vm_iplink_macfilter
>        virsh nodedev-detach pci_0000_81_02_0;
>        virsh nodedev-detach pci_0000_81_0a_0;
> 
> -      ./dpdk_nic_bind.py --st
> +      ./usertools/dpdk-devbind.py -s
> 
>        0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
>        0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused= @@ -96,7 +96,7 @@ Test Case 1:
> test_kernel_2pf_2vf_1vm_iplink_macfilter
>     bind them to igb_uio driver, and then start testpmd, enable CRC strip,
>     disable promisc mode,set it in mac forward mode::
> 
> -      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
> +      ./usertools/dpdk-devbind.py --bind=igb_uio 00:06.0 00:07.0
>        ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0
> -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
> 
>        testpmd> port stop all
> @@ -119,7 +119,7 @@ Test Case 2:
> test_kernel_2pf_2vf_1vm_mac_add_filter
> 
>  1. Get the pci device id of DUT, for example::
> 
> -      ./dpdk_nic_bind.py --st
> +      ./usertools/dpdk-devbind.py -s
> 
>        0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
>        0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused= @@ -129,7 +129,7 @@ Test Case 2:
> test_kernel_2pf_2vf_1vm_mac_add_filter
>        echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/sriov_numvfs
>        echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/sriov_numvfs
> 
> -      ./dpdk_nic_bind.py --st
> +      ./usertools/dpdk-devbind.py -s
>        0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
>        0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused=
>        0000:81:02.0 'XL710/X710 Virtual Function' unused= @@ -154,7
> +154,7 @@ Test Case 2: test_kernel_2pf_2vf_1vm_mac_add_filter
>        virsh nodedev-detach pci_0000_81_02_0;
>        virsh nodedev-detach pci_0000_81_0a_0;
> 
> -      ./dpdk_nic_bind.py --st
> +      ./usertools/dpdk-devbind.py -s
> 
>        0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
>        0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused= @@ -174,7 +174,7 @@ Test Case 2:
> test_kernel_2pf_2vf_1vm_mac_add_filter
>     bind them to igb_uio driver, and then start testpmd, enable CRC strip on
>     VF, disable promisc mode, add a new MAC to VF0 and then start::
> 
> -      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
> +      ./usertools/dpdk-devbind.py --bind=igb_uio 00:06.0 00:07.0
>        ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0
> -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
> 
>        testpmd> port stop all
> @@ -199,3 +199,177 @@ Test Case 2:
> test_kernel_2pf_2vf_1vm_mac_add_filter
>  8. Use scapy to send 100 random packets with a wrong MAC to VF0, verify
> the
>     packets can't be received by one VF and can be forward to another VF
>     correctly.
> +
> +Test Case 3: test_dpdk_2pf_2vf_1vm_mac_add_filter
> +===================================================
> +
> +1. Get the pci device id of DUT, bind them to igb_uio,for example::
> +
> +      ./usertools/dpdk-devbind.py -s
> +
> +      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
> +      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused=
> +      ./usertools/dpdk-devbind.py --bind=igb_uio 0000:81:00.0
> + 0000:81:00.1
> +
> +
> +2. Create 2 VFs from 2 PFs, and don't set the VF MAC address at PF0::
> +
> +      echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/max_vfs
> +      echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/max_vfs
> +
> +      ./usertools/dpdk-devbind.py -s
> +      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+'
> drv=igb_uio unused=i40e
> +      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+'
> drv=igb_uio unused=i40e
> +      0000:81:02.0 'XL710/X710 Virtual Function' unused=
> +      0000:81:0a.0 'XL710/X710 Virtual Function' unused=
> +
> +3. Start testpmd::
> +
> +      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4 -b
> + 0000:81:02.0 -b 0000:81:0a.0 -- -i
> +
> +4. Detach VFs from the host, bind them to pci-stub driver::
> +
> +      /sbin/modprobe pci-stub
> +
> +      using `lspci -nn|grep -i ethernet` to get VF device id, for
> + example "8086 154c",
> +
> +      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
> +      echo 0000:81:02.0 >
> /sys/bus/pci/devices/0000:08:02.0/driver/unbind
> +      echo 0000:81:02.0 > /sys/bus/pci/drivers/pci-stub/bind
> +
> +      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
> +      echo 0000:81:0a.0 >
> /sys/bus/pci/devices/0000:08:0a.0/driver/unbind
> +      echo 0000:81:0a.0 > /sys/bus/pci/drivers/pci-stub/bind
> +
> +   or using the following more easy way::
> +
> +      virsh nodedev-detach pci_0000_81_02_0;
> +      virsh nodedev-detach pci_0000_81_0a_0;
> +
> +      ./dpdk_nic_bind.py --st
> +
> +      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
> +      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused=
> +      0000:81:02.0 'XL710/X710 Virtual Function' if= drv=pci-stub unused=
> +      0000:81:0a.0 'XL710/X710 Virtual Function' if= drv=pci-stub
> + unused=
> +
> +   it can be seen that VFs 81:02.0 & 81:0a.0 's driver is pci-stub.
> +5. Passthrough VFs 81:02.0 & 81: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=81:02.0,id=pt_0 \
> +      -device pci-assign,host=81:0a.0,id=pt_1
> +
> +6. login vm0, got VFs pci device id in vm0, assume they are 00:06.0 &
> 00:07.0,
> +   bind them to igb_uio driver, and then start testpmd, enable CRC strip on
> +   VF, disable promisc mode, add a new MAC to VF0 and then start::
> +
> +      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
> +      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0
> + -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
> +
> +      testpmd> port stop all
> +      testpmd> port config all crc-strip on
> +      testpmd> port start all
> +      testpmd> set promisc all off
> +      testpmd> mac_addr add 0 00:11:22:33:44:55
> +      testpmd> set fwd mac
> +      testpmd> start
> +
> +   Note: In Jan, 2016, i40e doesn't support mac_addr add operation, so
> the
> +   case will be failed for FVL/Fort park NICs.
> +
> +7. Use scapy to send 100 random packets with current VF0's MAC, verify
> the
> +   packets can be received by one VF and can be forward to another VF
> +   correctly.
> +
> +8. Use scapy to send 100 random packets with new added VF0's MAC, verify
> the
> +   packets can be received by one VF and can be forward to another VF
> +   correctly.
> +
> +9. Use scapy to send 100 random packets with a wrong MAC to VF0, verify
> the
> +   packets can't be received by one VF and can be forward to another VF
> +   correctly.
> +Test Case 4: test_dpdk_2pf_2vf_1vm_iplink_macfilter
> +===================================================
> +
> +1. Get the pci device id of DUT, bind them to igb_uio,for example::
> +
> +      ./usertools/dpdk-devbind.py -s
> +
> +      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
> +      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused=
> +      ./usertools/dpdk-devbind.py --bind=igb_uio 0000:81:00.0
> + 0000:81:00.1
> +
> +
> +2. Create 2 VFs from 2 PFs, and set the VF MAC address at PF0::
> +
> +      echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/max_vfs
> +      echo 1 > /sys/bus/pci/devices/0000\:81\:00.1/max_vfs
> +
> +      ./usertools/dpdk-devbind.py -s
> +      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+'
> drv=igb_uio unused=i40e
> +      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+'
> drv=igb_uio unused=i40e
> +      0000:81:02.0 'XL710/X710 Virtual Function' unused=
> +      0000:81:0a.0 'XL710/X710 Virtual Function' unused=
> +
> +3. Start testpmd::
> +
> +      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4 -b
> 0000:81:02.0 -b 0000:81:0a.0 -- -i
> +      testpmd>set vf mac addr 0 0 00:11:22:33:44:55
> +
> +4. Detach VFs from the host, bind them to pci-stub driver::
> +
> +      /sbin/modprobe pci-stub
> +
> +      using `lspci -nn|grep -i ethernet` to get VF device id, for
> + example "8086 154c",
> +
> +      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
> +      echo 0000:81:02.0 >
> /sys/bus/pci/devices/0000:08:02.0/driver/unbind
> +      echo 0000:81:02.0 > /sys/bus/pci/drivers/pci-stub/bind
> +
> +      echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
> +      echo 0000:81:0a.0 >
> /sys/bus/pci/devices/0000:08:0a.0/driver/unbind
> +      echo 0000:81:0a.0 > /sys/bus/pci/drivers/pci-stub/bind
> +
> +   or using the following more easy way::
> +
> +      virsh nodedev-detach pci_0000_81_02_0;
> +      virsh nodedev-detach pci_0000_81_0a_0;
> +
> +      ./dpdk_nic_bind.py --st
> +
> +      0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0
> drv=i40e unused=
> +      0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1
> drv=i40e unused=
> +      0000:81:02.0 'XL710/X710 Virtual Function' if= drv=pci-stub unused=
> +      0000:81:0a.0 'XL710/X710 Virtual Function' if= drv=pci-stub
> + unused=
> +
> +   it can be seen that VFs 81:02.0 & 81:0a.0 's driver is pci-stub.
> +5. Passthrough VFs 81:02.0 & 81: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=81:02.0,id=pt_0 \
> +      -device pci-assign,host=81:0a.0,id=pt_1
> +
> +6. Login vm0, got VFs pci device id in vm0, assume they are 00:06.0 &
> 00:07.0,
> +   bind them to igb_uio driver, and then start testpmd, enable CRC strip,
> +   disable promisc mode,set it in mac forward mode::
> +
> +      ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
> +      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0
> + -w 00:07.0 -- -i --portmask=0x3 --tx-offloads=0x8fff
> +
> +      testpmd> port stop all
> +      testpmd> port config all crc-strip on
> +      testpmd> port start all
> +      testpmd> set promisc all off
> +      testpmd> set fwd mac
> +      testpmd> start
> +
> +7. Use scapy to send 100 random packets with ip link set MAC to VF, verify
> the
> +   packets can be received by one VF and can be forward to another VF
> +   correctly.
> +
> +8. Also use scapy to send 100 random packets with a wrong MAC to VF,
> verify
> +   the packets can't be received by one VF and can be forward to another
> VF
> +   correctly.
> --
> 2.17.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-28  8:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28  7:01 [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio zhao,meijuan
2018-11-28  7:01 ` [dts] [PATCH V2 2/2] test_plans/vf " zhao,meijuan
2018-11-28  8:28   ` Tu, Lijuan
2018-11-28  8:26 ` [dts] [PATCH V2 1/2] tests/vf " Tu, Lijuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).