Skip to contentSkip to conversation

test/crypto: maxlen calculation update

PATCH Superseded Kai Ji 3 participants 11 messages Sep 29, 2021 – Oct 31, 2021

lore
Share & tools
lore

Kai Ji

author
#0 lore raw

PATCH 1/1 test/crypto: maxlen calculation update

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 QAT raw datapath api.

Fixes 4868f6591c6f ("test/crypto: add cases for raw datapath API")
---
 app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
app/test/test_cryptodev.c +31 -4
index 16d770a17f..ea46911648 100644
@@ -167,6 +167,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,
@@ -181,6 +185,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,
@@ -190,6 +195,9 @@ 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;
+	/* oop is not supported in raw hw dp api*/
+	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) {
@@ -255,6 +263,29 @@ 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 {
+			/* oop is not supported in raw hw dp api */
+			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;
@@ -477,10 +508,6 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
 	return op;
 }
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
-struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;
-static struct crypto_unittest_params unittest_params;
-
 static int
 testsuite_setup(void)
 {
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 test/crypto: maxlen calculation update

CCing to [email protected]

Quoted 107 lines

-----Original Message-----
From: Ji, Kai <[email protected]>
Sent: Wednesday, September 29, 2021 4:38 PM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; Ji, Kai <[email protected]>
Subject: [dpdk-dev v1] test/crypto: maxlen calculation update

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 QAT raw datapath api.

Fixes 4868f6591c6f ("test/crypto: add cases for raw datapath API")
---
 app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
app/test/test_cryptodev.c +4 -0
index 16d770a17f..ea46911648 100644
@@ -167,6 +167,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,
app/test/test_cryptodev.c +1 -0
 		struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth,
@@ -181,6 +185,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;
app/test/test_cryptodev.c +3 -0
 	uint32_t cipher_offset = 0, cipher_len = 0, auth_offset = 0,
@@ -190,6 +195,9 @@ 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;
+	/* oop is not supported in raw hw dp api*/
+	int is_sgl = sop->m_src->nb_segs > 1;
 
 	ctx_service_size = rte_cryptodev_get_raw_dp_ctx_size(dev_id);
app/test/test_cryptodev.c +11 -0
 	if (ctx_service_size < 0) {
@@ -255,6 +263,29 @@ 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(

app/test/test_cryptodev.c +4 -0
+				sgl_buf, remaining_off);
+		} else {
+			/* oop is not supported in raw hw dp api */
+			auth_end_iova = rte_pktmbuf_iova(op->sym-
Quoted 1 line

m_src) +

app/test/test_cryptodev.c +1 -0
+							 auth_offset +

auth_len;

app/test/test_cryptodev.c +5 -0
+		}
+		/* 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 +

app/test/test_cryptodev.c +2 -4
+				ut_params->auth_xform.auth.digest_length);
+
 	} else if (is_cipher) {
 		cipher_offset = sop->cipher.data.offset;
 		cipher_len = sop->cipher.data.length;
@@ -477,10 +508,6 @@ process_crypto_request(uint8_t dev_id, struct
 rte_crypto_op *op)
 	return op;
 }
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
-struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;
-static struct crypto_unittest_params unittest_params;
-
 static int
 testsuite_setup(void)

{
--
2.17.1

#2 lore raw
In reply to Kai Ji
Quoted 39 lines

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 QAT raw datapath api.

Fixes 4868f6591c6f ("test/crypto: add cases for raw datapath API")
---
 app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
app/test/test_cryptodev.c +4 -0
index 16d770a17f..ea46911648 100644
@@ -167,6 +167,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,
app/test/test_cryptodev.c +1 -0
 		struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth,
@@ -181,6 +185,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;
app/test/test_cryptodev.c +0 -0
 	uint32_t cipher_offset = 0, cipher_len = 0, auth_offset = 0,

app/test/test_cryptodev.c process_sym_raw_dp_op(uint8_t dev_id, uint16_t · line 201

Quoted 7 lines
app/test/test_cryptodev.c +3 -0
@@ -190,6 +195,9 @@ 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;
+	/* oop is not supported in raw hw dp api*/
+	int is_sgl = sop->m_src->nb_segs > 1;

There is a patch series pending to be merged which support oop in raw dp api. Can we sync this patch based on that?
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Quoted 53 lines
app/test/test_cryptodev.c +17 -0
 	ctx_service_size = rte_cryptodev_get_raw_dp_ctx_size(dev_id);
 	if (ctx_service_size < 0) {
@@ -255,6 +263,29 @@ 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 {
+			/* oop is not supported in raw hw dp api */
+			auth_end_iova = rte_pktmbuf_iova(op->sym->m_src)
+
+							 auth_offset +

auth_len;

app/test/test_cryptodev.c +5 -0
+		}
+		/* 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 +

app/test/test_cryptodev.c +2 -4
+				ut_params->auth_xform.auth.digest_length);
+
 	} else if (is_cipher) {
 		cipher_offset = sop->cipher.data.offset;
 		cipher_len = sop->cipher.data.length;
@@ -477,10 +508,6 @@ process_crypto_request(uint8_t dev_id, struct
 rte_crypto_op *op)
 	return op;
 }
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
-struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;
-static struct crypto_unittest_params unittest_params;
-
 static int
 testsuite_setup(void)

{
--
2.17.1

#3 lore raw

Hi Akhil and Hemant,

This is a generic problem to raw_api applies either with dst_buf added or not.

The idea is for SGL test when Wireless algo digest encrypted case is tested and RTE_MAX(cipher_off + cipher len, auth_off + auth_len) is smaller than RTE_MAX(cipher_off + cipher len, auth_off + auth_len + digest_len), the original code will not add digest data SGL info into rte_crypto_sgl, leave alone the 4-byte digest is split into 2 2-byte segments.

This patch only try to address the problem and as far as I can see from the patch
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
the problem is not touched.

Regards,
Fan

Quoted 119 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 1:47 PM
To: Ji, Kai <[email protected]>; [email protected]
Cc: Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]
Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update

Quoted 11 lines

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 QAT raw datapath api.

Fixes 4868f6591c6f ("test/crypto: add cases for raw datapath API")
---
 app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++---

-

app/test/test_cryptodev.c post_process_raw_dp_op(void *user_data, · line 172

Quoted 13 lines
 1 file changed, 31 insertions(+), 4 deletions(-)
app/test/test_cryptodev.c +2 -0
index 16d770a17f..ea46911648 100644
@@ -167,6 +167,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;

Quoted 15 lines
app/test/test_cryptodev.c +2 -0
+static struct crypto_unittest_params unittest_params;
+
 void
 process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
app/test/test_cryptodev.c +1 -0
 		struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth,
@@ -181,6 +185,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;
app/test/test_cryptodev.c +0 -0
 	uint32_t cipher_offset = 0, cipher_len = 0, auth_offset = 0,

app/test/test_cryptodev.c process_sym_raw_dp_op(uint8_t dev_id, uint16_t · line 201

Quoted 7 lines
app/test/test_cryptodev.c +3 -0
@@ -190,6 +195,9 @@ 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;
+	/* oop is not supported in raw hw dp api*/
+	int is_sgl = sop->m_src->nb_segs > 1;

There is a patch series pending to be merged which support oop in raw dp api. Can we sync this patch based on that?
https://patchwork.dpdk.org/project/dpdk/patch/20210907075957.28848-4-
[email protected]/

Quoted 11 lines
app/test/test_cryptodev.c +3 -0
 	ctx_service_size = rte_cryptodev_get_raw_dp_ctx_size(dev_id);
 	if (ctx_service_size < 0) {
@@ -255,6 +263,29 @@ 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;

app/test/test_cryptodev.c process_sym_raw_dp_op(uint8_t dev_id, uint16_t · line 279

Quoted 10 lines
app/test/test_cryptodev.c +8 -0
+
+			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(

Quoted 20 lines
app/test/test_cryptodev.c +4 -0
+				sgl_buf, remaining_off);
+		} else {
+			/* oop is not supported in raw hw dp api */
+			auth_end_iova = rte_pktmbuf_iova(op->sym-

m_src)

app/test/test_cryptodev.c +2 -0
+
+							 auth_offset +

auth_len;

app/test/test_cryptodev.c +5 -0
+		}
+		/* 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 +

app/test/test_cryptodev.c +2 -0
+				ut_params->auth_xform.auth.digest_length);
+
 	} else if (is_cipher) {
 		cipher_offset = sop->cipher.data.offset;
 		cipher_len = sop->cipher.data.length;

app/test/test_cryptodev.c process_crypto_request(uint8_t dev_id, struct · line 482

Quoted 6 lines
app/test/test_cryptodev.c +0 -2
@@ -477,10 +508,6 @@ process_crypto_request(uint8_t dev_id, struct
 rte_crypto_op *op)
 	return op;
 }
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
-struct crypto_testsuite_params *p_testsuite_params =

&testsuite_params;

Quoted 7 lines
app/test/test_cryptodev.c +0 -2
-static struct crypto_unittest_params unittest_params;
-
 static int
 testsuite_setup(void)

{
--
2.17.1

#4 lore raw

Hi Fan,

Quoted 5 lines

Hi Akhil and Hemant,

This is a generic problem to raw_api applies either with dst_buf added or not.

Quoted 9 lines

The idea is for SGL test when Wireless algo digest encrypted case is tested and
RTE_MAX(cipher_off + cipher len, auth_off + auth_len) is smaller than RTE_MAX(cipher_off + cipher len, auth_off + auth_len + digest_len), the original
code will not add digest data SGL info into rte_crypto_sgl, leave alone the 4- byte
digest is split into 2 2-byte segments.

There are comments in the patch
/* oop is not supported in raw hw dp api */

This is now supported in the patchset that I mentioned. So Can we update according to that?

#5 lore raw

Hi Akhil,

Sorry didn't catch you are mentioning this part - yes we have been preparing for adding oop support into qat for a while :-). Rebecca has already tested and acked the patchset. We are waiting for you merging them before rebasing.

Regards,
Fan

Quoted 32 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 3:00 PM
To: Zhang, Roy Fan <[email protected]>; Ji, Kai <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update

Hi Fan,

Quoted 11 lines

Hi Akhil and Hemant,

This is a generic problem to raw_api applies either with dst_buf added or not.

The idea is for SGL test when Wireless algo digest encrypted case is tested and
RTE_MAX(cipher_off + cipher len, auth_off + auth_len) is smaller than RTE_MAX(cipher_off + cipher len, auth_off + auth_len + digest_len), the original
code will not add digest data SGL info into rte_crypto_sgl, leave alone the

4-

Quoted 3 lines

byte
digest is split into 2 2-byte segments.

There are comments in the patch
/* oop is not supported in raw hw dp api */

This is now supported in the patchset that I mentioned. So Can we update according to that?

#6 lore raw
Quoted 5 lines

Sorry didn't catch you are mentioning this part - yes we have been preparing for adding oop support into qat for a while :-). Rebecca has already tested and
acked the patchset. We are waiting for you merging them before rebasing.

I am expecting a new patchset from Hemant to handle Konstantin's comments.

#7 lore raw

Thanks Akhil - again anything we can help please let us know.

Regards,
Fan

Quoted 17 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 4:20 PM
To: Zhang, Roy Fan <[email protected]>; Ji, Kai <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update

Quoted 1 line

Sorry didn't catch you are mentioning this part - yes we have been

preparing

Quoted 4 lines

for adding oop support into qat for a while :-). Rebecca has already tested and
acked the patchset. We are waiting for you merging them before rebasing.

I am expecting a new patchset from Hemant to handle Konstantin's comments.

author
#8 lore raw
In reply to Akhil Goyal

Hi Akhil,

I just update the v2: http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
This patch is a generic fix of test case for SGL op, I think there is no dependence with Hemant's patch.

Regards

Kai

Quoted 16 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 4:20 PM
To: Zhang, Roy Fan <[email protected]>; Ji, Kai <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update

Quoted 5 lines

Sorry didn't catch you are mentioning this part - yes we have been preparing for adding oop support into qat for a while :-). Rebecca has already tested and acked the patchset. We are waiting for you merging them before rebasing.

I am expecting a new patchset from Hemant to handle Konstantin's comments.

author
#9 lore raw

PATCH v2 1/1 test/crypto: maxlen calculation update

In reply to Kai Ji

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 QAT raw datapath api.

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

---
v2:
- remove unnecessary comments
- rebase

 app/test/test_cryptodev.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)
app/test/test_cryptodev.c +29 -4
index 65b64e1af0..588f22d583 100644
@@ -179,6 +179,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,
@@ -193,6 +197,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,
@@ -202,6 +207,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) {
@@ -267,6 +274,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;
@@ -489,10 +518,6 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
 	return op;
 }
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
-struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;
-static struct crypto_unittest_params unittest_params;
-
 static int
 testsuite_setup(void)
 {
Signature · 1 line
2.17.1
Acked-by on v2 1/1 Applied
#10 lore raw

Title updated as test/crypto: fix maxlen calculation for raw datapath

Quoted 3 lines

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 QAT raw

The APIs are not QAT specific.
Dropped QAT from here.

Quoted 7 lines

datapath api.

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

---

Applied to dpdk-next-crypto