DPDK patches and discussions
 help / color / mirror / Atom feed
From: <alok.makhariya@nxp.com>
To: <dev@dpdk.org>
Cc: <pablo.de.lara.guarch@intel.com>, <hemant.agrawal@nxp.com>,
	Alok Makhariya <alok.makhariya@nxp.com>
Subject: [dpdk-dev] [PATCH v2 2/2] crypto/dpaa_sec: add support for out of place buffers
Date: Mon, 23 Oct 2017 01:05:51 +0530	[thread overview]
Message-ID: <20171022193551.953-2-alok.makhariya@nxp.com> (raw)
In-Reply-To: <20171022193551.953-1-alok.makhariya@nxp.com>

From: Alok Makhariya <alok.makhariya@nxp.com>

Enable out of place buffer test cases in dpaa_sec

Signed-off-by: Alok Makhariya <alok.makhariya@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
---
changes in v2:
corrected compilation issues in test

 drivers/crypto/dpaa_sec/dpaa_sec.c          | 46 ++++++++++++++++++-----------
 test/test/test_cryptodev.c                  |  6 ++++
 test/test/test_cryptodev_aes_test_vectors.h | 12 +++++---
 test/test/test_cryptodev_des_test_vectors.h |  6 ++--
 4 files changed, 47 insertions(+), 23 deletions(-)

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 53f004e..26a29a4 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -623,11 +623,10 @@ static inline struct dpaa_sec_job *
 build_cipher_only(struct rte_crypto_op *op, dpaa_sec_session *ses)
 {
 	struct rte_crypto_sym_op *sym = op->sym;
-	struct rte_mbuf *mbuf = sym->m_src;
 	struct dpaa_sec_job *cf;
 	struct dpaa_sec_op_ctx *ctx;
 	struct qm_sg_entry *sg;
-	phys_addr_t start_addr;
+	phys_addr_t src_start_addr, dst_start_addr;
 	uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			ses->iv.offset);
 
@@ -637,11 +636,17 @@ build_cipher_only(struct rte_crypto_op *op, dpaa_sec_session *ses)
 
 	cf = &ctx->job;
 	ctx->op = op;
-	start_addr = rte_pktmbuf_mtophys(mbuf);
+
+	src_start_addr = rte_pktmbuf_mtophys(sym->m_src);
+
+	if (sym->m_dst)
+		dst_start_addr = rte_pktmbuf_mtophys(sym->m_dst);
+	else
+		dst_start_addr = src_start_addr;
 
 	/* output */
 	sg = &cf->sg[0];
-	qm_sg_entry_set64(sg, start_addr + sym->cipher.data.offset);
+	qm_sg_entry_set64(sg, dst_start_addr + sym->cipher.data.offset);
 	sg->length = sym->cipher.data.length + ses->iv.length;
 	cpu_to_hw_sg(sg);
 
@@ -661,7 +666,7 @@ build_cipher_only(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	cpu_to_hw_sg(sg);
 
 	sg++;
-	qm_sg_entry_set64(sg, start_addr + sym->cipher.data.offset);
+	qm_sg_entry_set64(sg, src_start_addr + sym->cipher.data.offset);
 	sg->length = sym->cipher.data.length;
 	sg->final = 1;
 	cpu_to_hw_sg(sg);
@@ -673,16 +678,20 @@ static inline struct dpaa_sec_job *
 build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses)
 {
 	struct rte_crypto_sym_op *sym = op->sym;
-	struct rte_mbuf *mbuf = sym->m_src;
 	struct dpaa_sec_job *cf;
 	struct dpaa_sec_op_ctx *ctx;
 	struct qm_sg_entry *sg;
-	phys_addr_t start_addr;
 	uint32_t length = 0;
+	phys_addr_t src_start_addr, dst_start_addr;
 	uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			ses->iv.offset);
 
-	start_addr = mbuf->buf_physaddr + mbuf->data_off;
+	src_start_addr = sym->m_src->buf_physaddr + sym->m_src->data_off;
+
+	if (sym->m_dst)
+		dst_start_addr = sym->m_dst->buf_physaddr + sym->m_dst->data_off;
+	else
+		dst_start_addr = src_start_addr;
 
 	ctx = dpaa_sec_alloc_ctx(ses);
 	if (!ctx)
