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 235ABA0583; Fri, 20 Mar 2020 09:21:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 03B6E1B94F; Fri, 20 Mar 2020 09:21:32 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 52ADF2BBD for ; Fri, 20 Mar 2020 09:21:30 +0100 (CET) IronPort-SDR: Hrs63jxj+GVU/L4Zsg7auGLpj0yeFRImeKL1qUPwzSgr3ycsfsfM5J7U/aIrLPtQAueyXJ2TlL FIAHen/sNjgQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2020 01:21:29 -0700 IronPort-SDR: C9KHLx5sU6nqSmDehqDq4iNRiZ98v3bwiL/lvCjP24Ok7wB9/zNjaUOVqqon+XGbWK1pShFVnG acI7y9ujFXrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,283,1580803200"; d="scan'208";a="392082630" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 20 Mar 2020 01:21:28 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 20 Mar 2020 01:21:28 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 20 Mar 2020 01:21:27 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.235]) with mapi id 14.03.0439.000; Fri, 20 Mar 2020 16:21:25 +0800 From: "Tu, Lijuan" To: "Wang, Yinan" , "dts@dpdk.org" CC: "Wang, Yinan" Thread-Topic: [dts] [PATCH v1] tests/TestSuite_vhost_pmd_xstats: add automation script for vhost_pmd_xstats test Thread-Index: AQHV/okO0U8UqsYv7kuyQP0TvKFhaahRI/1A Date: Fri, 20 Mar 2020 08:21:25 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBEFB75@SHSMSX101.ccr.corp.intel.com> References: <20200320002144.55896-1-yinan.wang@intel.com> In-Reply-To: <20200320002144.55896-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/TestSuite_vhost_pmd_xstats: add automation script 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" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yinan > Sent: Friday, March 20, 2020 8:22 AM > To: dts@dpdk.org > Cc: Wang, Yinan > Subject: [dts] [PATCH v1] tests/TestSuite_vhost_pmd_xstats: add automatio= n > script for vhost_pmd_xstats test >=20 > From: Wang Yinan >=20 > Signed-off-by: Wang Yinan > --- > tests/TestSuite_vhost_pmd_xstats.py | 323 ++++++++++++++++++---------- > 1 file changed, 206 insertions(+), 117 deletions(-) >=20 > diff --git a/tests/TestSuite_vhost_pmd_xstats.py > b/tests/TestSuite_vhost_pmd_xstats.py > index e9f79ed..ad9e245 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, "#") > - > - 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) > + 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_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,116 +94,237 @@ 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.clear_port_xstats(scope) > + 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 virtio1.1 Mergeable Path. > + """ > + self.scapy_num =3D 0 > + 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() > + # stability test with basic packets number check > + self.scapy_num =3D 0 > + date_old =3D datetime.datetime.now() > + date_new =3D date_old + datetime.timedelta(minutes=3D2) > + while (1): > + date_now =3D datetime.datetime.now() > + scope =3D 'broadcast' > + self.dmac =3D '01:00:00:33:00:01' > + self.scapy_send_packet(64, self.dmac, 1) > + if date_now >=3D date_new: > + break > + self.send_verify(scope, self.scapy_num) > + self.close_all_testpmd() >=20 > - def clear_port_xstats(self, scope): > + 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() >=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) > - 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_vhost_xstats_virtio11_inorder_mergeable(self): > + """ > + performance for Vhost PVP virtio1.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() >=20 > - def test_based_types(self): > + def test_vhost_xstats_virtio11_inorder_no_mergeable(self): > """ > - Verify different type of packets receiving and transmitting pack= ets > correctly in the Vhost PMD xstats > + performance for Vhost PVP virtio1.1 inorder no_mergeable Path. > """ > - 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) > + 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() >=20 > - def test_stability(self): > + def test_vhost_xstats_virtio11_vector(self): > """ > - Verify stability case with multiple queues for Vhost PMD xstats > - Send packets for 2 minutes, check the xstats still can work corr= ectly > + performance for Vhost PVP virtio1.1 inorder no_mergeable Path. > """ > + virtio_pmd_arg =3D {"version": > "in_order=3D1,packed_vq=3D1,mrg_rxbuf=3D0,lro=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() > + # stability test with basic packets number check > self.scapy_num =3D 0 > - self.prepare_start() > date_old =3D datetime.datetime.now() > date_new =3D date_old + datetime.timedelta(minutes=3D2) > - while(1): > + while (1): > date_now =3D datetime.datetime.now() > + scope =3D 'broadcast' > + self.dmac =3D 'ff:ff:ff:ff:ff:ff' > 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) > - 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" % ( > - self.scapy_num, int(rx_packets))) > + self.send_verify(scope, self.scapy_num) > + 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) > + > + def clear_port_xstats(self, scope): > + > + 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") >=20 > def tear_down(self): > """ > Run after each test case. > """ > - if hasattr(self, "vm"): > - 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