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 578B5A0487 for ; Tue, 2 Jul 2019 09:31:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4144A5B34; Tue, 2 Jul 2019 09:31:33 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C93554C8F for ; Tue, 2 Jul 2019 09:31:30 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2019 00:31:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,442,1557212400"; d="scan'208";a="171699203" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 02 Jul 2019 00:31:31 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 2 Jul 2019 00:31:29 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.134]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0439.000; Tue, 2 Jul 2019 15:31:27 +0800 From: "Ma, LihongX" To: "Wang, Yinan" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V2 2/2][share lib] tests: add testsuite pvp share lib Thread-Index: AQHVLLZbhMJ7WJipGEC3g4t1DCYHWKaupBoAgAhSuLA= Date: Tue, 2 Jul 2019 07:31:26 +0000 Message-ID: References: <1561592467-2690-1-git-send-email-lihongx.ma@intel.com> <1561592467-2690-2-git-send-email-lihongx.ma@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V2 2/2][share lib] tests: add testsuite pvp share lib 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" Tested-by:lihong -----Original Message----- From: Wang, Yinan=20 Sent: Thursday, June 27, 2019 4:25 PM To: Ma, LihongX ; dts@dpdk.org Subject: RE: [dts][PATCH V2 2/2][share lib] tests: add testsuite pvp share = lib Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B6=1B$B7n=1B(B27=1B$BF|=1B(B 7:41 > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX=20 > > Subject: [dts][PATCH V2 2/2][share lib] tests: add testsuite pvp share=20 > lib >=20 > Signed-off-by: lihong > --- > tests/TestSuite_pvp_share_lib.py | 200 > +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 200 insertions(+) > create mode 100644 tests/TestSuite_pvp_share_lib.py >=20 > diff --git a/tests/TestSuite_pvp_share_lib.py=20 > b/tests/TestSuite_pvp_share_lib.py > new file mode 100644 > index 0000000..d85d79d > --- /dev/null > +++ b/tests/TestSuite_pvp_share_lib.py > @@ -0,0 +1,200 @@ > +# BSD LICENSE > +# > +# Copyright(c) <2019> Intel Corporation. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without=20 > +# modification, are permitted provided that the following conditions=20 > +# are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS # > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #=20 > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > # > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > # > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > # > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #=20 > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > # > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > ANY # > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #=20 > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE > USE # > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +""" > +DPDK Test suite. > +The feature need compile dpdk as shared libraries. > +""" > + > +import utils > +from test_case import TestCase > +from settings import HEADER_SIZE > +from pktgen import PacketGeneratorHelper > + > + > +class TestPVPShareLib(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.core_config =3D "1S/4C/1T" > + self.dut_ports =3D self.dut.get_ports() > + 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(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + self.verify(self.cores_num >=3D 4, > + "There has not enought cores to test this suite %s" = % > + self.suite_name) > + > + self.core_list =3D self.dut.get_core_list( > + self.core_config, socket=3Dself.ports_socket) > + self.core_list_virtio_user =3D self.core_list[0:2] > + self.core_list_vhost_user =3D self.core_list[2:4] > + self.core_mask_virtio_user =3D > utils.create_mask(self.core_list_virtio_user) > + self.core_mask_vhost_user =3D > utils.create_mask(self.core_list_vhost_user) > + self.mem_channels =3D self.dut.get_memory_channels() > + self.dst_mac =3D self.dut.get_mac_address(self.dut_ports[0]) > + self.prepare_share_lib_env() > + # create an instance to set stream field setting > + self.pktgen_helper =3D PacketGeneratorHelper() > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + 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") > + self.vhost_user.send_expect("export > LD_LIBRARY_PATH=3D%s/%s/lib:$LD_LIBRARY_PATH" % > + (self.dut.base_dir, self.dut.target), "# ") > + self.virtio_user.send_expect("export > LD_LIBRARY_PATH=3D%s/%s/lib:$LD_LIBRARY_PATH" % > + (self.dut.base_dir, self.dut.target), "# ") > + # Prepare the result table > + self.table_header =3D ['Frame'] > + self.table_header.append("Mode") > + self.table_header.append("Mpps") > + self.table_header.append("Queue Num") > + self.table_header.append("% linerate") > + self.result_table_create(self.table_header) > + > + def prepare_share_lib_env(self): > + self.dut.send_expect("sed -i > 's/CONFIG_RTE_BUILD_SHARED_LIB=3Dn$/CONFIG_RTE_BUILD_SHARED_LIB=3Dy/' > config/common_base", "# ") > + self.dut.build_install_dpdk(self.dut.target) > + > + def restore_env(self): > + self.dut.send_expect("sed -i > 's/CONFIG_RTE_BUILD_SHARED_LIB=3Dy$/CONFIG_RTE_BUILD_SHARED_LIB=3Dn/' > config/common_base", "# ") > + self.dut.build_install_dpdk(self.dut.target) > + > + def send_and_verify(self): > + """ > + Send packet with packet generator and verify > + """ > + payload_size =3D 64 - HEADER_SIZE['eth'] - HEADER_SIZE['ip'] - > HEADER_SIZE['tcp'] > + tgen_input =3D [] > + rx_port =3D self.tester.get_local_port(self.dut_ports[0]) > + tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > + self.tester.scapy_append( > + 'wrpcap("vhost.pcap", [Ether(dst=3D"%s")/IP()/TCP()/("X"*%d)= ])' % > + (self.dst_mac, payload_size)) > + tgen_input.append((tx_port, rx_port, "vhost.pcap")) > + > + self.tester.scapy_execute() > + self.tester.pktgen.clear_streams() > + streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, > + None, self.tester.pktgen) > + _, Pps =3D self.tester.pktgen.measure_throughput(stream_ids=3Dst= reams) > + self.verify(Pps > 0, "%s can not receive packets" % (self.runnin= g_case)) > + Pps /=3D 1E6 > + Pct =3D (Pps * 100) / \ > + self.wirespeed(self.nic, 64, 1) > + > + results_row =3D [64] > + results_row.append("share_lib") > + results_row.append(Pps) > + results_row.append("1") > + results_row.append(Pct) > + self.result_table_add(results_row) > + > + def start_testpmd_as_vhost(self, driver): > + """ > + start testpmd on vhost > + """ > + command_line_client =3D "%s/app/testpmd -c %s -n %d " + \ > + "--socket-mem 2048,2048 --legacy-mem " + \ > + "-d librte_pmd_vhost.so -d > librte_pmd_%s.so " + \ > + "-d librte_mempool_ring.so > --file-prefix=3Dvhost " + \ > + "--vdev > 'net_vhost0,iface=3Dvhost-net,queues=3D1' -- -i" > + command_line_client =3D command_line_client % (self.target, > + self.core_mask_vhost_user, self.mem_channels, > driver) > + self.vhost_user.send_expect(command_line_client, "testpmd> ", 12= 0) > + self.vhost_user.send_expect("start", "testpmd> ", 120) > + > + def start_testpmd_as_virtio(self): > + """ > + start testpmd on virtio > + """ > + command_line_user =3D "./%s/app/testpmd -n %d -c %s " + \ > + "--no-pci --socket-mem 2048,2048 > --legacy-mem " + \ > + "--file-prefix=3Dvirtio-user " + \ > + "-d librte_pmd_virtio.so -d > librte_mempool_ring.so " + \ > + > "--vdev=3Dnet_virtio_user0,mac=3D00:01:02:03:04:05,path=3D./vhost-net -- = -i" > + command_line_user =3D command_line_user % (self.target, > + self.mem_channels, self.core_mask_virtio_user) > + self.virtio_user.send_expect(command_line_user, "testpmd> ", 120= ) > + self.virtio_user.send_expect("start", "testpmd> ", 120) > + > + def close_all_apps(self): > + """ > + close testpmd and vhost-switch > + """ > + self.virtio_user.send_expect("quit", "# ", 60) > + self.vhost_user.send_expect("quit", "# ", 60) > + self.dut.close_session(self.vhost_user) > + self.dut.close_session(self.virtio_user) > + > + def test_perf_pvp_share_lib_of_niantic(self): > + """ > + Vhost/virtio-user pvp share lib test with niantic > + """ > + self.verify(self.nic in ['niantic'], > + "the nic not support this case: %s" % self.running_c= ase) > + self.start_testpmd_as_vhost(driver=3D'ixgbe') > + self.start_testpmd_as_virtio() > + self.send_and_verify() > + self.result_table_print() > + self.close_all_apps() > + > + def test_perf_pvp_share_lib_of_fortville(self): > + """ > + Vhost/virtio-user pvp share lib test with fortville > + """ > + self.verify(self.nic in ["fortville_eagle",=20 > + "fortville_spirit", > "fortville_25g"], > + "the nic not support this case: %s" % self.running_c= ase) > + self.start_testpmd_as_vhost(driver=3D'i40e') > + self.start_testpmd_as_virtio() > + self.send_and_verify() > + self.result_table_print() > + self.close_all_apps() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.send_expect("killall -s INT testpmd", "# ") > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.restore_env() > -- > 2.7.4