@@ -710,7 +719,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses)
 			cpu_to_hw_sg(sg);
 			sg++;
 		}
-		qm_sg_entry_set64(sg, start_addr + sym->aead.data.offset);
+		qm_sg_entry_set64(sg, src_start_addr + sym->aead.data.offset);
 		sg->length = sym->aead.data.length;
 		length += sg->length;
 		sg->final = 1;
@@ -730,7 +739,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses)
 			cpu_to_hw_sg(sg);
 			sg++;
 		}
-		qm_sg_entry_set64(sg, start_addr + sym->aead.data.offset);
+		qm_sg_entry_set64(sg, src_start_addr + sym->aead.data.offset);
 		sg->length = sym->aead.data.length;
 		length += sg->length;
 		cpu_to_hw_sg(sg);
@@ -755,7 +764,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	sg++;
 	qm_sg_entry_set64(&cf->sg[0], dpaa_mem_vtop(sg));
 	qm_sg_entry_set64(sg,
-		start_addr + sym->aead.data.offset - ses->auth_only_len);
+		dst_start_addr + sym->aead.data.offset - ses->auth_only_len);
 	sg->length = sym->aead.data.length + ses->auth_only_len;
 	length = sg->length;
 	if (is_encode(ses)) {
@@ -781,16 +790,19 @@ static inline struct dpaa_sec_job *
 build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses)
 {
 	struct rte_crypto_sym_op *sym = op->sym;
-	struct rte_mbuf *mbuf = sym->m_src;
 	struct dpaa_sec_job *cf;
 	struct dpaa_sec_op_ctx *ctx;
 	struct qm_sg_entry *sg;
-	phys_addr_t start_addr;
+	phys_addr_t src_start_addr, dst_start_addr;
 	uint32_t length = 0;
 	uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			ses->iv.offset);
 
-	start_addr = mbuf->buf_physaddr + mbuf->data_off;
+	src_start_addr = sym->m_src->buf_physaddr + sym->m_src->data_off;
+	if (sym->m_dst)
+		dst_start_addr = sym->m_dst->buf_physaddr + sym->m_dst->data_off;
+	else
+		dst_start_addr = src_start_addr;
 
 	ctx = dpaa_sec_alloc_ctx(ses);
 	if (!ctx)
@@ -810,7 +822,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses)
 		cpu_to_hw_sg(sg);
 
 		sg++;
-		qm_sg_entry_set64(sg, start_addr + sym->auth.data.offset);
+		qm_sg_entry_set64(sg, src_start_addr + sym->auth.data.offset);
 		sg->length = sym->auth.data.length;
 		length += sg->length;
 		sg->final = 1;
@@ -823,7 +835,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses)
 
 		sg++;
 
-		qm_sg_entry_set64(sg, start_addr + sym->auth.data.offset);
+		qm_sg_entry_set64(sg, src_start_addr + sym->auth.data.offset);
 		sg->length = sym->auth.data.length;
 		length += sg->length;
 		cpu_to_hw_sg(sg);
@@ -847,7 +859,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	/* output */
 	sg++;
 	qm_sg_entry_set64(&cf->sg[0], dpaa_mem_vtop(sg));
-	qm_sg_entry_set64(sg, start_addr + sym->cipher.data.offset);
+	qm_sg_entry_set64(sg, dst_start_addr + sym->cipher.data.offset);
 	sg->length = sym->cipher.data.length;
 	length = sg->length;
 	if (is_encode(ses)) {
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index cb9b486..72988c5 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -9370,6 +9370,12 @@ static struct unit_test_suite cryptodev_dpaa_sec_testsuite  = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GCM_auth_decryption_test_case_256_7),
 
