[dpdk-stable] patch 'test/crypto: fix max length for raw data path' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:31:52 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/1ce38454223d075dc9ad3ca64b18e337db92e07f

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 1ce38454223d075dc9ad3ca64b18e337db92e07f Mon Sep 17 00:00:00 2001
From: Kai Ji <kai.ji at intel.com>
Date: Fri, 8 Oct 2021 12:33:45 +0100
Subject: [PATCH] test/crypto: fix max length for raw data path
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 6d4c594e46529b6243f851b3a5e682b88829f3b3 ]

Update the calculation of the max length needed when converting mbuf to
data vec in partial digest test case. This update make sure the enough
vec buffers are allocated for the appended digest in sgl op for raw
datapath api.

Fixes: 4868f6591c6f ("test/crypto: add cases for raw datapath API")

Signed-off-by: Kai Ji <kai.ji at intel.com>
Acked-by: Akhil Goyal <gakhil at marvell.com>
---
 app/test/test_cryptodev.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index dd2b035b77..4772eea30c 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -178,6 +178,10 @@ post_process_raw_dp_op(void *user_data,	uint32_t index __rte_unused,
 			RTE_CRYPTO_OP_STATUS_ERROR;
 }
 
+static struct crypto_testsuite_params testsuite_params = { NULL };
+struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;
+static struct crypto_unittest_params unittest_params;
+
 void
 process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 		struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth,
@@ -192,6 +196,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 	struct rte_crypto_sgl sgl;
 	uint32_t max_len;
 	union rte_cryptodev_session_ctx sess;
+	uint64_t auth_end_iova;
 	uint32_t count = 0;
 	struct rte_crypto_raw_dp_ctx *ctx;
 	uint32_t cipher_offset = 0, cipher_len = 0, auth_offset = 0,
@@ -201,6 +206,8 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 	int ctx_service_size;
 	int32_t status = 0;
 	int enqueue_status, dequeue_status;
+	struct crypto_unittest_params *ut_params = &unittest_params;
+	int is_sgl = sop->m_src->nb_segs > 1;
 
 	ctx_service_size = rte_cryptodev_get_raw_dp_ctx_size(dev_id);
 	if (ctx_service_size < 0) {
@@ -266,6 +273,28 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 		digest.va = (void *)sop->auth.digest.data;
 		digest.iova = sop->auth.digest.phys_addr;
 
+		if (is_sgl) {
+			uint32_t remaining_off = auth_offset + auth_len;
+			struct rte_mbuf *sgl_buf = sop->m_src;
+
+			while (remaining_off >= rte_pktmbuf_data_len(sgl_buf)
+					&& sgl_buf->next != NULL) {
+				remaining_off -= rte_pktmbuf_data_len(sgl_buf);
+				sgl_buf = sgl_buf->next;
+			}
+
+			auth_end_iova = (uint64_t)rte_pktmbuf_iova_offset(
+				sgl_buf, remaining_off);
+		} else {
+			auth_end_iova = rte_pktmbuf_iova(op->sym->m_src) +
+							 auth_offset + auth_len;
+		}
+		/* Then check if digest-encrypted conditions are met */
+		if ((auth_offset + auth_len < cipher_offset + cipher_len) &&
+				(digest.iova == auth_end_iova) && is_sgl)
+			max_len = RTE_MAX(max_len, auth_offset + auth_len +
+				ut_params->auth_xform.auth.digest_length);
+
 	} else if (is_cipher) {
 		cipher_offset = sop->cipher.data.offset;
 		cipher_len = sop->cipher.data.length;
@@ -488,9 +517,6 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
 	return op;
 }
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
-static struct crypto_unittest_params unittest_params;
-
 static int
 testsuite_setup(void)
 {
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:11.958440160 +0800
+++ 0228-test-crypto-fix-max-length-for-raw-data-path.patch	2021-11-10 14:17:02.060744536 +0800
@@ -1 +1 @@
-From 6d4c594e46529b6243f851b3a5e682b88829f3b3 Mon Sep 17 00:00:00 2001
+From 1ce38454223d075dc9ad3ca64b18e337db92e07f Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 6d4c594e46529b6243f851b3a5e682b88829f3b3 ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org
@@ -17,2 +19,2 @@
- app/test/test_cryptodev.c | 33 +++++++++++++++++++++++++++++----
- 1 file changed, 29 insertions(+), 4 deletions(-)
+ app/test/test_cryptodev.c | 32 +++++++++++++++++++++++++++++---
+ 1 file changed, 29 insertions(+), 3 deletions(-)
@@ -21 +23 @@
-index 814a0b401d..f5f82abbd7 100644
+index dd2b035b77..4772eea30c 100644
@@ -24 +26 @@
-@@ -179,6 +179,10 @@ post_process_raw_dp_op(void *user_data,	uint32_t index __rte_unused,
+@@ -178,6 +178,10 @@ post_process_raw_dp_op(void *user_data,	uint32_t index __rte_unused,
@@ -35,2 +37,2 @@
-@@ -193,6 +197,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
- 	struct rte_crypto_sgl sgl, dest_sgl;
+@@ -192,6 +196,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
+ 	struct rte_crypto_sgl sgl;
@@ -43 +45 @@
-@@ -202,6 +207,8 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
+@@ -201,6 +206,8 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
@@ -52 +54 @@
-@@ -267,6 +274,28 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
+@@ -266,6 +273,28 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
@@ -81 +83 @@
-@@ -503,10 +532,6 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
+@@ -488,9 +517,6 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
@@ -86 +87,0 @@
--struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;


More information about the stable mailing list