> -----Original Message-----
> From: Shally Verma [mailto:shally.ve...@caviumnetworks.com]
> Sent: Wednesday, May 16, 2018 7:05 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.gua...@intel.com>
> Cc: Trahe, Fiona <fiona.tr...@intel.com>; akhil.go...@nxp.com;
> dev@dpdk.org; pathr...@caviumnetworks.com; Sunila Sahu
> <sunila.s...@caviumnetworks.com>; Ashish Gupta
> <ashish.gu...@caviumnetworks.com>
> Subject: [PATCH v3 2/6] lib/cryptodev: add asym op support in cryptodev

Change title to "cryptodev: support asymmetric operations".

> 
> Extend DPDK librte_cryptodev to:
> - define asym op type in rte_crypto_op_type and associated
>   op pool create/alloc APIs
> - define asym session and associated session APIs
> 
> If PMD shows in its feature flag that it supports both sym and asym then it 
> must
> support those on all its qps.
> 
> Changes from v2:
> - added rte_cryptodev_asym_session_set/get_private_data for app to setup
> private data in a session as per latest dpdk-next-crypto spec
> - rename rte_cryptodev_get_asym_session_private_size to be consistent with
> other API names
> - correct rte_cryptodev_asym_session_create to pass void** to
> rte_mempool_get() and add for private_data_size flag
> 
> Changes from v1
>     - resolve new line error in librte_cryptodev/rte_cryptodev_version.map

These changes should go after the three dashes after the "Signed-off-by" lines.

> 
> Signed-off-by: Shally Verma <shally.ve...@caviumnetworks.com>
> Signed-off-by: Sunila Sahu <sunila.s...@caviumnetworks.com>
> Signed-off-by: Ashish Gupta <ashish.gu...@caviumnetworks.com>
> ---
>  lib/librte_cryptodev/rte_crypto.h              |  37 ++++-
>  lib/librte_cryptodev/rte_cryptodev.c           | 180 
> +++++++++++++++++++++++++
>  lib/librte_cryptodev/rte_cryptodev.h           | 114 +++++++++++++++-
>  lib/librte_cryptodev/rte_cryptodev_pmd.h       |  58 +++++++-
>  lib/librte_cryptodev/rte_cryptodev_version.map |   7 +
>  5 files changed, 392 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_cryptodev/rte_crypto.h 
> b/lib/librte_cryptodev/rte_crypto.h
> index 25404264b..ef9820e55 100644
> --- a/lib/librte_cryptodev/rte_crypto.h
> +++ b/lib/librte_cryptodev/rte_crypto.h

...

> +                     if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC)
> +                             return (void *)((uint8_t *)(op+1) +

For consistency, use (op + 1).

...

> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c

...

>  /** Initialise rte_crypto_op mempool element */  static void
> rte_crypto_op_init(struct rte_mempool *mempool, @@ -1303,6 +1476,13 @@
> rte_crypto_op_pool_create(const char *name, enum rte_crypto_op_type type,
>                       sizeof(struct rte_crypto_sym_op) +
>                       priv_size;
> 

I would check for type == SYMMETRIC in the previous code,
else if type == ASYMMETRIC with this code, else log error and return NULL
(or use a switch, whatever you prefer).


> +     if (type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
> +             /* override size by size of asym op */
> +             elt_size = sizeof(struct rte_crypto_op) +
> +                        sizeof(struct rte_crypto_asym_op) +
> +                        priv_size;
> +     }
> +
>       /* lookup mempool in case already allocated */
>       struct rte_mempool *mp = rte_mempool_lookup(name);
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h
> b/lib/librte_cryptodev/rte_cryptodev.h
> index 261a359dc..623459a95 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h

...

> + */
> +int __rte_experimental
> +rte_cryptodev_asym_session_set_private_data(
> +                                     struct rte_cryptodev_asym_session
> *sess,
> +                                     void *data,
> +                                     uint16_t size)

Missing ";" here.

> +
> +/**
> + * Get private data of a session.
> + *
> + * @param    sess            Session pointer allocated by
> + *                           *rte_cryptodev_asym_session_create*.
> + *
> + * @return
> + *  - On success return pointer to private data.
> + *  - On failure returns NULL.
> + */
> +void * __rte_experimental
> +rte_cryptodev_asym_session_get_private_data(
> +                             struct rte_cryptodev_asym_session *sess)

Missing ";" here.

> +
> +
>  #ifdef __cplusplus
>  }
>  #endif

> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map
> b/lib/librte_cryptodev/rte_cryptodev_version.map
> index 560e46411..62b782444 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -89,6 +89,13 @@ DPDK_17.11 {
>  EXPERIMENTAL {
>          global:
> 
> +     rte_cryptodev_asym_get_private_session_size

I see that there is not rte_cryptodev_asym_get_header_session_size.
rte_cryptodev_get_header_session_size is deprecated, so you won't be able to 
use this API.


> +     rte_cryptodev_asym_session_clear;
> +     rte_cryptodev_asym_session_create;
> +     rte_cryptodev_asym_session_free;
> +     rte_cryptodev_asym_session_init;
> +     rte_cryptodev_asym_session_get_private_data
> +     rte_cryptodev_asym_session_set_private_data

Missing ";" at the end of these two functions.
Also, "asym_session_get_private_data" should be placed after 
"asym_session_free".

>       rte_cryptodev_sym_session_get_private_data;
>       rte_cryptodev_sym_session_set_private_data;
>  } DPDK_17.11;
> --
> 2.14.3

Reply via email to