From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6212BA0096 for ; Fri, 12 Apr 2019 16:08:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC4F81B129; Fri, 12 Apr 2019 16:08:18 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C685A1B128; Fri, 12 Apr 2019 16:08:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2019 07:08:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,341,1549958400"; d="scan'208";a="222964260" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by orsmga001.jf.intel.com with ESMTP; 12 Apr 2019 07:08:12 -0700 From: Bernard Iremonger To: dev@dpdk.org, konstantin.ananyev@intel.com, akhil.goyal@nxp.com Cc: Bernard Iremonger , stable@dpdk.org Date: Fri, 12 Apr 2019 15:08:09 +0100 Message-Id: <1555078089-6877-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1554988097-18819-1-git-send-email-bernard.iremonger@intel.com> References: <1554988097-18819-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v2] app/test/ipsec: fix logic around dequeue burst 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190412140809.S5VvePIwGzPZcACQMVJIR1hN311kGWyGO69Omib1ZKE@z> Added crypto_dequeue_burst() function to call rte_crypto_dequeue_burst() in a loop with a delay to ensure that all the packets are dequeued from the crtpto device. Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup") Cc: stable@dpdk.org Signed-off-by: Bernard Iremonger Acked-by: Fiona Trahe Acked-by: Konstantin Ananyev --- Changes in v2: Added crypto_dequeue_burst() function app/test/test_ipsec.c | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 80a2d25..d79fe11 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include @@ -42,6 +42,7 @@ #define OUTBOUND_SPI 17 #define BURST_SIZE 32 #define REORDER_PKTS 1 +#define DEQUEUE_COUNT 1000 struct user_params { enum rte_crypto_sym_xform_type auth; @@ -753,6 +754,29 @@ create_sa(enum rte_security_session_action_type action_type, } static int +crypto_dequeue_burst(uint16_t num_pkts) +{ + struct ipsec_testsuite_params *ts_params = &testsuite_params; + struct ipsec_unitest_params *ut_params = &unittest_params; + uint32_t pkt_cnt, k; + int i; + + for (i = 0, pkt_cnt = 0; + i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) { + k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, + &ut_params->cop[pkt_cnt], num_pkts - pkt_cnt); + pkt_cnt += k; + rte_delay_us(1); + } + + if (pkt_cnt != num_pkts) { + RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n"); + return TEST_FAILED; + } + return TEST_SUCCESS; +} + +static int crypto_ipsec(uint16_t num_pkts) { struct ipsec_testsuite_params *ts_params = &testsuite_params; @@ -767,6 +791,7 @@ crypto_ipsec(uint16_t num_pkts) RTE_LOG(ERR, USER1, "rte_ipsec_pkt_crypto_prepare fail\n"); return TEST_FAILED; } + k = rte_cryptodev_enqueue_burst(ts_params->valid_dev, 0, ut_params->cop, num_pkts); if (k != num_pkts) { @@ -774,12 +799,8 @@ crypto_ipsec(uint16_t num_pkts) return TEST_FAILED; } - k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, - ut_params->cop, num_pkts); - if (k != num_pkts) { - RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n"); + if (crypto_dequeue_burst(num_pkts) == TEST_FAILED) return TEST_FAILED; - } ng = rte_ipsec_pkt_crypto_group( (const struct rte_crypto_op **)(uintptr_t)ut_params->cop, @@ -868,7 +889,6 @@ crypto_ipsec_2sa(void) struct ipsec_testsuite_params *ts_params = &testsuite_params; struct ipsec_unitest_params *ut_params = &unittest_params; struct rte_ipsec_group grp[BURST_SIZE]; - uint32_t k, ng, i, r; for (i = 0; i < BURST_SIZE; i++) { @@ -890,12 +910,8 @@ crypto_ipsec_2sa(void) } } - k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, - ut_params->cop, BURST_SIZE); - if (k != BURST_SIZE) { - RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n"); + if (crypto_dequeue_burst(BURST_SIZE) == TEST_FAILED) return TEST_FAILED; - } ng = rte_ipsec_pkt_crypto_group( (const struct rte_crypto_op **)(uintptr_t)ut_params->cop, @@ -1029,12 +1045,8 @@ crypto_ipsec_2sa_4grp(void) } } - k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, - ut_params->cop, BURST_SIZE); - if (k != BURST_SIZE) { - RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n"); + if (crypto_dequeue_burst(BURST_SIZE) == TEST_FAILED) return TEST_FAILED; - } ng = rte_ipsec_pkt_crypto_group( (const struct rte_crypto_op **)(uintptr_t)ut_params->cop, -- 2.7.4