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 4BCCBA00E6 for ; Mon, 13 May 2019 09:24:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E7947293B; Mon, 13 May 2019 09:24:08 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 368D52082 for ; Mon, 13 May 2019 09:24:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 May 2019 00:24:06 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 13 May 2019 00:24:05 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 13 May 2019 00:24:05 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 13 May 2019 00:24:05 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.10]) with mapi id 14.03.0415.000; Mon, 13 May 2019 15:24:03 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Wang, Yinan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V2] Add testsuite vhost virtio user interrupt Thread-Index: AQHVBXeIQVZ64mi6OkeyrkUZJWSzQ6ZorrNg Date: Mon, 13 May 2019 07:24:02 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA7FC2E@SHSMSX101.ccr.corp.intel.com> References: <1557277435-11482-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1557277435-11482-1-git-send-email-lihongx.ma@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.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDNlOTdjMzEtMDlkMi00YzgxLTgwODgtNzM2MWU0NmM3Y2E3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidXhYNmVwU0hPNnU5akhMR0VtS2RuelVCWmQ0OUJPRnU4Zm1rV1AwbWZENlJQY1k3dGs4TzcwVU5YeGp6Q3BrdyJ9 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 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" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Wednesday, May 8, 2019 9:04 AM > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > 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 # > +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. > +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 = 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_l3fw= d, > + 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 q= ueue 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 > + %s" % result) > + > + def test_interrupt_with_vhost_net_as_backed(self): > + """ > + Check the virtio-user interrupt can work when use vhost-net 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 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", count=3D10= 0)' % > 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