[dpdk-dev] [PATCH v3 3/6] lib/cryptodev: add asymmetric crypto capability in cryptodev

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Sun Jun 17 14:11:30 CEST 2018



> -----Original Message-----
> From: Shally Verma [mailto:shally.verma at caviumnetworks.com]
> Sent: Wednesday, May 16, 2018 7:05 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Cc: Trahe, Fiona <fiona.trahe at intel.com>; akhil.goyal at nxp.com;
> dev at dpdk.org; pathreya at caviumnetworks.com; Sunila Sahu
> <sunila.sahu at caviumnetworks.com>; Ashish Gupta
> <ashish.gupta at caviumnetworks.com>
> Subject: [PATCH v3 3/6] lib/cryptodev: add asymmetric crypto capability in
> cryptodev
> 
> Extend cryptodev with asymmetric capability APIs and definitions.
> 
> changes from v2:
> - remove redundant xform_type from asym capability struct
> - rename rte_cryptodev_get_asym_xform_enum to be more consistent with
> other API names
> 
> Signed-off-by: Shally Verma <shally.verma at caviumnetworks.com>
> Signed-off-by: Sunila Sahu <sunila.sahu at caviumnetworks.com>
> Signed-off-by: Ashish Gupta <ashish.gupta at caviumnetworks.com>
> 
> ---
> User must apply patch
> "lib/cryptodev: add asymmetric algos in cryptodev" before compilation
> ---
> ---
>  lib/librte_cryptodev/Makefile                  |   1 +
>  lib/librte_cryptodev/rte_cryptodev.c           |  73 +++++++++++++++++
>  lib/librte_cryptodev/rte_cryptodev.h           | 107 ++++++++++++++++++++++++-
>  lib/librte_cryptodev/rte_cryptodev_version.map |  11 ++-
>  4 files changed, 186 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index
> 138e627dc..93f9d2d45 100644
> --- a/lib/librte_cryptodev/Makefile
> +++ b/lib/librte_cryptodev/Makefile
> @@ -12,6 +12,7 @@ LIBABIVER := 4
>  # build flags
>  CFLAGS += -O3
>  CFLAGS += $(WERROR_FLAGS)
> +CFLAGS += -DALLOW_EXPERIMENTAL_API

I don't think this flag is needed. You are exporting experimental API, but not using inside the library
(apps/drivers will need to use this flag, though).

>  LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf  LDLIBS += -lrte_kvargs
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> b/lib/librte_cryptodev/rte_cryptodev.c
> index 4015872ed..ee76cef07 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c

...

> +const struct rte_cryptodev_asymmetric_xfrm_capability *

s/xfrm/xform/. Same for the rest of the code.

...

> +int __rte_experimental
> +rte_cryptodev_asym_xfrm_capability_check_modlen(
> +	const struct rte_cryptodev_asymmetric_xfrm_capability *capability,
> +	uint16_t modlen)
> +{
> +	/* handle special case of 0 which means PMD doesn't define
> +	 * any limit
> +	 */
> +	if ((capability->modlen.min != 0) &&
> +		((modlen < capability->modlen.min) ||
> +		(capability->modlen.increment != 0 &&
> +		(modlen % (capability->modlen.increment)))))
> +		return -1;

It is a bit difficult to read this. I think it would be better to separate this if into multiple ones,
making it easier to review. Same with the following one.

> +	if ((capability->modlen.max != 0) &&
> +		((modlen > capability->modlen.max) ||
> +		(capability->modlen.increment != 0 &&
> +		(modlen % (capability->modlen.increment)))))
> +		return -1;
> +
> +	return 0;
> +}
> +
> 
>  const char *
>  rte_cryptodev_get_feature_name(uint64_t flag) diff --git
> a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> index 623459a95..6c13d23f8 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h

...

> @@ -1164,7 +1265,7 @@ int __rte_experimental
> rte_cryptodev_asym_session_set_private_data(
>  					struct rte_cryptodev_asym_session
> *sess,
>  					void *data,
> -					uint16_t size)
> +					uint16_t size);

Fix this in previous patch.

> 
>  /**
>   * Get private data of a session.
> @@ -1178,7 +1279,7 @@ rte_cryptodev_asym_session_set_private_data(
>   */
>  void * __rte_experimental
>  rte_cryptodev_asym_session_get_private_data(
> -				struct rte_cryptodev_asym_session *sess)
> +				struct rte_cryptodev_asym_session *sess);
> 
> 
>  #ifdef __cplusplus
> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map
> b/lib/librte_cryptodev/rte_cryptodev_version.map
> index 62b782444..817cf9f70 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -89,13 +89,18 @@ DPDK_17.11 {
>  EXPERIMENTAL {
>          global:
> 
> -	rte_cryptodev_asym_get_private_session_size
> +	rte_cryptodev_asym_capability_get;
> +	rte_cryptodev_asym_get_private_session_size;
> +	rte_cryptodev_asym_get_xform_enum;
> +	rte_crypto_asym_op_strings;
>  	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
> +	rte_cryptodev_asym_session_get_private_data;
> +	rte_cryptodev_asym_session_set_private_data;
> +	rte_cryptodev_asym_xfrm_capability_check_optype;
> +	rte_crypto_asym_xform_strings;

Make sure that list is sorted alphabetically (rte_crypto_* should go at the end).

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



More information about the dev mailing list