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 80957A0471 for ; Tue, 13 Aug 2019 08:40:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 75F171B94A; Tue, 13 Aug 2019 08:40:11 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4E3185681 for ; Tue, 13 Aug 2019 08:40:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 23:40:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,380,1559545200"; d="scan'208";a="181097904" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga006.jf.intel.com with ESMTP; 12 Aug 2019 23:40:08 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 12 Aug 2019 23:40:07 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 12 Aug 2019 23:40:07 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Tue, 13 Aug 2019 14:40:05 +0800 From: "Wang, Yinan" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V2] tests: add testsuite virtio user as exceptional path Thread-Index: AQHVUZO2VH4wcp7v2ki3tCXRybeS7ab4oLPA Date: Tue, 13 Aug 2019 06:40:04 +0000 Message-ID: References: <1565645696-28762-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1565645696-28762-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWYwOWFhNDQtYzUwMS00N2E4LWIyYzMtNmQ5MWRiZjczZjJjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVmwyTjBsN2taa25BeVoyMmJ1RHZtcWl6b1BwNXpnS1FDYjc4V3d6WjJuTTBhck1LZVpjUGQwV3orQWNuT2lEbiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 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] tests: add testsuite virtio user as exceptional path 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(B8=1B$B7n=1B(B13=1B$BF|=1B(B 5:35 > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > Subject: [dts][PATCH V2] tests: add testsuite virtio user as exceptional = path >=20 > Signed-off-by: lihong > --- > tests/TestSuite_virtio_user_as_exceptional_path.py | 242 > +++++++++++++++++++++ > 1 file changed, 242 insertions(+) > create mode 100644 tests/TestSuite_virtio_user_as_exceptional_path.py >=20 > diff --git a/tests/TestSuite_virtio_user_as_exceptional_path.py > b/tests/TestSuite_virtio_user_as_exceptional_path.py > new file mode 100644 > index 0000000..0330f7e > --- /dev/null > +++ b/tests/TestSuite_virtio_user_as_exceptional_path.py > @@ -0,0 +1,242 @@ > +# 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 as exception path test suite. > +""" > +import re > +import time > +import utils > +from test_case import TestCase > +import vhost_peer_conf as peer > + > + > +class TestVirtioUserAsExceptionalPath(TestCase): > + > + def set_up_all(self): > + # Get and verify the ports > + self.dut_ports =3D self.dut.get_ports() > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + # Get the port's socket and get the core for testpmd > + self.pf =3D self.dut_ports[0] > + netdev =3D self.dut.ports_info[self.pf]['port'] > + self.socket =3D netdev.get_nic_socket() > + self.cores =3D self.dut.get_core_list("1S/2C/1T", socket=3Dself.= socket) > + self.virtio_ip1 =3D "1.1.1.2" > + self.virtio_mac1 =3D "52:54:00:00:00:01" > + self.memory_channel =3D self.dut.get_memory_channels() > + > + self.pci =3D peer.get_pci_info() > + self.pci_drv =3D peer.get_pci_driver_info() > + self.peer_pci =3D peer.get_pci_peer_info() > + self.nic_in_kernel =3D peer.get_pci_peer_intf_info() > + self.verify(len(self.pci) !=3D 0 and len(self.pci_drv) !=3D 0 > + and len(self.peer_pci) !=3D 0 > + and len(self.nic_in_kernel) !=3D 0, > + 'Pls config the direct connection info in > vhost_peer_conf.cfg') > + # unbind the port conf in ports.cfg > + for i in self.dut_ports: > + port =3D self.dut.ports_info[i]['port'] > + port.bind_driver() > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -b igb_uio %s" % > + self.pci, '#', 30) > + > + # set diff arg about mem_socket base on socket number > + if len(set([int(core['socket']) for core in self.dut.cores])) = =3D=3D 1: > + self.socket_mem =3D '1024' > + else: > + self.socket_mem =3D '1024,1024' > + > + self.prepare_dpdk() > + > + def set_up(self): > + # > + # Run before each test case. > + # > + # Clean the execution ENV > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + self.dut.send_expect("modprobe vhost-net", "#") > + > + def launch_testpmd_exception_path(self): > + self.testcmd =3D self.target + "/app/testpmd -c %s -n %d > --socket-mem %s --legacy-mem" \ > + + " > --vdev=3Dvirtio_user0,mac=3D%s,path=3D/dev/vhost-net,queue_size=3D1024 --= -i" \ > + + " --rxd=3D1024 --txd=3D1024" > + self.coremask =3D utils.create_mask(self.cores) > + self.testcmd_start =3D self.testcmd % (self.coremask, > self.memory_channel, > + self.socket_mem, self.virtio_mac1) > + self.vhost_user =3D self.dut.new_session(suite=3D"user") > + self.vhost_user.send_expect("modprobe vhost-net", "#", 120) > + self.vhost_user.send_expect(self.testcmd_start, "testpmd> ", 120= ) > + self.vhost_user.send_expect("set fwd csum", "testpmd> ", 120) > + self.vhost_user.send_expect("stop", "testpmd> ", 120) > + self.vhost_user.send_expect("port stop 0", "testpmd> ", 120) > + self.vhost_user.send_expect("port stop 1", "testpmd> ", 120) > + self.vhost_user.send_expect("port config 0 tx_offload tcp_cksum = on", > "testpmd> ", 120) > + self.vhost_user.send_expect("port config 0 tx_offload ipv4_cksum= on", > "testpmd> ", 120) > + self.vhost_user.send_expect("csum set ip sw 1", "testpmd> ", 120= ) > + self.vhost_user.send_expect("csum set tcp hw 1", "testpmd> ", 12= 0) > + self.vhost_user.send_expect("csum set ip hw 0", "testpmd> ", 120= ) > + self.vhost_user.send_expect("csum set tcp hw 0", "testpmd> ", 12= 0) > + self.vhost_user.send_expect("tso set 1448 0", "testpmd> ", 120) > + self.vhost_user.send_expect("port start 0", "testpmd> ", 120) > + self.vhost_user.send_expect("port start 1", "testpmd> ", 120) > + self.vhost_user.send_expect("start", "testpmd> ", 120) > + > + def prepare_tap_device(self): > + self.dut.send_expect("ifconfig tap0 up", "#") > + self.dut.send_expect("ifconfig tap0 1.1.1.2", "#") > + > + def testpmd_reset(self): > + self.vhost_user.send_expect("stop", "testpmd> ", 120) > + self.vhost_user.send_expect("port stop 1", "testpmd> ", 120) > + self.vhost_user.send_expect("csum set ip sw 1", "testpmd> ", 120= ) > + self.vhost_user.send_expect("port start 1", "testpmd> ", 120) > + self.vhost_user.send_expect("start", "testpmd> ", 120) > + > + def config_kernel_nic_host(self): > + # > + self.dut.send_expect("ip netns del ns1", "#") > + self.dut.send_expect("ip netns add ns1", "#") > + self.dut.send_expect("ip link set %s netns ns1" % self.nic_in_ke= rnel, > "#") > + self.dut.send_expect("ip netns exec ns1 ifconfig %s 1.1.1.8 up" = % > self.nic_in_kernel, "#") > + self.dut.send_expect("ip netns exec ns1 ethtool -K %s gro on" % > self.nic_in_kernel, "#") > + self.dut.send_expect("ip netns exec ns1 ethtool -K %s tso on" % > + self.nic_in_kernel, "#") > + > + def prepare_dpdk(self): > + # > + # Changhe the testpmd checksum fwd code for mac change > + self.dut.send_expect( > + > "cp ./app/test-pmd/csumonly.c ./app/test-pmd/csumonly_backup.c", > + "#") > + self.dut.send_expect( > + "sed -i '/ether_addr_copy(&peer_eth/i\#if > 0' ./app/test-pmd/csumonly.c", "#") > + self.dut.send_expect( > + "sed -i '/parse_ethernet(eth_hdr, > &info/i\#endif' ./app/test-pmd/csumonly.c", "#") > + self.dut.build_install_dpdk(self.dut.target) > + > + def unprepare_dpdk(self): > + # Recovery the DPDK code to original > + self.dut.send_expect( > + > "cp ./app/test-pmd/csumonly_backup.c ./app/test-pmd/csumonly.c ", > + "#") > + self.dut.send_expect("rm -rf ./app/test-pmd/csumonly_backup.c", > "#") > + self.dut.build_install_dpdk(self.dut.target) > + > + def iperf_result_verify(self, vm_client): > + ''' > + Get the iperf test result > + ''' > + fmsg =3D vm_client.send_expect("cat /root/iperf_client.log", "#"= ) > + print fmsg > + iperfdata =3D re.compile('[\d+]*.[\d+]* [M|G]bits/sec').findall(= fmsg) > + print iperfdata > + self.verify(iperfdata, 'There no data about this case') > + self.result_table_create(['Data', 'Unit']) > + results_row =3D ['exception path'] > + results_row.append(iperfdata[-1]) > + self.result_table_add(results_row) > + self.result_table_print() > + self.output_result =3D "Iperf throughput is %s" % iperfdata[-1] > + self.logger.info(self.output_result) > + > + def test_vhost_exception_path_TAP_original(self): > + self.config_kernel_nic_host() > + self.launch_testpmd_exception_path() > + self.dut.get_session_output(timeout=3D2) > + time.sleep(5) > + # Get the virtio-net device name > + self.prepare_tap_device() > + self.testpmd_reset() > + self.dut.send_expect('ip netns exec ns1 iperf -s -i 1', '', 10) > + self.iperf =3D self.dut.new_session(suite=3D"iperf") > + self.iperf.send_expect('rm /root/iperf_client.log', '#', 10) > + self.iperf.send_expect('iperf -c 1.1.1.8 -i 1 -t 10 > /root/iper= f_client.log > &', '', 180) > + time.sleep(30) > + self.dut.send_expect('^C', '#', 10) > + self.iperf_result_verify(self.iperf) > + self.logger.info("TAP->virtio-user->Kernel_NIC %s " % > (self.output_result)) > + self.iperf.send_expect('rm /root/iperf_client.log', '#', 10) > + self.vhost_user.send_expect("quit", "#", 120) > + self.dut.close_session(self.vhost_user) > + self.dut.send_expect("ip netns del ns1", "#") > + self.dut.close_session(self.iperf) > + > + def test_vhost_exception_path_NIC_original(self): > + self.config_kernel_nic_host() > + self.launch_testpmd_exception_path() > + time.sleep(5) > + self.dut.get_session_output(timeout=3D2) > + self.prepare_tap_device() > + self.testpmd_reset() > + self.iperf =3D self.dut.new_session(suite=3D"iperf") > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.iperf.send_expect('iperf -s -i 1', '', 180) > + self.dut.send_expect('ip netns exec ns1 iperf -c 1.1.1.2 -i 1 -t= 10 > > /root/iperf_client.log &', '', 10) > + time.sleep(30) > + self.iperf.send_expect('^C', '#', 10) > + self.iperf_result_verify(self.dut) > + self.dut.get_session_output(timeout=3D2) > + self.logger.info("Kernel_NIC<-virtio-user<-TAP %s " % > (self.output_result)) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.vhost_user.send_expect("quit", "#", 120) > + self.dut.close_session(self.vhost_user) > + self.dut.send_expect("ip netns del ns1", "#") > + self.dut.close_session(self.iperf) > + > + def tear_down(self): > + # > + # Run after each test case. > + # > + 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", "#") > + time.sleep(2) > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -u %s" % (self.peer_pci), '# ',= 30) > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -b %s %s" % > + (self.pci_drv, self.peer_pci), '# ', 30) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.unprepare_dpdk() > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -u %s" % (self.pci), '# ', 30) > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -b %s %s" % > + (self.pci_drv, self.pci), '# ', 30) > -- > 2.7.4