Skip to contentSkip to conversation

test/event_crypto: fix missing IV value for AES algo

PATCH Superseded Hemant Agrawal 3 participants 19 messages Oct 1, 2019 – Nov 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 test/event_crypto: fix missing IV value for AES algo

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")

---
Please squash if possible.

 app/test/test_event_crypto_adapter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
app/test/test_event_crypto_adapter.c +12 -0
index 652e458f0..bf83a6357 100644
@@ -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");
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/6 test/event_crypto: fix check for HW support

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")

---
please squash if possible.

 app/test/test_event_crypto_adapter.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
app/test/test_event_crypto_adapter.c +16 -0
index bf83a6357..d3d19b98e 100644
@@ -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");
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/6 test/event_crypto: fix to avail the mempool entries

In reply to Hemant Agrawal

Added the missed code to avail the mempool entries before pool free.

Fixes 24054e3640a2 ("test/crypto: use separate session mempools");

---
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(+)
app/test/test_event_crypto_adapter.c +1 -0
index d3d19b98e..8d42462d8 100644
@@ -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;
 	}
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/6 test/event_crypto: support to release the atomic ctxt

In reply to Hemant Agrawal

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.

---
 app/test/test_event_crypto_adapter.c | 6 ++++++
 1 file changed, 6 insertions(+)
app/test/test_event_crypto_adapter.c +6 -0
index 8d42462d8..b9e3a439e 100644
@@ -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));
Signature · 1 line
2.17.1
#4 lore raw

PATCH 5/6 test/event_crypto: use device cap instead of fixed values

In reply to Hemant Agrawal

Instead of hardcoded event device capabilities, it is better to enquire and use the device supported caps.

---
 app/test/test_event_crypto_adapter.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
app/test/test_event_crypto_adapter.c +8 -11
index b9e3a439e..6b10909e3 100644
@@ -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,
Signature · 1 line
2.17.1
#5 lore raw

PATCH 6/6 test/event_crypto: separate the NEW and FWD mode inits

In reply to Hemant Agrawal

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.

---
 app/test/test_event_crypto_adapter.c | 78 ++++++++++++++++++++++------
 1 file changed, 63 insertions(+), 15 deletions(-)
app/test/test_event_crypto_adapter.c +63 -15
index 6b10909e3..e396358f2 100644
@@ -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 */
Signature · 1 line
2.17.1
#6 lore raw
In reply to Hemant Agrawal
Quoted 7 lines · Hemant Agrawal

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")

Abhinandan,

Could you please review the crypto adapter fixes, I would like to pull this for RC1 if possible.

Quoted 53 lines

---
Please squash if possible.

 app/test/test_event_crypto_adapter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
app/test/test_event_crypto_adapter.c +12 -1
index 652e458f0..bf83a6357 100644
@@ -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");
--

2.17.1

#7 lore raw

Sure Jerin.

Regards
Abhinandan

Quoted 78 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Thursday, October 3, 2019 8:54 AM
To: Hemant Agrawal <[email protected]>
Cc: dpdk-dev <[email protected]>; Jerin Jacob <[email protected]>; Gujjar, Abhinandan S <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/6] test/event_crypto: fix missing IV value for AES algo

Quoted 6 lines · Hemant Agrawal

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")

Abhinandan,

Could you please review the crypto adapter fixes, I would like to pull this for RC1 if possible.

Quoted 54 lines

---
Please squash if possible.

 app/test/test_event_crypto_adapter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
app/test/test_event_crypto_adapter.c +12 -1
index 652e458f0..bf83a6357 100644
@@ -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");
--

2.17.1

#8 lore raw
In reply to Hemant Agrawal

Hi Hemanth,

I tried to test the series of patches on test with SW adapter.
Looks like, test hangs after 3rd case!
Not sure, if I am missing any params to be passed to the app or anything else has to be done.

