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 C67EDA0096 for ; Thu, 9 May 2019 03:01:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B29FD3772; Thu, 9 May 2019 03:01:25 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 5B61C2C2B for ; Thu, 9 May 2019 03:01:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2019 18:01:22 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 08 May 2019 18:01:22 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 8 May 2019 18:01:22 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 8 May 2019 18:01:21 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.70]) with mapi id 14.03.0415.000; Thu, 9 May 2019 09:01:20 +0800 From: "Ma, LihongX" To: "Wang, Yinan" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V2] Add testsuite vhost virtio user interrupt Thread-Index: AQHVBXd61/5hQybHw0GbbQTtpAI1ZqZguEEAgAFCKWA= Date: Thu, 9 May 2019 01:01:19 +0000 Message-ID: References: <1557277435-11482-1-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] Add testsuite vhost virtio user interrupt 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: Wednesday, May 8, 2019 9:48 PM To: Ma, LihongX ; dts@dpdk.org Subject: RE: [dts][PATCH V2] Add testsuite vhost virtio user interrupt Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B5=1B$B7n=1B(B8=1B$BF|=1B(B 9:04 > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX=20 > > Subject: [dts][PATCH V2] Add testsuite vhost virtio user interrupt >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vhost_virtio_user_interrupt.py | 217 > +++++++++++++++++++++++++ > 1 file changed, 217 insertions(+) > create mode 100644 tests/TestSuite_vhost_virtio_user_interrupt.py >=20 > diff --git a/tests/TestSuite_vhost_virtio_user_interrupt.py > b/tests/TestSuite_vhost_virtio_user_interrupt.py > new file mode 100644 > index 0000000..6713590 > --- /dev/null > +++ b/tests/TestSuite_vhost_virtio_user_interrupt.py > @@ -0,0 +1,217 @@ > +# 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 > # > +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. > +Virtio-user interrupt need test with l3fwd-power sample """ > + > +import re > +import time > +import utils > +from test_case import TestCase > + > + > +class TestVirtioUserInterrupt(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.cores_num =3D len([n for n in self.dut.cores if int(n['sock= et']) =3D=3D 0]) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + self.verify(self.cores_num >=3D 4, "There has not enought cores= =20 > + to test > this case") > + self.core_list =3D self.dut.get_core_list(self.core_config) > + self.core_list_vhost =3D self.core_list[0:2] > + self.core_list_l3fwd =3D self.core_list[2:4] > + self.core_mask_vhost =3D utils.create_mask(self.core_list_vhost) > + self.core_mask_l3fwd =3D utils.create_mask(self.core_list_l3fwd) > + self.core_mask_virtio =3D self.core_mask_l3fwd > + self.mem_channel =3D self.dut.get_memory_channels() > + > + self.prepare_l3fwd_power() > + self.tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > + self.tx_interface =3D self.tester.get_interface(self.tx_port) > + > + def set_up(self): > + """ > + run before each test case. > + """ > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT l3fwd-power", "#") > + self.dut.send_expect("rm -rf vhost-net*", "#") > + > + self.l3fwd =3D self.dut.new_session(suite=3D"l3fwd") > + self.vhost =3D self.dut.new_session(suite=3D"vhost") > + self.virtio =3D self.dut.new_session(suite=3D"virito") > + > + def close_all_session(self): > + self.dut.close_session(self.vhost) > + self.dut.close_session(self.virtio) > + self.dut.close_session(self.l3fwd) > + > + def prepare_l3fwd_power(self): > + self.dut.send_expect("cp ./examples/l3fwd-power/main.c .", "#") > + self.dut.send_expect( > + "sed -i > '/DEV_RX_OFFLOAD_CHECKSUM/d' ./examples/l3fwd-power/main.c", "#", 10) > + out =3D self.dut.build_dpdk_apps("./examples/l3fwd-power") > + self.verify("Error" not in out, "compilation l3fwd-power > + error") > + > + def launch_l3fwd(self, path): > + self.core_interrupt =3D self.core_list_l3fwd[0] > + cmd_l3fwd =3D "./examples/l3fwd-power/build/l3fwd-power " + \ > + "-n %d -c %s --socket-mem 1024,1024 --legacy-mem " > + \ > + "--log-level=3D'user1,7' --no-pci --file-prefix=3Dl3= fwd-pwd " > + \ > + "--vdev=3Dvirtio_user0,path=3D%s -- -p 1 " + \ > + " -P --config=3D'(0,0,%s)' --parse-ptype " > + cmd_l3fwd =3D cmd_l3fwd % (self.mem_channel, > self.core_mask_l3fwd, > + path, self.core_interrupt) > + self.l3fwd.send_expect(cmd_l3fwd, "POWER", 40) > + time.sleep(10) > + out =3D self.l3fwd.get_session_before() > + if ("Error" in out and "Error opening" not in out): > + self.logger.error("Launch l3fwd-power sample error") > + else: > + self.logger.info("Launch l3fwd-power sample finished") > + > + def start_vhost_testpmd(self, pci=3D""): > + """ > + start testpmd on vhost side > + """ > + cmd_vhost_user =3D self.dut.target + "/app/testpmd -n %d -c %s "= + \ > + "--socket-mem 1024,1024 --legacy-mem %s " + \ > + "--file-prefix=3Dvhost " + \ > + "--vdev 'net_vhost0,iface=3Dvhost-net,queues=3D1,client=3D= 0' " + \ > + "-- -i --rxq=3D1 --txq=3D1" > + cmd_vhost_user =3D cmd_vhost_user % (self.mem_channel, > + self.core_mask_vhost, pci) > + > + self.vhost.send_expect(cmd_vhost_user, "testpmd>", 30) > + self.vhost.send_expect("set fwd mac", "testpmd>", 30) > + self.vhost.send_expect("start", "testpmd>", 30) > + > + def start_virtio_user(self): > + """ > + start testpmd on virtio side > + """ > + cmd_virtio_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" + \ > + " -- -i --txd=3D512 --rxd=3D128 --tx-offloads=3D= 0x00" > + cmd_virtio_user =3D cmd_virtio_user % (self.mem_channel, > + self.core_mask_virtio) > + > + self.virtio.send_expect(cmd_virtio_user, "testpmd>", 120) > + self.virtio.send_expect("set fwd mac", "testpmd>", 20) > + self.virtio.send_expect("start", "testpmd>", 20) > + > + def check_interrupt_log(self, status): > + out =3D self.l3fwd.get_session_before() > + if status =3D=3D "waked up": > + info =3D "lcore %s is waked up from rx interrupt on port 0=20 > + queue > 0" > + elif status =3D=3D "sleeps": > + info =3D "lcore %s sleeps until interrupt triggers" > + info =3D info % self.core_interrupt > + self.logger.info(info) > + self.verify(info in out, "The CPU status not right for %s" % > + info) > + > + def check_virtio_side_link_status(self, status): > + out =3D self.virtio.send_expect("show port info 0", "testpmd> ",= 20) > + rinfo =3D re.search("Link\s*status:\s*([a-z]*)", out) > + result =3D rinfo.group(1) > + if status in result: > + self.logger.info("Link status is right, status is %s" % stat= us) > + else: > + self.logger.error("Wrong link status not right, status is=20 > + %s" % result) > + > + def test_interrupt_with_vhost_net_as_backed(self): > + """ > + Check the virtio-user interrupt can work when use vhost-net=20 > + as > backend > + """ > + self.launch_l3fwd(path=3D"/dev/vhost-net") > + self.virtio.send_expect("ifconfig tap0 up", "#", 20) > + self.virtio.send_expect("ifconfig tap0 1.1.1.2", "#", 20) > + # start to ping, check the status of interrupt core > + self.virtio.send_command("ping -I tap0 1.1.1.1 > aa &", 20) > + time.sleep(3) > + self.check_interrupt_log(status=3D"waked up") > + # stop ping, check the status of interrupt core > + self.dut.send_expect("killall -s INT ping", "#") > + time.sleep(2) > + self.check_interrupt_log(status=3D"sleeps") > + # restart ping, check the status of interrupt core > + self.virtio.send_command("ping -I tap0 1.1.1.1 > aa &", 20) > + time.sleep(3) > + self.check_interrupt_log(status=3D"waked up") > + self.dut.send_expect("killall -s INT ping", "#") > + > + def test_interrupt_with_vhost_user_as_backed(self): > + """ > + Check the virtio-user interrupt can work when use vhost-user=20 > + as > backend > + """ > + self.start_vhost_testpmd(pci=3D"") > + self.launch_l3fwd(path=3D"./vhost-net") > + # double check the status of interrupt core > + for i in range(2): > + > self.tester.scapy_append('pk=3D[Ether(dst=3D"52:54:00:00:00:01")/IP()/("X= " > *64)]') > + self.tester.scapy_append('sendp(pk, iface=3D"%s",=20 > + count=3D100)' % > self.tx_interface) > + self.tester.scapy_execute() > + time.sleep(3) > + self.check_interrupt_log(status=3D"waked up") > + > + def test_lsc_event_between_vhost_and_virtio_user(self): > + """ > + LSC event between vhost-user and virtio-user > + """ > + self.start_vhost_testpmd(pci=3D"--no-pci") > + self.start_virtio_user() > + self.check_virtio_side_link_status("up") > + > + self.vhost.send_expect("quit", "#", 20) > + self.check_virtio_side_link_status("down") > + > + def tear_down(self): > + """ > + run after each test case. > + """ > + self.dut.send_expect("killall -s INT l3fwd-power", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.close_all_session() > + > + def tear_down_all(self): > + """ > + run after each test suite. > + """ > + self.dut.send_expect("mv ./main.c ./examples/l3fwd-power/", "#") > + self.dut.build_dpdk_apps('examples/l3fwd-power') > -- > 2.7.4