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 88A56A00E6 for ; Wed, 15 May 2019 07:08:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 579DA2BF2; Wed, 15 May 2019 07:08:10 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C77242BCE for ; Wed, 15 May 2019 07:08:08 +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 orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2019 22:08:07 -0700 X-ExtLoop1: 1 Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 14 May 2019 22:08:07 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 14 May 2019 22:08:07 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 14 May 2019 22:08:06 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.216]) with mapi id 14.03.0415.000; Wed, 15 May 2019 13:08:04 +0800 From: "Ma, LihongX" To: "Wang, Yinan" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] Add testsuite virtio event idx interrupt Thread-Index: AQHVCsk6/EVjc7YsV0mYvwAwY6cTT6ZrGzIAgACHgdA= Date: Wed, 15 May 2019 05:08:04 +0000 Message-ID: References: <1557862301-19352-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 V1] Add testsuite virtio event idx 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 15, 2019 1:03 PM To: Ma, LihongX ; dts@dpdk.org Subject: RE: [dts][PATCH V1] Add testsuite virtio event idx interrupt Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B5=1B$B7n=1B(B15=1B$BF|=1B(B 3:32 > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX=20 > > Subject: [dts][PATCH V1] Add testsuite virtio event idx interrupt >=20 > Signed-off-by: lihong > --- > tests/TestSuite_virtio_event_idx_interrupt.py | 272 > ++++++++++++++++++++++++++ > 1 file changed, 272 insertions(+) > create mode 100644 tests/TestSuite_virtio_event_idx_interrupt.py >=20 > diff --git a/tests/TestSuite_virtio_event_idx_interrupt.py > b/tests/TestSuite_virtio_event_idx_interrupt.py > new file mode 100644 > index 0000000..acaa18a > --- /dev/null > +++ b/tests/TestSuite_virtio_event_idx_interrupt.py > @@ -0,0 +1,272 @@ > +# 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 idx interrupt need test with l3fwd-power sample """ > + > +import utils > +import time > +import thread > +import re > +from virt_common import VM > +from test_case import TestCase > +from etgen import IxiaPacketGenerator > + > + > +class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + > self.tester.extend_external_packet_generator(TestVirtioIdxInterrupt,=20 > self) > + self.queues =3D 1 > + self.nb_cores =3D 1 > + self.dut_ports =3D self.dut.get_ports() > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + 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.mem_channels =3D self.dut.get_memory_channels() > + self.dst_mac =3D self.dut.get_mac_address(self.dut_ports[0]) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + # Clean the execution ENV > + self.flag =3D None > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.vhost =3D self.dut.new_session(suite=3D"vhost") > + > + def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, > + version, flags, ihl, ttl, > id): > + """ > + Configure IP protocol. > + """ > + self.add_tcl_cmd("protocol config -name ip") > + self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src) > + self.add_tcl_cmd('ip config -destIpAddrMode ipRandom') > + self.add_tcl_cmd("ip config -ttl %d" % ttl) > + self.add_tcl_cmd("ip config -totalLength %d" % len) > + self.add_tcl_cmd("ip config -fragment %d" % frag) > + self.add_tcl_cmd("ip config -ipProtocol %d" % proto) > + self.add_tcl_cmd("ip config -identifier %d" % id) > + self.add_tcl_cmd("stream config -framesize %d" % (len + 18)) > + self.add_tcl_cmd("ip set %d %d %d" % (self.chasId, port['card'], > + port['port'])) > + > + def get_core_mask(self): > + self.core_config =3D "1S/%dC/1T" % (self.nb_cores + 1) > + self.verify(self.cores_num >=3D (self.nb_cores + 1), > + "There has not enough cores to test this case %s" % > + self.running_case) > + self.core_list =3D self.dut.get_core_list(self.core_config) > + self.core_mask =3D utils.create_mask(self.core_list) > + > + def start_vhost_testpmd(self): > + """ > + start the testpmd on vhost side > + """ > + # get the core mask depend on the nb_cores number > + self.get_core_mask() > + command_line =3D self.dut.target + "/app/testpmd -c %s -n %d " += \ > + "--socket-mem 2048,2048 --legacy-mem=20 > + --file-prefix=3Dvhost > " + \ > + "--vdev 'net_vhost,iface=3Dvhost-net,queues=3D%d' -- -i = " + \ > + "--nb-cores=3D%d --txd=3D1024 --rxd=3D1024 --rxq=3D%d --= txq=3D%d" > + command_line =3D command_line % (self.core_mask, > self.mem_channels, > + self.queues, self.nb_cores, self.queues, > self.queues) > + self.vhost.send_expect(command_line, "testpmd> ", 30) > + self.vhost.send_expect("start", "testpmd> ", 30) > + > + def start_vms(self): > + """ > + start qemus > + """ > + self.vm =3D VM(self.dut, 'vm0', 'vhost_sample') > + vm_params =3D {} > + vm_params['driver'] =3D 'vhost-user' > + vm_params['opt_path'] =3D './vhost-net' > + vm_params['opt_mac'] =3D "00:11:22:33:44:55" > + opt_args =3D > "mrg_rxbuf=3Don,csum=3Don,gso=3Don,guest_csum=3Don,host_tso4=3Don,guest_t= so4=3Do > n" > + if self.queues > 1: > + vm_params['opt_queue'] =3D self.queues > + opt_args =3D opt_args + ",mq=3Don,vectors=3D%d" %=20 > + (2*self.queues > + 2) > + vm_params['opt_settings'] =3D opt_args > + 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("ERROR: Failure for %s" % str(e)) > + self.vm_dut.restore_interfaces() > + > + def config_virito_net_in_vm(self): > + """ > + config ip for virtio net > + set net for multi queues enable > + """ > + self.vm_intf =3D self.vm_dut.ports_info[0]['intf'] > + self.vm_dut.send_expect("ifconfig %s down" % self.vm_intf, "#") > + out =3D self.vm_dut.send_expect("ifconfig", "#") > + self.verify(self.vm_intf not in out, "the virtio-pci down failed= ") > + self.vm_dut.send_expect("ifconfig %s up" % self.vm_intf, "#") > + if self.queues > 1: > + self.vm_dut.send_expect("ethtool -L %s combined %d" % > + (self.vm_intf, self.queues), "#", 20) > + > + def start_to_send_packets(self, delay): > + """ > + start send packets > + """ > + tgen_input =3D [] > + port =3D self.tester.get_local_port(self.dut_ports[0]) > + > self.tester.scapy_append('a=3D[Ether(dst=3D"%s")/IP(src=3D"0.240.74.101",= pro > to=3D25 > 5)/UDP()/("X"*18)]' % (self.dst_mac)) > + self.tester.scapy_append('wrpcap("interrupt.pcap", a)') > + self.tester.scapy_execute() > + > + tgen_input.append((port, port, "interrupt.pcap")) > + _, self.flag =3D > + self.tester.traffic_generator_throughput(tgen_input, delay=3Ddelay) > + > + def check_packets_after_reload_virtio_device(self, reload_times): > + """ > + start to send packets and check virtio net has receive packets > + """ > + # ixia send packets times equal to reload_times * wait_times > + start_time =3D time.time() > + thread.start_new_thread(self.start_to_send_packets, > (reload_times*20,)) > + # wait the ixia begin to send packets > + time.sleep(10) > + self.vm_pci =3D self.vm_dut.ports_info[0]['pci'] > + # reload virtio device to check the virtio-net can receive packe= ts > + for i in range(reload_times+1): > + if time.time() - start_time > reload_times*30: > + self.logger.error("The ixia has stop to send packets, " > + "please change the delay time of ixia") > + self.logger.info("The virtio device has reload %d=20 > + times" % > i) > + return False > + self.logger.info("The virtio net device reload %d times" % i= ) > + self.vm_dut.send_expect("tcpdump -n -vv -i %s" % self.vm_int= f, > + "tcpdump", 30) > + time.sleep(5) > + out =3D self.vm_dut.get_session_output(timeout=3D3) > + self.vm_dut.send_expect("^c", "#", 30) > + self.verify("ip-proto-255" in out, > + "The virtio device can not receive packets" > + "after reload %d times" % i) > + time.sleep(2) > + # reload virtio device > + self.vm_dut.restore_interfaces() > + time.sleep(3) > + self.vm_dut.send_expect("ifconfig %s down" %=20 > + self.vm_intf, > "#") > + self.vm_dut.send_expect("ifconfig %s up" % self.vm_intf, > + "#") > + > + # wait ixia thread exit > + self.logger.info("wait the thread of ixia to exit") > + while(1): > + if self.flag is not None: > + break > + time.sleep(5) > + return True > + > + def check_each_queue_has_packets_info_on_vhost(self): > + """ > + check each queue has receive packets on vhost side > + """ > + out =3D self.vhost.send_expect("stop", "testpmd> ", 60) > + print out > + for queue_index in range(0, self.queues): > + queue =3D re.search("Port=3D 0/Queue=3D\s*%d" % queue_index, > out) > + queue =3D queue.group() > + 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 + \ > + "rx-packets:%d, tx-packets:%d" % > + (rx_packets, tx_packets)) > + > + self.vhost.send_expect("clear port stats all", "testpmd> ",=20 > + 60) > + > + def stop_all_apps(self): > + """ > + close all vms > + """ > + self.vm.stop() > + self.vhost.send_expect("quit", "#", 20) > + > + def test_perf_virito_idx_interrupt_with_virtio_pci_driver_reload(sel= f): > + """ > + virtio-pci driver reload test > + """ > + self.queues =3D 1 > + self.nb_cores =3D 1 > + self.start_vhost_testpmd() > + self.start_vms() > + self.config_virito_net_in_vm() > + res =3D > self.check_packets_after_reload_virtio_device(reload_times=3D30) > + self.verify(res is True, "Should increase the wait times of ixia= ") > + self.stop_all_apps() > + > + def test_perf_virtio_idx_interrupt_with_multi_queue(self): > + """ > + wake up virtio-net cores with event idx interrupt mode 16=20 > + queues > test > + """ > + self.queues =3D 16 > + self.nb_cores =3D 16 > + self.start_vhost_testpmd() > + self.start_vms() > + self.config_virito_net_in_vm() > + self.start_to_send_packets(delay=3D15) > + self.check_each_queue_has_packets_info_on_vhost() > + self.stop_all_apps() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.close_session(self.vhost) > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64",=20 > + "#") > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.7.4