DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update
@ 2021-09-29 15:38 Kai Ji
  2021-09-30  9:43 ` [dpdk-dev] FW: " Zhang, Roy Fan
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Kai Ji @ 2021-09-29 15:38 UTC (permalink / raw)
  To: dev; +Cc: roy.fan.zhang, 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")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Kai Ji <kai.ji@intel.com>
---
 app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 16d770a17f..ea46911648 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -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)
 {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] FW: [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-09-29 15:38 [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update Kai Ji
@ 2021-09-30  9:43 ` Zhang, Roy Fan
  2021-10-07 12:46 ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-10-08 11:33 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
  2 siblings, 0 replies; 11+ messages in thread
From: Zhang, Roy Fan @ 2021-09-30  9:43 UTC (permalink / raw)
  To: stable; +Cc: dev

CCing to stable@dpdk.org

> -----Original Message-----
> From: Ji, Kai <kai.ji@intel.com>
> Sent: Wednesday, September 29, 2021 4:38 PM
> To: dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Ji, Kai <kai.ji@intel.com>
> 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")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Kai Ji <kai.ji@intel.com>
> ---
>  app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++----
>  1 file changed, 31 insertions(+), 4 deletions(-)
> 
> diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> index 16d770a17f..ea46911648 100644
> --- a/app/test/test_cryptodev.c
> +++ b/app/test/test_cryptodev.c
> @@ -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)
>  {
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-09-29 15:38 [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update Kai Ji
  2021-09-30  9:43 ` [dpdk-dev] FW: " Zhang, Roy Fan
@ 2021-10-07 12:46 ` Akhil Goyal
  2021-10-07 13:54   ` Zhang, Roy Fan
  2021-10-08 11:33 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
  2 siblings, 1 reply; 11+ messages in thread
From: Akhil Goyal @ 2021-10-07 12:46 UTC (permalink / raw)
  To: Kai Ji, dev; +Cc: roy.fan.zhang, hemant.agrawal, g.singh

> 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")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Kai Ji <kai.ji@intel.com>
> ---
>  app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++----
>  1 file changed, 31 insertions(+), 4 deletions(-)
> 
> diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> index 16d770a17f..ea46911648 100644
> --- a/app/test/test_cryptodev.c
> +++ b/app/test/test_cryptodev.c
> @@ -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;

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-hemant.agrawal@nxp.com/

> 
>  	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)
>  {
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-10-07 12:46 ` [dpdk-dev] [EXT] " Akhil Goyal
@ 2021-10-07 13:54   ` Zhang, Roy Fan
  2021-10-07 13:59     ` Akhil Goyal
  0 siblings, 1 reply; 11+ messages in thread
From: Zhang, Roy Fan @ 2021-10-07 13:54 UTC (permalink / raw)
  To: Akhil Goyal, Ji, Kai, dev; +Cc: hemant.agrawal, g.singh

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/20210907075957.28848-15-hemant.agrawal@nxp.com/
the problem is not touched.

Regards,
Fan


> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, October 7, 2021 1:47 PM
> To: Ji, Kai <kai.ji@intel.com>; dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; hemant.agrawal@nxp.com;
> g.singh@nxp.com
> Subject: RE: [EXT] [dpdk-dev] [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")
> > Cc: roy.fan.zhang@intel.com
> >
> > Signed-off-by: Kai Ji <kai.ji@intel.com>
> > ---
> >  app/test/test_cryptodev.c | 35 +++++++++++++++++++++++++++++++---
> -
> >  1 file changed, 31 insertions(+), 4 deletions(-)
> >
> > diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> > index 16d770a17f..ea46911648 100644
> > --- a/app/test/test_cryptodev.c
> > +++ b/app/test/test_cryptodev.c
> > @@ -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;
> 
> 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-
> hemant.agrawal@nxp.com/
> 
> >
> >  	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)
> >  {
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-10-07 13:54   ` Zhang, Roy Fan
@ 2021-10-07 13:59     ` Akhil Goyal
  2021-10-07 14:34       ` Zhang, Roy Fan
  0 siblings, 1 reply; 11+ messages in thread
From: Akhil Goyal @ 2021-10-07 13:59 UTC (permalink / raw)
  To: Zhang, Roy Fan, Ji, Kai, dev; +Cc: hemant.agrawal, g.singh

Hi Fan,

> 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.
> 

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?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-10-07 13:59     ` Akhil Goyal
@ 2021-10-07 14:34       ` Zhang, Roy Fan
  2021-10-07 15:20         ` Akhil Goyal
  0 siblings, 1 reply; 11+ messages in thread
From: Zhang, Roy Fan @ 2021-10-07 14:34 UTC (permalink / raw)
  To: Akhil Goyal, Ji, Kai, dev; +Cc: hemant.agrawal, g.singh

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

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, October 7, 2021 3:00 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Ji, Kai <kai.ji@intel.com>;
> dev@dpdk.org
> Cc: hemant.agrawal@nxp.com; g.singh@nxp.com
> Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation
> update
> 
> Hi Fan,
> 
> > 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.
> >
> 
> 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?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-10-07 14:34       ` Zhang, Roy Fan
@ 2021-10-07 15:20         ` Akhil Goyal
  2021-10-07 15:43           ` Zhang, Roy Fan
  2021-10-08 11:40           ` Ji, Kai
  0 siblings, 2 replies; 11+ messages in thread
From: Akhil Goyal @ 2021-10-07 15:20 UTC (permalink / raw)
  To: Zhang, Roy Fan, Ji, Kai, dev; +Cc: hemant.agrawal, g.singh

> 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-10-07 15:20         ` Akhil Goyal
@ 2021-10-07 15:43           ` Zhang, Roy Fan
  2021-10-08 11:40           ` Ji, Kai
  1 sibling, 0 replies; 11+ messages in thread
From: Zhang, Roy Fan @ 2021-10-07 15:43 UTC (permalink / raw)
  To: Akhil Goyal, Ji, Kai, dev; +Cc: hemant.agrawal, g.singh

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

Regards,
Fan

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, October 7, 2021 4:20 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Ji, Kai <kai.ji@intel.com>;
> dev@dpdk.org
> Cc: hemant.agrawal@nxp.com; g.singh@nxp.com
> Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation
> update
> 
> > 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [dpdk-dev v2] test/crypto: maxlen calculation update
  2021-09-29 15:38 [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update Kai Ji
  2021-09-30  9:43 ` [dpdk-dev] FW: " Zhang, Roy Fan
  2021-10-07 12:46 ` [dpdk-dev] [EXT] " Akhil Goyal
@ 2021-10-08 11:33 ` Kai Ji
  2021-10-31 19:26   ` [dpdk-dev] [EXT] " Akhil Goyal
  2 siblings, 1 reply; 11+ messages in thread
From: Kai Ji @ 2021-10-08 11:33 UTC (permalink / raw)
  To: dev; +Cc: Kai Ji, roy.fan.zhang

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")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Kai Ji <kai.ji@intel.com>
---
v2:
 - remove unnecessary comments
 - rebase

 app/test/test_cryptodev.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 65b64e1af0..588f22d583 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -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)
 {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v1] test/crypto: maxlen calculation update
  2021-10-07 15:20         ` Akhil Goyal
  2021-10-07 15:43           ` Zhang, Roy Fan
@ 2021-10-08 11:40           ` Ji, Kai
  1 sibling, 0 replies; 11+ messages in thread
From: Ji, Kai @ 2021-10-08 11:40 UTC (permalink / raw)
  To: Akhil Goyal, Zhang, Roy Fan, dev; +Cc: hemant.agrawal, g.singh

Hi Akhil,

I just update the v2: http://patchwork.dpdk.org/project/dpdk/patch/20211008113345.31818-1-kai.ji@intel.com/
This patch is a generic fix of test case for SGL op, I think there is no dependence with Hemant's patch.

Regards

Kai 

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, October 7, 2021 4:20 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Ji, Kai <kai.ji@intel.com>;
> dev@dpdk.org
> Cc: hemant.agrawal@nxp.com; g.singh@nxp.com
> Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation
> update
> 
> > 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [EXT] [dpdk-dev v2] test/crypto: maxlen calculation update
  2021-10-08 11:33 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
@ 2021-10-31 19:26   ` Akhil Goyal
  0 siblings, 0 replies; 11+ messages in thread
From: Akhil Goyal @ 2021-10-31 19:26 UTC (permalink / raw)
  To: Kai Ji, dev; +Cc: roy.fan.zhang, stable

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

> 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.

> datapath api.
> 
> Fixes: 4868f6591c6f ("test/crypto: add cases for raw datapath API")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Kai Ji <kai.ji@intel.com>
> ---

Cc: stable@dpdk.org
Acked-by: Akhil Goyal <gakhil@marvell.com>
Applied to dpdk-next-crypto



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-10-31 19:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 15:38 [dpdk-dev] [dpdk-dev v1] test/crypto: maxlen calculation update Kai Ji
2021-09-30  9:43 ` [dpdk-dev] FW: " Zhang, Roy Fan
2021-10-07 12:46 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-07 13:54   ` Zhang, Roy Fan
2021-10-07 13:59     ` Akhil Goyal
2021-10-07 14:34       ` Zhang, Roy Fan
2021-10-07 15:20         ` Akhil Goyal
2021-10-07 15:43           ` Zhang, Roy Fan
2021-10-08 11:40           ` Ji, Kai
2021-10-08 11:33 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
2021-10-31 19:26   ` [dpdk-dev] [EXT] " Akhil Goyal

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