Hi Kai,

> -----Original Message-----
> From: dev <dev-boun...@dpdk.org> On Behalf Of Kai Ji
> Sent: Tuesday, October 26, 2021 6:25 PM
> To: dev@dpdk.org
> Cc: Ji, Kai <kai...@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.gua...@intel.com>; adamx.dybkow...@intel.com
> Subject: [dpdk-dev] [dpdk-dev v1 6/7] app/test: cryptodev test fix
> 
> test_mixed_auth_cipher: ensure enough space allocate in ibuf & obuf
> for mbuf to vec conversion
> test_kasumi_decryption: cipher length update.
> qat/dev: support sgl oop operation
> 
> Fixes: 681f540da52b ("cryptodev: do not use AAD in wireless algorithms")
> Cc: pablo.de.lara.gua...@intel.com
> 
> Fixes: e847fc512817 ("test/crypto: add encrypted digest case for AES-CTR-
> CMAC")
> Cc: adamx.dybkow...@intel.com
> 
> Signed-off-by: Kai Ji <kai...@intel.com>
> ---
>  app/test/test_cryptodev.c                    | 52 ++++++++++++++----
>  drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 28 ++++++++--
>  drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c | 14 ++++-
>  drivers/crypto/qat/dev/qat_sym_pmd_gen1.c    | 55 +++++++++++++++++-
> --
>  4 files changed, 124 insertions(+), 25 deletions(-)
> 
> diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> index 814a0b401d..dd791a181a 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, dest_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,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) {
> @@ -267,6 +275,30 @@ 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);
> +

This fix to me only address the in-place SGL problem but not the out-of-place 
SGL.

Regards,
Fan

Reply via email to