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 B0202A0566; Wed, 11 Mar 2020 05:31:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 73EC41BF96; Wed, 11 Mar 2020 05:31:27 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id CA8211BF7F for ; Wed, 11 Mar 2020 05:31:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Mar 2020 21:31:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,539,1574150400"; d="scan'208";a="389144997" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 10 Mar 2020 21:31:24 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 10 Mar 2020 21:31:23 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 10 Mar 2020 21:31:23 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 10 Mar 2020 21:31:22 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.232]) with mapi id 14.03.0439.000; Wed, 11 Mar 2020 12:31:21 +0800 From: "Tu, Lijuan" To: "Zhao, XinfengX" , "dts@dpdk.org" CC: "Zhao, XinfengX" Thread-Topic: [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test Thread-Index: AQHV8TSDsYQxUdE7rE2BnsFjq3/stqhC2VyA Date: Wed, 11 Mar 2020 04:31:20 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBEB96F@SHSMSX101.ccr.corp.intel.com> References: <20200302225836.26508-1-xinfengx.zhao@intel.com> In-Reply-To: <20200302225836.26508-1-xinfengx.zhao@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 1/4] tests: modify the suite of cryptodev virtio unit-test 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 the series, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xinfengx > Sent: Tuesday, March 3, 2020 6:59 AM > To: dts@dpdk.org > Cc: Zhao, XinfengX > Subject: [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio un= it-test >=20 > Signed-off-by: xinfengx > --- > tests/TestSuite_virtio_unit_cryptodev_func.py | 85 +++++++++++-------- > 1 file changed, 49 insertions(+), 36 deletions(-) >=20 > diff --git a/tests/TestSuite_virtio_unit_cryptodev_func.py > b/tests/TestSuite_virtio_unit_cryptodev_func.py > index a9d1ee1..b828d6f 100644 > --- a/tests/TestSuite_virtio_unit_cryptodev_func.py > +++ b/tests/TestSuite_virtio_unit_cryptodev_func.py > @@ -53,24 +53,31 @@ class VirtioCryptodevUnitTest(TestCase): > self.verify(len(self.dut_ports) >=3D 1, 'Insufficient ports for = test') > self.cores =3D self.dut.get_core_list("1S/3C/1T") > self.mem_channel =3D self.dut.get_memory_channels() > - self.bind_script_path =3D self.dut.get_dpdk_bind_script() > - > - self.vfio_pci =3D self.get_suite_cfg()["vfio_pci"] > - for each in self.vfio_pci.split(): > - cmd =3D "echo {} > /sys/bus/pci/devices/{}/driver/unbind".fo= rmat(each, > each.replace(":", "\:")) > - self.dut_execut_cmd(cmd) >=20 > if not cc.is_build_skip(self): > - self.tar_dpdk() > self.dut.skip_setup =3D False > cc.build_dpdk_with_cryptodev(self) > - self.build_vhost_app() > - > cc.bind_qat_device(self) > + self.build_vhost_app() >=20 > - self.launch_vhost_switch() > - self.bind_vfio_pci() > + self.vf_assign_method =3D "vfio-pci" > + self.dut.setup_modules(None, self.vf_assign_method, None) > + > + self.dut.restore_interfaces() > + self.used_dut_port =3D self.dut_ports[0] > + self.dut.generate_sriov_vfs_by_port( > + self.used_dut_port, 1, driver=3D'default') > + self.sriov_vfs_port =3D self.dut.ports_info[ > + self.used_dut_port]['vfs_port'] > + for port in self.sriov_vfs_port: > + port.bind_driver(self.vf_assign_method) >=20 > + intf =3D self.dut.ports_info[self.used_dut_port]['intf'] > + vf_mac =3D "52:00:00:00:00:01" > + self.dut.send_expect("ip link set %s vf 0 mac %s" % > + (intf, vf_mac), "# ") > + > + self.launch_vhost_switch() > self.vm0, self.vm0_dut =3D self.launch_virtio_dut("vm0") >=20 > def set_up(self): > @@ -79,27 +86,20 @@ class VirtioCryptodevUnitTest(TestCase): > def dut_execut_cmd(self, cmdline, ex=3D'#', timout=3D30): > return self.dut.send_expect(cmdline, ex, timout) >=20 > - def tar_dpdk(self): > - self.dut_execut_cmd("rm -rf %s" % self.target, '#', 100) > - self.dut_execut_cmd("tar -czf %s/dep/dpdk.tar.gz ../dpdk" % > os.getcwd(), '#', 100) > - > def build_user_dpdk(self, user_dut): > user_dut.send_expect( > "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dn$/CONFIG_RTE_LIBRTE_PMD_AES > NI_MB=3Dy/' config/common_base", '#', 30) > - out =3D user_dut.send_expect("make install T=3D%s" % self.target= , "# ", 600) > - assert ("Error" not in out), "Compilation error..." > + user_dut.send_expect( > + "sed -i > 's/CONFIG_RTE_EAL_IGB_UIO=3Dn/CONFIG_RTE_EAL_IGB_UIO=3Dy/g' > config/common_base", '#', 30) > + out =3D user_dut.send_expect("make install T=3D%s" % self.target= , "# ", 900) > + self.verify("Error" not in out, "compilation error 1") > + self.verify("No such file" not in out, "compilation error 2") >=20 > def build_vhost_app(self): > - self.dut_execut_cmd("export RTE_SDK=3D`pwd`") > - self.dut_execut_cmd("export RTE_TARGET=3D%s" % self.target) > out =3D self.dut_execut_cmd("make -C ./examples/vhost_crypto") > - self.verify("Error" not in out, "compilation error") >=20 > - def build_user_app(self, user_dut): > - user_dut.send_expect("export RTE_SDK=3D`pwd`", '#', 30) > - user_dut.send_expect("export RTE_TARGET=3D%s" % self.target, '#'= , 30) > - out =3D user_dut.send_expect("make -C ./%s test-build" % self.ta= rget, '#', > 600) > - self.verify("Error" not in out, "compilation error") > + self.verify("Error" not in out, "compilation error 1") > + self.verify("No such file" not in out, "compilation error 2") >=20 > def get_vhost_eal(self): > default_eal_opts =3D { > @@ -129,16 +129,14 @@ class VirtioCryptodevUnitTest(TestCase): >=20 > def launch_vhost_switch(self): > eal_opt_str =3D self.get_vhost_eal() > + > config =3D '"(%s,0,0),(%s,0,0)"' % tuple(self.cores[-2:]) > socket_file =3D "%s,/tmp/vm0_crypto0.sock --socket- > file=3D%s,/tmp/vm0_crypto1.sock" % tuple(self.cores[-2:]) > self.vhost_switch_cmd =3D cc.get_dpdk_app_cmd_str(self.sample_ap= p, > eal_opt_str, > '--config %s --socket-file %s' % (co= nfig, socket_file)) >=20 > - self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30) > - > - def bind_vfio_pci(self): > - subprocess.getoutput("modprobe vfio-pci") > - subprocess.getoutput('%s -b vfio-pci %s' % > (os.path.join(self.dut.base_dir, self.bind_script_path), self.vfio_pci)) > + out =3D self.dut_execut_cmd(self.vhost_switch_cmd, "socket creat= ed", 30) > + self.logger.info(out) >=20 > def set_virtio_pci(self, dut): > out =3D dut.send_expect("lspci -d:1054|awk '{{print $1}}'", "# "= , 10) @@ - > 150,26 +148,37 @@ class VirtioCryptodevUnitTest(TestCase): > dut.send_expect(cmd, "# ", 10) > dut.send_expect('echo "1af4 1054" > > /sys/bus/pci/drivers/uio_pci_generic/new_id', "# ", 10) >=20 > + return virtio_list > + > def launch_virtio_dut(self, vm_name): > # start vm > vm =3D QEMUKvm(self.dut, vm_name, 'virtio_unit_cryptodev_func') > + vf0 =3D {'opt_host': self.sriov_vfs_port[0].pci} > + vm.set_vm_device(driver=3Dself.vf_assign_method, **vf0) > + skip_setup =3D self.dut.skip_setup >=20 > try: > - vm_dut =3D vm.start(set_target=3DFalse) > + self.dut.skip_setup =3D True > + vm_dut =3D vm.start() > if vm_dut is None: > print(('{} start failed'.format(vm_name))) > except Exception as err: > raise err >=20 > + self.dut.skip_setup =3D skip_setup > vm_dut.restore_interfaces() >=20 > if not self.dut.skip_setup: > self.build_user_dpdk(vm_dut) > - self.build_user_app(vm_dut) >=20 > vm_dut.setup_modules(self.target, "igb_uio", None) > vm_dut.bind_interfaces_linux('igb_uio') > - self.set_virtio_pci(vm_dut) > + vm.virtio_list =3D self.set_virtio_pci(vm_dut) > + self.logger.info("{} virtio list: {}".format(vm_name, vm.virtio_= list)) > + vm.cores =3D vm_dut.get_core_list("all") > + self.logger.info("{} core list: {}".format(vm_name, vm.cores)) > + vm.ports =3D [port["pci"] for port in vm_dut.ports_info] > + self.logger.info("{} port list: {}".format(vm_name, vm.ports)) >=20 > return vm, vm_dut >=20 > @@ -180,7 +189,7 @@ class VirtioCryptodevUnitTest(TestCase): > def __run_unit_test(self, testsuite, eal_opt_str=3D'', timeout=3D600= ): > self.logger.info("STEP_TEST: " + testsuite) > self.vm0_dut.send_expect("dmesg -C", "# ", 30) > - cmd_str =3D cc.get_dpdk_app_cmd_str(self.user_app, "--log-level = 8", > eal_opt_str) > + cmd_str =3D cc.get_dpdk_app_cmd_str(self.user_app, "--log-level > + 6", eal_opt_str) > info =3D self.vm0_dut.send_expect(cmd_str, "RTE>>", 30) > self.logger.info(info) >=20 > @@ -202,11 +211,15 @@ class VirtioCryptodevUnitTest(TestCase): > pass >=20 > def tear_down_all(self): > - if self.vm0: > + if getattr(self, 'vm0', None): > + self.vm0_dut.kill_all() > self.vm0.stop() > - self.dut.virt_exit() > self.vm0 =3D None >=20 > + if getattr(self, 'used_dut_port', None) !=3D None: > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > + self.used_dut_port =3D None > + > self.dut_execut_cmd("^C", "# ") > self.dut_execut_cmd("killall -s INT vhost-crypto") > self.dut_execut_cmd("killall -s INT qemu-system-x86_64") > -- > 2.17.1