From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id AA7972C01 for ; Thu, 17 Jan 2019 09:45:23 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jan 2019 00:45:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,488,1539673200"; d="scan'208";a="136521808" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 17 Jan 2019 00:45:22 -0800 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 17 Jan 2019 00:45:22 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 17 Jan 2019 00:45:21 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.63]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.160]) with mapi id 14.03.0415.000; Thu, 17 Jan 2019 16:45:20 +0800 From: "Zhao, XinfengX" To: "dts@dpdk.org" Thread-Topic: [PATCH V1] tests: add the suite of cryptodev performance test Thread-Index: AQHUrWVCV0LwQB3oPEqJXVCLRb3OsKWzJx8w Date: Thu, 17 Jan 2019 08:45:20 +0000 Message-ID: <44051B25D8C8784BB77FFB604D6A70CA1201D9E5@shsmsx102.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: 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="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: Thu, 17 Jan 2019 08:45:24 -0000 Tested-by : Xinfeng Zhao -----Original Message----- From: Zhao, XinfengX=20 Sent: Wednesday, January 16, 2019 2:36 PM To: dts@dpdk.org Cc: Zhao, XinfengX Subject: [PATCH V1] tests: add the suite of cryptodev performance test add the script of cryptodev performance test to tests 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 diff --git a/tests/TestSuite_cryptodev_perf_crypto-perf.py b/tests/TestSuit= e_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 #=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 #=20 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #=20 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #=20 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #=20 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #=20 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #=20 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #=20 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #=20 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #=20 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #=20 +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-cr= ypto-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.json= ", "w") as fv: + json.dump(self._perf_result, fv, indent=3D4,=20 + 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_sha1_= 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_sha2_= 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(line= _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,=20 + 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_str= , + 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_opt= _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_toler= ance'] + self.expected_throughput =3D\ + self.get_suite_cfg()['expected_throughput'][case_name][buf= _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_failures"= ] + }, + { + "name":"failed_deq", + "unit": "ops", + "value": values["dequeue_failures"= ] + }, + { + "name":"throughput_mops", + "unit": "Mops", + "value": values["mops"] + }, + { + "name":"cycle_buf", + "unit": "Cycles", + "value": values["cycle_buf"]/value= s["nr"] + }, + ], + "parameters": + [ + { + "name": "core_num/thread_num", + "unit": "num/num", + "value": "{}/{}".format(c_num, t_n= um) + }, + { + "name":"frame_size", + "unit": "bytes",=20 + "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