From: "Zhang, Roy Fan" <roy.fan.zhang@intel.com>
To: "stable@dpdk.org" <stable@dpdk.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-stable] FW: [dpdk-dev v1] test/crypto: maxlen calculation update
Date: Thu, 30 Sep 2021 09:43:37 +0000 [thread overview]
Message-ID: <CY4PR11MB1718B74A6D5190014F9FC8E2B8AA9@CY4PR11MB1718.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210929153809.69039-1-kai.ji@intel.com>
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
next parent reply other threads:[~2021-09-30 9:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210929153809.69039-1-kai.ji@intel.com>
2021-09-30 9:43 ` Zhang, Roy Fan [this message]
[not found] ` <20211008113345.31818-1-kai.ji@intel.com>
2021-10-31 19:26 ` [dpdk-stable] [EXT] [dpdk-dev] [dpdk-dev v2] " Akhil Goyal
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=CY4PR11MB1718B74A6D5190014F9FC8E2B8AA9@CY4PR11MB1718.namprd11.prod.outlook.com \
--to=roy.fan.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/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).