[dpdk-dev] [PATCH] cryptodev: remove crypto device type enumeration
De Lara Guarch, Pablo
pablo.de.lara.guarch at intel.com
Wed May 17 11:00:04 CEST 2017
Hi Slawomir,
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Slawomir
> Mrozowicz
> Sent: Monday, May 15, 2017 10:56 AM
> To: Doherty, Declan
> Cc: dev at dpdk.org; Mrozowicz, SlawomirX
> Subject: [dpdk-dev] [PATCH] cryptodev: remove crypto device type
> enumeration
>
> Changes device type identification to be based on a unique
> driver id replacing the current device type enumeration, which needed
> library changes every time a new crypto driver was added.
>
> The driver id is assigned dynamically during driver registration using
> the new macro RTE_PMD_REGISTER_CRYPTO_DRIVER which returns a
> unique
> uint8_t identifier for that driver. New APIs are also introduced
> to allow retrieval of the driver id using the driver name.
>
> Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
There are compilation issues with the patch: http://dpdk.org/ml/archives/test-report/2017-May/019815.html
Could you add some information in the release notes?
There is an API change here, that should be noted.
> ---
> doc/guides/prog_guide/cryptodev_lib.rst | 5 +-
> drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 12 +-
> drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 2 +-
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 12 +-
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 2 +-
> drivers/crypto/armv8/rte_armv8_pmd.c | 12 +-
> drivers/crypto/armv8/rte_armv8_pmd_ops.c | 2 +-
> drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 10 +-
> drivers/crypto/kasumi/rte_kasumi_pmd.c | 12 +-
> drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 2 +-
> drivers/crypto/null/null_crypto_pmd.c | 12 +-
> drivers/crypto/null/null_crypto_pmd_ops.c | 2 +-
> drivers/crypto/openssl/rte_openssl_pmd.c | 12 +-
> drivers/crypto/openssl/rte_openssl_pmd_ops.c | 2 +-
> drivers/crypto/qat/qat_crypto.c | 7 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 8 +-
> drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 31 ++--
> drivers/crypto/scheduler/scheduler_pmd.c | 7 +-
> drivers/crypto/scheduler/scheduler_pmd_ops.c | 2 +-
> drivers/crypto/scheduler/scheduler_pmd_private.h | 2 +-
> drivers/crypto/snow3g/rte_snow3g_pmd.c | 12 +-
> drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 2 +-
> drivers/crypto/zuc/rte_zuc_pmd.c | 12 +-
> drivers/crypto/zuc/rte_zuc_pmd_ops.c | 2 +-
> lib/librte_cryptodev/rte_cryptodev.c | 39 ++++-
> lib/librte_cryptodev/rte_cryptodev.h | 68 ++++---
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 2 +-
> lib/librte_cryptodev/rte_cryptodev_version.map | 11 +-
> test/test/test_cryptodev.c | 195 ++++++++++++++-------
> test/test/test_cryptodev_blockcipher.c | 68 ++++---
> test/test/test_cryptodev_blockcipher.h | 2 +-
> test/test/test_cryptodev_perf.c | 124 ++++++++-----
> 32 files changed, 472 insertions(+), 221 deletions(-)
>
...
> diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> index 101ef98..64a0ba0 100644
> --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> @@ -143,8 +143,9 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp,
> struct rte_crypto_sym_op *op)
> struct aesni_gcm_session *sess = NULL;
>
> if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
> - if (unlikely(op->session->dev_type
> - !=
> RTE_CRYPTODEV_AESNI_GCM_PMD))
> + if (unlikely(op->session->driver_id !=
> + rte_cryptodev_driver_id_get(
> +
I would store the driver id of the PMD somewhere (maybe in aesni_gcm_qp or access dev->driver_id?),
and not call this function for all operations (same for other PMDs).
...
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h
> b/lib/librte_cryptodev/rte_cryptodev.h
> index 88aeb87..533017c 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
...
> +
> +/**
> + * Provide driver name.
> + *
> + * @param driver_id
> + * The driver identifier.
> + * @return
> + * The driver name or null if no driver found
> + */
> +char *rte_cryptodev_driver_name_get(uint8_t driver_id);
> +
> +/**
> + * Allocate driver identifier.
> + *
Mark this as internal, as this will only be used by PMDs, not apps.
More information about the dev
mailing list