From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42AAFA0559; Tue, 17 Mar 2020 06:19:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2EF2C292D; Tue, 17 Mar 2020 06:19:51 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 27BFA25D9 for ; Tue, 17 Mar 2020 06:19:48 +0100 (CET) IronPort-SDR: oti0/6qopCwY2TTAftC7aZBCxhQKZy2sjdn4NwLZnFitqo+ln6ujNlynI9W1BXFwwj8I2Wy566 0uaA5Bt8N4iQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2020 22:19:47 -0700 IronPort-SDR: FKUUjrrRHtrsvVRcBa3kBwJaORfRAlsWyOOc1LEql5LWnjMTJlvnlBfxKMVWVOvBPyrnA5xLf3 0d6ShjVRklxQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,563,1574150400"; d="scan'208";a="233394599" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 16 Mar 2020 22:19:47 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 16 Mar 2020 22:19:46 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 16 Mar 2020 22:19:46 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.144]) with mapi id 14.03.0439.000; Tue, 17 Mar 2020 13:19:44 +0800 From: "Tu, Lijuan" To: "Wang, Yinan" , "dts@dpdk.org" CC: "Wang, Yinan" Thread-Topic: [dts] [PATCH v1] tests: add test suite for vhost_pmd_xstats test Thread-Index: AQHV+G++cPc3rKRdR0Kg3ljgtZapnKhMRlzg Date: Tue, 17 Mar 2020 05:19:43 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBEE9C9@SHSMSX101.ccr.corp.intel.com> References: <20200312060545.15118-1-yinan.wang@intel.com> In-Reply-To: <20200312060545.15118-1-yinan.wang@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH v1] tests: add test suite for vhost_pmd_xstats test X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Hi yinan, Applied failed, could you please rework it, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yinan > Sent: Thursday, March 12, 2020 2:06 PM > To: dts@dpdk.org > Cc: Wang, Yinan > Subject: [dts] [PATCH v1] tests: add test suite for vhost_pmd_xstats test >=20 > From: Wang Yinan >=20 > Signed-off-by: Wang Yinan > --- > tests/TestSuite_vhost_pmd_xstats.py | 291 ++++++++++++++++++---------- > 1 file changed, 184 insertions(+), 107 deletions(-) >=20 > diff --git a/tests/TestSuite_vhost_pmd_xstats.py > b/tests/TestSuite_vhost_pmd_xstats.py > index 0ebbe1c..610a11a 100755 > --- a/tests/TestSuite_vhost_pmd_xstats.py > +++ b/tests/TestSuite_vhost_pmd_xstats.py > @@ -56,69 +56,37 @@ class TestVhostPmdXstats(TestCase): > self.unbind_ports =3D copy.deepcopy(self.dut_ports) > self.unbind_ports.remove(0) > self.dut.unbind_interfaces_linux(self.unbind_ports) > - cores =3D self.dut.get_core_list("1S/4C/1T") > - self.coremask =3D utils.create_mask(cores) > txport =3D self.tester.get_local_port(self.dut_ports[0]) > self.txItf =3D self.tester.get_interface(txport) > - > self.scapy_num =3D 0 > self.dmac =3D self.dut.get_mac_address(self.dut_ports[0]) > self.virtio1_mac =3D "52:54:00:00:00:01" > - self.pci_info =3D self.dut.ports_info[0]['pci'] > - > - # build sample app > - out =3D self.dut.build_dpdk_apps("./examples/vhost") > - self.verify("Error" not in out, "compilation error 1") > - self.verify("No such file" not in out, "compilation error 2") > - self.base_dir =3D self.dut.base_dir.replace('~', '/root') > + self.core_config =3D "1S/6C/1T" > + self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + self.cores_num =3D len([n for n in self.dut.cores if int(n['sock= et']) > + =3D=3D self.ports_socket]) > + self.verify(self.cores_num >=3D 6, > + "There has not enough cores to test this case") > + self.core_list =3D self.dut.get_core_list( > + self.core_config, socket=3Dself.ports_socket) > + self.core_list_user =3D self.core_list[0:3] > + self.core_list_host =3D self.core_list[3:6] > + self.dst_mac =3D self.dut.get_mac_address(self.dut_ports[0]) >=20 > def set_up(self): > """ > Run before each test case. > Launch vhost sample using default params > """ > - self.dut.send_expect("rm -rf ./vhost.out", "#") > - self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "#"= ) > - self.dut.send_expect("killall vhost-switch", "#") > - dut_arch =3D self.dut.send_expect("uname -m", "#") > - self.dut.send_expect("killall qemu-system-%s" % dut_arch, "#") > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.vhost_user =3D self.dut.new_session(suite=3D"vhost-user") > + self.virtio_user =3D self.dut.new_session(suite=3D"virtio-user") >=20 > - def vm_testpmd_start(self): > - """ > - Start testpmd in vm > - """ > - self.vm_testpmd =3D "./%s/app/testpmd -c 0x3 -n 4 -- -i --tx-off= loads=3D0" % > self.target > - if self.vm_dut is not None: > - self.vm_dut.send_expect(self.vm_testpmd, "testpmd>", 60) > - > - def vm_tx_first_start(self): > - """ > - Start tx_first > - """ > - if self.vm_dut is not None: > - # Start tx_first > - self.vm_dut.send_expect("set fwd mac", "testpmd>") > - self.vm_dut.send_expect("start tx_first", "testpmd>") > - > - def start_onevm(self): > - """ > - Start One VM with one virtio device > - """ > - self.vm_dut =3D None > - self.vm =3D QEMUKvm(self.dut, 'vm0', 'vhost_pmd_xstats') > - vm_params =3D {} > - vm_params['driver'] =3D 'vhost-user' > - vm_params['opt_path'] =3D self.base_dir + '/vhost-net' > - vm_params['opt_mac'] =3D self.virtio1_mac > - self.vm.set_vm_device(**vm_params) > - > - try: > - self.vm_dut =3D self.vm.start() > - if self.vm_dut is None: > - raise Exception("Set up VM ENV failed") > - except Exception as e: > - self.logger.error("Failure for %s" % str(e)) > - return True > + @property > + def check_2M_env(self): > + out =3D self.dut.send_expect("cat /proc/meminfo |grep > Hugepagesize|awk '{print($2)}'", "# ") > + return True if out =3D=3D '2048' else False >=20 > def scapy_send_packet(self, pktsize, dmac, num=3D1): > """ > @@ -126,85 +94,196 @@ class TestVhostPmdXstats(TestCase): > """ > self.scapy_num +=3D 1 > pkt =3D Packet(pkt_type=3D'TCP', pkt_len=3Dpktsize) > - pkt.config_layer('ether', {'dst': dmac, }) > + pkt.config_layer('ether', {'dst': dmac}) > pkt.send_pkt(self.tester, tx_port=3Dself.txItf, count=3Dnum) >=20 > def send_verify(self, scope, mun): > """ > according the scope to check results > """ > - out =3D self.dut.send_expect( > - "show port xstats %s" % self.dut_ports[0], "testpmd>", 60) > - packet =3D re.search("rx_%s_packets:\s*(\d*)" % scope, out) > - sum_packet =3D packet.group(1) > - self.verify(int(sum_packet) >=3D mun, > - "Insufficient the received package") > + out =3D self.vhost_user.send_expect( > + "show port xstats 1", "testpmd>", 60) > + packet_rx =3D re.search("rx_%s_packets:\s*(\d*)" % scope, out) > + sum_packet_rx =3D packet_rx.group(1) > + packet_tx =3D re.search("tx_%s_packets:\s*(\d*)" % scope, out) > + sum_packet_tx =3D packet_tx.group(1) > + self.verify(int(sum_packet_rx) >=3D mun, > + "Insufficient the received packets from nic") > + self.verify(int(sum_packet_tx) >=3D mun, > + "Insufficient the received packets from virtio") >=20 > - def prepare_start(self): > + def start_vhost_testpmd(self): > """ > - prepare all of the conditions for start > + start testpmd on vhost > """ > - testcmd =3D self.target + "/app/testpmd " > - vdev =3D [r"'net_vhost0,iface=3D%s/vhost-net,queues=3D1'" % self= .base_dir] > - eal_params =3D self.dut.create_eal_parameters(cores=3D"1S/4C/1T"= , > ports=3D[self.pci_info], vdevs=3Dvdev) > - para =3D " -- -i --nb-cores=3D1" > - cmd =3D testcmd + eal_params + para > - self.dut.send_expect(cmd, "testpmd>", 60) > - self.start_onevm() > - self.vm_testpmd_start() > - self.dut.send_expect("set fwd mac", "testpmd>", 60) > - self.dut.send_expect("start tx_first", "testpmd>", 60) > - self.vm_tx_first_start() > + eal_param =3D self.dut.create_eal_parameters(socket=3Dself.ports= _socket, > cores=3Dself.core_list_host, prefix=3D'vhost', > + vdevs=3D['net_vhost0,= iface=3Dvhost- > net,queues=3D2,client=3D0']) > + command_line_client =3D "./%s/app/testpmd " % self.target + eal_= param > + ' -- -i --nb-cores=3D2 --rxq=3D2 --txq=3D2 --rss-ip' > + self.vhost_user.send_expect(command_line_client, "testpmd> ", 12= 0) > + self.vhost_user.send_expect("set fwd io", "testpmd> ", 120) > + self.vhost_user.send_expect("start", "testpmd> ", 120) >=20 > - def test_based_size(self): > + def start_virtio_testpmd(self, args): > + """ > + start testpmd on virtio > + """ > + eal_param =3D self.dut.create_eal_parameters(socket=3Dself.ports= _socket, > cores=3Dself.core_list_user, prefix=3D'virtio', > + no_pci=3DTrue, vdevs= =3D[ > + 'net_virtio_user0,mac=3D00:01:02:03:04:05,path=3D./vhost= - > net,queues=3D2,%s' % args["version"]]) > + if self.check_2M_env: > + eal_param +=3D " --single-file-segments" > + command_line_user =3D "./%s/app/testpmd " % self.target + eal_pa= ram + > " -- -i %s --rss-ip --nb-cores=3D2 --rxq=3D2 --txq=3D2" % \ > + args["path"] > + self.virtio_user.send_expect(command_line_user, "testpmd> ", 120= ) > + self.virtio_user.send_expect("set fwd io", "testpmd> ", 120) > + self.virtio_user.send_expect("start", "testpmd> ", 120) > + > + def xstats_number_and_type_verify(self): > """ > Verify receiving and transmitting packets correctly in the Vhost= PMD > xstats > """ > - self.prepare_start() > - out =3D self.dut.send_expect( > - "show port xstats %s" % self.dut_ports[0], "testpmd>", 60) > + out =3D self.vhost_user.send_expect( > + "show port xstats 1", "testpmd>", 60) > p =3D re.compile(r'rx_size_[0-9]+_[to_\w+]*packets') > categories =3D p.findall(out) > + categories =3D categories[:-1] > self.verify(len(categories) > 0, 'Unable to find the categories = of RX packet > size!') > for cat in categories: > scope =3D re.search(r'(?<=3Drx_)\w+(?=3D_packets)', cat).gro= up(0) > pktsize =3D int(re.search(r'(?<=3Drx_size_)\d+', cat).group(= 0)) > if pktsize > 1518: > self.tester.send_expect('ifconfig %s mtu %d' % (self.txI= tf, > ETHER_JUMBO_FRAME_MTU), '# ') > + types =3D ['ff:ff:ff:ff:ff:ff', '01:00:00:33:00:01'] > + for p in types: > + if p =3D=3D 'ff:ff:ff:ff:ff:ff': > + scope =3D 'broadcast' > + self.dmac =3D 'ff:ff:ff:ff:ff:ff' > + elif p =3D=3D '01:00:00:33:00:01': > + scope =3D 'multicast' > + self.dmac =3D '01:00:00:33:00:01' > + self.scapy_send_packet(int(pktsize + 4), self.dmac, 1000= 0) > + self.send_verify(scope, 10000) > + self.vhost_user.send_expect("clear port xstats all", "te= stpmd>", 60) > + self.tester.send_expect('ifconfig %s mtu %d' % (self.txItf, > + DEFAULT_JUMBO_FRAME_MTU), '# ') >=20 > - self.scapy_send_packet(pktsize, self.dmac, 10000) > - self.send_verify(scope, 10000) > - self.clear_port_xstats(scope) > - self.tester.send_expect('ifconfig %s mtu %d' % (self.txItf, > DEFAULT_JUMBO_FRAME_MTU), '# ') > + def test_vhost_xstats_virtio11_mergeable(self): > + """ > + performance for Vhost PVP virtio 1.1 Mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "in_order=3D0,packed_vq=3D1,mrg_r= xbuf=3D1", > + "path": "--tx-offloads=3D0x0 --enable-hw-vla= n-strip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_virtio11_no_mergeable(self): > + """ > + performance for Vhost PVP virtio1.1 no_mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "in_order=3D0,packed_vq=3D1,mrg_r= xbuf=3D0", > + "path": "--tx-offloads=3D0x0 --enable-hw-vla= n-strip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_virtio11_inorder_mergeable(self): > + """ > + performance for Vhost PVP virtio 1.1 inorder Mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "in_order=3D1,packed_vq=3D1,mrg_r= xbuf=3D1", > + "path": "--tx-offloads=3D0x0 --enable-hw-vla= n-strip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_virtio11_inorder_no_mergeable(self): > + """ > + performance for Vhost PVP virtio1.1 inorder no_mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "in_order=3D1,packed_vq=3D1,mrg_r= xbuf=3D0", > + "path": "--tx-offloads=3D0x0 --enable-hw-vla= n-strip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_inorder_mergeable(self): > + """ > + performance for Vhost PVP In_order mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "packed_vq=3D0,in_order=3D1,mrg_r= xbuf=3D1", > + "path": "--tx-offloads=3D0x0 --enable-hw-vla= n-strip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_inorder_no_mergeable(self): > + """ > + performance for Vhost PVP In_order no_mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "packed_vq=3D0,in_order=3D1,mrg_r= xbuf=3D0", > + "path": "--tx-offloads=3D0x0 --enable-hw-vlan-st= rip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_mergeable(self): > + """ > + performance for Vhost PVP Mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "packed_vq=3D0,in_order=3D0,mrg_r= xbuf=3D1", > + "path": "--tx-offloads=3D0x0 --enable-hw-vla= n-strip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_no_mergeable(self): > + """ > + performance for Vhost PVP no_mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": "packed_vq=3D0,in_order=3D0,mrg_r= xbuf=3D0", > + "path": "--tx-offloads=3D0x0 --enable-hw-vla= n-strip --rss-ip"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def test_vhost_xstats_vector_rx(self): > + """ > + performance for Vhost PVP Vector_RX Path > + """ > + virtio_pmd_arg =3D {"version": "packed_vq=3D0,in_order=3D0,mrg_r= xbuf=3D0", > + "path": "--tx-offloads=3D0x0"} > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.xstats_number_and_type_verify() > + self.close_all_testpmd() > + > + def close_all_testpmd(self): > + """ > + close all testpmd of vhost and virtio > + """ > + self.vhost_user.send_expect("quit", "#", 60) > + self.virtio_user.send_expect("quit", "#", 60) >=20 > def clear_port_xstats(self, scope): >=20 > - self.dut.send_expect("clear port xstats all", "testpmd>", 60) > - out =3D self.dut.send_expect( > - "show port xstats %s" % self.dut_ports[0], "testpmd>", 60) > + self.vhost_user.send_expect("clear port xstats 1", "testpmd>", 6= 0) > + """ > + out =3D self.vhost_user.send_expect( > + "show port xstats 1", "testpmd>", 60) > packet =3D re.search("rx_%s_packets:\s*(\d*)" % scope, out) > sum_packet =3D packet.group(1) > self.verify(int(sum_packet) =3D=3D 0, "Insufficient the received= package") > - > - def test_based_types(self): > """ > - Verify different type of packets receiving and transmitting pack= ets > correctly in the Vhost PMD xstats > - """ > - self.prepare_start() > - types =3D ['ff:ff:ff:ff:ff:ff', '01:00:00:33:00:01'] > - scope =3D '' > - for p in types: > - if p =3D=3D 'ff:ff:ff:ff:ff:ff': > - scope =3D 'broadcast' > - self.dmac =3D 'ff:ff:ff:ff:ff:ff' > - elif p =3D=3D '01:00:00:33:00:01': > - scope =3D 'multicast' > - self.dmac =3D '01:00:00:33:00:01' > - self.scapy_send_packet(64, self.dmac, 10000) > - self.send_verify(scope, 10000) > - self.clear_port_xstats(scope) > - > - def test_stability(self): > + > + def ltest_stability(self): > """ > Verify stability case with multiple queues for Vhost PMD xstats > Send packets for 2 minutes, check the xstats still can work corr= ectly @@ > -218,8 +297,8 @@ class TestVhostPmdXstats(TestCase): > self.scapy_send_packet(64, self.dmac, 1) > if date_now >=3D date_new: > break > - out_0 =3D self.dut.send_expect( > - "show port xstats %s" % self.dut_ports[0], "testpmd>", 60) > + out_0 =3D self.vhost_user.send_expect( > + "show port xstats 1", "testpmd>", 60) > rx_packet =3D re.search("rx_size_64_packets:\s*(\d*)", out_0) > rx_packets =3D rx_packet.group(1) > self.verify(self.scapy_num =3D=3D int(rx_packets), "Error for > rx_packets:%s !=3D tx_packets :%s" % ( @@ -229,12 +308,10 @@ class > TestVhostPmdXstats(TestCase): > """ > Run after each test case. > """ > - self.vm._stop_vm() > - self.dut.kill_all() > - time.sleep(2) > + self.dut.send_expect("killall -s INT testpmd", "#") >=20 > def tear_down_all(self): > """ > Run after each test suite. > """ > - self.dut.bind_interfaces_linux(nics_to_bind=3Dself.unbind_ports) > + pass > \ No newline at end of file > -- > 2.17.1