From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id B65BA1B433 for ; Sat, 2 Feb 2019 08:52:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Feb 2019 23:52:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,551,1539673200"; d="scan'208";a="119440119" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga007.fm.intel.com with ESMTP; 01 Feb 2019 23:52:03 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 1 Feb 2019 23:52:02 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.207]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.174]) with mapi id 14.03.0415.000; Sat, 2 Feb 2019 15:52:01 +0800 From: "Zhao, XinfengX" To: "dts@dpdk.org" Thread-Topic: [dts][PATCH V2] tests: rename and modify the cryptodev performance test Thread-Index: AQHUusukpdlSB+c+bUKekb7oM6E1EKXMIrhw Date: Sat, 2 Feb 2019 07:52:00 +0000 Message-ID: <44051B25D8C8784BB77FFB604D6A70CA12027520@shsmsx102.ccr.corp.intel.com> References: <1549093904-52963-1-git-send-email-xinfengx.zhao@intel.com> In-Reply-To: <1549093904-52963-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 V2] tests: rename and modify the 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: Sat, 02 Feb 2019 07:52:05 -0000 Tested-by : Xinfeng Zhao -----Original Message----- From: Zhao, XinfengX=20 Sent: Saturday, February 2, 2019 3:52 PM To: dts@dpdk.org Cc: Zhao, XinfengX Subject: [dts][PATCH V2] tests: rename and modify the cryptodev performance= test Signed-off-by: Xinfeng Zhao --- tests/TestSuite_crypto_perf.py | 1484 ---------------------= ---- tests/TestSuite_crypto_perf_cryptodev_perf.py | 487 ++++++++ 2 files changed, 487 insertions(+), 1484 deletions(-) delete mode 100755 tests/TestSuite_crypto_perf.py create mode 100644 tests/TestSuite_crypto_perf_cryptodev_perf.py diff --git a/tests/TestSuite_crypto_perf.py b/tests/TestSuite_crypto_perf.p= y deleted file mode 100755 index 1715e5c..0000000 --- a/tests/TestSuite_crypto_perf.py +++ /dev/null @@ -1,1484 +0,0 @@ -# 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 hmac -import hashlib -import binascii -import time -import os -import sys -import dts -import utils -import commands -import copy -import time -import random -from test_case import TestCase - - -class TestCryptoPerf(TestCase): - - def set_up_all(self): - - self.filename =3D "" - self.__LTCY =3D "" - self.__THPT =3D "" - self.qat_wilte_list =3D [] - self.total_buffer_list =3D [] - self.waiting_to_coll_buf =3D [] - - self.core_config =3D "1S/2C/1T" - self.number_of_ports =3D 1 - self.dut_ports =3D self.dut.get_ports(self.nic) - self.verify(len(self.dut_ports) >=3D self.number_of_ports, - "Not enough ports for " + self.nic) - self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) - - self.logger.info("core config =3D " + self.core_config) - self.logger.info("number of ports =3D " + str(self.number_of_ports= )) - self.logger.info("dut ports =3D " + str(self.dut_ports)) - self.logger.info("ports_socket =3D " + str(self.ports_socket)) - - self.core_mask =3D utils.create_mask(self.dut.get_core_list( - self.core_config, - socket=3Dself.ports_socket)) - self.port_mask =3D utils.create_mask([self.dut_ports[0]]) - - self.tx_port =3D self.tester.get_local_port(self.dut_ports[0]) - self.rx_port =3D self.tester.get_local_port(self.dut_ports[0]) - - self.tx_interface =3D self.tester.get_interface(self.tx_port) - self.rx_interface =3D self.tester.get_interface(self.rx_port) - - self.logger.info("core mask =3D " + self.core_mask) - self.logger.info("port mask =3D " + self.port_mask) - self.logger.info("tx interface =3D " + self.tx_interface) - self.logger.info("rx interface =3D " + self.rx_interface) - - # Rebuild the dpdk with cryptodev pmds CONFIG_RTE_LIBRTE_PMD_ZUC= =3Dn - self.dut.send_expect("export AESNI_MULTI_BUFFER_LIB_PATH=3D/root/i= psec_044/code/", "#") - self.dut.send_expect("export LIBSSO_SNOW3G_PATH=3D/root/libsso_sno= w3g/snow3g/", "#") - self.dut.send_expect("export LIBSSO_ZUC_PATH=3D/root/libsso_zuc.1.= 0.1.1-8/zuc", "#") - self.dut.send_expect("export LIBSSO_KASUMI_PATH=3D/root/LibSSO_0_3= _1/isg_cid-wireless_libs/ciphers/kasumi/", "#") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_QAT=3Dn$/CON= FIG_RTE_LIBRTE_PMD_QAT=3Dy/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3D= n$/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3Dy/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO= =3Dn$/CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=3Dy/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dn$/= CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dy/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_KASUMI=3Dn$/= CONFIG_RTE_LIBRTE_PMD_KASUMI=3Dy/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dn$= /CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dy/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dn= $/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dy/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dn$/CON= FIG_RTE_LIBRTE_PMD_ZUC=3Dy/' config/common_base", "# ") - self.dut.skip_setup =3D False - self.dut.build_install_dpdk(self.dut.target) - - # test-crypto-perf compile - out =3D self.dut.build_dpdk_apps("./app/test-crypto-perf") - - # Bind QAT VF devices - out =3D self.dut.send_expect("lspci -d:37c9|awk '{print $1}'", "# = ", 10) - self.dut.send_expect('echo "8086 37c9" > /sys/bus/pci/drivers/igb_= uio/new_id', "# ", 10) - for line in out.replace("\r", "\n").replace("\n\n", "\n").split("\= n"): - cmd =3D "echo 0000:{} > /sys/bus/pci/devices/0000\:{}/driver/u= nbind".format(line, line.replace(":", "\:")) - qat_device =3D "0000:{}".format(line, line.replace(":", "\:")) - self.qat_wilte_list.append(qat_device) - self.dut.send_expect(cmd, "# ", 10) - cmd =3D "echo 0000:{} > /sys/bus/pci/drivers/igb_uio/bind".for= mat(line) - self.dut.send_expect(cmd, "# ", 10) - self.__check_buffer_size_number() - - def set_up(self): - pass - - def test_qat_AES_CBC_perf(self): - result =3D True - self.logger.info("Test qat_c_AES_CBC_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_c_AES_CBC_Perf") - self.verify(result, True) - - def test_qat_AES_CTR_perf(self): - result =3D True - self.logger.info("Test qat_c_AES_CTR_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_c_AES_CTR_Perf") - self.verify(result, True) - - def test_qat_AES_GCM_perf(self): - result =3D True - self.logger.info("Test qat_c_AES_GCM_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_c_AES_GCM_Perf") - self.verify(result, True) - - def test_qat_3DES_CBC_perf(self): - result =3D True - self.logger.info("Test qat_c_3DES_CTR_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_c_3DES_CTR_Perf") - self.verify(result, True) - - def test_qat_3DES_CTR_perf(self): - result =3D True - self.logger.info("Test qat_c_3DES_CBC_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_c_3DES_CBC_Perf") - self.verify(result, True) - - def test_qat_KASUMI_perf(self): - result =3D True - self.logger.info("Test qat_c_KASUMMI_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_c_KASUMMI_Perf") - self.verify(result, True) - - def test_qat_SNOW3G_perf(self): - result =3D True - self.logger.info("Test qat_c_SNOW3G_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_c_SNOW3G_Perf") - self.verify(result, True) - - def test_qat_HASH_perf(self): - result =3D True - self.logger.info("Test qat_h_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_h_auto_Perf") - self.verify(result, True) - - def test_qat_NULL_perf(self): - result =3D True - self.logger.info("Test qat_NULL_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "qat_NULL_auto_Perf") - self.verify(result, True) - - def test_aesni_mb_AES_CBC_perf(self): - result =3D True - self.logger.info("Test aesni_mb_c_AES_CBC_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "aesni_mb_c_AES_CBC_Perf") - self.verify(result, True) - - def test_aesni_mb_AES_CTR_perf(self): - result =3D True - self.logger.info("Test aesni_mb_c_AES_CTR_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "aesni_mb_c_AES_CTR_Perf") - self.verify(result, True) - - def test_aesni_mb_HASH_perf(self): - result =3D True - self.logger.info("Test aesni_mb_h_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "aesni_mb_h_auto_Perf") - self.verify(result, True) - - def test_aesni_gcm_AES_GCM_perf(self): - result =3D True - self.logger.info("Test aes_gcm_c_AES_GCM_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "aes_gcm_c_AES_GCM_Perf") - self.verify(result, True) - - def test_kasumi_KASUMI_perf(self): - result =3D True - self.logger.info("Test kasumi_KASUMI_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "kasumi_KASUMI_auto_Perf") - self.verify(result, True) - - def test_snow3g_SNOW3G_perf(self): - result =3D True - self.logger.info("Test snow3g_SNOW3G_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "snow3g_SNOW3G_auto_Perf") - self.verify(result, True) - - def test_zuc_ZUC_perf(self): - result =3D True - self.logger.info("Test zuc_ZUC_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "zuc_ZUC_auto_Perf") - self.verify(result, True) - - def test_null_NULL_perf(self): - result =3D True - self.logger.info("Test null_NULL_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "null_NULL_auto_Perf") - self.verify(result, True) - - def test_openssl_AES_CBC_perf(self): - result =3D True - self.logger.info("Test openssl_c_AES_CBC_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "openssl_c_AES_CBC_Perf") - self.verify(result, True) - - def test_openssl_AES_CTR_perf(self): - result =3D True - self.logger.info("Test openssl_c_AES_CTR_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "openssl_c_AES_CTR_Perf") - self.verify(result, True) - - def test_openssl_AES_GCM_perf(self): - result =3D True - self.logger.info("Test openssl_c_AES_GCM_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "openssl_c_AES_GCM_Perf") - self.verify(result, True) - - def test_openssl_3DES_CBC_perf(self): - result =3D True - self.logger.info("Test openssl_c_3DES_CBC_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "openssl_c_3DES_CBC_Perf") - self.verify(result, True) - - def test_openssl_3DES_CTR_perf(self): - result =3D True - self.logger.info("Test openssl_c_3DES_CTR_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "openssl_c_3DES_CTR_Perf") - self.verify(result, True) - - def test_openssl_HASH_perf(self): - result =3D True - self.logger.info("Test openssl_h_HASH_auto_Perf") - result =3D self.__execute_crypto_perf_test( - test_vectors, "openssl_h_HASH_auto_Perf") - self.verify(result, True) - - def test_calculatr_case_number(self): - - self.__calculate_totall_cases_numb() - - def __execute_crypto_perf_test(self, test_vectors, test_vector_name): - failed_count =3D 0 - result =3D True - - if test_vector_name not in test_vectors: - self.logger.warn("SKIP : " + test_vector_name) - return True - - test_vector =3D test_vectors[test_vector_name] - - test_vector_list =3D self.__test_vector_to_vector_list(test_vector= , - core_mask=3Ds= elf.core_mask, - port_mask=3Ds= elf.port_mask) - - currently_time =3D time.strftime('%Y-%m-%d %H:%M:%S', time.localti= me(time.time())) - case_line =3D "<<<[{time}][{name}] Total Generated: [{num}] Cases>= >>\n".format( - time=3Dcurrently_time, name=3Dtest_vector_name, num= =3Dlen(test_vector_list)) - self.logger.info(case_line) - - for test_vector in test_vector_list: - self.logger.debug(test_vector) - cmd_str =3D self.__test_vector_to_cmd(test_vector, - core_mask=3Dself.core_mask= , - port_mask=3Dself.port_mask= ) - out =3D self.dut.send_expect(cmd_str, "]# ", 600) - self.logger.info("Test Result:\n*********************\n {ret}"= .format(ret=3Dout)) - ret =3D self.__result_collection(out, test_vector) - if ret is False: - failed_count =3D failed_count + 1 - result =3D result and ret - self.logger.info(("[{name}] Total Failed cases: [{num}]\n".format( - name=3Dtest_vector_name, num=3Dfailed_count))) - return result - - def tear_down(self): - pass - - def tear_down_all(self): - f =3D open(self.filename, "a") - currently_time =3D time.strftime('%Y-%m-%d %H:%M:%S', time.localti= me(time.time())) - f.write("...Test Finished [{time}]...".format(time=3Dcurrently_tim= e)) - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_QAT=3Dy$/CON= FIG_RTE_LIBRTE_PMD_QAT=3Dn/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3D= y$/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3Dn/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO= =3Dy$/CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=3Dn/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dy$/= CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dn/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_KASUMI=3Dy$/= CONFIG_RTE_LIBRTE_PMD_KASUMI=3Dn/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dy$= /CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dn/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dy= $/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dn/' config/common_base", "# ") - self.dut.send_expect("sed -i 's/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dy$/CON= FIG_RTE_LIBRTE_PMD_ZUC=3Dn/' config/common_base", "# ") - f.close() - - def __check_buffer_size_number(self): - buf_numb =3D 0 - buf_list =3D [] - for vector_name in test_vectors: - temp_numb =3D 0 - temp_list =3D [] - vector =3D test_vectors[vector_name] - if vector["buffer-sz"] !=3D "": - if vector["buffer-sz"].find(",") !=3D -1: - buf =3D vector["buffer-sz"].split(",") - temp_list =3D copy.deepcopy(buf) - temp_numb =3D len(buf) - elif vector["buffer-sz"].find(":") !=3D -1: - buf =3D vector["buffer-sz"].split(":") - if len(buf) !=3D 3: - self.logger.info("buffer-sz format is invalid") - else: - temp =3D buf[0] - while temp <=3D buf[2]: - temp_list.append(temp) - temp_numb =3D temp_numb + 1 - temp =3D temp + buf[1] - else: - temp_numb =3D 1 - if temp_numb > buf_numb: - buf_numb =3D temp_numb - buf_list =3D copy.deepcopy(temp_list) - - head =3D "PMD,chain,ptest,cipher_algo,cipher_op,cipher_key,iv,auth= _algo,auth_op,auth_key,aad,digest," - self.__LTCY =3D head - self.__THPT =3D head - self.total_buffer_list =3D copy.deepcopy(buf_list) - for buf_sz in buf_list: - self.__LTCY =3D self.__LTCY + "buf{buffer} Ltcy(us),buf{buffer= } Cyc,".format(buffer=3Dbuf_sz) - self.__THPT =3D self.__THPT + "buf{buffer} Thpt(Gbps),buf{buff= er} Ops,".format(buffer=3Dbuf_sz) - self.__LTCY =3D self.__LTCY[:len(self.__LTCY) - 1] + "\n" - self.__THPT =3D self.__THPT[:len(self.__THPT) - 1] + "\n" - - str_pid =3D str(os.getpid()) - self.filename =3D "/tmp/test_crypto_perf_{0}.csv".format(time.time= ()) - f =3D open(self.filename, "a") - if f is None: - self.logger.info("open scv file failed.") - return - - current_time =3D time.strftime('%Y-%m-%d %H:%M:%S', time.localtime= (time.time())) - f.write("...Test Start [{time}]...\n".format(time=3Dcurrent_time)) - f.write(self.__THPT) - f.write(self.__LTCY) - f.close() - - def __calculate_totall_cases_numb(self): - alg_map =3D {} - pmd_map =3D {} - map_combine =3D {} - count =3D 0 - alg =3D "" - pmd =3D "" - alg_list =3D ["AES_CBC", "AES_CTR", "AES_GCM", "3DES_CBC", - "3DES_CTR", "SNOW3G", "KASUMI", "ZUC", "NULL", "MD_SHA= "] - pmd_list =3D ["qat", "aesni_mb", "aesni_gcm", "snow3g", - "kasumi", "zuc", "openssl", "null"] - valid_map =3D { - "qat": ["AES_CBC", "AES_CTR", "AES_GCM", "3DES_CBC", - "3DES_CTR", "SNOW3G", "KASUMI", "NULL", "MD_SH= A"], - "aesni_mb": ["AES_CBC", "AES_CTR"], - "aesni_gcm": ["AES_GCM"], - "snow3g": ["SNOW3G"], - "kasumi": ["KASUMI"], - "zuc": ["ZUC"], - "openssl": ["AES_CBC", "AES_CTR", "AES_GCM", "3DES_CBC= ", "3DES_CTR", "MD_SHA"], - "null": ["NULL"] - } - - for index, value in test_vectors.iteritems(): - test_vector_list =3D self.__test_vector_to_vector_list(value, - core_mask= =3D"-1", - port_mask= =3Dself.port_mask) - count =3D count + len(test_vector_list) - for i in alg_list: - if (index.upper()).find(i) !=3D -1: - alg =3D i - if i in alg_map: - alg_map[i] +=3D len(test_vector_list) - else: - alg_map[i] =3D len(test_vector_list) - for j in pmd_list: - if (index).find(j) !=3D -1: - pmd =3D j - if j in pmd_map: - pmd_map[j] +=3D len(test_vector_list) - else: - pmd_map[j] =3D len(test_vector_list) - if (pmd !=3D "") and (alg in valid_map[pmd]): - temp_str =3D pmd + "_" + alg - if temp_str in map_combine: - map_combine[temp_str] +=3D len(test_vector_list) - else: - map_combine[temp_str] =3D len(test_vector_list) - for k, v in alg_map.iteritems(): - self.logger.info("Total {name} cases:\t\t\t{number}".format(na= me=3Dk, number=3Dv)) - for k, v in pmd_map.iteritems(): - self.logger.info("Total {name} cases:\t\t\t{number}".format(na= me=3Dk, number=3Dv)) - for k, v in map_combine.iteritems(): - self.logger.info("Total {name} cases:\t\t\t{number}".format(na= me=3Dk, number=3Dv)) - self.logger.info("Total cases:\t\t\t {0}".format(count)) - - def __parse_througuput_data(self, original_out): - throughPut_line =3D "" - count =3D 0 - data_finished =3D False - index =3D original_out.find("# lcore id") - if index =3D=3D -1: - seg_index =3D original_out.find("Segmentation fault") - throughPut_line =3D "sgtf,sgtf" if seg_index !=3D -1 else "otf= ,otf" - else: - value_data =3D (original_out[index:]).replace("\r", "") - value_list =3D (value_data.replace("\n\n", "\n")).split("\n") - temp_list =3D filter(lambda x: (x.find("lcore id") =3D=3D -1) = and (x !=3D ""), value_list) - length =3D len(temp_list) - for data_list in temp_list: - count =3D count + 1 - value_data_list =3D (data_list).split(";") - if length =3D=3D count: - data_finished =3D True - throughPut_line =3D throughPut_line + self.__buffer_size_r= esult_check( - value_data_list[1], value_data_= list[8], - value_data_list[7], data_finish= ed) - throughPut_line =3D throughPut_line + "\n" - return throughPut_line - - def __parse_latency_data(self, original_out): - latency =3D "" - count =3D 0 - data_finished =3D False - index =3D original_out.find("# lcore") - if index =3D=3D -1: - seg_index =3D original_out.find("Segmentation fault") - latency =3D "sgtf,sgtf" if seg_index !=3D -1 else "otf,otf" - else: - value_data =3D (original_out[index:]).replace("\r", "") - value_list =3D (value_data.replace("\r", "")).split("\n") - temp_list =3D filter(lambda x: (x.find("lcore") =3D=3D -1) and= (x !=3D ""), value_list) - length =3D len(temp_list) - for data_list in temp_list: - count =3D count + 1 - value_data_list =3D data_list.split(";") - if length =3D=3D count: - data_finished =3D True - latency =3D latency + self.__buffer_size_result_check( - value_data_list[1], value_data_lis= t[5], - value_data_list[4], data_finished) - latency =3D latency + "\n" - return latency - - def __buffer_size_result_check(self, buf_size, thpt_ltcy, ops_cycl, fi= nished): - count =3D 0 - result =3D "" - buffer_sz =3D copy.deepcopy(self.total_buffer_list) - - for buf in self.waiting_to_coll_buf: - if int(buf_size) > int(buf): - count =3D count + 1 - result =3D result + "*,*," - elif int(buf_size) =3D=3D int(buf): - count =3D count + 1 - self.waiting_to_coll_buf =3D self.waiting_to_coll_buf[coun= t:] - result =3D result + "{throughput_latenct},{ops_cycle},".fo= rmat( - buffer=3Dbuf_size, throughput_latenct=3Dthpt_= ltcy, ops_cycle=3Dops_cycl) - else: - if finished is True: - result =3D result + "*,*," - else: - break - return result - - def __parse_dut_out_data(self, original_out, test_vector): - perf_data_collect =3D "" - if test_vector["ptest"] =3D=3D "latency": - perf_data_collect =3D self.__parse_latency_data(original_out) - else: - perf_data_collect =3D self.__parse_througuput_data(original_ou= t) - - return perf_data_collect - - def __valid_data_write_line(self, test_vector): - iv =3D "{IV}".format(IV=3Dtest_vector["cipher-iv-sz"]) if test_vec= tor["cipher-iv-sz"] !=3D "" else "/" - aad =3D "{Aad}".format(Aad=3Dtest_vector["auth-aad-sz"]) if test_v= ector["auth-aad-sz"] !=3D "" else "/" - ptest =3D (test_vector["ptest"]).upper() - optype =3D test_vector["optype"] - digest =3D "{dgst}".format(dgst=3Dtest_vector["auth-digest-sz"]) i= f test_vector["auth-digest-sz"] !=3D "" else "/" - auth_op =3D (test_vector["auth-op"]).capitalize() if test_vector["= auth-op"] !=3D "" else "/" - devtype =3D ((test_vector["devtype"]).replace("crypto_", "")).uppe= r() - auth_key =3D "{key}".format(key=3Dtest_vector["auth-key-sz"]) if t= est_vector["auth-key-sz"] !=3D "" else "/" - cipher_op =3D (test_vector["cipher-op"]).capitalize() if test_vect= or["cipher-op"] !=3D "" else "-" - auth_algo =3D ((test_vector["auth-algo"]).replace("-", "_")).upper= () if test_vector["auth-algo"] !=3D "" else "/" - cipher_key =3D "{key}".format(key=3Dtest_vector["cipher-key-sz"]) = if test_vector["cipher-key-sz"] !=3D "" else "/" - cipher_algo =3D ((test_vector["cipher-algo"]).replace("-", "_")).u= pper() if test_vector["cipher-algo"] !=3D "" else "/" - - if optype.find("only") !=3D -1: - chain =3D (optype.replace("-", "_")).upper() - else: - chain =3D ((optype.replace("-then-", "_")).replace("auth", "ha= sh")).upper() - - w_line =3D "{pmd},{Chain},{test_type},{cAlg},{cop},{cKey},{IV},{hA= lg},{hop},{hkey},{Aad},{dgst},".format( - pmd=3Ddevtype, Chain=3Dchain, test_type=3Dptest, cAlg=3Dci= pher_algo, cop=3Dcipher_op, cKey=3Dcipher_key, IV=3Div, - hAlg=3Dauth_algo, hop=3Dauth_op, hkey=3Dauth_key, Aad=3Daa= d, dgst=3Ddigest) - - return w_line - - def __result_collection(self, original_out, test_vector): - result =3D True - perf_line =3D "" - f =3D open(self.filename, "a") - if f is None: - logger.info("open scv file failed.") - return - self.waiting_to_coll_buf =3D copy.deepcopy(self.total_buffer_list) - perf_line =3D self.__valid_data_write_line(test_vector) + self.__p= arse_dut_out_data(original_out, test_vector) - f.write(perf_line) - - if (perf_line.find("sgtf") !=3D -1) or (perf_line.find("otf") !=3D= -1): - result =3D False - return result - - def __test_vector_to_cmd(self, test_vector, core_mask=3D"", port_mask= =3D""): - TEST_CRYPTO_PERF =3D "./app/test-crypto-perf/build/app/dpdk-test-c= rypto-perf" - EAL_CORE_MASK =3D " -cf" if core_mask =3D=3D "" else " -c" + core_= mask - EAL_SEP =3D " --" - QUEUE_NUM =3D " " - CSV_FRIENDLY =3D " --csv-friendly" - - # port info - pci_bus =3D "" - for port in self.dut.ports_info: - pci_bus =3D " -w " + port['pci'] - - qat_bus =3D "" - if len(self.qat_wilte_list) > 0: - qat_bus =3D " -w " + self.qat_wilte_list[random.randint(0, len= (self.qat_wilte_list) - 1)] - - vdev =3D "" - if self.__check_field_in_vector(test_vector, "vdev"): - vdev =3D " --vdev " + test_vector["vdev"] - - ptest =3D "" - if self.__check_field_in_vector(test_vector, "ptest"): - ptest =3D " --ptest " + test_vector["ptest"] - - devtype =3D "" - if self.__check_field_in_vector(test_vector, "devtype"): - devtype =3D " --devtype " + test_vector["devtype"] - - chain =3D "" - if self.__check_field_in_vector(test_vector, "optype"): - chain =3D " --optype " + test_vector["optype"] - - cipher_algo =3D "" - if self.__check_field_in_vector(test_vector, "cipher-algo"): - cipher_algo =3D " --cipher-algo " + test_vector["cipher-algo"] - - cipher_op =3D "" - if self.__check_field_in_vector(test_vector, "cipher-op"): - cipher_op =3D " --cipher-op " + test_vector["cipher-op"] - - cipher_key =3D "" - if self.__check_field_in_vector(test_vector, "cipher-key-sz"): - cipher_key =3D " --cipher-key-sz {size}".format(size=3Dtest_ve= ctor["cipher-key-sz"]) - - iv =3D "" - if self.__check_field_in_vector(test_vector, "cipher-iv-sz"): - iv =3D " --cipher-iv-sz {size}".format(size=3Dtest_vector["cip= her-iv-sz"]) - - auth_algo =3D "" - if self.__check_field_in_vector(test_vector, "auth-algo"): - auth_algo =3D " --auth-algo " + test_vector["auth-algo"] - - auth_op =3D "" - if self.__check_field_in_vector(test_vector, "auth-op"): - auth_op =3D " --auth-op " + test_vector["auth-op"] - - auth_key =3D "" - if self.__check_field_in_vector(test_vector, "auth-key-sz"): - auth_key =3D " --auth-key-sz {size}".format(size=3Dtest_vector= ["auth-key-sz"]) - - aad =3D "" - if self.__check_field_in_vector(test_vector, "auth-aad-sz"): - aad =3D " --auth-aad-sz {size}".format(size=3Dtest_vector["aut= h-aad-sz"]) - - digest =3D "" - if self.__check_field_in_vector(test_vector, "auth-digest-sz"): - digest =3D " --auth-digest-sz {size}".format(size=3Dtest_vecto= r["auth-digest-sz"]) - - total_ops =3D "" - if self.__check_field_in_vector(test_vector, "total-ops"): - total_ops =3D " --total-ops {size}".format(size=3Dtest_vector[= "total-ops"]) - - burst_size =3D "" - if self.__check_field_in_vector(test_vector, "burst-sz"): - burst_size =3D " --burst-sz {size}".format(size=3Dtest_vector[= "burst-sz"]) - - buffer_size =3D "" - if self.__check_field_in_vector(test_vector, "buffer-sz"): - buffer_size =3D " --buffer-sz {size}".format(size=3Dtest_vecto= r["buffer-sz"]) - - cmd_str =3D "".join([TEST_CRYPTO_PERF, EAL_CORE_MASK, vdev, pci_bu= s, qat_bus, EAL_SEP, QUEUE_NUM, - ptest, devtype, chain, cipher_algo, cipher_op, = cipher_key, iv, auth_algo, - auth_op, auth_key, aad, digest, total_ops, burs= t_size, buffer_size, CSV_FRIENDLY]) - - return cmd_str - - def __check_field_in_vector(self, test_vector, field_name): - if field_name in test_vector and test_vector[field_name]: - return True - return False - - def __format_hex_to_param(self, hex_str, sep=3D":", prefix=3D""): - if not hex_str: - return "" - if len(hex_str) =3D=3D 1: - return prefix + "0" + hex_str - - result =3D prefix + hex_str[0:2] - for i in range(2, len(hex_str), 2): - if len(hex_str) < i + 2: - result =3D result + sep + "0" + hex_str[i:] - else: - result =3D result + sep + hex_str[i:i+2] - - return result - - def __var2list(self, var): - var_list =3D var if isinstance(var, list) else [var] - return var_list - - def __is_valid_op(self, chain, op): - chain_op_map =3D { - "aead": ["encrypt", "generate"], - "cipher-only": ["encrypt", "decrypt"], - "auth-only": ["generate", "verify"], - "cipher-then-auth": ["encrypt", "generate"], - "auth-then-cipher": ["decrypt", "verify"], - } - if op in chain_op_map[chain]: - return True - return False - - def __is_valid_size(self, key_type, algo, size): - algo_size_map =3D { - "aes-cbc": { - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16] - }, - "aes-ctr": { - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16] - }, - "3des-cbc": { - "cipher-key-sz": [16, 24], - "cipher-iv-sz": [8] - }, - "3des-ctr": { - "cipher-key-sz": [16, 24], - "cipher-iv-sz": [8] - }, - "aes-gcm": { - "cipher-key-sz": [16, 24, 32], - "auth-key-sz": [16, 24, 32], - "auth-aad-sz": [1, 2, 3, 4, 5, 6, 8, 9, 12, 16, 24, 32= , 64, 128, 155, 256, 1024, 65535], - "cipher-iv-sz": [12, 16], - "auth-digest-sz": [16] - }, - "snow3g-uea2": { - "cipher-key-sz": [16], - "cipher-iv-sz": [16] - }, - "kasumi-f8": { - "cipher-key-sz": [16], - "cipher-iv-sz": [8] - }, - "zuc-eea3": { - "cipher-key-sz": [16], - "cipher-iv-sz": [16] - }, - "null": { - "cipher-key-sz": [0], - "auth-key-sz": [0], - "auth-aad-sz": [0], - "cipher-iv-sz": [0], - "auth-digest-sz": [0] - }, - "md5-hmac": { - "auth-key-sz": [64], - "auth-aad-sz": [0], - "auth-digest-sz": [16] - }, - "sha1-hmac": { - "auth-key-sz": [64], - "auth-aad-sz": [0], - "auth-digest-sz": [20] - }, - "sha2-224-hmac": { - "auth-key-sz": [64], - "auth-aad-sz": [0], - "auth-digest-sz": [28] - }, - "sha2-256-hmac": { - "auth-key-sz": [64], - "auth-aad-sz": [0], - "auth-digest-sz": [32] - }, - "sha2-384-hmac": { - "auth-key-sz": [128], - "auth-aad-sz": [0], - "auth-digest-sz": [48] - }, - "sha2-512-hmac": { - "auth-key-sz": [128], - "auth-aad-sz": [0], - "auth-digest-sz": [64] - }, - "aes-gmac": { - "auth-key-sz": [16, 24, 32], - "auth-aad-sz": [1, 2, 3, 4, 5, 6, 8, 9, 12, 16, 24, 32= , 64, 128, 155, 256, 1024, 65535], - "auth-digest-sz": [16] - }, - "aes-xcbc-hmac": { - "auth-key-sz": [16], - "auth-aad-sz": [0], - "auth-digest-sz": [16] - }, - "snow3g-uia2": { - "auth-key-sz": [16], - "auth-aad-sz": [16], - "auth-digest-sz": [4] - }, - "kasumi-f9": { - "auth-key-sz": [16], - "auth-aad-sz": [8], - "auth-digest-sz": [4] - }, - "zuc-eia3": { - "auth-key-sz": [16], - "auth-aad-sz": [16], - "auth-digest-sz": [4] - }, - "md5": { - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [16] - }, - "sha1": { - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [20] - }, - "sha2-224": { - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [28] - }, - "sha2-256": { - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [32] - }, - "sha2-384": { - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [48] - }, - "sha2-512": { - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [64] - }, - } - result =3D False - if algo in algo_size_map: - if key_type in algo_size_map[algo]: - if size in algo_size_map[algo][key_type]: - result =3D True - return result - - def __actually_aesni_mb_digest(self, vector): - - if ((vector["vdev"]).find("crypto_aesni_mb") =3D=3D -1): - return - - auth_algo_dgst_map =3D { - "md5-hmac": 12, - "sha1-hamc": 12, - "sha2-224-hamc": 14, - "sha2-256-hamc": 16, - "sha2-384-hamc": 24, - "sha2-512-hamc": 32 - } - if vector["auth-algo"] in auth_algo_dgst_map: - digest =3D auth_algo_dgst_map[vector["auth-algo"]] - vector["auth-digest-sz"] =3D digest - - def __iter_optype(self, vector, vector_list, core_mask=3D"", port_mask= =3D""): - test_vector =3D vector.copy() - chain_list =3D self.__var2list(test_vector["optype"]) - for op_type in chain_list: - test_vector =3D vector.copy() - test_vector["optype"] =3D op_type - self.__iter_cipher_algo(test_vector, vector_list, core_mask, p= ort_mask) - - def __iter_cipher_algo(self, vector, vector_list, core_mask=3D"", port= _mask=3D""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "auth-only": - test_vector["cipher-algo"] =3D "" - self.__iter_cipher_op(test_vector, vector_list, core_mask, por= t_mask) - else: - cipher_algo_list =3D self.__var2list(test_vector["cipher-algo"= ]) - for cipher_algo in cipher_algo_list: - test_vector =3D vector.copy() - test_vector["cipher-algo"] =3D cipher_algo - self.__iter_cipher_op(test_vector, vector_list, core_mask,= port_mask) - - def __iter_cipher_op(self, vector, vector_list, core_mask=3D"", port_m= ask=3D""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "auth-only": - test_vector["cipher-op"] =3D "" - self.__iter_cipher_key(test_vector, vector_list, core_mask, po= rt_mask) - else: - cipher_op_list =3D self.__var2list(test_vector["cipher-op"]) - for cipher_op in cipher_op_list: - if self.__is_valid_op(test_vector["optype"], cipher_op): - test_vector =3D vector.copy() - test_vector["cipher-op"] =3D cipher_op - self.__iter_cipher_key(test_vector, vector_list, - core_mask, port_mask) - - def __iter_cipher_key(self, vector, vector_list, core_mask=3D"", port_= mask=3D""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "auth-only": - test_vector["cipher-key-sz"] =3D "" - self.__iter_iv(test_vector, vector_list, core_mask, port_mask) - else: - cipher_key_list =3D self.__var2list(test_vector["cipher-key-sz= "]) - for cipher_key in cipher_key_list: - test_vector =3D vector.copy() - if isinstance(cipher_key, int): - if self.__is_valid_size("cipher-key-sz", - test_vector["cipher-algo"], - cipher_key): - test_vector["cipher-key-sz"] =3D cipher_key - self.__iter_iv(test_vector, vector_list, core_mask= , port_mask) - else: - continue - else: - test_vector["cipher-key-sz"] =3D 0 - self.__iter_iv(test_vector, vector_list, core_mask, po= rt_mask) - - def __iter_iv(self, vector, vector_list, core_mask=3D"", port_mask=3D"= "): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "auth-only": - test_vector["cipher-iv-sz"] =3D "" - self.__iter_auth_algo(test_vector, vector_list, core_mask, por= t_mask) - else: - iv_list =3D self.__var2list(test_vector["cipher-iv-sz"]) - for iv in iv_list: - test_vector =3D vector.copy() - if isinstance(iv, int): - if self.__is_valid_size("cipher-iv-sz", - test_vector["cipher-algo"], - iv): - test_vector["cipher-iv-sz"] =3D iv - self.__iter_auth_algo(test_vector, vector_list, co= re_mask, port_mask) - else: - continue - else: - test_vector["cipher-iv-sz"] =3D 0 - self.__iter_auth_algo(test_vector, vector_list, - core_mask, port_mask) - - def __iter_auth_algo(self, vector, vector_list, core_mask=3D"", port_m= ask=3D""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "cipher-only": - test_vector["auth-algo"] =3D "" - self.__iter_auth_op(test_vector, vector_list, core_mask, port_= mask) - else: - auth_algo_list =3D self.__var2list(test_vector["auth-algo"]) - for auth_algo in auth_algo_list: - test_vector =3D vector.copy() - test_vector["auth-algo"] =3D auth_algo - self.__iter_auth_op(test_vector, vector_list, core_mask, p= ort_mask) - - def __iter_auth_op(self, vector, vector_list, core_mask=3D"", port_mas= k=3D""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "cipher-only": - test_vector["auth-op"] =3D "" - self.__iter_auth_key(test_vector, vector_list, core_mask, port= _mask) - else: - auth_op_list =3D self.__var2list(test_vector["auth-op"]) - for auth_op in auth_op_list: - if self.__is_valid_op(test_vector["optype"], auth_op): - test_vector =3D vector.copy() - test_vector["auth-op"] =3D auth_op - self.__iter_auth_key(test_vector, vector_list, - core_mask, port_mask) - - def __iter_auth_key(self, vector, vector_list, core_mask=3D"", port_ma= sk=3D""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "cipher-only": - test_vector["auth-key-sz"] =3D "" - self.__iter_aad(test_vector, vector_list, core_mask, port_mask= ) - else: - auth_key_list =3D self.__var2list(test_vector["auth-key-sz"]) - for auth_key in auth_key_list: - test_vector =3D vector.copy() - if isinstance(auth_key, int): - if self.__is_valid_size("auth-key-sz", - test_vector["auth-algo"], - auth_key): - test_vector["auth-key-sz"] =3D auth_key - self.__iter_aad(test_vector, vector_list, core_mas= k, port_mask) - else: - continue - else: - test_vector["auth-key-sz"] =3D 0 - self.__iter_aad(test_vector, vector_list, core_mask, p= ort_mask) - - def __iter_aad(self, vector, vector_list, core_mask=3D"", port_mask=3D= ""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "cipher-only": - test_vector["auth-aad-sz"] =3D "" - self.__iter_digest(test_vector, vector_list, core_mask, port_m= ask) - else: - aad_list =3D self.__var2list(test_vector["auth-aad-sz"]) - for aad in aad_list: - test_vector =3D vector.copy() - if isinstance(aad, int): - if self.__is_valid_size("auth-aad-sz", - test_vector["auth-algo"], - aad): - test_vector["auth-aad-sz"] =3D aad - self.__iter_digest(test_vector, vector_list, - core_mask, port_mask) - else: - continue - else: - test_vector["auth-aad-sz"] =3D 0 - self.__iter_digest(test_vector, vector_list, - core_mask, port_mask) - - def __iter_digest(self, vector, vector_list, core_mask=3D"", port_mask= =3D""): - test_vector =3D vector.copy() - if test_vector["optype"] =3D=3D "cipher-only": - test_vector["auth-digest-sz"] =3D "" - self.__iter_buffer_size(test_vector, vector_list, - core_mask, port_mask) - else: - digest_list =3D self.__var2list(vector["auth-digest-sz"]) - for digest in digest_list: - test_vector =3D vector.copy() - if isinstance(digest, int): - if self.__is_valid_size("auth-digest-sz", - test_vector["auth-algo"], - digest): - test_vector["auth-digest-sz"] =3D digest - else: - continue - else: - test_vector["auth-digest-sz"] =3D 0 - self.__actually_aesni_mb_digest(test_vector) - self.__iter_buffer_size(test_vector, vector_list, - core_mask, port_mask) - - def __iter_buffer_size(self, vector, vector_list, core_mask=3D"", port= _mask=3D""): - test_vector =3D vector.copy() - buffer_sz_list =3D vector["buffer-sz"] - if buffer_sz_list =3D=3D "": - buffer_sz_list =3D "32,64,128,256, 512,768, 1024,1280,1536,179= 2,2048" - test_vector["buffer-sz"] =3D buffer_sz_list - vector_list.append(test_vector) - - def __test_vector_to_vector_list(self, test_vector, core_mask=3D"", po= rt_mask=3D""): - vector_list =3D [] - ptest_list =3D self.__var2list(test_vector["ptest"]) - for ptest in ptest_list: - test_vector["ptest"] =3D ptest - self.__iter_optype(test_vector, vector_list, core_mask, port_m= ask) - - return vector_list - -test_vectors =3D { - - "qat_c_AES_CBC_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["aes-cbc"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16], - "auth-algo": ["md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [8, 16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_c_AES_CTR_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["aes-ctr"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16], - "auth-algo": ["md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_c_AES_GCM_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["aead"], - "cipher-algo": ["aes-gcm"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16], - "auth-algo": ["aes-gcm", "aes-gmac", "md5-hmac", "sha1-hmac", "sha= 2-224-hmac", "sha2-256-hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [8, 16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0, 8, 12], - "auth-digest-sz": [8, 12, 16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_c_3DES_CBC_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["3des-cbc"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24], - "cipher-iv-sz": [8], - "auth-algo": ["md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_c_3DES_CTR_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["3des-ctr"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24], - "cipher-iv-sz": [8], - "auth-algo": ["md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_c_KASUMMI_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["kasumi-f8"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16], - "cipher-iv-sz": [8], - "auth-algo": ["kasumi-f9"], - "auth-op": ["generate"], - "auth-key-sz": [16], - "auth-aad-sz": [8], - "auth-digest-sz": [4], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_c_SNOW3G_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["snow3g-uea2"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16], - "cipher-iv-sz": [16], - "auth-algo": ["snow3g-uia2"], - "auth-op": ["generate"], - "auth-key-sz": [16], - "auth-aad-sz": [16], - "auth-digest-sz": [4], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_h_auto_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["auth-only"], - "cipher-algo": "", - "cipher-op": "", - "cipher-key-sz": "", - "cipher-iv-sz": "", - "auth-algo": ["aes-gcm", "aes-gmac", "kasumi-f9", "snow3g-uia2", "= md5-hmac", - "sha1-hmac", "sha2-224-hmac", "sha2-256-hmac", "sha2= -384-hmac", - "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [8, 16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0, 8, 12], - "auth-digest-sz": [4, 8, 12, 16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "qat_NULL_auto_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only"], - "cipher-algo": ["null"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [0], - "cipher-iv-sz": [0], - "auth-algo": ["null"], - "auth-op": ["generate"], - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [0], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "aesni_mb_c_AES_CBC_Perf": { - "vdev": "crypto_aesni_mb_pmd", - "devtype": "crypto_aesni_mb", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["aes-cbc"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16], - "auth-algo": ["md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [8, 16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [12, 14, 16, 24, 32], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "aesni_mb_c_AES_CTR_Perf": { - "vdev": "crypto_aesni_mb_pmd", - "devtype": "crypto_aesni_mb", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["aes-ctr"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16], - "auth-algo": ["md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [8, 16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [12, 14, 16, 24, 32], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "aesni_mb_h_auto_Perf": { - "vdev": "crypto_aesni_mb_pmd", - "devtype": "crypto_aesni_mb", - "ptest": ["throughput", "latency"], - "optype": ["auth-only", "cipher-then-auth"], - "cipher-algo": "", - "cipher-op": "", - "cipher-key-sz": "", - "cipher-iv-sz": "", - "auth-algo": ["md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [8, 16, 24, 32, 40, 48, 56, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [12, 14, 16, 24, 32], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "aes_gcm_c_AES_GCM_Perf": { - "vdev": "crypto_aesni_gcm_pmd", - "devtype": "crypto_aesni_gcm", - "ptest": ["throughput", "latency"], - "optype": ["aead"], - "cipher-algo": ["aes-gcm"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 32], - "cipher-iv-sz": [12], - "auth-algo": ["aes-gcm", "aes-gmac"], - "auth-op": ["generate"], - "auth-key-sz": [16, 32], - "auth-aad-sz": [1, 4, 8, 12, 16, 65535], - "auth-digest-sz": [8, 12, 16], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "kasumi_KASUMI_auto_Perf": { - "vdev": "crypto_kasumi_pmd", - "devtype": "crypto_kasumi", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "auth-only", "cipher-then-auth"], - "cipher-algo": ["kasumi-f8"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16], - "cipher-iv-sz": [8], - "auth-algo": ["kasumi-f9"], - "auth-op": ["generate"], - "auth-key-sz": [16], - "auth-aad-sz": [8], - "auth-digest-sz": [4], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "snow3g_SNOW3G_auto_Perf": { - "vdev": "crypto_snow3g_pmd", - "devtype": "crypto_snow3g", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "auth-only", "cipher-then-auth"], - "cipher-algo": ["snow3g-uea2"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16], - "cipher-iv-sz": [16], - "auth-algo": ["snow3g-uia2"], - "auth-op": ["generate"], - "auth-key-sz": [16], - "auth-aad-sz": [16], - "auth-digest-sz": [4], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "zuc_ZUC_auto_Perf": { - "vdev": "crypto_zuc_pmd", - "devtype": "crypto_zuc", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "auth-only", "cipher-then-auth"], - "cipher-algo": ["zuc-eea3"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16], - "cipher-iv-sz": [16], - "auth-algo": ["zuc-eia3"], - "auth-op": ["generate"], - "auth-key-sz": [16], - "auth-aad-sz": [16], - "auth-digest-sz": [4], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "null_NULL_auto_Perf": { - "vdev": "", - "devtype": "crypto_qat", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only"], - "cipher-algo": ["null"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [0], - "cipher-iv-sz": [0], - "auth-algo": ["null"], - "auth-op": ["generate"], - "auth-key-sz": [0], - "auth-aad-sz": [0], - "auth-digest-sz": [0], - "buffer-sz": "32,64,128,256,512,768,1024,1280,1536,1792,2048", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "openssl_c_AES_CBC_Perf": { - "vdev": "crypto_openssl_pmd", - "devtype": "crypto_openssl", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["aes-cbc"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16], - "auth-algo": ["md5", "sha1", "sha2-224", "sha2-256", "sha2-384", "= sha2-512", - "md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [0, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "openssl_c_AES_CTR_Perf": { - "vdev": "crypto_openssl_pmd", - "devtype": "crypto_openssl", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["aes-ctr"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24, 32], - "cipher-iv-sz": [16], - "auth-algo": ["md5", "sha1", "sha2-224", "sha2-256", "sha2-384", "= sha2-512", - "md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [0, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "openssl_c_AES_GCM_Perf": { - "vdev": "crypto_openssl_pmd", - "devtype": "crypto_openssl", - "ptest": ["throughput", "latency"], - "optype": ["aead"], - "cipher-algo": ["aes-gcm"], - "cipher-op": ["aead"], - "cipher-key-sz": [16], - "cipher-iv-sz": [12, 16], - "auth-algo": ["aes-gcm", "aes-gmac", "md5", "sha1", "sha2-224", "s= ha2-256", - "sha2-384", "sha2-512", "md5-hmac", "sha1-hmac", "sh= a2-224-hmac", - "sha2-256-hmac", "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [0, 16, 24, 32, 64, 128], - "auth-aad-sz": [0, 8, 12], - "auth-digest-sz": [8, 12, 16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64,128,256", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "openssl_c_3DES_CBC_Perf": { - "vdev": "crypto_openssl_pmd", - "devtype": "crypto_openssl", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["3des-cbc"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24], - "cipher-iv-sz": [8], - "auth-algo": ["md5", "sha1", "sha2-224", "sha2-256", "sha2-384", "= sha2-512", - "md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [0, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "openssl_c_3DES_CTR_Perf": { - "vdev": "crypto_openssl_pmd", - "devtype": "crypto_openssl", - "ptest": ["throughput", "latency"], - "optype": ["cipher-only", "cipher-then-auth"], - "cipher-algo": ["3des-ctr"], - "cipher-op": ["encrypt", "decrypt"], - "cipher-key-sz": [16, 24], - "cipher-iv-sz": [8], - "auth-algo": ["md5", "sha1", "sha2-224", "sha2-256", "sha2-384", "= sha2-512", - "md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [0, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64", - "burst-sz": 32, - "total-ops": 10000000 - }, - - "openssl_h_HASH_auto_Perf": { - "vdev": "crypto_openssl_pmd", - "devtype": "crypto_openssl", - "ptest": ["throughput", "latency"], - "optype": ["auth-only"], - "cipher-algo": "", - "cipher-op": "", - "cipher-key-sz": "", - "cipher-iv-sz": "", - "auth-algo": ["md5", "sha1", "sha2-224", "sha2-256", "sha2-384", "= sha2-512", - "md5-hmac", "sha1-hmac", "sha2-224-hmac", "sha2-256-= hmac", - "sha2-384-hmac", "sha2-512-hmac"], - "auth-op": ["generate"], - "auth-key-sz": [0, 64, 128], - "auth-aad-sz": [0], - "auth-digest-sz": [16, 20, 28, 32, 48, 64], - "buffer-sz": "32,64", - "burst-sz": 32, - "total-ops": 10000000 - }, -} diff --git a/tests/TestSuite_crypto_perf_cryptodev_perf.py b/tests/TestSuit= e_crypto_perf_cryptodev_perf.py new file mode 100644 index 0000000..fe48884 --- /dev/null +++ b/tests/TestSuite_crypto_perf_cryptodev_perf.py @@ -0,0 +1,487 @@ +# 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 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, 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, + 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) + + stats_results =3D self._stat_results_by_buf_size(results) + if not stats_results: + return False + + json_result =3D [] + for buf_size, values in stats_results.items(): + status, delta =3D "PASS", 0 + # delta, status + if 'accepted_tolerance' in self.get_suite_cfg(): + self.accepted_gap =3D self.get_suite_cfg()['accepted_t= olerance'] + 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", + "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 --=20 2.7.4