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 343C8A04DD; Thu, 2 Jan 2020 03:18:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 253121BF81; Thu, 2 Jan 2020 03:18:42 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 908081BF7E for ; Thu, 2 Jan 2020 03:18:39 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2020 18:18:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,385,1571727600"; d="scan'208";a="216388800" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 01 Jan 2020 18:18:38 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 1 Jan 2020 18:18:38 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 1 Jan 2020 18:18:38 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.30]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.28]) with mapi id 14.03.0439.000; Thu, 2 Jan 2020 10:18:36 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Wang, Yinan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] tests: add test suite vm2vm virtio user Thread-Index: AQHVu5UAbs0RiNRJP0e2HhEiBt5jMqfWrq+A Date: Thu, 2 Jan 2020 02:18:36 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBA0D81@SHSMSX101.ccr.corp.intel.com> References: <1577300825-8227-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1577300825-8227-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.2.0.6 dlp-reaction: no-action 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 V1] tests: add test suite vm2vm virtio user 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 > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Thursday, December 26, 2019 3:07 AM > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts] [PATCH V1] tests: add test suite vm2vm virtio user >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vm2vm_virtio_user.py | 538 > +++++++++++++++++++++++++++++++++++ > 1 file changed, 538 insertions(+) > create mode 100644 tests/TestSuite_vm2vm_virtio_user.py >=20 > diff --git a/tests/TestSuite_vm2vm_virtio_user.py > b/tests/TestSuite_vm2vm_virtio_user.py > new file mode 100644 > index 0000000..17bee0e > --- /dev/null > +++ b/tests/TestSuite_vm2vm_virtio_user.py > @@ -0,0 +1,538 @@ > +# 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. > + > +Test cases for vm2vm virtio-user > +This suite include split virtqueue vm2vm in-order mergeable, in-order > +non-mergeable, mergeable, non-mergeable, vector_rx path test and packed > +virtqueue vm2vm in-order mergeable, in-order non-mergeable, mergeable, > +non-mergeable path test """ > +import re > +import time > +import utils > +from test_case import TestCase > +from packet import Packet > +from pmd_output import PmdOutput > + > + > +class TestVM2VMVirtioUser(TestCase): > + def set_up_all(self): > + self.memory_channel =3D self.dut.get_memory_channels() > + self.dump_virtio_pcap =3D "/tmp/pdump-virtio-rx.pcap" > + self.dump_vhost_pcap =3D "/tmp/pdump-vhost-rx.pcap" > + self.vhost_prefix =3D 'vhost' > + self.virtio_prefix =3D 'virtio' > + socket_num =3D len(set([int(core['socket']) for core in self.dut= .cores])) > + self.socket_mem =3D ','.join(['1024']*socket_num) > + self.get_core_list() > + self.rebuild_flag =3D False > + self.config_value =3D 'CONFIG_RTE_LIBRTE_PMD_PCAP' > + self.enable_pcap_lib_in_dpdk(self.dut) > + > + def set_up(self): > + """ > + run before each test case. > + """ > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("rm -rf %s" % self.dump_virtio_pcap, "#") > + self.dut.send_expect("rm -rf %s" % self.dump_vhost_pcap, "#") > + > + def get_core_list(self): > + """ > + create core mask > + """ > + self.core_config =3D "1S/6C/1T" > + self.cores_list =3D self.dut.get_core_list(self.core_config) > + self.verify(len(self.cores_list) >=3D 6, 'There no enough cores = to run this > suite') > + self.core_list_vhost =3D self.cores_list[0:2] > + self.core_list_virtio0 =3D self.cores_list[2:4] > + self.core_list_virtio1 =3D self.cores_list[4:6] > + > + self.vhost_user =3D self.dut.new_session(suite=3D"vhost-user") > + self.virtio_user0 =3D self.dut.new_session(suite=3D"virtio-user0= ") > + self.virtio_user1 =3D self.dut.new_session(suite=3D"virtio-user1= ") > + self.pdump_session =3D self.dut.new_session(suite=3D"pdump") > + self.pmd_vhost =3D PmdOutput(self.dut, self.vhost_user) > + self.pmd_virtio0 =3D PmdOutput(self.dut, self.virtio_user0) > + self.pmd_virtio1 =3D PmdOutput(self.dut, self.virtio_user1) > + > + def enable_pcap_lib_in_dpdk(self, client_dut): > + """ > + enable pcap lib in dpdk code and recompile > + """ > + out =3D self.dut.send_command('cat config/common_base', timeout= =3D3) > + pcap =3D re.search('%s=3D(\S*)' % self.config_value, out) > + self.verify(pcap is not None, 'The config:%s can not find in > common_base' % self.config_value) > + default_value =3D pcap.group(1) > + if str.lower(default_value) !=3D 'y': > + client_dut.send_expect("sed -i 's/%s=3Dn$/%s=3Dy/' > config/common_base" % ( > + self.config_value, self.config_value), '# ') > + client_dut.build_install_dpdk(self.target) > + self.rebuild_flag =3D True > + > + def disable_pcap_lib_in_dpdk(self, client_dut): > + """ > + reset pcap lib in dpdk and recompile > + """ > + if self.rebuild_flag is True: > + client_dut.send_expect("sed -i 's/%s=3Dy$/%s=3Dn/' > config/common_base" % > + (self.config_value, self.config_value), "#") > + client_dut.build_install_dpdk(self.target) > + > + def launch_vhost_testpmd(self, vdev_num, fixed_prefix=3DFalse, > fwd_mode=3D'io'): > + eal_params =3D > self.dut.create_eal_parameters(cores=3Dself.core_list_vhost, > + no_pci=3DTrue, prefix=3Dself.vhost_prefix, fixed_pre= fix=3Dfixed_prefix) > + vdev_params =3D '' > + for i in range(vdev_num): > + vdev_params +=3D "--vdev > + 'net_vhost%d,iface=3D./vhost-net%d,queues=3D1' " % (i, i) > + > + self.command_line =3D self.dut.target + '/app/testpmd %s ' + \ > + '--socket-mem %s %s -- -i --nb-cores=3D1 --no-flush-rx' > + > + self.command_line =3D self.command_line % ( > + eal_params, self.socket_mem, vdev_params) > + self.pmd_vhost.execute_cmd(self.command_line, timeout=3D30) > + self.pmd_vhost.execute_cmd('set fwd %s' % fwd_mode) > + > + def start_virtio_testpmd_with_vhost_net1(self, path_mode, > extern_params=3D''): > + """ > + launch the testpmd as virtio with vhost_net1 > + """ > + eal_params =3D > self.dut.create_eal_parameters(cores=3Dself.core_list_virtio1, > + no_pci=3DTrue, prefix=3Dself.virtio_prefix, fixed_prefix= =3DTrue) > + vdev_params =3D '-- > vdev=3Dnet_virtio_user1,mac=3D00:01:02:03:04:05,path=3D./vhost- > net1,queues=3D1,%s ' % path_mode > + command_line =3D self.dut.target + "/app/testpmd %s " + \ > + "--socket-mem %s %s -- -i --nb-cores=3D1 --txd=3D256 --rxd= =3D256 %s" > + command_line =3D command_line % (eal_params, self.socket_mem, > + vdev_params, extern_params) > + self.pmd_virtio1.execute_cmd(command_line, timeout=3D30) > + self.pmd_virtio1.execute_cmd('set fwd rxonly') > + self.pmd_virtio1.execute_cmd('start') > + > + def start_virtio_testpmd_with_vhost_net0(self, path_mode, > extern_params=3D''): > + """ > + launch the testpmd as virtio with vhost_net0 > + and start to send 251 small packets with diff burst > + """ > + eal_params =3D > self.dut.create_eal_parameters(cores=3Dself.core_list_virtio0, > + no_pci=3DTrue, prefix=3D'virtio0') > + vdev_params =3D '-- > vdev=3Dnet_virtio_user0,mac=3D00:01:02:03:04:05,path=3D./vhost- > net0,queues=3D1,%s ' % path_mode > + command_line =3D self.dut.target + '/app/testpmd %s ' + \ > + '--socket-mem %s %s -- -i --nb-cores=3D1 --txd=3D256 --rxd= =3D256 %s' > + command_line =3D command_line % (eal_params, self.socket_mem, > + vdev_params, extern_params) > + > + self.pmd_virtio0.execute_cmd(command_line, timeout=3D30) > + self.pmd_virtio0.execute_cmd('set burst 1') > + self.pmd_virtio0.execute_cmd('start tx_first 27') > + self.pmd_virtio0.execute_cmd('stop') > + self.pmd_virtio0.execute_cmd('set burst 32') > + self.pmd_virtio0.execute_cmd('start tx_first 7') > + > + def resend_32_large_pkt_from_virtio0(self): > + self.pmd_virtio0.execute_cmd('stop') > + self.pmd_virtio0.execute_cmd('set burst 32') > + self.pmd_virtio0.execute_cmd('set txpkts 2000') > + self.pmd_virtio0.execute_cmd('start tx_first 1') > + > + def launch_pdump_to_capture_pkt(self, dump_port, file_prefix, > filename): > + """ > + launch pdump app with dump_port and file_prefix > + the pdump app should start after testpmd started > + if dump the vhost-testpmd, the vhost-testpmd should started befo= re > launch pdump > + if dump the virtio-testpmd, the virtio-testpmd should started be= fore > launch pdump > + """ > + eal_params =3D self.dut.create_eal_parameters(cores=3D'Default', > + prefix=3Dfile_prefix, fixed_prefix=3DTrue) > + command_line =3D self.target + "/app/dpdk-pdump %s -v -- " + \ > + "--pdump '%s,queue=3D*,rx-dev=3D%s,mbuf-size=3D8000= '" > + self.pdump_session.send_expect(command_line % (eal_params, > + dump_port, filename), 'Port') > + > + def get_dump_file_of_virtio_user(self, path_mode, extern_param=3D'')= : > + """ > + get the dump file of virtio user > + the virtio_user0 always send 251 small pkts + 32 large pkts(8k) = to verify > + how many pkts can received by virtio1 > + """ > + dump_port =3D 'device_id=3Dnet_virtio_user1' > + self.launch_vhost_testpmd(vdev_num=3D2) > + self.start_virtio_testpmd_with_vhost_net1(path_mode, extern_para= m) > + self.launch_pdump_to_capture_pkt(dump_port, self.virtio_prefix, > self.dump_virtio_pcap) > + # the virtio0 will send 251 small pkts > + self.start_virtio_testpmd_with_vhost_net0(path_mode, extern_para= m) > + # then send 32 large pkts > + self.pmd_virtio0.execute_cmd('stop') > + self.pmd_virtio0.execute_cmd('set burst 32') > + self.pmd_virtio0.execute_cmd('set txpkts 2000,2000,2000,2000') > + self.pmd_virtio0.execute_cmd('start tx_first 1') > + # packet will fwd after vhost testpmd start > + self.pmd_vhost.execute_cmd('start') > + > + def get_dump_file_of_vhost_user(self, path_mode, extern_param=3D''): > + """ > + get the dump file of vhost testpmd > + the virtio0 will alway send 251 small pkts + some large pkts(dep= end on > + diff path_mode send diff pkts num) to verify how many pkts can > received by vhost > + """ > + dump_port =3D 'port=3D0' > + self.launch_vhost_testpmd(vdev_num=3D1, fixed_prefix=3DTrue, > fwd_mode=3D'rxonly') > + self.pmd_vhost.execute_cmd('start') > + self.launch_pdump_to_capture_pkt(dump_port, self.vhost_prefix, > self.dump_vhost_pcap) > + # the virtio0 send 251 small pkts > + self.start_virtio_testpmd_with_vhost_net0(path_mode, extern_para= m) > + # if the path_mode is mergeable, then send large pkt to verify > + # and packed mergeable and split mergeable is diff about large p= kt > + # in packed mergeable, 1 large pkt will occupies 5 ring, so send= 1 large > pkt to verify > + # in split mergeable, 1 large pkt will occupied 1 ring, so send = 5 large pkt > to verify > + mergeable =3D re.search('mrg_rxbuf\s*=3D\s*1', path_mode) > + split =3D re.search('packed_vq\s*=3D\s*0', path_mode) > + no_inorder =3D re.search('in_order\s*=3D\s*0', path_mode) > + pkt_num =3D 1 > + if split and mergeable and no_inorder: > + pkt_num =3D 5 > + if mergeable: > + self.pmd_virtio0.execute_cmd('stop') > + self.pmd_virtio0.execute_cmd('set burst %d' % pkt_num) > + self.pmd_virtio0.execute_cmd('set txpkts 2000,2000,2000,2000= ') > + self.pmd_virtio0.execute_cmd('start tx_first 1') > + > + def check_packet_payload_valid(self, filename, small_pkts_num, > large_8k_pkts_num, large_2k_pkts_num): > + """ > + check the payload is valid > + """ > + # stop pdump > + total_pkts_num =3D small_pkts_num + large_8k_pkts_num + > large_2k_pkts_num > + time.sleep(2) > + self.pdump_session.send_expect('^c', '# ', 60) > + # quit testpmd > + self.quit_all_testpmd() > + time.sleep(2) > + self.dut.session.copy_file_from(src=3D"%s" % filename, dst=3D"%s= " % > filename) > + pkt =3D Packet() > + pkts =3D pkt.read_pcapfile(filename) > + self.verify(pkts is not None and len(pkts) =3D=3D total_pkts_num= , > + "The virtio/vhost do not capture all the packets= " > + "expect pkt num is: %d, actual pkt num is: %d" % > (total_pkts_num, len(pkts))) > + for i in range(len(pkts)): > + if i < small_pkts_num: > + pkt_len =3D 64 > + elif i >=3D small_pkts_num and i < small_pkts_num+large_8k_p= kts_num: > + pkt_len =3D 8000 > + else: > + pkt_len =3D 2000 > + self.verify(len(pkts[i]) =3D=3D pkt_len, 'the received pkts = len is wrong,' > + 'the received pkt len is: %d, expect pkt len is: > + %d' % (len(pkts[i]), pkt_len)) > + > + def check_vhost_and_virtio_pkts_content(self): > + """ > + vhost received pkts in self.dump_vhost_pcap, virtio received pkt= s > self.dump_virtio_pcap > + check headers and payload of all pkts are same. > + """ > + pk_rx_virtio =3D Packet() > + pk_rx_vhost =3D Packet() > + pk_rx_virtio.read_pcapfile(self.dump_virtio_pcap) > + pk_rx_vhost.read_pcapfile(self.dump_vhost_pcap) > + # check the headers and payload is same of vhost and virtio > + for i in range(len(pk_rx_virtio)): > + self.verify(pk_rx_virtio[i].haslayer('Raw'), 'The pkt index = %d, virtio pkt > has no layer Raw' % i) > + self.verify(pk_rx_vhost[i].haslayer('Raw'), 'The pkt index %= d, vhost > pkt has no layer Raw' % i) > + self.verify(pk_rx_virtio[i].haslayer('UDP'), 'The pkt index = %d, virtio pkt > has no layer UDP' % i) > + self.verify(pk_rx_vhost[i].haslayer('UDP'), 'The pkt index %= d, vhost > pkt has no layer UDP' % i) > + rx_virtio_load =3D pk_rx_virtio[i]['Raw'].load > + rx_vhost_load =3D pk_rx_vhost[i]['Raw'].load > + rx_virtio_head =3D pk_rx_virtio[i]['UDP'].remove_payload() > + rx_vhost_head =3D pk_rx_vhost[i]['UDP'].remove_payload() > + # check header is same > + self.verify(pk_rx_virtio[i] =3D=3D pk_rx_vhost[i], 'the head= is different on > index: %d' % i + \ > + 'virtio head: %s, vhost head: %s' % (pk_rx_virtio[i]= .show, > pk_rx_vhost[i].show())) > + # check payload is same > + self.verify(len(rx_virtio_load) =3D=3D len(rx_vhost_load), > + 'the len is diff between virtio pcap and vhost pcap,= ' > + 'virtio len:%d, vhost len: %d' % (len(rx_virtio_load= ), > len(rx_vhost_load))) > + diff_list =3D [s for s in range(len(rx_virtio_load)) if rx_v= irtio_load[s] !=3D > rx_vhost_load[s]] > + self.verify(len(diff_list) =3D=3D 0, 'there have some diff b= etween the load > of virtio and vhost pcap' + \ > + 'pkt index is: %d, the load index include %s' % (i, > + diff_list)) > + > + def quit_all_testpmd(self): > + self.pmd_vhost.quit() > + self.pmd_virtio0.quit() > + self.pmd_virtio1.quit() > + self.pdump_session.send_expect('^c', '# ', 60) > + > + def test_vm2vm_virtio_user_packed_virtqueue_mergeable_path(self): > + """ > + packed virtqueue vm2vm mergeable path test > + about packed virtqueue path, the 8k length pkt will occupies 5 r= ing, > + 2000,2000,2000,2000 will need 4 consequent ring, still need one = ring > put header > + so, as the rxt=3D256, if received pkts include 8k chain pkt, it = will received > up to 252 pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 1 > + large_2k_pkts_num =3D 32 > + path_mode =3D 'packed_vq=3D1,mrg_rxbuf=3D1,in_order=3D0' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 252 pkts > + # then resend 32 large pkts, all will received > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.resend_32_large_pkt_from_virtio0() > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.resend_32_large_pkt_from_virtio0() > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def > test_vm2vm_virtio_user_packed_virtqueue_inorder_mergeable_path(self): > + """ > + packed virtqueue vm2vm inorder mergeable path test > + about packed virtqueue path, the 8k length pkt will occupies 5 r= ing, > + 2000,2000,2000,2000 will need 4 consequent ring, still need one = ring > put header > + so, as the rxt=3D256, if received pkts include 8k chain pkt, it = will received > up to 252 pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 1 > + large_2k_pkts_num =3D 0 > + path_mode =3D 'packed_vq=3D1,mrg_rxbuf=3D1,in_order=3D1' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 252 pkts > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def test_vm2vm_virtio_user_packed_virtqueue_no_mergeable_path(self): > + """ > + packed virtqueue vm2vm non-mergeable path test > + about non-mergeable path, it can not received large pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 0 > + large_2k_pkts_num =3D 0 > + path_mode =3D 'packed_vq=3D1,mrg_rxbuf=3D0,in_order=3D0' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 251 pkts > + # the no-mergeable path can not received large pkts > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def > test_vm2vm_virtio_user_packed_virtqueue_inorder_no_mergeable_path(sel > f): > + """ > + packed virtqueue vm2vm inorder non-mergeable path test > + about non-mergeable path, it can not received large pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 0 > + large_2k_pkts_num =3D 0 > + path_mode =3D 'packed_vq=3D1,mrg_rxbuf=3D0,in_order=3D1' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 251 pkts > + # the no-mergeable path can not received large pkts > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def test_vm2vm_virtio_user_split_virtqueue_mergeable_path(self): > + """ > + split virtqueue vm2vm mergeable path test > + about split virtqueue path, the 8k length pkt will occupies 1 ri= ng, > + so, as the rxt=3D256, if received pkts include 8k chain pkt, als= o will > received up to 256 pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 5 > + large_2k_pkts_num =3D 32 > + path_mode =3D 'packed_vq=3D0,mrg_rxbuf=3D1,in_order=3D0' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 256 pkts > + # then virtio send 32 large pkts, the virtio will all received > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.resend_32_large_pkt_from_virtio0() > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.resend_32_large_pkt_from_virtio0() > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def > test_vm2vm_virtio_user_split_virtqueue_inorder_mergeable_path(self): > + """ > + split virtqueue vm2vm inorder mergeable path test > + about split virtqueue path, the 8k length pkt will occupies 5 ri= ng, > + 2000,2000,2000,2000 will need 4 consequent ring, still need one = ring > put header > + so, as the rxt=3D256, if received pkts include 8k chain pkt, it = will received > up to 252 pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 1 > + large_2k_pkts_num =3D 0 > + path_mode =3D 'packed_vq=3D0,mrg_rxbuf=3D1,in_order=3D1' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 252 pkts > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def test_vm2vm_virtio_user_split_virtqueue_no_mergeable_path(self): > + """ > + split virtqueue vm2vm non-mergeable path test > + about non-mergeable path, it can not received large pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 0 > + large_2k_pkts_num =3D 0 > + path_mode =3D 'packed_vq=3D0,mrg_rxbuf=3D0,in_order=3D0' > + extern_params =3D '--enable-hw-vlan-strip' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 251 pkts > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode, extern_params) > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode, extern_params) > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def > test_vm2vm_virtio_user_split_virtqueue_inorder_no_mergeable_path(self): > + """ > + split virtqueue vm2vm inorder non-mergeable path test > + about non-mergeable path, it can not received large pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 0 > + large_2k_pkts_num =3D 0 > + path_mode =3D 'packed_vq=3D0,mrg_rxbuf=3D0,in_order=3D1' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 251 pkts > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def test_vm2vm_virtio_user_split_virtqueue_vector_rx_path(self): > + """ > + split virtqueue vm2vm vector_rx path test > + about vector_rx path, it can not received large pkts > + """ > + small_pkts_num =3D 251 > + large_8k_pkts_num =3D 0 > + large_2k_pkts_num =3D 0 > + path_mode =3D 'packed_vq=3D0,mrg_rxbuf=3D0,in_order=3D0' > + # get dump pcap file of virtio > + # the virtio0 will send 283 pkts, but the virtio only will recei= ved 251 pkts > + self.logger.info('check pcap file info about virtio') > + self.get_dump_file_of_virtio_user(path_mode) > + self.check_packet_payload_valid(self.dump_virtio_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + # get dump pcap file of vhost > + self.logger.info('check pcap file info about vhost') > + self.get_dump_file_of_vhost_user(path_mode) > + self.check_packet_payload_valid(self.dump_vhost_pcap, > + small_pkts_num, large_8k_pkts_num, large_2k_pkts_num) > + > + self.logger.info('diff the pcap file of vhost and virtio') > + self.check_vhost_and_virtio_pkts_content() > + > + def close_all_session(self): > + if getattr(self, 'vhost_user', None): > + self.dut.close_session(self.vhost_user) > + if getattr(self, 'virtio-user0', None): > + self.dut.close_session(self.virtio-user0) > + if getattr(self, 'virtio-user1', None): > + self.dut.close_session(self.virtio-user1) > + if getattr(self, 'pdump_session', None): > + self.dut.close_session(self.pdump_session) > + > + def tear_down(self): > + # > + # Run after each test case. > + # > + self.dut.kill_all() > + time.sleep(2) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.disable_pcap_lib_in_dpdk(self.dut) > + self.close_all_session() > -- > 2.7.4