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 3B317A0487 for ; Thu, 4 Jul 2019 08:38:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2EAB85680; Thu, 4 Jul 2019 08:38:03 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 34D25374C for ; Thu, 4 Jul 2019 08:38:01 +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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 23:38:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,449,1557212400"; d="scan'208";a="184935241" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 03 Jul 2019 23:38:00 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 3 Jul 2019 23:38:00 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 3 Jul 2019 23:37:58 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.134]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.240]) with mapi id 14.03.0439.000; Thu, 4 Jul 2019 14:37:57 +0800 From: "Ma, LihongX" To: "Wang, Yinan" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1 2/2][vhost gro] tests: add testsuite vhost gro Thread-Index: AQHVMiX4LC9EvkWQZkK2XIIIgISGYaa5cdiAgACP4fA= Date: Thu, 4 Jul 2019 06:37:56 +0000 Message-ID: References: <1562190140-24335-1-git-send-email-lihongx.ma@intel.com> <1562190140-24335-2-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 2/2][vhost gro] tests: add testsuite vhost gro 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: Thursday, July 4, 2019 2:03 PM To: Ma, LihongX ; dts@dpdk.org Subject: RE: [dts][PATCH V1 2/2][vhost gro] tests: add testsuite vhost gro Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B7=1B$B7n=1B(B4=1B$BF|=1B(B 5:42 > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX=20 > > Subject: [dts][PATCH V1 2/2][vhost gro] tests: add testsuite vhost gro >=20 > Signed-off-by: lihong > --- > tests/TestSuite_dpdk_gro_lib.py | 381 > ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 381 insertions(+) > create mode 100644 tests/TestSuite_dpdk_gro_lib.py >=20 > diff --git a/tests/TestSuite_dpdk_gro_lib.py=20 > b/tests/TestSuite_dpdk_gro_lib.py new file mode 100644 index=20 > 0000000..e3561c0 > --- /dev/null > +++ b/tests/TestSuite_dpdk_gro_lib.py > @@ -0,0 +1,381 @@ > +# 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. > + > +Vhost gro test suite. > +""" > +import re > +import time > +import utils > +from test_case import TestCase > +from virt_common import VM > +from config import UserConf > + > + > +class TestVhostGRO(TestCase): > + > + def set_up_all(self): > + # This suite will not use the port config in ports.cfg > + # it will use the port config in vhost_gro.cfg > + # And it need two interface reconnet in DUT > + # Get and verify the ports > + self.dut_ports =3D self.dut.get_ports() > + self.cores =3D self.dut.get_core_list("1S/2C/1T", socket=3D1) > + # unbind the port which config in ports.cfg > + for i in self.dut_ports: > + port =3D self.dut.ports_info[i]['port'] > + port.bind_driver() > + > + # get and bind the port config in vhost_gro.cfg > + config =3D UserConf('conf/vhost_gro.cfg') > + conf =3D config.conf > + section =3D config.get_sections() > + self.verify('peerconf' in section, > + 'Pls config peer info about intf in conf file vhost_gro.= cfg') > + params =3D conf._sections['peerconf'] > + self.pci =3D params['pci'] > + self.pci_drv =3D params['pci_drv'] > + self.peer_pci =3D params['peer'] > + self.nic_in_kernel =3D params['peer_intf'] > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -b igb_uio %s" % > + self.pci, '#', 30) > + > + # Set the params for VM > + 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() > + 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",=20 > + "#") > + > + def launch_testpmd_gro_on(self, mode=3D1): > + # > + # Launch the vhost sample with different parameters > + # mode 1 : tcp traffic light mode > + # mode 2 : tcp traffic heavy mode > + # mode 3 : vxlan traffic light mode > + # mode 4 : tcp traffic flush 4 > + self.testcmd =3D self.target + "/app/testpmd -c %s -n %d > --socket-mem %s --legacy-mem" \ > + + " --vdev 'net_vhost0,iface=3Dvhost-net,queues=3D1' -- -i > --enable-hw-vlan-strip --tx-offloads=3D0x00" \ > + + " --txd=3D1024 --rxd=3D1024" > + self.coremask =3D utils.create_mask(self.cores) > + self.testcmd_start =3D self.testcmd % ( > + self.coremask, self.memory_channel, self.socket_mem) > + self.vhost_user =3D self.dut.new_session(suite=3D"user") > + 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("csum set tcp hw 0", "testpmd> ", 12= 0) > + self.vhost_user.send_expect("csum set ip hw 0", "testpmd> ", 120= ) > + self.vhost_user.send_expect("csum set tcp hw 1", "testpmd> ", 12= 0) > + self.vhost_user.send_expect("csum set ip hw 1", "testpmd> ", 120= ) > + if(mode =3D=3D 1): > + self.vhost_user.send_expect("set port 0 gro on",=20 > + "testpmd> ", > 120) > + self.vhost_user.send_expect("set gro flush 1", "testpmd> ", = 120) > + if(mode =3D=3D 2): > + self.vhost_user.send_expect("set port 0 gro on",=20 > + "testpmd> ", > 120) > + self.vhost_user.send_expect("set gro flush 2", "testpmd> ", = 120) > + if (mode =3D=3D 3): > + self.vhost_user.send_expect("csum parse-tunnel on 1", > "testpmd> ", 120) > + self.vhost_user.send_expect("csum parse-tunnel on 0", > "testpmd> ", 120) > + self.vhost_user.send_expect("csum set outer-ip hw 0",=20 > + "testpmd> > ", 120) > + self.vhost_user.send_expect("set port 0 gro on",=20 > + "testpmd> ", > 120) > + self.vhost_user.send_expect("set gro flush 2", "testpmd> ", = 120) > + else: > + self.vhost_user.send_expect("set port 0 gro on",=20 > + "testpmd> ", > 120) > + self.vhost_user.send_expect("set gro flush 4", "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 set_testpmd_gro_off(self): > + # > + # Launch the vhost sample with different parameters > + # > + self.vhost_user.send_expect("stop", "testpmd> ", 120) > + self.vhost_user.send_expect("set port 0 gro off", "testpmd> ", 1= 20) > + self.vhost_user.send_expect("start", "testpmd> ", 120) > + > + def quit_testpmd(self): > + # Quit testpmd and close temp ssh session > + self.vhost_user.send_expect("quit", "#", 120) > + self.dut.close_session(self.vhost_user) > + > + def config_kernel_nic_host(self, mode=3D1): > + if (mode =3D=3D 0): > + 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_kernel, "#") > + 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 tso on" % > + self.nic_in_kernel, "#") > + if (mode =3D=3D 1): > + 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_kernel, "#") > + self.dut.send_expect( > + "ip netns exec ns1 ifconfig %s 1.1.2.4/24 up" % > + self.nic_in_kernel, "#") > + self.dut.send_expect( > + "ip netns exec ns1 ip link add vxlan1 type vxlan id=20 > + 42 dev %s > dstport 4789" % > + self.nic_in_kernel, "#") > + self.dut.send_expect( > + "ip netns exec ns1 bridge fdb append to=20 > + 00:00:00:00:00:00 > dst 1.1.2.3 dev vxlan1", "#") > + self.dut.send_expect( > + "ip netns exec ns1 ip addr add 50.1.1.1/24 dev vxlan1", = "#") > + self.dut.send_expect( > + "ip netns exec ns1 ip link set up dev vxlan1", "#") > + > + 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( > + > "cp ./drivers/net/vhost/rte_eth_vhost.c=20 > ./drivers/net/vhost/rte_eth_vhost-bac > kup.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", "#") > + # change offload of vhost > + tx_offload =3D 'DEV_TX_OFFLOAD_VLAN_INSERT | ' + \ > + 'DEV_TX_OFFLOAD_UDP_CKSUM | ' + \ > + 'DEV_TX_OFFLOAD_TCP_CKSUM | ' + \ > + 'DEV_TX_OFFLOAD_IPV4_CKSUM | ' + \ > + 'DEV_TX_OFFLOAD_TCP_TSO;' > + rx_offload =3D 'DEV_RX_OFFLOAD_VLAN_STRIP | ' + \ > + 'DEV_RX_OFFLOAD_TCP_CKSUM | ' + \ > + 'DEV_RX_OFFLOAD_UDP_CKSUM | ' + \ > + 'DEV_RX_OFFLOAD_IPV4_CKSUM | ' + \ > + 'DEV_RX_OFFLOAD_TCP_LRO;' > + self.dut.send_expect( > + "sed -i 's/DEV_TX_OFFLOAD_VLAN_INSERT;/%s/' > drivers/net/vhost/rte_eth_vhost.c" % tx_offload, "#") > + self.dut.send_expect( > + "sed -i 's/DEV_RX_OFFLOAD_VLAN_STRIP;/%s/' > drivers/net/vhost/rte_eth_vhost.c" % rx_offload, "#") > + 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( > + > "cp ./drivers/net/vhost/rte_eth_vhost-backup.c=20 > ./drivers/net/vhost/rte_eth_vh ost.c ", > + "#") > + self.dut.send_expect("rm -rf=20 > + ./app/test-pmd/csumonly_backup.c", > "#") > + self.dut.send_expect("rm > -rf ./drivers/net/vhost/rte_eth_vhost-backup.c", "#") > + self.dut.build_install_dpdk(self.dut.target) > + > + def start_vm(self): > + self.vm1 =3D VM(self.dut, 'vm0', 'vhost_gro') > + vm_params_1 =3D {} > + vm_params_1['driver'] =3D 'vhost-user' > + vm_params_1['opt_path'] =3D './vhost-net' > + vm_params_1['opt_mac'] =3D self.virtio_mac1 > + vm_params_1[ > + 'opt_settings'] =3D > 'mrg_rxbuf=3Don,csum=3Doff,gso=3Doff,host_tso4=3Don,guest_tso4=3Don' > + self.vm1.set_vm_device(**vm_params_1) > + try: > + self.vm1_dut =3D self.vm1.start() > + if self.vm1_dut is None: > + raise Exception("Set up VM ENV failed") > + except Exception as e: > + print utils.RED("Failure for %s" % str(e)) > + self.vm1_dut.restore_interfaces() > + > + def iperf_result_verify(self, run_info): > + ''' > + Get the iperf test result > + ''' > + fmsg =3D self.dut.send_expect("cat /root/iperf_client.log", "#") > + print fmsg > + iperfdata =3D re.compile('[\d+]*.[\d+]* [M|G|K]bits/sec').findal= l(fmsg) > + print iperfdata > + self.verify(iperfdata, 'There no data about this case') > + self.result_table_create(['Data', 'Unit']) > + results_row =3D [run_info] > + 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_gro_tcp_lightmode(self): > + self.config_kernel_nic_host(0) > + self.launch_testpmd_gro_on() > + self.start_vm() > + time.sleep(5) > + self.dut.get_session_output(timeout=3D2) > + # Get the virtio-net device name > + for port in self.vm1_dut.ports_info: > + self.vm1_intf =3D port['intf'] > + # Start the Iperf test > + self.vm1_dut.send_expect('ifconfig -a', '#', 30) > + self.vm1_dut.send_expect( > + 'ifconfig %s %s' % > + (self.vm1_intf, self.virtio_ip1), '#', 10) > + self.vm1_dut.send_expect('ifconfig %s up' % self.vm1_intf, '#', = 10) > + self.vm1_dut.send_expect( > + 'ethtool -K %s gro off' % (self.vm1_intf), '#', 10) > + self.vm1_dut.send_expect('iperf -s', '', 10) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.dut.send_expect( > + 'ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1> > /root/iperf_client.log &' % > + (self.virtio_ip1), '', 180) > + time.sleep(30) > + self.iperf_result_verify('GRO lib') > + print "the GRO lib %s " % (self.output_result) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + # Turn off DPDK GRO lib and Kernel GRO off > + self.set_testpmd_gro_off() > + self.dut.send_expect( > + 'ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1 > > /root/iperf_client.log &' % > + (self.virtio_ip1), '', 180) > + time.sleep(30) > + self.iperf_result_verify('Kernel GRO') > + print "the Kernel GRO %s " % (self.output_result) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.quit_testpmd() > + self.dut.send_expect("killall -s INT qemu-system-x86_64",=20 > + "#") > + > + def test_vhost_gro_tcp_heavymode(self): > + self.config_kernel_nic_host(0) > + self.heavymode =3D 2 > + self.launch_testpmd_gro_on(self.heavymode) > + self.start_vm() > + time.sleep(5) > + self.dut.get_session_output(timeout=3D2) > + # Get the virtio-net device name > + for port in self.vm1_dut.ports_info: > + self.vm1_intf =3D port['intf'] > + # Start the Iperf test > + self.vm1_dut.send_expect('ifconfig -a', '#', 30) > + self.vm1_dut.send_expect( > + 'ifconfig %s %s' % > + (self.vm1_intf, self.virtio_ip1), '#', 10) > + self.vm1_dut.send_expect('ifconfig %s up' % self.vm1_intf, '#', = 10) > + self.vm1_dut.send_expect( > + 'ethtool -K %s gro off' % > + (self.vm1_intf), '#', 10) > + self.vm1_dut.send_expect('iperf -s', '', 10) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.dut.send_expect( > + 'ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1> > /root/iperf_client.log &' % > + (self.virtio_ip1), '', 180) > + time.sleep(30) > + self.iperf_result_verify('GRO lib') > + print "the GRO lib %s " % (self.output_result) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.quit_testpmd() > + self.dut.send_expect("killall -s INT qemu-system-x86_64",=20 > + "#") > + > + def test_vhost_gro_tcp_heavymode_flush4(self): > + self.config_kernel_nic_host(0) > + self.heavymode =3D 4 > + self.launch_testpmd_gro_on(self.heavymode) > + self.start_vm() > + time.sleep(5) > + self.dut.get_session_output(timeout=3D2) > + # Get the virtio-net device name > + for port in self.vm1_dut.ports_info: > + self.vm1_intf =3D port['intf'] > + # Start the Iperf test > + self.vm1_dut.send_expect('ifconfig -a', '#', 30) > + self.vm1_dut.send_expect( > + 'ifconfig %s %s' % > + (self.vm1_intf, self.virtio_ip1), '#', 10) > + self.vm1_dut.send_expect('ifconfig %s up' % self.vm1_intf, '#', = 10) > + self.vm1_dut.send_expect( > + 'ethtool -K %s gro off' % > + (self.vm1_intf), '#', 10) > + self.vm1_dut.send_expect('iperf -s', '', 10) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.dut.send_expect( > + 'ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1> > /root/iperf_client.log &' % > + (self.virtio_ip1), '', 180) > + time.sleep(30) > + self.iperf_result_verify('GRO lib') > + print "the GRO lib %s " % (self.output_result) > + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) > + self.quit_testpmd() > + self.dut.send_expect("killall -s INT qemu-system-x86_64",=20 > + "#") > + > + 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("ip netns del ns1", "# ", 30) > + 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("ip netns del ns1", "# ", 30) > + 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