Skip to contentSkip to conversation

armv8 crypto PMD

PATCH In review Ruifeng Wang 3 participants 6 messages Aug 31, 2020 – Oct 8, 2020 Crypto API

lore
Share & tools
lore
#0 lore raw

cover armv8 crypto PMD

This patch set migrates armv8 crypto PMD unit test from device specific test suite to common crypto dev test suite. Fixed couple of issues found during the migration.

Ruifeng Wang (3):
test/crypto: fix stat test
crypto/armv8: fix mempool object returning
crypto/armv8: move to cryptodev test suite

 app/test/test_cryptodev.c            | 21 +--------------------
 drivers/crypto/armv8/rte_armv8_pmd.c |  4 ++--
 2 files changed, 3 insertions(+), 22 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 test/crypto: fix stat test

ut_setup / ut_teardown are invoked for each test case by test framework. The call inside test_stats is unnecessary and even incorrect. This caused double free of objects such as crypto operation structure. Trapped the issue when RTE_LIBRTE_MEMPOOL_DEBUG was enabled. Fix issue by removing ut_setup / ut_teardown from test case implementation.

Fixes 202d375c60bc ("app/test: add cryptodev unit and performance tests")
---
 app/test/test_cryptodev.c | 2 --
 1 file changed, 2 deletions(-)
app/test/test_cryptodev.c +0 -2
index 70bf6fe2c..068b8c9c1 100644
@@ -9326,9 +9326,7 @@ test_stats(void)
 		"rte_cryptodev_stats_get invalid Param failed");
 
 	/* Test expected values */
-	ut_setup();
 	test_AES_CBC_HMAC_SHA1_encrypt_digest();
-	ut_teardown();
 	TEST_ASSERT_SUCCESS(rte_cryptodev_stats_get(ts_params->valid_devs[0],
 			&stats),
 		"rte_cryptodev_stats_get failed");
Signature · 1 line
2.17.1
Tested-by on v1 1/3
#2 lore raw

Re: [dpdk-dev] [PATCH 1/3] test/crypto: fix stat test

Quoted 18 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Ruifeng Wang
Sent: Monday, 31 August, 2020 10:52
To: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; Griffin, John <[email protected]>; Des O Dea <[email protected]>; Sergio Gonzalez Monroy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Ruifeng Wang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 1/3] test/crypto: fix stat test

ut_setup / ut_teardown are invoked for each test case by test framework. The call inside test_stats is unnecessary and even incorrect. This caused double free of objects such as crypto operation structure. Trapped the issue when RTE_LIBRTE_MEMPOOL_DEBUG was enabled. Fix issue by removing ut_setup / ut_teardown from test case implementation.

Quoted 5 lines
Fixes 202d375c60bc ("app/test: add cryptodev unit and performance tests")
#3 lore raw

PATCH 2/3 crypto/armv8: fix mempool object returning

In reply to Ruifeng Wang

Crypto session and device session private data were put back to wrong pools.
This caused data corruption when the object was reallocated and used. Because objects from different mempools have different element size, and wrong mempool info caused out of bound write.
Fix the issue by putting back objects to correct mempools.

Fixes b3bbd9e5f265 ("cryptodev: support device independent sessions")
Fixes 725d2a7fbf71 ("cryptodev: change queue pair configure structure")
---
 drivers/crypto/armv8/rte_armv8_pmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/armv8/rte_armv8_pmd.c +2 -2
index c95729db5..72d29ae0c 100644
@@ -674,8 +674,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 		memset(op->sym->session, 0,
 			rte_cryptodev_sym_get_existing_header_session_size(
 				op->sym->session));
-		rte_mempool_put(qp->sess_mp, sess);
-		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
+		rte_mempool_put(qp->sess_mp_priv, sess);
+		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
 
Signature · 1 line
2.17.1
#4 lore raw

PATCH 3/3 crypto/armv8: move to cryptodev test suite

In reply to Ruifeng Wang

Switched from device specific test suite to unified cryptodev test suite. Removed the armv8 device specific test suite.

---
 app/test/test_cryptodev.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
app/test/test_cryptodev.c +1 -18
index 068b8c9c1..7cdf9587e 100644
@@ -12590,23 +12590,6 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite  = {
 	}
 };
 
-static struct unit_test_suite cryptodev_armv8_testsuite  = {
-	.suite_name = "Crypto Device ARMv8 Unit Test Suite",
-	.setup = testsuite_setup,
-	.teardown = testsuite_teardown,
-	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-
-		/** Negative tests */
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
-
-		TEST_CASES_END() /**< NULL terminate unit test array */
-	}
-};
-
 static struct unit_test_suite cryptodev_mrvl_testsuite  = {
 	.suite_name = "Crypto Device Marvell Component Test Suite",
 	.setup = testsuite_setup,
@@ -12882,7 +12865,7 @@ test_cryptodev_armv8(void)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_armv8_testsuite);
+	return unit_test_suite_runner(&cryptodev_testsuite);
 }
 
 static int
Signature · 1 line
2.17.1
#5 lore raw
In reply to Ruifeng Wang
Quoted 4 lines

This patch set migrates armv8 crypto PMD unit test from device specific test suite to common crypto dev test suite. Fixed couple of issues found during the migration.

Quoted 8 lines

Ruifeng Wang (3):
test/crypto: fix stat test
crypto/armv8: fix mempool object returning
crypto/armv8: move to cryptodev test suite

 app/test/test_cryptodev.c            | 21 +--------------------
 drivers/crypto/armv8/rte_armv8_pmd.c |  4 ++--
 2 files changed, 3 insertions(+), 22 deletions(-)

Series Acked and Applied to dpdk-next-crypto

Thanks.