From: "Liu, Yong" <yong.liu@intel.com>
To: Yulong Pei <yulong.pei@intel.com>, dts@dpdk.org
Subject: Re: [dts] [PATCH] add vf reset test case
Date: Wed, 06 Jan 2016 09:51:14 +0800 [thread overview]
Message-ID: <568C7312.8000105@intel.com> (raw)
In-Reply-To: <1451361809-1494-1-git-send-email-yulong.pei@intel.com>
Hi Yulong,
Could you add some basic information in commit log, that will help us to
known what's in the patch.
And for email subject, better follow our format " module name : what
happened".
On 12/29/2015 12:03 PM, Yulong Pei wrote:
> Signed-off-by: Yulong Pei <yulong.pei@intel.com>
> ---
> conf/vf_packet_rxtx.cfg | 19 ++++
> test_plans/vf_packet_rxtx_test_plan.rst | 72 ++++++++++++++
> tests/TestSuite_vf_packet_rxtx.py | 160 +++++++++++++++++++++++++++++++-
> 3 files changed, 248 insertions(+), 3 deletions(-)
>
> diff --git a/conf/vf_packet_rxtx.cfg b/conf/vf_packet_rxtx.cfg
> index 986d289..20db90c 100644
> --- a/conf/vf_packet_rxtx.cfg
> +++ b/conf/vf_packet_rxtx.cfg
> @@ -103,3 +103,22 @@ vnc =
> displayNum=1;
> daemon =
> enable=yes;
> +
> +[vm1]
> +cpu =
> + model=host,number=4,cpupin=9 10 11 12;
> +disk =
> + file=/home/image/sriov-fc20-2.img;
> +login =
> + user=root,password=tester;
> +net =
> + type=nic,opt_vlan=1;
> + type=user,opt_vlan=1;
> +monitor =
> + port=;
> +qga =
> + enable=yes;
> +vnc =
> + displayNum=2;
> +daemon =
> + enable=yes;
> diff --git a/test_plans/vf_packet_rxtx_test_plan.rst b/test_plans/vf_packet_rxtx_test_plan.rst
> index f9ea736..6a70e20 100644
> --- a/test_plans/vf_packet_rxtx_test_plan.rst
> +++ b/test_plans/vf_packet_rxtx_test_plan.rst
> @@ -98,3 +98,75 @@ testpmd> start
>
> 6. get mac address of one VF and use it as dest mac, using scapy to send 2000 random packets from tester,
> verify the packets can be received by one VF and can be forward to another VF correctly.
> +
> +Test Case 2: VF reset test
> +==============================================
> +
> +1. got the pci device id of DUT, for example,
> +
> +./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=
> +
> +2. create 3 VFs from 1 PF,
> +
> +echo 3 > /sys/bus/pci/devices/0000\:81\:00.0/sriov_numvfs
> +./dpdk_nic_bind.py --st
> +
> +0000:81:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=igb_uio
> +0000:81:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=igb_uio
> +0000:81:02.0 'XL710/X710 Virtual Function' unused=
> +0000:81:02.1 'XL710/X710 Virtual Function' unused=
> +0000:81:02.2 'XL710/X710 Virtual Function' unused=
> +
> +3. detach VFs from the host, bind them to pci-stub driver,
> +
> +virsh nodedev-detach pci_0000_81_02_0;
> +virsh nodedev-detach pci_0000_81_02_1;
> +virsh nodedev-detach pci_0000_81_02_2;
> +
> +./dpdk_nic_bind.py --st
> +
> +0000:81:02.0 'XL710/X710 Virtual Function' if= drv=pci-stub unused=igb_uio
> +0000:81:02.1 'XL710/X710 Virtual Function' if= drv=pci-stub unused=igb_uio
> +0000:81:02.2 'XL710/X710 Virtual Function' if= drv=pci-stub unused=igb_uio
> +
> +4. passthrough VFs 81:02.0 & 81:02.1 to vm0, passthrough VF 81:02.2 to vm1, start vm0 & vm1
> +
> +/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:02.1,id=pt_1
> +
> +/usr/bin/qemu-system-x86_64 -name vm1 -enable-kvm \
> +-cpu host -smp 4 -m 2048 -drive file=/home/image/sriov-fc20-1.img -vnc :1 \
> +-device pci-assign,host=81:02.2,id=pt_0 \
> +
> +5. 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, 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 --txqflags=0
> +
> +testpmd> set fwd mac
> +testpmd> start
> +
> +on tester, use scapy, sending packets to vf0 in vm0 in infinite loop.
> +
> +6. login vm1, got VF pci device id in vm1, assume it is 00:06.0, bind them to igb_uio driver, start testpmd,
> +
> +./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0
> +./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -w 00:06.0 -- -i --portmask=0x1 --txqflags=0
> +
> +in testpmd, run vf port stop/start 1000 times to trigger vf reset 1000 times,
> +
> +testpmd> port stop all
> +testpmd> port start all
> +
> +7. on tester, kill scapy to stop sending packets to vf0 in vm0, then check the following stats of
> +vf0 and vf1 in vm0 to make sure it is correct,
> +
> +vf0_stats, RX-packets != 0, RX-errors == 0
> +vf1_stats, TX-packets != 0, TX-errors == 0
> +vf0-RX-packets == vf1-TX-packets
> diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py
> index 19bc331..9c150b2 100644
> --- a/tests/TestSuite_vf_packet_rxtx.py
> +++ b/tests/TestSuite_vf_packet_rxtx.py
> @@ -18,10 +18,12 @@ class TestVfPacketRxtx(TestCase):
> self.dut_ports = self.dut.get_ports(self.nic)
> self.verify(len(self.dut_ports) > 1, "Insufficient ports")
> self.vm0 = None
> + self.vm1 = None
>
> def set_up(self):
>
> self.setup_2pf_2vf_1vm_env_flag = 0
> + self.setup_3vf_2vm_env_flag = 0
>
> def setup_2pf_2vf_1vm_env(self, driver='default'):
>
> @@ -98,16 +100,14 @@ class TestVfPacketRxtx(TestCase):
>
> self.setup_2pf_2vf_1vm_env_flag = 0
>
> -######1. test case for kernel pf and dpdk vf 2pf_2vf_1vm scenario
> +######1. test case for kernel pf and dpdk vf 2pf_2vf_1vm scenario packet rx tx.
>
> def test_kernel_2pf_2vf_1vm(self):
>
> self.setup_2pf_2vf_1vm_env(driver='')
>
> self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
> -
> port_id_0 = 0
> -
> self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
> self.vm0_testpmd.execute_cmd('show port info all')
> @@ -130,16 +130,170 @@ class TestVfPacketRxtx(TestCase):
> result = self.tester.check_random_pkts(tgen_ports, allow_miss=False, params=pkt_param)
> self.verify(result != False, "VF0 failed to forward packets to VF1")
>
> + def setup_3vf_2vm_env(self, driver='default'):
> +
> + self.used_dut_port = self.dut_ports[0]
> + self.dut.generate_sriov_vfs_by_port(self.used_dut_port, 3, driver=driver)
> + self.sriov_vfs_port = self.dut.ports_info[self.used_dut_port]['vfs_port']
> +
> + try:
> +
> + for port in self.sriov_vfs_port:
> + print port.pci
> + port.bind_driver('pci-stub')
> +
> + time.sleep(1)
> + vf0_prop = {'opt_host': self.sriov_vfs_port[0].pci}
> + vf1_prop = {'opt_host': self.sriov_vfs_port[1].pci}
> + vf2_prop = {'opt_host': self.sriov_vfs_port[2].pci}
> +
> + for port_id in self.dut_ports:
> + if port_id == self.used_dut_port:
> + continue
> + port = self.dut.ports_info[port_id]['port']
> + port.bind_driver()
> +
> + if driver == 'igb_uio':
> + self.host_testpmd = PmdOutput(self.dut)
> + eal_param = '-b %(vf0)s -b %(vf1)s -b %(vf2)s' % {'vf0': self.sriov_vfs_port[0].pci,
> + 'vf1': self.sriov_vfs_port[1].pci,
> + 'vf2': self.sriov_vfs_port[2].pci}
> + self.host_testpmd.start_testpmd("1S/2C/2T", eal_param=eal_param)
> +
> + # set up VM0 ENV
> + self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_packet_rxtx')
> + self.vm0.set_vm_device(driver='pci-assign', **vf0_prop)
> + self.vm0.set_vm_device(driver='pci-assign', **vf1_prop)
> + self.vm_dut_0 = self.vm0.start()
> + if self.vm_dut_0 is None:
> + raise Exception("Set up VM0 ENV failed!")
> + # set up VM1 ENV
> + self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_packet_rxtx')
> + self.vm1.set_vm_device(driver='pci-assign', **vf2_prop)
> + self.vm_dut_1 = self.vm1.start()
> + if self.vm_dut_1 is None:
> + raise Exception("Set up VM1 ENV failed!")
> +
> + self.setup_3vf_2vm_env_flag = 1
> + except Exception as e:
> + self.destroy_3vf_2vm_env()
> + raise Exception(e)
> +
> + def destroy_3vf_2vm_env(self):
> + if getattr(self, 'vm0', None):
> + self.vm0_testpmd.execute_cmd('stop')
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + self.vm0_testpmd = None
> + self.vm0_dut_ports = None
> + self.vm_dut_0 = None
> + self.vm0.stop()
> + self.vm0 = None
> +
> + if getattr(self, 'vm1', None):
> + self.vm1_testpmd.execute_cmd('stop')
> + self.vm1_testpmd.execute_cmd('quit', '# ')
> + self.vm1_testpmd = None
> + self.vm1_dut_ports = None
> + self.vm_dut_1 = None
> + self.vm1.stop()
> + self.vm1 = None
> +
> + if getattr(self, 'host_testpmd', None):
> + self.host_testpmd.execute_cmd('quit', '# ')
> + self.host_testpmd = None
> +
> + if getattr(self, 'used_dut_port', None):
> + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> + port = self.dut.ports_info[self.used_dut_port]['port']
> + port.bind_driver()
> + self.used_dut_port = None
> +
> + for port_id in self.dut_ports:
> + port = self.dut.ports_info[port_id]['port']
> + port.bind_driver()
> +
> + self.setup_3vf_2vm_env_flag = 0
> +
> + def test_vf_reset(self):
> +
> + self.setup_3vf_2vm_env(driver='')
> +
> + self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
> + self.vm1_dut_ports = self.vm_dut_1.get_ports('any')
> +
> + port_id_0 = 0
> + port_id_1 = 1
> +
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
> + self.vm0_testpmd.execute_cmd('show port info all')
> + pmd0_vf0_mac = self.vm0_testpmd.get_port_mac(port_id_0)
> + self.vm0_testpmd.execute_cmd('set fwd mac')
> + self.vm0_testpmd.execute_cmd('start')
> +
> + time.sleep(2)
> +
> + self.vm1_testpmd = PmdOutput(self.vm_dut_1)
> + self.vm1_testpmd.start_testpmd(VM_CORES_MASK)
> + self.vm1_testpmd.execute_cmd('show port info all')
> +
> + tx_port = self.tester.get_local_port(self.dut_ports[0])
> + rx_port = tx_port
> +
> + dst_mac = pmd0_vf0_mac
> + src_mac = self.tester.get_mac(tx_port)
> +
> + itf = self.tester.get_interface(tx_port)
> +
> + self.tester.send_expect("echo '#!/usr/bin/python' > send_pkt_loop.py", "# ")
> + self.tester.send_expect("echo 'from scapy.all import *' >> send_pkt_loop.py", "# ")
> + cmd = 'sendp([Ether(dst="%s", src="%s")/IP(len=46)], iface="%s", loop=1)' % (dst_mac, src_mac, itf)
> + self.tester.send_expect("echo '%s' >> send_pkt_loop.py" % cmd, "# ")
> + self.tester.send_expect("chmod +x send_pkt_loop.py", "# ")
> + self.tester.send_expect("cat send_pkt_loop.py", "# ")
> + self.tester.send_expect("./send_pkt_loop.py &", "# ")
> +
Could we use subprocess to do those task? It will helpful for multiple
instance running in the same time.
> + #vf port stop/start can trigger reset action
> + for num in range(10):
> + self.vm1_testpmd.execute_cmd('port stop all')
> + time.sleep(0.1)
> + self.vm1_testpmd.execute_cmd('port start all')
> + time.sleep(0.1)
> +
> + self.tester.send_expect("killall send_pkt_loop.py", "# ")
> +
> + pmd0_vf0_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + pmd0_vf1_stats = self.vm0_testpmd.get_pmd_stats(port_id_1)
> +
> + vf0_rx_cnt = pmd0_vf0_stats['RX-packets']
> + self.verify(vf0_rx_cnt != 0, "no packet was received by vm0_VF0")
> +
> + vf0_rx_err = pmd0_vf0_stats['RX-errors']
> + self.verify(vf0_rx_err == 0, "vm0_VF0 rx-errors")
> +
> + vf1_tx_cnt = pmd0_vf1_stats['TX-packets']
> + self.verify(vf1_tx_cnt != 0, "no packet was transmitted by vm0_VF1")
> +
> + vf1_tx_err = pmd0_vf1_stats['TX-errors']
> + self.verify(vf1_tx_err == 0, "vm0_VF0 tx-errors")
> +
> + self.verify(vf0_rx_cnt == vf1_tx_cnt, "vm0_VF0 failed to forward packets to vm0_VF1 when reset vm1_VF0 frequently")
> +
> def tear_down(self):
>
> if self.setup_2pf_2vf_1vm_env_flag == 1:
> self.destroy_2pf_2vf_1vm_env()
> + if self.setup_3vf_2vm_env_flag == 1:
> + self.destroy_3vf_2vm_env()
>
> def tear_down_all(self):
>
> if getattr(self, 'vm0', None):
> self.vm0.stop()
>
> + if getattr(self, 'vm1', None):
> + self.vm1.stop()
> +
> for port_id in self.dut_ports:
> self.dut.destroy_sriov_vfs_by_port(port_id)
>
prev parent reply other threads:[~2016-01-06 1:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-29 4:03 Yulong Pei
2016-01-06 1:51 ` Liu, Yong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568C7312.8000105@intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
--cc=yulong.pei@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).