From patchwork Tue Oct 1 11:33:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 60326 X-Patchwork-Delegate: jerinj@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 8623E4C9D; Tue, 1 Oct 2019 13:36:06 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id AD84D91 for ; Tue, 1 Oct 2019 13:36:04 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 8596420054C; Tue, 1 Oct 2019 13:36:04 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B7C1B2001C2; Tue, 1 Oct 2019 13:36:02 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id D2643402C7; Tue, 1 Oct 2019 19:35:59 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: jerinj@marvell.com, abhinandan.gujjar@intel.com Date: Tue, 1 Oct 2019 17:03:34 +0530 Message-Id: <20191001113339.21767-1-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 1/6] test/event_crypto: fix missing IV value for AES algo 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" The IV was not set, which was causing HW based SEC on DPAA1 to fail. Fixes: ce02103ad072 ("test/event_crypto: change the SEC cipher algo") Signed-off-by: Hemant Agrawal --- Please squash if possible. app/test/test_event_crypto_adapter.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 652e458f0..bf83a6357 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -171,6 +171,7 @@ test_op_forward_mode(uint8_t session_less) struct rte_event ev; uint32_t cap; int ret; + uint8_t cipher_key[17]; memset(&m_data, 0, sizeof(m_data)); @@ -186,6 +187,11 @@ test_op_forward_mode(uint8_t session_less) cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; + cipher_xform.cipher.key.data = cipher_key; + cipher_xform.cipher.key.length = 16; + cipher_xform.cipher.iv.offset = IV_OFFSET; + cipher_xform.cipher.iv.length = 16; + op = rte_crypto_op_alloc(params.op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC); TEST_ASSERT_NOT_NULL(op, @@ -364,6 +370,7 @@ test_op_new_mode(uint8_t session_less) struct rte_mbuf *m; uint32_t cap; int ret; + uint8_t cipher_key[17]; memset(&m_data, 0, sizeof(m_data)); @@ -379,6 +386,11 @@ test_op_new_mode(uint8_t session_less) cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; + cipher_xform.cipher.key.data = cipher_key; + cipher_xform.cipher.key.length = 16; + cipher_xform.cipher.iv.offset = IV_OFFSET; + cipher_xform.cipher.iv.length = 16; + op = rte_crypto_op_alloc(params.op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC); TEST_ASSERT_NOT_NULL(op, "Failed to allocate crypto_op!\n"); From patchwork Tue Oct 1 11:33:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 60327 X-Patchwork-Delegate: jerinj@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 99EAB5B3A; Tue, 1 Oct 2019 13:36:08 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id B0FAC91 for ; Tue, 1 Oct 2019 13:36:05 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6E560200540; Tue, 1 Oct 2019 13:36:05 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 9FBD5200064; Tue, 1 Oct 2019 13:36:03 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id BA423402DA; Tue, 1 Oct 2019 19:36:00 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: jerinj@marvell.com, abhinandan.gujjar@intel.com Date: Tue, 1 Oct 2019 17:03:35 +0530 Message-Id: <20191001113339.21767-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001113339.21767-1-hemant.agrawal@nxp.com> References: <20191001113339.21767-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/6] test/event_crypto: fix check for HW support 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" When HW is available but the mode mismatches, it is better to skip the test case. Fixes: cfe599b325e8 ("test/event_crypto: no service core when HW support available") Signed-off-by: Hemant Agrawal --- please squash if possible. app/test/test_event_crypto_adapter.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index bf83a6357..d3d19b98e 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -302,6 +302,10 @@ test_sessionless_with_op_forward_mode(void) if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) && !(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) map_adapter_service_core(); + else { + if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD)) + return TEST_SKIPPED; + } TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID), "Failed to start event crypto adapter"); @@ -323,6 +327,10 @@ test_session_with_op_forward_mode(void) if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) && !(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) map_adapter_service_core(); + else { + if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD)) + return TEST_SKIPPED; + } TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID ), "Failed to start event crypto adapter"); @@ -458,6 +466,10 @@ test_sessionless_with_op_new_mode(void) if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) && !(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) map_adapter_service_core(); + else { + if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) + return TEST_SKIPPED; + } /* start the event crypto adapter */ TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID), @@ -480,6 +492,10 @@ test_session_with_op_new_mode(void) if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) && !(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) map_adapter_service_core(); + else { + if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) + return TEST_SKIPPED; + } TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID), "Failed to start event crypto adapter"); From patchwork Tue Oct 1 11:33:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 60328 X-Patchwork-Delegate: jerinj@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 6441A49DF; Tue, 1 Oct 2019 13:36:10 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 889F658C4; Tue, 1 Oct 2019 13:36:07 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 3ABCD200557; Tue, 1 Oct 2019 13:36:07 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 191A62001EF; Tue, 1 Oct 2019 13:36:05 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 97E044030D; Tue, 1 Oct 2019 19:36:01 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: jerinj@marvell.com, abhinandan.gujjar@intel.com, stable@dpdk.org Date: Tue, 1 Oct 2019 17:03:36 +0530 Message-Id: <20191001113339.21767-3-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001113339.21767-1-hemant.agrawal@nxp.com> References: <20191001113339.21767-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 3/6] test/event_crypto: fix to avail the mempool entries 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" Added the missed code to avail the mempool entries before pool free. Fixes: 24054e3640a2 ("test/crypto: use separate session mempools"); Cc: stable@dpdk.org Signed-off-by: Hemant Agrawal --- The file location has been changed, thus check-git-log is giving err on this patch app/test/test_event_crypto_adapter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index d3d19b98e..8d42462d8 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -905,6 +905,7 @@ crypto_teardown(void) params.session_mpool = NULL; } if (params.session_priv_mpool != NULL) { + rte_mempool_avail_count(params.session_priv_mpool); rte_mempool_free(params.session_priv_mpool); params.session_priv_mpool = NULL; } From patchwork Tue Oct 1 11:33:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 60329 X-Patchwork-Delegate: jerinj@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 7507E1B952; Tue, 1 Oct 2019 13:36:12 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 993204C8D for ; Tue, 1 Oct 2019 13:36:10 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 74D621A094A; Tue, 1 Oct 2019 13:36:10 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A757E1A0558; Tue, 1 Oct 2019 13:36:08 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id E4E6A40328; Tue, 1 Oct 2019 19:36:02 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: jerinj@marvell.com, abhinandan.gujjar@intel.com Date: Tue, 1 Oct 2019 17:03:37 +0530 Message-Id: <20191001113339.21767-4-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001113339.21767-1-hemant.agrawal@nxp.com> References: <20191001113339.21767-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 4/6] test/event_crypto: support to release the atomic ctxt 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" The test cases uses ATOMIC queues. Once the packet is recived it is required to release the ATOMIC ctxt, at least for the HW based eventdevs. This patch makes empty dq call, which in turn releases the atomic ctxt. Signed-off-by: Hemant Agrawal --- app/test/test_event_crypto_adapter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 8d42462d8..b9e3a439e 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -357,6 +357,12 @@ send_op_recv_ev(struct rte_crypto_op *op) rte_pause(); recv_op = ev.event_ptr; + + /* In case of Atomic/Ordered Queue, call dequeue one more time + * to release, if there is any atomic context to be freed + */ + rte_event_dequeue_burst(evdev, TEST_APP_PORT_ID, &ev, NUM, 0); + #if PKT_TRACE struct rte_mbuf *m = recv_op->sym->m_src; rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m)); From patchwork Tue Oct 1 11:33:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 60330 X-Patchwork-Delegate: jerinj@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 013D01BE0C; Tue, 1 Oct 2019 13:36:14 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id C53AF4C99 for ; Tue, 1 Oct 2019 13:36:10 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A3CB91A094E; Tue, 1 Oct 2019 13:36:10 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id D76D21A0567; Tue, 1 Oct 2019 13:36:08 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id ED7EC4032B; Tue, 1 Oct 2019 19:36:03 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: jerinj@marvell.com, abhinandan.gujjar@intel.com Date: Tue, 1 Oct 2019 17:03:38 +0530 Message-Id: <20191001113339.21767-5-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001113339.21767-1-hemant.agrawal@nxp.com> References: <20191001113339.21767-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 5/6] test/event_crypto: use device cap instead of fixed values 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" Instead of hardcoded event device capabilities, it is better to enquire and use the device supported caps. Signed-off-by: Hemant Agrawal --- app/test/test_event_crypto_adapter.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index b9e3a439e..6b10909e3 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -703,12 +703,11 @@ test_crypto_adapter_free(void) static int test_crypto_adapter_create(void) { - struct rte_event_port_conf conf = { - .dequeue_depth = 8, - .enqueue_depth = 8, - .new_event_threshold = 1200, - }; int ret; + struct rte_event_port_conf conf; + + ret = rte_event_port_default_conf_get(TEST_CDEV_ID, 0, &conf); + TEST_ASSERT_SUCCESS(ret, "Failed to get port0 info"); /* Create adapter with default port creation callback */ ret = rte_event_crypto_adapter_create(TEST_ADAPTER_ID, @@ -747,14 +746,12 @@ test_crypto_adapter_qp_add_del(void) static int configure_event_crypto_adapter(enum rte_event_crypto_adapter_mode mode) { - struct rte_event_port_conf conf = { - .dequeue_depth = 8, - .enqueue_depth = 8, - .new_event_threshold = 1200, - }; - uint32_t cap; int ret; + struct rte_event_port_conf conf; + + ret = rte_event_port_default_conf_get(TEST_CDEV_ID, 0, &conf); + TEST_ASSERT_SUCCESS(ret, "Failed to get port0 info"); /* Create adapter with default port creation callback */ ret = rte_event_crypto_adapter_create(TEST_ADAPTER_ID, From patchwork Tue Oct 1 11:33:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 60331 X-Patchwork-Delegate: jerinj@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 E44C01BE82; Tue, 1 Oct 2019 13:36:15 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 0FB404C8D for ; Tue, 1 Oct 2019 13:36:11 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E76391A0563; Tue, 1 Oct 2019 13:36:10 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id EB2011A0943; Tue, 1 Oct 2019 13:36:08 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id F357D402C7; Tue, 1 Oct 2019 19:36:04 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: jerinj@marvell.com, abhinandan.gujjar@intel.com Date: Tue, 1 Oct 2019 17:03:39 +0530 Message-Id: <20191001113339.21767-6-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001113339.21767-1-hemant.agrawal@nxp.com> References: <20191001113339.21767-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 6/6] test/event_crypto: separate the NEW and FWD mode inits 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" The earlier patch was using a single method to init the crypto adapter for FWD and NEW mode, which was also causing the adapter mode to be set incorrectly for NEW mode. This patch segregate the init for NEW and FWD modes. In case of NEW mode the packets will be directly sent to the cryptodev, so port linking is not required. Signed-off-by: Hemant Agrawal --- app/test/test_event_crypto_adapter.c | 78 ++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 15 deletions(-) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 6b10909e3..e396358f2 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -789,26 +789,44 @@ test_crypto_adapter_stop(void) rte_service_runstate_set(adapter_service_id, 0); rte_service_lcore_stop(slcore_id); rte_service_lcore_del(slcore_id); - rte_event_crypto_adapter_stop(TEST_ADAPTER_ID); } + rte_event_crypto_adapter_stop(TEST_ADAPTER_ID); if (rte_event_dev_service_id_get(evdev, &evdev_service_id) == 0) { rte_service_runstate_set(evdev_service_id, 0); rte_service_lcore_stop(slcore_id); rte_service_lcore_del(slcore_id); - rte_event_dev_stop(evdev); + } + rte_event_dev_stop(evdev); +} + +static void +test_crypto_adapter_clear(void) +{ + uint8_t qid; + test_crypto_adapter_stop(); + + if (crypto_adapter_setup_done) { + qid = TEST_CRYPTO_EV_QUEUE_ID; + rte_event_port_unlink(evdev, params.crypto_event_port_id, + &qid, 1); + rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID, + TEST_CDEV_ID, TEST_CDEV_QP_ID); + rte_event_crypto_adapter_free(TEST_ADAPTER_ID); + crypto_adapter_setup_done = 0; } } static int -test_crypto_adapter_conf(enum rte_event_crypto_adapter_mode mode) +test_crypto_adapter_conf(void) { uint32_t evdev_service_id; uint8_t qid; int ret; if (!crypto_adapter_setup_done) { - ret = configure_event_crypto_adapter(mode); + ret = configure_event_crypto_adapter( + RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD); if (!ret) { qid = TEST_CRYPTO_EV_QUEUE_ID; ret = rte_event_port_link(evdev, @@ -845,24 +863,54 @@ test_crypto_adapter_conf(enum rte_event_crypto_adapter_mode mode) } static int -test_crypto_adapter_conf_op_forward_mode(void) +test_crypto_adapter_conf_new(void) { - enum rte_event_crypto_adapter_mode mode; + uint32_t evdev_service_id; + int ret; - mode = RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD; - TEST_ASSERT_SUCCESS(test_crypto_adapter_conf(mode), - "Failed to config crypto adapter"); + if (!crypto_adapter_setup_done) { + ret = configure_event_crypto_adapter( + RTE_EVENT_CRYPTO_ADAPTER_OP_NEW); + TEST_ASSERT_SUCCESS(ret, "Failed to config crypto adapter"); + crypto_adapter_setup_done = 1; + } + + /* retrieve service ids */ + if (rte_event_dev_service_id_get(evdev, &evdev_service_id) == 0) { + /* add a service core and start it */ + TEST_ASSERT_SUCCESS(rte_service_lcore_add(slcore_id), + "Failed to add service core"); + TEST_ASSERT_SUCCESS(rte_service_lcore_start(slcore_id), + "Failed to start service core"); + + /* map services to it */ + TEST_ASSERT_SUCCESS(rte_service_map_lcore_set(evdev_service_id, + slcore_id, 1), "Failed to map evdev service"); + + /* set services to running */ + TEST_ASSERT_SUCCESS(rte_service_runstate_set(evdev_service_id, + 1), "Failed to start evdev service"); + } + + /* start the eventdev */ + TEST_ASSERT_SUCCESS(rte_event_dev_start(evdev), + "Failed to start event device"); return TEST_SUCCESS; } static int -test_crypto_adapter_conf_op_new_mode(void) +test_crypto_adapter_conf_op_forward_mode(void) { - enum rte_event_crypto_adapter_mode mode; + TEST_ASSERT_SUCCESS(test_crypto_adapter_conf(), + "Failed to config crypto adapter"); + return TEST_SUCCESS; +} - mode = RTE_EVENT_CRYPTO_ADAPTER_OP_NEW; - TEST_ASSERT_SUCCESS(test_crypto_adapter_conf(mode), +static int +test_crypto_adapter_conf_op_new_mode(void) +{ + TEST_ASSERT_SUCCESS(test_crypto_adapter_conf_new(), "Failed to config crypto adapter"); return TEST_SUCCESS; @@ -957,7 +1005,7 @@ static struct unit_test_suite functional_testsuite = { test_session_with_op_forward_mode), TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode, - test_crypto_adapter_stop, + test_crypto_adapter_clear, test_sessionless_with_op_forward_mode), TEST_CASE_ST(test_crypto_adapter_conf_op_new_mode, @@ -965,7 +1013,7 @@ static struct unit_test_suite functional_testsuite = { test_session_with_op_new_mode), TEST_CASE_ST(test_crypto_adapter_conf_op_new_mode, - test_crypto_adapter_stop, + test_crypto_adapter_clear, test_sessionless_with_op_new_mode), TEST_CASES_END() /**< NULL terminate unit test array */