+ ------------------------------------------------------- +
+ TestCase [ 0] : test_crypto_adapter_create succeeded
+ TestCase [ 1] : test_crypto_adapter_qp_add_del succeeded
+------------------------------------------------------+
+ Crypto adapter stats for instance 0:

 + Event port poll count          0
 + Event dequeue count            0
 + Cryptodev enqueue count        0
 + Cryptodev enqueue failed count 0
 + Cryptodev dequeue count        0
 + Event enqueue count            0
 + Event enqueue retry count      0
 + Event enqueue fail count       0

+------------------------------------------------------+
+ TestCase [ 2] : test_crypto_adapter_stats succeeded

Quoted 65 lines

-----Original Message-----
From: Hemant Agrawal <[email protected]>
Sent: Tuesday, October 1, 2019 5:04 PM
To: [email protected]
Cc: [email protected]; Gujjar, Abhinandan S <[email protected]>
Subject: [PATCH 1/6] test/event_crypto: fix missing IV value for AES algo

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")

---
Please squash if possible.

 app/test/test_event_crypto_adapter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
app/test/test_event_crypto_adapter.c +12 -1
index 652e458f0..bf83a6357 100644
@@ -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");
--

2.17.1

#9 lore raw
Quoted 6 lines · Abhinandan S

Hi Hemanth,

I tried to test the series of patches on test with SW adapter.
Looks like, test hangs after 3rd case!
Not sure, if I am missing any params to be passed to the app or anything else has to be done.

Waiting for your reply to review further and apply to the next-eventdev tree(after getting the ack from Abhinandan)

Quoted 17 lines

+ ------------------------------------------------------- +
+ TestCase [ 0] : test_crypto_adapter_create succeeded
+ TestCase [ 1] : test_crypto_adapter_qp_add_del succeeded
+------------------------------------------------------+
+ Crypto adapter stats for instance 0:

 + Event port poll count          0
 + Event dequeue count            0
 + Cryptodev enqueue count        0
 + Cryptodev enqueue failed count 0
 + Cryptodev dequeue count        0
 + Event enqueue count            0
 + Event enqueue retry count      0
 + Event enqueue fail count       0

+------------------------------------------------------+
+ TestCase [ 2] : test_crypto_adapter_stats succeeded

#10 lore raw
In reply to Gujjar, Abhinandan S

Hi Abhinandan,

Quoted 8 lines

-----Original Message-----
From: Gujjar, Abhinandan S <[email protected]>
Sent: Friday, October 4, 2019 3:06 PM
To: Hemant Agrawal <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH 1/6] test/event_crypto: fix missing IV value for AES algo
Importance: High

Quoted 6 lines

Hi Hemanth,

I tried to test the series of patches on test with SW adapter. Looks like, test hangs after 3rd case!
Not sure, if I am missing any params to be passed to the app or anything else has to be done.

[Hemant] OK, let me split this series into 2.
I will send the restructuring patch separately post rework. Most likely that patch is causing hang on x86.

Quoted 85 lines

+ ------------------------------------------------------- +
+ TestCase [ 0] : test_crypto_adapter_create succeeded + TestCase [ 1] :
test_crypto_adapter_qp_add_del succeeded +-----------------------------------
-------------------+
+ Crypto adapter stats for instance 0:

 + Event port poll count          0
 + Event dequeue count            0
 + Cryptodev enqueue count        0
 + Cryptodev enqueue failed count 0
 + Cryptodev dequeue count        0
 + Event enqueue count            0
 + Event enqueue retry count      0
 + Event enqueue fail count       0

+------------------------------------------------------+
+ TestCase [ 2] : test_crypto_adapter_stats succeeded

Quoted 67 lines

-----Original Message-----
From: Hemant Agrawal <[email protected]>
Sent: Tuesday, October 1, 2019 5:04 PM
To: [email protected]
Cc: [email protected]; Gujjar, Abhinandan S <[email protected]>
Subject: [PATCH 1/6] test/event_crypto: fix missing IV value for AES algo

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")

---
Please squash if possible.

 app/test/test_event_crypto_adapter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
app/test/test_event_crypto_adapter.c +12 -1
index 652e458f0..bf83a6357 100644
@@ -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");
--

