From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 57BD03576 for ; Mon, 21 Jan 2019 04:26:50 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2019 19:26:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,501,1539673200"; d="scan'208";a="111382726" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga008.jf.intel.com with ESMTP; 20 Jan 2019 19:26:48 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 20 Jan 2019 19:26:47 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 20 Jan 2019 19:26:46 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.196]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.184]) with mapi id 14.03.0415.000; Mon, 21 Jan 2019 11:26:45 +0800 From: "Tu, Lijuan" To: "Zhao, XinfengX" , "dts@dpdk.org" CC: "Zhao, XinfengX" Thread-Topic: [dts] [PATCH V1] tests: add the suite of cryptodev performance test Thread-Index: AQHUrWVAD/MAZyvh0E+OXn5O+7Gm96W5FziA Date: Mon, 21 Jan 2019 03:26:44 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA05170@SHSMSX101.ccr.corp.intel.com> References: <1547620549-4538-1-git-send-email-xinfengx.zhao@intel.com> In-Reply-To: <1547620549-4538-1-git-send-email-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.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGM3MWYzODAtMDlkYy00ZDVhLWI3ZDctNjkxZjk2NDc4MmQ4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiV0F5QWFpUDFsZ2lJN1RTaE9MT2Y4RWdvZXMrY1I5VjJrVzdxbUdhUjcwOU4zQng0WDBla0tGK0ZGcVJOY0UxbSJ9 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 the suite of cryptodev performance 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: , X-List-Received-Date: Mon, 21 Jan 2019 03:26:51 -0000 Hi Xinfeng, Could you kindly fix these warning? Applying: tests: add the suite of cryptodev performance test .git/rebase-apply/patch:382: trailing whitespace. cmd_str =3D cc.get_dpdk_app_cmd_str(self._app_path, .git/rebase-apply/patch:472: trailing whitespace. "unit": "bytes", warning: 2 lines add whitespace errors. thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xinfeng Zhao > Sent: Wednesday, January 16, 2019 2:36 PM > To: dts@dpdk.org > Cc: Zhao, XinfengX > Subject: [dts] [PATCH V1] tests: add the suite of cryptodev performance t= est >=20 > add the script of cryptodev performance test to tests >=20 > Signed-off-by: Xinfeng Zhao > --- > tests/TestSuite_cryptodev_perf_crypto-perf.py | 484 > ++++++++++++++++++++++++++ > 1 file changed, 484 insertions(+) > create mode 100644 tests/TestSuite_cryptodev_perf_crypto-perf.py >=20 > diff --git a/tests/TestSuite_cryptodev_perf_crypto-perf.py > b/tests/TestSuite_cryptodev_perf_crypto-perf.py > new file mode 100644 > index 0000000..5a50747 > --- /dev/null > +++ b/tests/TestSuite_cryptodev_perf_crypto-perf.py > @@ -0,0 +1,484 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2016-2017 Intel Corporation. All rights reserved. > +# 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. > + > +import re > +import json > +from test_case import TestCase > +import TestSuite_cryptodev_common as cc > + > + > +class PerfTestsCryptodev(TestCase): > + > + def set_up_all(self): > + self._perf_result =3D {} > + > + self._default_crypto_perf_opts =3D { > + "ptest": "throughput", > + "silent": "", > + "pool-sz": None, > + "total-ops": "1000000", > + "burst-sz": "32", > + "buffer-sz": "64", > + "devtype": None, > + "segments-nb": None, > + "optype": "cipher-then-auth", > + "sessionless": None, > + "out-of-place": None, > + "test-file": None, > + "test-name": None, > + "cipher-algo": None, > + "cipher-op": None, > + "cipher-key-sz": None, > + "cipher-iv-sz": None, > + "auth-algo": None, > + "auth-op": None, > + "auth-key-sz": None, > + "auth-iv-sz": None, > + "aead-algo": None, > + "aead-op": None, > + "aead-key-sz": None, > + "aead-iv-sz": None, > + "aead-aad-sz": None, > + "digest-sz": None, > + "csv-friendly": None > + } > + self._app_path =3D "./x86_64-native-linuxapp-gcc/build/app/test-= crypto- > perf/dpdk-test-crypto-perf" > + > + if not cc.is_build_skip(self): > + cc.build_dpdk_with_cryptodev(self) > + > + self.vf_driver =3D self.get_suite_cfg()['vf_driver'] > + cc.bind_qat_device(self, self.vf_driver) > + > + def tear_down_all(self): > + cc.clear_dpdk_config(self) > + > + if not self._perf_result: > + return > + > + with open(self.logger.log_path + "/" + "perf_cryptodev_result.js= on", "w") > as fv: > + json.dump(self._perf_result, fv, indent=3D4, > + encoding=3D"utf-8") > + > + def set_up(self): > + pass > + > + def tear_down(self): > + self.dut.kill_all() > + > + def test_qat_aes_cbc_sha1_hmac(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"vdev":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "qat_aes_cbc_sha1_hmac= ") > + self.verify(result, "Test failed") > + > + def test_sw_aes_cbc_sha1_hmac(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"w":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "sw_aes_cbc_sha1_hmac"= ) > + self.verify(result, "Test failed") > + > + def test_qat_aes_cbc_sha2_hmac(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"vdev":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "qat_aes_cbc_sha2_hmac= ") > + self.verify(result, "Test failed") > + > + def test_sw_aes_cbc_sha2_hmac(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"w":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "sw_aes_cbc_sha2_hmac"= ) > + self.verify(result, "Test failed") > + > + def test_qat_aes_gcm(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"vdev":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "qat_aes_gcm") > + self.verify(result, "Test failed") > + > + def test_sw_aes_gcm(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"w":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "sw_aes_gcm") > + self.verify(result, "Test failed") > + > + def test_qat_kasumi(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"vdev":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "qat_kasumi") > + self.verify(result, "Test failed") > + > + def test_sw_kasumi(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"w":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "sw_kasumi") > + self.verify(result, "Test failed") > + > + def test_qat_snow3g(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"vdev":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "qat_snow3g") > + self.verify(result, "Test failed") > + > + def test_sw_snow3g(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"w":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "sw_snow3g") > + self.verify(result, "Test failed") > + > + def test_qat_zuc(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"vdev":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "qat_zuc") > + self.verify(result, "Test failed") > + > + def test_sw_zuc(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self, {"w":None}) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "sw_zuc") > + self.verify(result, "Test failed") > + > + def test_scheduler_aes_cbc_sha1_hmac(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "scheduler_aes_cbc_sha= 1_hmac") > + self.verify(result, "Test failed") > + > + def test_scheduler_aes_cbc_sha2_hmac(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "scheduler_aes_cbc_sha= 2_hmac") > + self.verify(result, "Test failed") > + > + def test_scheduler_aes_gcm(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "scheduler_aes_gcm") > + self.verify(result, "Test failed") > + > + def test_scheduler_kasumi(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "scheduler_kasumi") > + self.verify(result, "Test failed") > + > + def test_scheduler_snow3g(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "scheduler_snow3g") > + self.verify(result, "Test failed") > + > + def test_scheduler_zuc(self): > + if cc.is_test_skip(self): > + return > + > + eal_opt_str =3D cc.get_eal_opt_str(self) > + crypto_perf_opt_str =3D self._get_crypto_perf_opt_str() > + result =3D self._run_crypto_perf_throughput(eal_opt_str, > + crypto_perf_opt_str, > + "scheduler_zuc") > + self.verify(result, "Test failed") > + > + # Private functions > + def _get_crypto_perf_opt_str(self, override_crypto_perf_opts=3D{}): > + return cc.get_opt_str(self, self._default_crypto_perf_opts, > + override_crypto_perf_opts) > + > + def _parse_output(self, output): > + try: > + lines =3D output.split("\r\n") > + line_nb =3D len(lines) > + self.logger.debug("Total output lines: " + str(line_nb)) > + > + # Find data line > + for line_index in range(line_nb): > + if lines[line_index].startswith(" lcore id"): > + self.logger.debug("data output line from: " + str(li= ne_index)) > + break > + data_line =3D line_index + 2 > + > + results =3D [] > + pattern =3D re.compile(r'\s+') > + for line in lines[data_line:-1]: > + result =3D {} > + result_list =3D pattern.split(line.strip(" ")) > + if result_list[0] =3D=3D "lcore id" or result_list[0] = =3D=3D "lcore" or not > result_list[0]: > + continue > + result["lcore_id"] =3D int(result_list[0]) > + result["buf_size"] =3D int(result_list[1]) > + result["burst_size"] =3D int(result_list[2]) > + result["enqueue"] =3D int(result_list[3]) > + result["dequeue"] =3D int(result_list[4]) > + result["enqueue_failures"] =3D int(result_list[5]) > + result["dequeue_failures"] =3D int(result_list[6]) > + result["mops"] =3D float(result_list[7]) > + result["gbps"] =3D float(result_list[8]) > + result["cycle_buf"] =3D float(result_list[9]) > + results.append(result) > + > + self.logger.debug(results) > + return results > + except Exception, ex: > + self.logger.error(ex) > + raise ex > + > + def _stat_results_by_buf_size(self, results): > + stats_results =3D {} > + for result in results: > + buf_size =3D result["buf_size"] > + if buf_size in stats_results: > + stats_results[buf_size]["lcore_id"] =3D \ > + str(stats_results[buf_size]["lcore_id"]) \ > + + ":" + str(result["lcore_id"]) > + stats_results[buf_size]["enqueue"] =3D \ > + stats_results[buf_size]["enqueue"] + \ > + result["enqueue"] > + stats_results[buf_size]["enqueue_failures"] =3D \ > + stats_results[buf_size]["enqueue_failures"] + \ > + result["enqueue_failures"] > + stats_results[buf_size]["dequeue_failures"] =3D \ > + stats_results[buf_size]["dequeue_failures"] + \ > + result["dequeue_failures"] > + stats_results[buf_size]["mops"] =3D \ > + stats_results[buf_size]["mops"] + \ > + result["mops"] > + stats_results[buf_size]["gbps"] =3D \ > + stats_results[buf_size]["gbps"] + \ > + result["gbps"] > + stats_results[buf_size]["cycle_buf"] =3D \ > + stats_results[buf_size]["cycle_buf"] + \ > + result["cycle_buf"] > + stats_results[buf_size]["nr"] =3D stats_results[buf_size= ]["nr"] + 1 > + else: > + stats_results[buf_size] =3D result > + stats_results[buf_size]["nr"] =3D 1 > + self.logger.debug(stats_results) > + return stats_results > + > + def _run_crypto_perf(self, eal_opt_str, crypto_perf_opt_str): > + cmd_str =3D cc.get_dpdk_app_cmd_str(self._app_path, > + eal_opt_str, > + crypto_perf_opt_str) > + self.logger.info(cmd_str) > + try: > + out =3D self.dut.send_expect(cmd_str, "#", 600) > + except Exception, ex: > + self.logger.error(ex) > + raise ex > + > + results =3D self._parse_output(out) > + > + return results > + > + def _get_core_and_thread_num(self): > + cpu_info =3D{} > + out =3D self.dut.send_expect("lscpu", "#") > + for each_line in out.split('\n'): > + key, value =3D each_line.split(':') > + cpu_info[key] =3D value.strip() > + > + core, thread =3D 0, 0 > + lcores =3D self.get_case_cfg()["l"].split(",") > + for lcore in lcores: > + if int(lcore) < int(cpu_info['Core(s) per socket']) * > int(cpu_info['Socket(s)']): > + core =3D+1 > + thread =3D+1 > + elif int(lcore) < int(cpu_info['CPU(s)']): > + thread =3D+1 > + return core, thread > + > + def _run_crypto_perf_throughput(self, eal_opt_str, crypto_perf_opt_s= tr, > + case_name): > + c_num, t_num =3D self._get_core_and_thread_num() > + try: > + results =3D self._run_crypto_perf(eal_opt_str, crypto_perf_o= pt_str) > + if not results: > + return False > + stats_results =3D self._stat_results_by_buf_size(results) > + json_result =3D [] > + for buf_size, values in stats_results.items(): > + status =3D "PASS" > + # delta, status > + self.accepted_gap =3D self.get_suite_cfg()['accepted_tol= erance'] > + self.expected_throughput =3D\ > + self.get_suite_cfg()['expected_throughput'][case_name][b= uf_size] > + delta =3D (values["gbps"] - > self.expected_throughput)/self.expected_throughput > + if abs(delta) > self.accepted_gap: > + status =3D "FAIL" > + > + perf_info=3D{ > + "status": status, > + "performance": > + [ > + { > + "name": "throughput", > + "value": values["gbps"], > + "unit": "Gbps", > + "delta": delta > + }, > + { > + "name":"failed_enq", > + "unit": "ops", > + "value": values["enqueue_failure= s"] > + }, > + { > + "name":"failed_deq", > + "unit": "ops", > + "value": values["dequeue_failure= s"] > + }, > + { > + "name":"throughput_mops", > + "unit": "Mops", > + "value": values["mops"] > + }, > + { > + "name":"cycle_buf", > + "unit": "Cycles", > + "value": values["cycle_buf"]/val= ues["nr"] > + }, > + ], > + "parameters": > + [ > + { > + "name": "core_num/thread_num", > + "unit": "num/num", > + "value": "{}/{}".format(c_num, t= _num) > + }, > + { > + "name":"frame_size", > + "unit": "bytes", > + "value": buf_size > + }, > + { > + "name":"burst_size", > + "unit": "bytes", > + "value": values["burst_size"] > + }, > + { > + "name":"total_ops", > + "unit": "ops", > + "value": values["enqueue"] > + }, > + ] > + } > + > + self.logger.debug(perf_info) > + json_result.append(perf_info) > + self._perf_result[case_name] =3D json_result > + self.logger.debug(self._perf_result) > + return True > + except Exception, ex: > + self.logger.error(ex) > + return False > -- > 2.7.4