From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 44B9BF94 for ; Thu, 13 Oct 2016 14:17:52 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP; 13 Oct 2016 05:17:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="scan'208";a="19164992" Received: from sivswdev03.ir.intel.com (HELO localhost.localdomain) ([10.237.217.157]) by fmsmga006.fm.intel.com with ESMTP; 13 Oct 2016 05:17:48 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: fiona.trahe@intel.com, pablo.de.lara.guarch@intel.com, john.griffin@intel.com, deepak.k.jain@intel.com, Arek Kusztal Date: Thu, 13 Oct 2016 13:17:41 +0100 Message-Id: <1476361061-7366-1-git-send-email-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] app/test: add crypto continual tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2016 12:17:52 -0000 This commit adds continual performace tests to Intel(R) QuickAssist Technology tests suite. Performance tests are run continually with some number of repeating loops. Signed-off-by: Arek Kusztal --- app/test/test_cryptodev_perf.c | 133 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 119 insertions(+), 14 deletions(-) diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index 43a7166..dd741fa 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -3876,9 +3876,9 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id, } static int -test_perf_AES_GCM(void) +test_perf_AES_GCM(int continual_buf_len, int continual_size) { - uint16_t i, j; + uint16_t i, j, k, loops = 1; uint16_t buf_lengths[] = { 64, 128, 256, 512, 1024, 1536, 2048 }; @@ -3886,6 +3886,9 @@ test_perf_AES_GCM(void) &AES_GCM_128_12IV_0AAD }; + if (continual_buf_len) + loops = continual_size; + int TEST_CASES_GCM = RTE_DIM(gcm_tests); const unsigned burst_size = 32; @@ -3930,21 +3933,42 @@ test_perf_AES_GCM(void) params_set[i].chain = CIPHER_HASH; params_set[i].session_attrs = &session_attrs[i]; params_set[i].symmetric_op = &ops_set[i]; - params_set[i].total_operations = 1000000; + if (continual_buf_len) + params_set[i].total_operations = 0xFFFFFF; + else + params_set[i].total_operations = 1000000; + params_set[i].burst_size = burst_size; } + if (continual_buf_len) + printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub" + " burst size: %u", "AES_GCM", "AES_GCM", + gcm_test->key.len << 3, burst_size); + for (i = 0; i < RTE_DIM(gcm_tests); i++) { - printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub" + if (!continual_buf_len) { + printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub" " burst size: %u", "AES_GCM", "AES_GCM", - gcm_test->key.len << 3, burst_size - ); - printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t" - " Retries\tEmptyPolls"); + gcm_test->key.len << 3, burst_size); + printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t" + " Retries\tEmptyPolls"); + } - for (j = 0; j < RTE_DIM(buf_lengths); ++j) { + uint16_t len = RTE_DIM(buf_lengths); + uint16_t p = 0; + + if (continual_buf_len) { + for (k = 0; k < RTE_DIM(buf_lengths); k++) + if (buf_lengths[k] == continual_buf_len) { + len = k + 1; + p = k; + break; + } + } + for (j = p; j < len; ++j) { params_set[i].symmetric_op->c_len = buf_lengths[j]; params_set[i].symmetric_op->p_len = buf_lengths[j]; @@ -3959,9 +3983,16 @@ test_perf_AES_GCM(void) ¶ms_set[i], 1)) return TEST_FAILED; - if (perf_AES_GCM(testsuite_params.dev_id, 0, - ¶ms_set[i], 0)) - return TEST_FAILED; + for (k = 0; k < loops; k++) { + if (continual_buf_len) + printf("\n\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t" + " Retries\tEmptyPolls"); + if (perf_AES_GCM(testsuite_params.dev_id, 0, + ¶ms_set[i], 0)) + return TEST_FAILED; + if (continual_buf_len) + printf("\n\nCompleted loop %i of %i ...", k+1, loops); + } } } @@ -3969,6 +4000,70 @@ test_perf_AES_GCM(void) return 0; } +static int test_cryptodev_perf_AES_GCM(void) +{ + return test_perf_AES_GCM(0, 0); +} +/* + * This function calls AES GCM performance tests providing + * size of packet as an argument. If size of packet is not + * in the buf_lengths array, all sizes will be used + */ +static int test_continual_perf_AES_GCM(void) +{ + return test_perf_AES_GCM(1024, 10); +} + +static int +test_perf_continual_performance_test(void) +{ + unsigned total_operations = 0xFFFFFF; + unsigned total_loops = 10; + unsigned burst_size = 32; + uint8_t i; + + struct perf_test_params params_set = { + .total_operations = total_operations, + .burst_size = burst_size, + .buf_size = 1024, + + .chain = CIPHER_HASH, + + .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, + .cipher_key_length = 16, + .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC + }; + + for (i = 1; i <= total_loops; ++i) { + printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u." + " burst_size: %d ops\n", + chain_mode_name(params_set.chain), + cipher_algo_name(params_set.cipher_algo), + auth_algo_name(params_set.auth_algo), + params_set.cipher_key_length, + burst_size); + printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t" + "Retries\tEmptyPolls\n"); + test_perf_aes_sha(testsuite_params.dev_id, 0, + ¶ms_set); + printf("\nCompleted loop %i of %i ...", i, total_loops); + } + return 0; +} + +static struct unit_test_suite cryptodev_qat_continual_testsuite = { + .suite_name = "Crypto Device Continual Performance Test", + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { + TEST_CASE_ST(ut_setup, ut_teardown, + test_perf_continual_performance_test), + TEST_CASE_ST(ut_setup, ut_teardown, + test_continual_perf_AES_GCM), + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; + static struct unit_test_suite cryptodev_testsuite = { .suite_name = "Crypto Device Unit Test Suite", .setup = testsuite_setup, @@ -3977,7 +4072,7 @@ static struct unit_test_suite cryptodev_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_perf_aes_cbc_encrypt_digest_vary_pkt_size), TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_AES_GCM), + test_cryptodev_perf_AES_GCM), TEST_CASE_ST(ut_setup, ut_teardown, test_perf_aes_cbc_vary_burst_size), TEST_CASES_END() /**< NULL terminate unit test array */ @@ -3990,7 +4085,7 @@ static struct unit_test_suite cryptodev_gcm_testsuite = { .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_AES_GCM), + test_cryptodev_perf_AES_GCM), TEST_CASES_END() /**< NULL terminate unit test array */ } }; @@ -4080,6 +4175,14 @@ perftest_libcrypto_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) return unit_test_suite_runner(&cryptodev_libcrypto_testsuite); } +static int +perftest_qat_continual_cryptodev(void) +{ + gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD; + + return unit_test_suite_runner(&cryptodev_qat_continual_testsuite); +} + REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perftest, perftest_aesni_mb_cryptodev); REGISTER_TEST_COMMAND(cryptodev_qat_perftest, perftest_qat_cryptodev); REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perftest, perftest_sw_snow3g_cryptodev); @@ -4087,3 +4190,5 @@ REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perftest, perftest_qat_snow3g_cryptod REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_perftest, perftest_aesni_gcm_cryptodev); REGISTER_TEST_COMMAND(cryptodev_libcrypto_perftest, perftest_libcrypto_cryptodev); +REGISTER_TEST_COMMAND(cryptodev_qat_continual_perftest, + perftest_qat_continual_cryptodev); -- 2.1.0