2.17.1

#11 lore raw

PATCH v2 1/3 test/event_crypto: fix missing IV value for AES algo

In reply to Hemant Agrawal

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")

---
Sending only the fixes. dropped the functional changes

 app/test/test_event_crypto_adapter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
app/test/test_event_crypto_adapter.c +12 -0
index 652e458f0..bf83a6357 100644
@@ -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");
Signature · 1 line
2.17.1
#12 lore raw

PATCH v2 2/3 test/event_crypto: fix to avail the mempool entries

Added the missed code to avail the mempool entries before pool free.

Fixes 24054e3640a2 ("test/crypto: use separate session mempools");
---
 app/test/test_event_crypto_adapter.c | 1 +
 1 file changed, 1 insertion(+)
app/test/test_event_crypto_adapter.c +1 -0
index bf83a6357..6b47a5c01 100644
@@ -889,6 +889,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;
 	}
Signature · 1 line
2.17.1
#13 lore raw

PATCH v2 3/3 test/event_crypto: fix check for HW support

In reply to Hemant Agrawal

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")
---
 app/test/test_event_crypto_adapter.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
app/test/test_event_crypto_adapter.c +16 -0
index 6b47a5c01..8d42462d8 100644
@@ -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");
Signature · 1 line
2.17.1
#15 lore raw

Hi Jerin,

Last week, I was on vacation. So, could not review it. I will try to finish this by tomorrow.

Regards
Abhinandan

Quoted 23 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, November 18, 2019 9:30 PM
To: Hemant Agrawal <[email protected]>
Cc: dpdk-dev <[email protected]>; Gujjar, Abhinandan S <[email protected]>
Subject: Re: [PATCH v2 1/3] test/event_crypto: fix missing IV value for AES algo

Quoted 8 lines · Hemant Agrawal

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")

---
Sending only the fixes. dropped the functional changes

Hi Abhinandan,

Can I merge this patch series?

Acked-by on v2 1/3
#16 lore raw
In reply to Hemant Agrawal

For series:

I noticed that these patches have issue with "Intel-compilation". Hope, it will be taken care before merging.

Quoted 66 lines

-----Original Message-----
From: Hemant Agrawal <[email protected]>
Sent: Thursday, November 7, 2019 2:31 PM
To: [email protected]
Cc: [email protected]; Gujjar, Abhinandan S <[email protected]>
Subject: [PATCH v2 1/3] test/event_crypto: fix missing IV value for AES algo

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")

---
Sending only the fixes. dropped the functional changes

 app/test/test_event_crypto_adapter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
app/test/test_event_crypto_adapter.c +12 -1
index 652e458f0..bf83a6357 100644
@@ -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");
--

2.17.1

#17 lore raw
In reply to Hemant Agrawal
Quoted 9 lines · Hemant Agrawal

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")

---
Sending only the fixes. dropped the functional changes

Could you fix the following check-git-log.sh errors and send the v3. I can pull the v3 for rc3.

Wrong 'Fixes' reference:

Fixes ce02103ad072 ("test/event_crypto: change the SEC cipher algo")
Fixes 24054e3640a2 ("test/crypto: use separate session mempools");
Fixes cfe599b325e8 ("test/event_crypto: no service core when

HW support available")

Acked-by Abhinandan Gujjar
#18 lore raw
Quoted 13 lines · Jerin Jacob
Quoted 9 lines · Hemant Agrawal

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")

---
Sending only the fixes. dropped the functional changes

Quoted 8 lines

Could you fix the following check-git-log.sh errors and send the v3. I can pull the v3 for rc3.

Wrong 'Fixes' reference:

Fixes ce02103ad072 ("test/event_crypto: change the SEC cipher algo")
Fixes 24054e3640a2 ("test/crypto: use separate session mempools");
Fixes cfe599b325e8 ("test/event_crypto: no service core when

HW support available")

Fixed the wrong references.

Series applied to dpdk-next-eventdev/master. Thanks.