From patchwork Wed Mar 20 12:14:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Iremonger, Bernard" X-Patchwork-Id: 51392 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 E86055A4A; Wed, 20 Mar 2019 13:14:12 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 557E75A44 for ; Wed, 20 Mar 2019 13:14:10 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2019 05:14:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,248,1549958400"; d="scan'208";a="156665343" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by fmsmga001.fm.intel.com with ESMTP; 20 Mar 2019 05:14:07 -0700 From: Bernard Iremonger To: dev@dpdk.org, konstantin.ananyev@intel.com, akhil.goyal@nxp.com Cc: Bernard Iremonger Date: Wed, 20 Mar 2019 12:14:04 +0000 Message-Id: <1553084044-21373-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test/ipsec: fix test initialisation 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" Fix xform initialisation. Fix testsuite_setup. Loop on rte_cryptodev_dequeue_burst(). Remove unused variables. Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test") Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup") Signed-off-by: Bernard Iremonger --- app/test/test_ipsec.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 80a2d25..7e3fc97 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -42,6 +42,7 @@ #define OUTBOUND_SPI 17 #define BURST_SIZE 32 #define REORDER_PKTS 1 +#define DEQUEUE_COUNT 100 struct user_params { enum rte_crypto_sym_xform_type auth; @@ -79,7 +80,6 @@ struct ipsec_unitest_params { struct rte_mbuf *obuf[BURST_SIZE], *ibuf[BURST_SIZE], *testbuf[BURST_SIZE]; - uint8_t *digest; uint16_t pkt_index; }; @@ -111,8 +111,6 @@ static struct ipsec_testsuite_params testsuite_params = { NULL }; static struct ipsec_unitest_params unittest_params; static struct user_params uparams; -static uint8_t global_key[128] = { 0 }; - struct supported_cipher_algo { const char *keyword; enum rte_crypto_cipher_algorithm algo; @@ -215,30 +213,26 @@ fill_crypto_xform(struct ipsec_unitest_params *ut_params, const struct supported_auth_algo *auth_algo, const struct supported_cipher_algo *cipher_algo) { - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.auth.algo = auth_algo->algo; - ut_params->auth_xform.auth.key.data = global_key; - ut_params->auth_xform.auth.key.length = auth_algo->key_len; - ut_params->auth_xform.auth.digest_length = auth_algo->digest_len; - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; ut_params->cipher_xform.cipher.algo = cipher_algo->algo; - ut_params->cipher_xform.cipher.key.data = global_key; - ut_params->cipher_xform.cipher.key.length = cipher_algo->key_len; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET; - ut_params->cipher_xform.cipher.iv.length = cipher_algo->iv_len; + ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; + ut_params->auth_xform.auth.algo = auth_algo->algo; if (ut_params->ipsec_xform.direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) { - ut_params->crypto_xforms = &ut_params->auth_xform; - ut_params->auth_xform.next = &ut_params->cipher_xform; + ut_params->cipher_xform.cipher.op = + RTE_CRYPTO_CIPHER_OP_DECRYPT; + ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; ut_params->cipher_xform.next = NULL; + ut_params->auth_xform.next = &ut_params->cipher_xform; + ut_params->crypto_xforms = &ut_params->auth_xform; } else { - ut_params->crypto_xforms = &ut_params->cipher_xform; - ut_params->cipher_xform.next = &ut_params->auth_xform; + ut_params->cipher_xform.cipher.op = + RTE_CRYPTO_CIPHER_OP_ENCRYPT; + ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; ut_params->auth_xform.next = NULL; + ut_params->cipher_xform.next = &ut_params->auth_xform; + ut_params->crypto_xforms = &ut_params->cipher_xform; } } @@ -287,9 +281,12 @@ testsuite_setup(void) int rc; memset(ts_params, 0, sizeof(*ts_params)); + memset(ut_params, 0, sizeof(*ut_params)); + memset(&uparams, 0, sizeof(struct user_params)); uparams.auth = RTE_CRYPTO_SYM_XFORM_AUTH; uparams.cipher = RTE_CRYPTO_SYM_XFORM_CIPHER; + uparams.aead = RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED; strcpy(uparams.auth_algo, "null"); strcpy(uparams.cipher_algo, "null"); @@ -759,6 +756,7 @@ crypto_ipsec(uint16_t num_pkts) struct ipsec_unitest_params *ut_params = &unittest_params; uint32_t k, ng; struct rte_ipsec_group grp[1]; + int i = 0; /* call crypto prepare */ k = rte_ipsec_pkt_crypto_prepare(&ut_params->ss[0], ut_params->ibuf, @@ -774,8 +772,12 @@ crypto_ipsec(uint16_t num_pkts) return TEST_FAILED; } - k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, - ut_params->cop, num_pkts); + while ((k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, + ut_params->cop, num_pkts)) == 0 && i < DEQUEUE_COUNT) { + rte_pause(); + i++; + } + if (k != num_pkts) { RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n"); return TEST_FAILED;