From patchwork Fri Oct 11 10:03:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 60960 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DFAFD1EAA2; Fri, 11 Oct 2019 12:06:41 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 348DF1EA35 for ; Fri, 11 Oct 2019 12:06:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2019 03:06:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,283,1566889200"; d="scan'208";a="207398920" Received: from akusztax-mobl.ger.corp.intel.com ([10.104.14.168]) by fmsmga001.fm.intel.com with ESMTP; 11 Oct 2019 03:06:37 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com, Arek Kusztal Date: Fri, 11 Oct 2019 12:03:38 +0200 Message-Id: <20191011100339.12912-5-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20191011100339.12912-1-arkadiuszx.kusztal@intel.com> References: <20191011100339.12912-1-arkadiuszx.kusztal@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 4/5] test/crypto: add sessionless to asymmetric mod exp X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commmit adds asymmetric sessionless tests to mod exp int test_cryptodev test file Signed-off-by: Arek Kusztal --- app/test/test_cryptodev_asym.c | 73 ++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index e8177e7..31d8bfa 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -283,7 +283,7 @@ test_cryptodev_asym_ver(union test_case_structure *data_tc, static int test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params, union test_case_structure *data_tc, - char *test_msg) + char *test_msg, int sessionless) { struct rte_crypto_asym_op *asym_op = NULL; struct rte_crypto_op *op = NULL; @@ -382,27 +382,31 @@ test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params, goto error_exit; } - sess = rte_cryptodev_asym_session_create(ts_params->session_mpool); - if (!sess) { - snprintf(test_msg, ASYM_TEST_MSG_LEN, - "line %u " - "FAILED: %s", __LINE__, - "Session creation failed"); - status = TEST_FAILED; - goto error_exit; - } - - if (rte_cryptodev_asym_session_init(dev_id, sess, &xform_tc, - ts_params->session_mpool) < 0) { - snprintf(test_msg, ASYM_TEST_MSG_LEN, - "line %u FAILED: %s", - __LINE__, "unabled to config sym session"); - status = TEST_FAILED; - goto error_exit; - } + if (!sessionless) { + sess = rte_cryptodev_asym_session_create(ts_params->session_mpool); + if (!sess) { + snprintf(test_msg, ASYM_TEST_MSG_LEN, + "line %u " + "FAILED: %s", __LINE__, + "Session creation failed"); + status = TEST_FAILED; + goto error_exit; + } - rte_crypto_op_attach_asym_session(op, sess); + if (rte_cryptodev_asym_session_init(dev_id, sess, &xform_tc, + ts_params->session_mpool) < 0) { + snprintf(test_msg, ASYM_TEST_MSG_LEN, + "line %u FAILED: %s", + __LINE__, "unabled to config sym session"); + status = TEST_FAILED; + goto error_exit; + } + rte_crypto_op_attach_asym_session(op, sess); + } else { + asym_op->xform = &xform_tc; + op->sess_type = RTE_CRYPTO_OP_SESSIONLESS; + } RTE_LOG(DEBUG, USER1, "Process ASYM operation"); /* Process crypto operation */ @@ -433,7 +437,10 @@ test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params, goto error_exit; } - snprintf(test_msg, ASYM_TEST_MSG_LEN, "PASS"); + if (!sessionless) + snprintf(test_msg, ASYM_TEST_MSG_LEN, "PASS"); + else + snprintf(test_msg, ASYM_TEST_MSG_LEN, "SESSIONLESS PASS"); error_exit: if (sess != NULL) { @@ -451,7 +458,7 @@ test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params, } static int -test_one_case(const void *test_case) +test_one_case(const void *test_case, int sessionless) { int status = TEST_SUCCESS; char test_msg[ASYM_TEST_MSG_LEN + 1]; @@ -460,7 +467,8 @@ test_one_case(const void *test_case) union test_case_structure tc; memcpy(&tc, test_case, sizeof(tc)); - status = test_cryptodev_asym_op(&testsuite_params, &tc, test_msg); + status = test_cryptodev_asym_op(&testsuite_params, &tc, test_msg, + sessionless); printf(" %u) TestCase %s %s\n", test_index++, tc.modex.description, test_msg); @@ -501,14 +509,31 @@ static int test_one_by_one(void) { int status = TEST_SUCCESS; + struct crypto_testsuite_params *ts_params = &testsuite_params; uint32_t i = 0; + uint8_t dev_id = ts_params->valid_devs[0]; + struct rte_cryptodev_info dev_info; + int sessionless = 0; + + rte_cryptodev_info_get(dev_id, &dev_info); + if ((dev_info.feature_flags & + RTE_CRYPTODEV_FF_ASYM_SESSIONLESS)) { + sessionless = 1; + } /* Go through all test cases */ test_index = 0; for (i = 0; i < test_vector.size; i++) { - if (test_one_case(test_vector.address[i]) != TEST_SUCCESS) + if (test_one_case(test_vector.address[i], 0) != TEST_SUCCESS) status = TEST_FAILED; } + if (sessionless) { + for (i = 0; i < test_vector.size; i++) { + if (test_one_case(test_vector.address[i], 1) + != TEST_SUCCESS) + status = TEST_FAILED; + } + } TEST_ASSERT_EQUAL(status, 0, "Test failed"); return status;