From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 83FA0A00E6 for ; Mon, 15 Apr 2019 03:36:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7AFE75B3C; Mon, 15 Apr 2019 03:36:46 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 328405B38 for ; Mon, 15 Apr 2019 03:36:45 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Apr 2019 18:36:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,351,1549958400"; d="scan'208";a="131372778" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 14 Apr 2019 18:36:43 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 14 Apr 2019 18:36:43 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 14 Apr 2019 18:36:43 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.92]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.39]) with mapi id 14.03.0415.000; Mon, 15 Apr 2019 09:36:41 +0800 From: "Wang, Yinan" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V2] add testsuite of loopback multi queues Thread-Index: AQHU8POGcUec+PweFkmOmAyqlL4iwqY8dRXw Date: Mon, 15 Apr 2019 01:36:40 +0000 Message-ID: References: <1555021795-3026-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1555021795-3026-1-git-send-email-lihongx.ma@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWFkZTg3ZDgtZDEzOC00YmFhLWI5MjEtZDcxYWE1YzQwZmVlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicFBhalRKcEJpWWs2RkF5TnVJT29LRFJkSnBETFVlK3lBWG9MRWFJNm5WWU1iNjl3SFwvUVI3Vm1ldmZVRWs5bGkifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action 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] add testsuite of loopback multi queues 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" Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B4=1B$B7n=1B(B12=1B$BF|=1B(B 6:30 > To: dts@dpdk.org; Wang, Yinan > Cc: Ma, LihongX > Subject: [dts][PATCH V2] add testsuite of loopback multi queues >=20 > Signed-off-by: lihong > --- > tests/TestSuite_loopback_multi_queues.py | 308 > +++++++++++++++++++++++++++++++ > 1 file changed, 308 insertions(+) > create mode 100644 tests/TestSuite_loopback_multi_queues.py >=20 > diff --git a/tests/TestSuite_loopback_multi_queues.py > b/tests/TestSuite_loopback_multi_queues.py > new file mode 100644 > index 0000000..5ab17fd > --- /dev/null > +++ b/tests/TestSuite_loopback_multi_queues.py > @@ -0,0 +1,308 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without # > +modification, are permitted provided that the following conditions # > +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 # > +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 > # > +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 # > +(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. > +Test vhost/virtio-user loopback multi-queues on 8 tx/rx path. > +Includes Mergeable, Normal, Vector_RX, Inorder mergeable, Inorder > +no-mergeable, Virtio 1.1 mergeable, Virtio 1.1 no-mergeable Path, > +Virtio 1.1 inorder no-mergeable Path. > +""" > + > +import utils > +import time > +import re > +from test_case import TestCase > + > + > +class TestLoopbackMultiQueues(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.frame_sizes =3D [64, 128, 256, 512, 1024, 1518] > + self.core_config =3D "1S/18C/1T" > + self.nb_cores =3D 2 > + self.queue_number =3D 2 > + self.cores_num =3D len([n for n in self.dut.cores if int(n['sock= et']) =3D=3D 0]) > + self.verify(self.cores_num >=3D 18, > + "There has not enought cores to test this case") > + self.core_list =3D self.dut.get_core_list(self.core_config) > + self.logger.info("you can config packet_size in file %s.cfg," % > self.suite_name + \ > + "in region 'suite' like packet_sizes=3D[64, 128, > 256]") > + # get the frame_sizes from cfg file > + if 'packet_sizes' in self.get_suite_cfg(): > + self.frame_sizes =3D self.get_suite_cfg()['packet_sizes'] > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + # Prepare the result table > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.table_header =3D ["Frame", "Mode", "Throughput(Mpps)"] > + self.result_table_create(self.table_header) > + > + self.vhost =3D self.dut.new_session(suite=3D"vhost") > + self.virtio_user =3D self.dut.new_session(suite=3D"virtio-user") > + > + def get_core_mask(self): > + """ > + get the coremask about vhost and virito depend on the queue > number > + """ > + self.core_list_user =3D self.core_list[0:self.nb_cores + 1] > + self.core_list_host =3D self.core_list[self.nb_cores + 1:2 * > self.nb_cores + 2] > + self.core_mask_user =3D utils.create_mask(self.core_list_user) > + self.core_mask_host =3D utils.create_mask(self.core_list_host) > + > + def start_vhost_testpmd(self): > + """ > + start testpmd on vhost > + """ > + command_line_client =3D self.dut.target + "/app/testpmd -n %d -c= %s > --socket-mem 1024,1024" + \ > + " --legacy-mem --no-pci > --file-prefix=3Dvhost --vdev " + \ > + > "'net_vhost0,iface=3Dvhost-net,queues=3D%d' -- -i --nb-cores=3D%d " + \ > + "--rxq=3D%d --txq=3D%d --txd=3D1024 > --rxd=3D1024" > + command_line_client =3D command_line_client % ( > + self.dut.get_memory_channels(), self.core_mask_host, > self.queue_number, > + self.nb_cores, self.queue_number, self.queue_number) > + self.vhost.send_expect(command_line_client, "testpmd> ", 120) > + self.vhost.send_expect("set fwd mac", "testpmd> ", 120) > + > + def start_virtio_testpmd(self, args): > + """ > + start testpmd on virtio > + """ > + command_line_user =3D self.dut.target + "/app/testpmd -n %d -c %= s " > + \ > + " --socket-mem 1024,1024 --legacy-mem > --no-pci --file-prefix=3Dvirtio " + \ > + > "--vdev=3Dnet_virtio_user0,mac=3D00:01:02:03:04:05,path=3D./vhost-net,que= ues=3D%d > ,%s " + \ > + "-- -i %s --rss-ip --nb-cores=3D%d --rxq=3D%= d > --txq=3D%d --txd=3D1024 --rxd=3D1024" > + command_line_user =3D command_line_user % ( > + self.dut.get_memory_channels(), self.core_mask_user, > self.queue_number, > + args["version"], args["path"], self.nb_cores, > self.queue_number, self.queue_number) > + self.virtio_user.send_expect(command_line_user, "testpmd> ", 120= ) > + self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120) > + self.virtio_user.send_expect("start", "testpmd> ", 120) > + > + def calculate_avg_throughput(self): > + """ > + calculate the average throughput > + """ > + results =3D 0.0 > + results_row =3D [] > + for i in range(10): > + out =3D self.vhost.send_expect("show port stats all", "testp= md>", > 60) > + time.sleep(5) > + lines =3D re.search("Rx-pps:\s*(\d*)", out) > + result =3D lines.group(1) > + results +=3D float(result) > + Mpps =3D results / (1000000 * 10) > + self.verify(Mpps > 0, "port can not receive packets") > + return Mpps > + > + def update_result_table(self, frame_size, case_info, Mpps): > + results_row =3D [frame_size] > + results_row.append(case_info) > + results_row.append(Mpps) > + self.result_table_add(results_row) > + > + def check_packets_of_each_queue(self, frame_size): > + """ > + check each queue has receive packets > + """ > + out =3D self.vhost.send_expect("stop", "testpmd> ", 60) > + for queue_index in range(0, self.queue_number): > + queue =3D "Queue=3D %d" % queue_index > + index =3D out.find(queue) > + rx =3D re.search("RX-packets:\s*(\d*)", out[index:]) > + tx =3D re.search("TX-packets:\s*(\d*)", out[index:]) > + rx_packets =3D int(rx.group(1)) > + tx_packets =3D int(tx.group(1)) > + self.verify(rx_packets > 0 and tx_packets > 0, > + "The queue %d rx-packets or tx-packets is 0 about " % > + queue_index + \ > + "frame_size:%d, rx-packets:%d, tx-packets:%d" % > + (frame_size, rx_packets, tx_packets)) > + > + self.vhost.send_expect("clear port stats all", "testpmd> ", 60) > + > + def send_and_verify(self, case_info): > + """ > + start to send packets and calculate avg throughput > + """ > + for frame_size in self.frame_sizes: > + self.vhost.send_expect("set txpkts %d" % frame_size, > "testpmd> ", 30) > + self.vhost.send_expect("start tx_first 32", "testpmd> ", 30) > + Mpps =3D self.calculate_avg_throughput() > + self.update_result_table(frame_size, case_info, Mpps) > + self.check_packets_of_each_queue(frame_size) > + self.result_table_print() > + > + def close_all_testpmd(self): > + """ > + close all testpmd of vhost and virtio > + """ > + self.vhost.send_expect("quit", "#", 60) > + self.virtio_user.send_expect("quit", "#", 60) > + > + def close_all_session(self): > + """ > + close all session of vhost and vhost-user > + """ > + self.dut.close_session(self.virtio_user) > + self.dut.close_session(self.vhost) > + > + def test_loopback_multi_queue_virtio11_mergeable(self): > + """ > + performance for Vhost PVP virtio 1.1 Mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": > "in_order=3D0,packed_vq=3D1,mrg_rxbuf=3D1", > + "path": "--tx-offloads=3D0x0 > --enable-hw-vlan-strip"} > + self.nb_cores =3D 2 > + self.queue_number =3D 2 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("virtio_1.1 mergeable on") > + self.close_all_testpmd() > + > + def test_loopback_multi_queue_virtio11_normal(self): > + """ > + performance for Vhost PVP virtio1.1 Normal Path. > + """ > + virtio_pmd_arg =3D {"version": > "in_order=3D0,packed_vq=3D1,mrg_rxbuf=3D0", > + "path": "--tx-offloads=3D0x0 > --enable-hw-vlan-strip"} > + self.nb_cores =3D 2 > + self.queue_number =3D 2 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("virtio_1.1 normal") > + self.close_all_testpmd() > + > + def test_loopback_multi_queue_virtio11_inorder(self): > + """ > + performance for Vhost PVP virtio1.1 inorder Path. > + """ > + virtio_pmd_arg =3D {"version": > "in_order=3D1,packed_vq=3D1,mrg_rxbuf=3D0", > + "path": "--tx-offloads=3D0x0 > --enable-hw-vlan-strip"} > + self.nb_cores =3D 2 > + self.queue_number =3D 2 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("virtio_1.1 inorder") > + self.close_all_testpmd() > + > + def test_loopback_multi_queue_inorder_mergeable(self): > + """ > + performance for Vhost PVP In_order mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": > "packed_vq=3D0,in_order=3D1,mrg_rxbuf=3D1", > + "path": "--tx-offloads=3D0x0 > --enable-hw-vlan-strip"} > + self.nb_cores =3D 2 > + self.queue_number =3D 2 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("inoder mergeable on") > + self.close_all_testpmd() > + > + def test_loopback_multi_queue_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_rxbuf=3D0", > + "path": "--tx-offloads=3D0x0 > --enable-hw-vlan-strip"} > + self.nb_cores =3D 2 > + self.queue_number =3D 2 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("inoder mergeable off") > + self.close_all_testpmd() > + > + def test_loopback_mulit_queue_mergeable(self): > + """ > + performance for Vhost PVP Mergeable Path. > + """ > + virtio_pmd_arg =3D {"version": > "packed_vq=3D0,in_order=3D0,mrg_rxbuf=3D1", > + "path": "--tx-offloads=3D0x0 > --enable-hw-vlan-strip"} > + self.nb_cores =3D 8 > + self.queue_number =3D 8 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("virito mergeable") > + self.close_all_testpmd() > + > + def test_loopback_multi_queue_normal(self): > + """ > + performance for Vhost PVP Normal Path. > + """ > + virtio_pmd_arg =3D {"version": > "packed_vq=3D0,in_order=3D0,mrg_rxbuf=3D0", > + "path": "--tx-offloads=3D0x0 > --enable-hw-vlan-strip"} > + self.nb_cores =3D 8 > + self.queue_number =3D 8 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("virtio normal") > + self.close_all_testpmd() > + > + def test_loopback_multi_queue_vector_rx(self): > + """ > + performance for Vhost PVP Vector_RX Path > + """ > + virtio_pmd_arg =3D {"version": > "packed_vq=3D0,in_order=3D0,mrg_rxbuf=3D0", > + "path": "--tx-offloads=3D0x0"} > + self.nb_cores =3D 8 > + self.queue_number =3D 8 > + self.get_core_mask() > + self.start_vhost_testpmd() > + self.start_virtio_testpmd(virtio_pmd_arg) > + self.send_and_verify("virito vector rx") > + self.close_all_testpmd() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.close_all_session() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.7.4