+		/** Out of place tests */
+		TEST_CASE_ST(ut_setup, ut_teardown,
+			test_AES_GCM_authenticated_encryption_oop_test_case_1),
+		TEST_CASE_ST(ut_setup, ut_teardown,
+			test_AES_GCM_authenticated_decryption_oop_test_case_1),
+
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
diff --git a/test/test/test_cryptodev_aes_test_vectors.h b/test/test/test_cryptodev_aes_test_vectors.h
index 050d868..9c13041 100644
--- a/test/test/test_cryptodev_aes_test_vectors.h
+++ b/test/test/test_cryptodev_aes_test_vectors.h
@@ -1446,7 +1446,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 |
 			BLOCKCIPHER_TEST_TARGET_PMD_QAT |
 			BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
 	},
 	{
 		.test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
@@ -1457,7 +1458,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 |
 			BLOCKCIPHER_TEST_TARGET_PMD_QAT |
 			BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
 	},
 	{
 		.test_descr = "AES-128-CBC HMAC-SHA224 Encryption Digest",
@@ -1614,7 +1616,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
 		.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
 	},
 	{
 		.test_descr = "AES-256-CBC OOP Decryption",
@@ -1623,7 +1626,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
 		.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
 	},
 	{
 		.test_descr = "AES-128-CTR Encryption",
diff --git a/test/test/test_cryptodev_des_test_vectors.h b/test/test/test_cryptodev_des_test_vectors.h
index 0602df7..d09e23d 100644
--- a/test/test/test_cryptodev_des_test_vectors.h
+++ b/test/test/test_cryptodev_des_test_vectors.h
@@ -1188,7 +1188,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 		.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
 	},
 	{
 		.test_descr = "3DES-128-CBC HMAC-SHA1 Decryption Digest"
@@ -1198,7 +1199,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 		.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+			BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
 	},
 	{
 		.test_descr = "3DES-128-CBC HMAC-SHA1 Encryption Digest"
-- 
2.9.3

  reply	other threads:[~2017-10-22 19:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 13:07 [dpdk-dev] [PATCH] crypto/dpaa_sec: add check for segmented buffer alok.makhariya
2017-10-12 13:07 ` [dpdk-dev] [PATCH] crypto/dpaa2_sec: " alok.makhariya
2017-10-13 15:38   ` [dpdk-dev] [PATCH v2] " alok.makhariya
2017-10-13 15:44     ` Akhil Goyal
2017-10-16 14:06       ` De Lara Guarch, Pablo
2017-10-12 13:07 ` [dpdk-dev] [PATCH] crypto/dpaa_sec: remove memset of icv on decryption side alok.makhariya
2017-10-13 14:22   ` Akhil Goyal
2017-10-16 11:21     ` De Lara Guarch, Pablo
2017-10-12 13:07 ` [dpdk-dev] [PATCH] crypto/dpaa2_sec: " alok.makhariya
2017-10-13 14:24   ` Akhil Goyal
2017-10-16 11:21     ` De Lara Guarch, Pablo
2017-10-12 13:07 ` [dpdk-dev] [PATCH] crypto/dpaa2_sec: add support for out of place buffers alok.makhariya
2017-10-13 14:25   ` Akhil Goyal
2017-10-16 11:32     ` De Lara Guarch, Pablo
2017-10-16 14:29       ` De Lara Guarch, Pablo
2017-10-22 19:35   ` [dpdk-dev] [PATCH v2 1/2] " alok.makhariya
2017-10-22 19:35     ` alok.makhariya [this message]
2017-10-23  8:36     ` De Lara Guarch, Pablo
2017-10-12 13:07 ` [dpdk-dev] [PATCH] crypto/dpaa_sec: " alok.makhariya
2017-10-13 14:25   ` Akhil Goyal
2017-10-16 11:33     ` De Lara Guarch, Pablo
2017-10-13 14:43 ` [dpdk-dev] [PATCH] crypto/dpaa_sec: add check for segmented buffer Akhil Goyal
2017-10-13 15:37 ` [dpdk-dev] [PATCH v2] " alok.makhariya
2017-10-13 15:45   ` Akhil Goyal
2017-10-16 14:07     ` De Lara Guarch, Pablo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171022193551.953-2-alok.makhariya@nxp.com \
    --to=alok.makhariya@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=pablo.de.lara.guarch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).