From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id DD5E32B89 for ; Mon, 22 May 2017 13:11:13 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP; 22 May 2017 04:11:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,377,1491289200"; d="scan'208";a="1172657001" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga002.fm.intel.com with SMTP; 22 May 2017 04:11:08 -0700 Received: by Sent (sSMTP sendmail emulation); Mon, 22 May 2017 13:11:02 +0200 From: Slawomir Mrozowicz To: declan.doherty@intel.com Cc: dev@dpdk.org, Slawomir Mrozowicz Date: Mon, 22 May 2017 13:10:57 +0200 Message-Id: <20170522111057.25238-1-slawomirx.mrozowicz@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170515095542.108383-1-slawomirx.mrozowicz@intel.com> References: <20170515095542.108383-1-slawomirx.mrozowicz@intel.com> Subject: [dpdk-dev] [PATCH v2] cryptodev: remove crypto device type enumeration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 May 2017 11:11:16 -0000 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 --- v2 changes: - add release notes information - reduce some call of rte_cryptodev_driver_id_get - remove clang compiler error - add internal mark for function rte_cryptodev_allocate_driver_id --- doc/guides/prog_guide/cryptodev_lib.rst | 5 +- doc/guides/rel_notes/release_17_08.rst | 30 +++- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 10 +- drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 10 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 10 +- drivers/crypto/armv8/rte_armv8_pmd_ops.c | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 +- drivers/crypto/kasumi/rte_kasumi_pmd.c | 10 +- drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 2 +- drivers/crypto/null/null_crypto_pmd.c | 10 +- drivers/crypto/null/null_crypto_pmd_ops.c | 2 +- drivers/crypto/openssl/rte_openssl_pmd.c | 10 +- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 2 +- drivers/crypto/qat/qat_crypto.c | 5 +- drivers/crypto/qat/qat_crypto.h | 2 + drivers/crypto/qat/rte_qat_cryptodev.c | 7 +- drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 22 +-- drivers/crypto/scheduler/scheduler_pmd.c | 6 +- drivers/crypto/scheduler/scheduler_pmd_ops.c | 2 +- drivers/crypto/scheduler/scheduler_pmd_private.h | 4 +- drivers/crypto/snow3g/rte_snow3g_pmd.c | 10 +- drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 2 +- drivers/crypto/zuc/rte_zuc_pmd.c | 10 +- drivers/crypto/zuc/rte_zuc_pmd_ops.c | 2 +- lib/librte_cryptodev/rte_cryptodev.c | 41 ++++- lib/librte_cryptodev/rte_cryptodev.h | 69 +++++--- 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 ++++++++----- 34 files changed, 477 insertions(+), 222 deletions(-) diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 4f98f28..4644802 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -291,7 +291,7 @@ relevant information for the device. struct rte_cryptodev_info { const char *driver_name; - enum rte_cryptodev_type dev_type; + uint8_t driver_id; struct rte_pci_device *pci_dev; uint64_t feature_flags; @@ -451,7 +451,8 @@ functions for the configuration of the session parameters and freeing function so the PMD can managed the memory on destruction of a session. **Note**: Sessions created on a particular device can only be used on Crypto -devices of the same type, and if you try to use a session on a device different +devices of the same type - the same driver id used by this devices, +and if you try to use a session on a device different to that on which it was created then the Crypto operation will fail. ``rte_cryptodev_sym_session_create()`` is used to create a symmetric session on diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst index 74aae10..347828d 100644 --- a/doc/guides/rel_notes/release_17_08.rst +++ b/doc/guides/rel_notes/release_17_08.rst @@ -42,6 +42,15 @@ New Features ========================================================= +* **Add a helper functions for crypto device driver identification.** + + Added functions to: + * Provide crypto device driver unique identification. + * Provide crypto device driver name. + + Added macro to register crypto driver. + + Resolved Issues --------------- @@ -111,6 +120,10 @@ API Changes ========================================================= +* Changes device type identification to be based on a unique + driver id uint8_t type replacing the previous device type enumeration. + + ABI Changes ----------- @@ -125,6 +138,21 @@ ABI Changes ========================================================= +Removed Items +------------- + +.. This section should contain removed items in this release. Sample format: + + * Add a short 1-2 sentence description of the removed item in the past + tense. + + This section is a comment. do not overwrite or remove it. + Also, make sure to start the actual text at the margin. + ========================================================= + + +* The crypto device type enumeration has been removed from librte_cryptodev. + Shared Library Versions ----------------------- @@ -195,4 +223,4 @@ Tested Platforms This section is a comment. do not overwrite or remove it. Also, make sure to start the actual text at the margin. - ========================================================= + ========================================================= \ No newline at end of file diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index 101ef98..b2a0606 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -42,6 +42,8 @@ #include "aesni_gcm_pmd_private.h" +static uint8_t cryptodev_driver_id; + /** GCM encode functions pointer table */ static const struct aesni_gcm_ops aesni_gcm_enc[] = { [AESNI_GCM_KEY_128] = { @@ -143,8 +145,8 @@ 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 != + cryptodev_driver_id)) return sess; sess = (struct aesni_gcm_session *)op->session->_private; @@ -456,7 +458,7 @@ aesni_gcm_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_AESNI_GCM_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_aesni_gcm_pmd_ops; /* register rx/tx burst functions for data path */ @@ -539,3 +541,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_AESNI_GCM_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c index 1fc047b..2aa0266 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c @@ -181,7 +181,7 @@ aesni_gcm_pmd_info_get(struct rte_cryptodev *dev, struct aesni_gcm_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->feature_flags = dev->feature_flags; dev_info->capabilities = aesni_gcm_pmd_capabilities; diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index 45b25c9..9a701ce 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -40,6 +40,8 @@ #include "rte_aesni_mb_pmd_private.h" +static uint8_t cryptodev_driver_id; + typedef void (*hash_one_block_t)(const void *data, void *digest); typedef void (*aes_keyexp_t)(const void *key, void *enc_exp_keys, void *dec_exp_keys); @@ -345,8 +347,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) struct aesni_mb_session *sess = NULL; if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->sym->session->dev_type != - RTE_CRYPTODEV_AESNI_MB_PMD)) { + if (unlikely(op->sym->session->driver_id != + cryptodev_driver_id)) { return NULL; } @@ -705,7 +707,7 @@ cryptodev_aesni_mb_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_AESNI_MB_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_aesni_mb_pmd_ops; /* register rx/tx burst functions for data path */ @@ -806,3 +808,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_MB_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_AESNI_MB_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c index d1bc28e..3a2683b 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c @@ -321,7 +321,7 @@ aesni_mb_pmd_info_get(struct rte_cryptodev *dev, struct aesni_mb_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->feature_flags = dev->feature_flags; dev_info->capabilities = aesni_mb_pmd_capabilities; dev_info->max_nb_queue_pairs = internals->max_nb_queue_pairs; diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c index 3d603a5..17dde0b 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd.c +++ b/drivers/crypto/armv8/rte_armv8_pmd.c @@ -44,6 +44,8 @@ #include "rte_armv8_pmd_private.h" +static uint8_t cryptodev_driver_id; + static int cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev); /** @@ -547,8 +549,8 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op) if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { /* get existing session */ if (likely(op->sym->session != NULL && - op->sym->session->dev_type == - RTE_CRYPTODEV_ARMV8_PMD)) { + op->sym->session->driver_id == + cryptodev_driver_id)) { sess = (struct armv8_crypto_session *) op->sym->session->_private; } @@ -814,7 +816,7 @@ cryptodev_armv8_crypto_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_ARMV8_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_armv8_crypto_pmd_ops; /* register rx/tx burst functions for data path */ @@ -904,3 +906,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_ARMV8_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_ARMV8_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c index 4d9ccbf..2911417 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c +++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c @@ -178,7 +178,7 @@ armv8_crypto_pmd_info_get(struct rte_cryptodev *dev, struct armv8_crypto_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->feature_flags = dev->feature_flags; dev_info->capabilities = armv8_crypto_pmd_capabilities; dev_info->max_nb_queue_pairs = internals->max_nb_qpairs; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 4e01fe8..5bb9041 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -73,6 +73,8 @@ #define AES_CBC_IV_LEN 16 enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8; +static uint8_t cryptodev_driver_id; + static inline int build_authenc_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op, @@ -1383,7 +1385,7 @@ dpaa2_sec_dev_infos_get(struct rte_cryptodev *dev, info->feature_flags = dev->feature_flags; info->capabilities = dpaa2_sec_capabilities; info->sym.max_nb_sessions = internals->max_nb_sessions; - info->dev_type = RTE_CRYPTODEV_DPAA2_SEC_PMD; + info->driver_id = cryptodev_driver_id; } } @@ -1509,7 +1511,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) } hw_id = dpaa2_dev->object_id; - cryptodev->dev_type = RTE_CRYPTODEV_DPAA2_SEC_PMD; + cryptodev->driver_id = cryptodev_driver_id; cryptodev->dev_ops = &crypto_ops; cryptodev->enqueue_burst = dpaa2_sec_enqueue_burst; @@ -1654,3 +1656,5 @@ static struct rte_dpaa2_driver rte_dpaa2_sec_driver = { }; RTE_PMD_REGISTER_DPAA2(dpaa2_sec_pmd, rte_dpaa2_sec_driver); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_DPAA2_SEC_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 9da9e89..aa7eab5 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -47,6 +47,8 @@ #define KASUMI_MAX_BURST 4 #define BYTE_LEN 8 +static uint8_t cryptodev_driver_id; + /** Get xform chain order. */ static enum kasumi_operation kasumi_get_mode(const struct rte_crypto_sym_xform *xform) @@ -143,8 +145,8 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op) struct kasumi_session *sess; if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->sym->session->dev_type != - RTE_CRYPTODEV_KASUMI_PMD)) + if (unlikely(op->sym->session->driver_id != + cryptodev_driver_id)) return NULL; sess = (struct kasumi_session *)op->sym->session->_private; @@ -580,7 +582,7 @@ cryptodev_kasumi_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_KASUMI_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_kasumi_pmd_ops; /* Register RX/TX burst functions for data path. */ @@ -664,3 +666,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_KASUMI_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c index 62ebdbd..343c9b3 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c @@ -156,7 +156,7 @@ kasumi_pmd_info_get(struct rte_cryptodev *dev, struct kasumi_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->max_nb_queue_pairs = internals->max_nb_queue_pairs; dev_info->sym.max_nb_sessions = internals->max_nb_sessions; dev_info->feature_flags = dev->feature_flags; diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index 023450a..6788865 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -38,6 +38,8 @@ #include "null_crypto_pmd_private.h" +static uint8_t cryptodev_driver_id; + /** verify and set session parameters */ int null_crypto_set_session_parameters( @@ -94,8 +96,8 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_sym_op *op) struct null_crypto_session *sess; if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->session == NULL || - op->session->dev_type != RTE_CRYPTODEV_NULL_PMD)) + if (unlikely(op->session == NULL || op->session->driver_id != + cryptodev_driver_id)) return NULL; sess = (struct null_crypto_session *)op->session->_private; @@ -183,7 +185,7 @@ cryptodev_null_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_NULL_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = null_crypto_pmd_ops; /* register rx/tx burst functions for data path */ @@ -268,3 +270,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_NULL_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c index 12c946c..a7c891e 100644 --- a/drivers/crypto/null/null_crypto_pmd_ops.c +++ b/drivers/crypto/null/null_crypto_pmd_ops.c @@ -151,7 +151,7 @@ null_crypto_pmd_info_get(struct rte_cryptodev *dev, struct null_crypto_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->max_nb_queue_pairs = internals->max_nb_qpairs; dev_info->sym.max_nb_sessions = internals->max_nb_sessions; dev_info->feature_flags = dev->feature_flags; diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index f0c5ca3..eb5dda3 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -44,6 +44,8 @@ #define DES_BLOCK_SIZE 8 +static uint8_t cryptodev_driver_id; + static int cryptodev_openssl_remove(struct rte_vdev_device *vdev); /*----------------------------------------------------------------------------*/ @@ -448,8 +450,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op) if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { /* get existing session */ if (likely(op->sym->session != NULL && - op->sym->session->dev_type == - RTE_CRYPTODEV_OPENSSL_PMD)) + op->sym->session->driver_id == + cryptodev_driver_id)) sess = (struct openssl_session *) op->sym->session->_private; } else { @@ -1283,7 +1285,7 @@ cryptodev_openssl_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_OPENSSL_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_openssl_pmd_ops; /* register rx/tx burst functions for data path */ @@ -1372,3 +1374,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_OPENSSL_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_OPENSSL_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c index 22a6873..f65de53 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c @@ -536,7 +536,7 @@ openssl_pmd_info_get(struct rte_cryptodev *dev, struct openssl_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->feature_flags = dev->feature_flags; dev_info->capabilities = openssl_pmd_capabilities; dev_info->max_nb_queue_pairs = internals->max_nb_qpairs; diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 386aa45..9dc3150 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -913,7 +913,8 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg, return -EINVAL; } - if (unlikely(op->sym->session->dev_type != RTE_CRYPTODEV_QAT_SYM_PMD)) { + if (unlikely(op->sym->session->driver_id != + cryptodev_qat_driver_id)) { PMD_DRV_LOG(ERR, "Session was not created for this device"); return -EINVAL; } @@ -1253,7 +1254,7 @@ void qat_dev_info_get(__rte_unused struct rte_cryptodev *dev, info->feature_flags = dev->feature_flags; info->capabilities = internals->qat_dev_capabilities; info->sym.max_nb_sessions = internals->max_nb_sessions; - info->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD; + info->driver_id = cryptodev_qat_driver_id; } } diff --git a/drivers/crypto/qat/qat_crypto.h b/drivers/crypto/qat/qat_crypto.h index b740d6b..efcf607 100644 --- a/drivers/crypto/qat/qat_crypto.h +++ b/drivers/crypto/qat/qat_crypto.h @@ -85,6 +85,8 @@ struct qat_pmd_private { const struct rte_cryptodev_capabilities *qat_dev_capabilities; }; +extern uint8_t cryptodev_qat_driver_id; + int qat_dev_config(struct rte_cryptodev *dev, struct rte_cryptodev_config *config); int qat_dev_start(struct rte_cryptodev *dev); diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c index 1bdd30d..6bfd2bb 100644 --- a/drivers/crypto/qat/rte_qat_cryptodev.c +++ b/drivers/crypto/qat/rte_qat_cryptodev.c @@ -39,6 +39,8 @@ #include "qat_crypto.h" #include "qat_logs.h" +uint8_t cryptodev_qat_driver_id; + static const struct rte_cryptodev_capabilities qat_cpm16_capabilities[] = { QAT_BASE_CPM16_SYM_CAPABILITIES, RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() @@ -106,7 +108,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_ RTE_DEV_TO_PCI(cryptodev->device)->addr.devid, RTE_DEV_TO_PCI(cryptodev->device)->addr.function); - cryptodev->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD; + cryptodev->driver_id = cryptodev_qat_driver_id; cryptodev->dev_ops = &crypto_qat_ops; cryptodev->enqueue_burst = qat_pmd_enqueue_op_burst; @@ -160,4 +162,5 @@ static struct rte_cryptodev_driver rte_qat_pmd = { RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv); RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map); - +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_QAT_SYM_PMD, + cryptodev_qat_driver_id); diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c index 319dcf0..c1b43c7 100644 --- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c +++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c @@ -198,7 +198,7 @@ rte_cryptodev_scheduler_slave_attach(uint8_t scheduler_id, uint8_t slave_id) return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -226,12 +226,12 @@ rte_cryptodev_scheduler_slave_attach(uint8_t scheduler_id, uint8_t slave_id) rte_cryptodev_info_get(slave_id, &dev_info); slave->dev_id = slave_id; - slave->dev_type = dev_info.dev_type; + slave->driver_id = dev_info.driver_id; sched_ctx->nb_slaves++; if (update_scheduler_capability(sched_ctx) < 0) { slave->dev_id = 0; - slave->dev_type = 0; + slave->driver_id = 0; sched_ctx->nb_slaves--; CS_LOG_ERR("capabilities update failed"); @@ -257,7 +257,7 @@ rte_cryptodev_scheduler_slave_detach(uint8_t scheduler_id, uint8_t slave_id) return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -314,7 +314,7 @@ rte_cryptodev_scheduler_mode_set(uint8_t scheduler_id, return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -377,7 +377,7 @@ rte_cryptodev_scheduler_mode_get(uint8_t scheduler_id) return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -405,7 +405,7 @@ rte_cryptodev_scheduler_ordering_set(uint8_t scheduler_id, return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -433,7 +433,7 @@ rte_cryptodev_scheduler_ordering_get(uint8_t scheduler_id) return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -455,7 +455,7 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id, return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -512,7 +512,7 @@ rte_cryptodev_scheduler_slaves_get(uint8_t scheduler_id, uint8_t *slaves) return -ENOTSUP; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } @@ -580,7 +580,7 @@ rte_cryptodev_scheduler_option_get(uint8_t scheduler_id, return -EINVAL; } - if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) { + if (dev->driver_id != cryptodev_scheduler_driver_id) { CS_LOG_ERR("Operation not supported"); return -ENOTSUP; } diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c index 0b63c20..7168491 100644 --- a/drivers/crypto/scheduler/scheduler_pmd.c +++ b/drivers/crypto/scheduler/scheduler_pmd.c @@ -41,6 +41,8 @@ #include "rte_cryptodev_scheduler.h" #include "scheduler_pmd_private.h" +uint8_t cryptodev_scheduler_driver_id; + struct scheduler_init_params { struct rte_crypto_vdev_init_params def_p; uint32_t nb_slaves; @@ -110,7 +112,7 @@ cryptodev_scheduler_create(const char *name, return -EFAULT; } - dev->dev_type = RTE_CRYPTODEV_SCHEDULER_PMD; + dev->driver_id = cryptodev_scheduler_driver_id; dev->dev_ops = rte_crypto_scheduler_pmd_ops; sched_ctx = dev->data->dev_private; @@ -454,3 +456,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SCHEDULER_PMD, "max_nb_sessions= " "socket_id= " "slave="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_SCHEDULER_PMD, + cryptodev_scheduler_driver_id); diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c index 2b5858d..1f91bce 100644 --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c @@ -368,7 +368,7 @@ scheduler_pmd_info_get(struct rte_cryptodev *dev, max_nb_sessions; } - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->feature_flags = dev->feature_flags; dev_info->capabilities = sched_ctx->capabilities; dev_info->max_nb_queue_pairs = sched_ctx->max_nb_queue_pairs; diff --git a/drivers/crypto/scheduler/scheduler_pmd_private.h b/drivers/crypto/scheduler/scheduler_pmd_private.h index 421dae3..615a207 100644 --- a/drivers/crypto/scheduler/scheduler_pmd_private.h +++ b/drivers/crypto/scheduler/scheduler_pmd_private.h @@ -63,7 +63,7 @@ struct scheduler_slave { uint16_t qp_id; uint32_t nb_inflight_cops; - enum rte_cryptodev_type dev_type; + uint8_t driver_id; }; struct scheduler_ctx { @@ -105,6 +105,8 @@ struct scheduler_session { RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES]; }; +extern uint8_t cryptodev_scheduler_driver_id; + static inline uint16_t __attribute__((always_inline)) get_max_enqueue_order_count(struct rte_ring *order_ring, uint16_t nb_ops) { diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index 960956c..7db6409 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -46,6 +46,8 @@ #define SNOW3G_MAX_BURST 8 #define BYTE_LEN 8 +static uint8_t cryptodev_driver_id; + /** Get xform chain order. */ static enum snow3g_operation snow3g_get_mode(const struct rte_crypto_sym_xform *xform) @@ -143,8 +145,8 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op) struct snow3g_session *sess; if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->sym->session->dev_type != - RTE_CRYPTODEV_SNOW3G_PMD)) + if (unlikely(op->sym->session->driver_id != + cryptodev_driver_id)) return NULL; sess = (struct snow3g_session *)op->sym->session->_private; @@ -569,7 +571,7 @@ cryptodev_snow3g_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_SNOW3G_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_snow3g_pmd_ops; /* Register RX/TX burst functions for data path. */ @@ -653,3 +655,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SNOW3G_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_SNOW3G_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c index 7ce96be..26cc3e9 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c @@ -156,7 +156,7 @@ snow3g_pmd_info_get(struct rte_cryptodev *dev, struct snow3g_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->max_nb_queue_pairs = internals->max_nb_queue_pairs; dev_info->sym.max_nb_sessions = internals->max_nb_sessions; dev_info->feature_flags = dev->feature_flags; diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c index 1020544..5d50bab 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -45,6 +45,8 @@ #define ZUC_MAX_BURST 8 #define BYTE_LEN 8 +static uint8_t cryptodev_driver_id; + /** Get xform chain order. */ static enum zuc_operation zuc_get_mode(const struct rte_crypto_sym_xform *xform) @@ -142,8 +144,8 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op) struct zuc_session *sess; if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->sym->session->dev_type != - RTE_CRYPTODEV_ZUC_PMD)) + if (unlikely(op->sym->session->driver_id != + cryptodev_driver_id)) return NULL; sess = (struct zuc_session *)op->sym->session->_private; @@ -469,7 +471,7 @@ cryptodev_zuc_create(const char *name, goto init_error; } - dev->dev_type = RTE_CRYPTODEV_ZUC_PMD; + dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_zuc_pmd_ops; /* Register RX/TX burst functions for data path. */ @@ -552,3 +554,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_ZUC_PMD, "max_nb_queue_pairs= " "max_nb_sessions= " "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(CRYPTODEV_NAME_ZUC_PMD, + cryptodev_driver_id); diff --git a/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c index e793459..645b80c 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c +++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c @@ -156,7 +156,7 @@ zuc_pmd_info_get(struct rte_cryptodev *dev, struct zuc_private *internals = dev->data->dev_private; if (dev_info != NULL) { - dev_info->dev_type = dev->dev_type; + dev_info->driver_id = dev->driver_id; dev_info->max_nb_queue_pairs = internals->max_nb_queue_pairs; dev_info->sym.max_nb_sessions = internals->max_nb_sessions; dev_info->feature_flags = dev->feature_flags; diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index b65cd9c..b8e1018 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -509,12 +509,12 @@ rte_cryptodev_count(void) } uint8_t -rte_cryptodev_count_devtype(enum rte_cryptodev_type type) +rte_cryptodev_device_count_by_driver(uint8_t driver_id) { uint8_t i, dev_count = 0; for (i = 0; i < rte_cryptodev_globals->max_devs; i++) - if (rte_cryptodev_globals->devs[i].dev_type == type && + if (rte_cryptodev_globals->devs[i].driver_id == driver_id && rte_cryptodev_globals->devs[i].attached == RTE_CRYPTODEV_ATTACHED) dev_count++; @@ -1293,7 +1293,7 @@ rte_cryptodev_sym_session_init(struct rte_mempool *mp, memset(sess, 0, mp->elt_size); sess->dev_id = dev->data->dev_id; - sess->dev_type = dev->dev_type; + sess->driver_id = dev->driver_id; sess->mp = mp; if (dev->dev_ops->session_initialize) @@ -1460,7 +1460,7 @@ rte_cryptodev_sym_session_free(uint8_t dev_id, dev = &rte_crypto_devices[dev_id]; /* Check the session belongs to this device type */ - if (sess->dev_type != dev->dev_type) + if (sess->driver_id != dev->driver_id) return sess; /* Let device implementation clear session material */ @@ -1572,3 +1572,36 @@ rte_cryptodev_pmd_create_dev_name(char *name, const char *dev_name_prefix) return -1; } + +static struct { + char name[RTE_CRYPTODEV_NAME_LEN]; +} rte_cryptodev_registered_drivers[RTE_CRYPTO_MAX_DEVS]; + +static uint8_t rte_cryptodev_driver_id; + +uint8_t +rte_cryptodev_driver_id_get(const char *name) +{ + uint8_t id; + + for (id = 0; id < rte_cryptodev_driver_id; id++) + if (strcmp(name, rte_cryptodev_registered_drivers[id].name) + == 0) + return id; + return 0; +} + +char * +rte_cryptodev_driver_name_get(uint8_t driver_id) +{ + return rte_cryptodev_registered_drivers[driver_id].name; +} + +uint8_t +rte_cryptodev_allocate_driver_id(const char *name) +{ + rte_cryptodev_driver_id++; + strcpy(rte_cryptodev_registered_drivers + [rte_cryptodev_driver_id].name, name); + return rte_cryptodev_driver_id; +} diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 88aeb87..eaa7d90 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -73,21 +73,6 @@ extern "C" { #define CRYPTODEV_NAME_DPAA2_SEC_PMD cryptodev_dpaa2_sec_pmd /**< NXP DPAA2 - SEC PMD device name */ -/** Crypto device type */ -enum rte_cryptodev_type { - RTE_CRYPTODEV_NULL_PMD = 1, /**< Null crypto PMD */ - RTE_CRYPTODEV_AESNI_GCM_PMD, /**< AES-NI GCM PMD */ - RTE_CRYPTODEV_AESNI_MB_PMD, /**< AES-NI multi buffer PMD */ - RTE_CRYPTODEV_QAT_SYM_PMD, /**< QAT PMD Symmetric Crypto */ - RTE_CRYPTODEV_SNOW3G_PMD, /**< SNOW 3G PMD */ - RTE_CRYPTODEV_KASUMI_PMD, /**< KASUMI PMD */ - RTE_CRYPTODEV_ZUC_PMD, /**< ZUC PMD */ - RTE_CRYPTODEV_OPENSSL_PMD, /**< OpenSSL PMD */ - RTE_CRYPTODEV_ARMV8_PMD, /**< ARMv8 crypto PMD */ - RTE_CRYPTODEV_SCHEDULER_PMD, /**< Crypto Scheduler PMD */ - RTE_CRYPTODEV_DPAA2_SEC_PMD, /**< NXP DPAA2 - SEC PMD */ -}; - extern const char **rte_cyptodev_names; /* Logging Macros */ @@ -321,7 +306,7 @@ rte_cryptodev_get_feature_name(uint64_t flag); /** Crypto device information */ struct rte_cryptodev_info { const char *driver_name; /**< Driver name. */ - enum rte_cryptodev_type dev_type; /**< Device type */ + uint8_t driver_id; /**< Driver identifier */ struct rte_pci_device *pci_dev; /**< PCI information. */ uint64_t feature_flags; /**< Feature flags */ @@ -454,13 +439,13 @@ rte_cryptodev_count(void); /** * Get number of crypto device defined type. * - * @param type type of device. + * @param driver_id driver identifier. * * @return * Returns number of crypto device. */ extern uint8_t -rte_cryptodev_count_devtype(enum rte_cryptodev_type type); +rte_cryptodev_device_count_by_driver(uint8_t driver_id); /** * Get number and identifiers of attached crypto device. @@ -475,6 +460,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type); uint8_t rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices, uint8_t nb_devices); + /* * Return the NUMA socket to which a device is connected * @@ -732,8 +718,8 @@ struct rte_cryptodev { struct rte_device *device; /**< Backing device */ - enum rte_cryptodev_type dev_type; - /**< Crypto device type */ + uint8_t driver_id; + /**< Crypto driver identifier*/ struct rte_cryptodev_cb_list link_intr_cbs; /**< User application callback for interrupts if present */ @@ -870,8 +856,8 @@ struct rte_cryptodev_sym_session { struct { uint8_t dev_id; /**< Device Id */ - enum rte_cryptodev_type dev_type; - /** Crypto Device type session created on */ + uint8_t driver_id; + /** Crypto driver identifier session created on */ struct rte_mempool *mp; /**< Mempool session allocated from */ } __rte_aligned(8); @@ -952,6 +938,45 @@ int rte_cryptodev_queue_pair_detach_sym_session(uint16_t qp_id, struct rte_cryptodev_sym_session *session); +/** + * Provide driver identifier. + * + * @param name + * The pointer to a driver name. + * @return + * The driver type identifier or 0 if no driver found + */ +uint8_t rte_cryptodev_driver_id_get(const char *name); + +/** + * 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); + +/** + * @internal + * Allocate driver identifier. + * + * @param name + * The pointer to a driver name to be initialized. + * @return + * The driver type identifier + */ +uint8_t rte_cryptodev_allocate_driver_id(const char *name); + + +#define RTE_PMD_REGISTER_CRYPTO_DRIVER(name, driver_id)\ +RTE_INIT(init_ ##driver_id);\ +static void init_ ##driver_id(void)\ +{\ + driver_id = rte_cryptodev_allocate_driver_id(RTE_STR(name));\ +} + #ifdef __cplusplus } diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index 17ef37c..fb3972b 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -61,7 +61,7 @@ struct rte_cryptodev_session { RTE_STD_C11 struct { uint8_t dev_id; - enum rte_cryptodev_type type; + uint8_t driver_id; struct rte_mempool *mp; } __rte_aligned(8); diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 9ac510e..91f2e56 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -6,7 +6,6 @@ DPDK_16.04 { rte_cryptodev_callback_unregister; rte_cryptodev_close; rte_cryptodev_count; - rte_cryptodev_count_devtype; rte_cryptodev_configure; rte_cryptodev_create_vdev; rte_cryptodev_get_dev_id; @@ -74,3 +73,13 @@ DPDK_17.05 { rte_cryptodev_queue_pair_detach_sym_session; } DPDK_17.02; + +DPDK_17.08 { + global: + + rte_cryptodev_allocate_driver_id; + rte_cryptodev_device_count_by_driver; + rte_cryptodev_driver_id_get; + rte_cryptodev_driver_name_get; + +} DPDK_17.05; diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 029ce8a..d1384ef 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -60,7 +60,7 @@ #include "test_cryptodev_gcm_test_vectors.h" #include "test_cryptodev_hmac_test_vectors.h" -static enum rte_cryptodev_type gbl_cryptodev_type; +static uint8_t gbl_driver_id; struct crypto_testsuite_params { struct rte_mempool *mbuf_pool; @@ -210,14 +210,16 @@ testsuite_setup(void) } /* Create an AESNI MB device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) { #ifndef RTE_LIBRTE_PMD_AESNI_MB RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_AESNI_MB_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL); @@ -230,14 +232,16 @@ testsuite_setup(void) } /* Create an AESNI GCM device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_GCM_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) { #ifndef RTE_LIBRTE_PMD_AESNI_GCM RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_AESNI_GCM_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))); if (nb_devs < 1) { TEST_ASSERT_SUCCESS(rte_vdev_init( RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL), @@ -248,13 +252,16 @@ testsuite_setup(void) } /* Create a SNOW 3G device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_SNOW3G_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) { #ifndef RTE_LIBRTE_PMD_SNOW3G RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))); if (nb_devs < 1) { TEST_ASSERT_SUCCESS(rte_vdev_init( RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL), @@ -265,13 +272,16 @@ testsuite_setup(void) } /* Create a KASUMI device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_KASUMI_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_KASUMI_PMD))) { #ifndef RTE_LIBRTE_PMD_KASUMI RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_KASUMI must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_KASUMI_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_KASUMI_PMD))); if (nb_devs < 1) { TEST_ASSERT_SUCCESS(rte_vdev_init( RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL), @@ -282,13 +292,16 @@ testsuite_setup(void) } /* Create a ZUC device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_ZUC_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ZUC_PMD))) { #ifndef RTE_LIBRTE_PMD_ZUC RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ZUC must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_ZUC_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ZUC_PMD))); if (nb_devs < 1) { TEST_ASSERT_SUCCESS(rte_vdev_init( RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL), @@ -299,14 +312,16 @@ testsuite_setup(void) } /* Create a NULL device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_NULL_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD))) { #ifndef RTE_LIBRTE_PMD_NULL_CRYPTO RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_NULL_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL); @@ -319,14 +334,16 @@ testsuite_setup(void) } /* Create an OPENSSL device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_OPENSSL_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) { #ifndef RTE_LIBRTE_PMD_OPENSSL RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_OPENSSL_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD), @@ -339,14 +356,16 @@ testsuite_setup(void) } /* Create a ARMv8 device if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_ARMV8_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) { #ifndef RTE_LIBRTE_PMD_ARMV8_CRYPTO RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_ARMV8_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_ARMV8_PMD), @@ -359,15 +378,17 @@ testsuite_setup(void) } #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER - if (gbl_cryptodev_type == RTE_CRYPTODEV_SCHEDULER_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD))) { #ifndef RTE_LIBRTE_PMD_AESNI_MB RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_SCHEDULER_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD), @@ -382,7 +403,8 @@ testsuite_setup(void) #endif /* RTE_LIBRTE_PMD_CRYPTO_SCHEDULER */ #ifndef RTE_LIBRTE_PMD_QAT - if (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))) { RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled " "in config file to run this testsuite.\n"); return TEST_FAILED; @@ -398,7 +420,7 @@ testsuite_setup(void) /* Create list of valid crypto devs */ for (i = 0; i < nb_devs; i++) { rte_cryptodev_info_get(i, &info); - if (info.dev_type == gbl_cryptodev_type) + if (info.driver_id == gbl_driver_id) ts_params->valid_devs[ts_params->valid_dev_count++] = i; } @@ -1341,7 +1363,8 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) TEST_ASSERT_BUFFERS_ARE_EQUAL(digest, catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, - gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ? + gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) ? TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 : DIGEST_BYTE_LENGTH_SHA1, "Generated digest data not as expected"); @@ -1506,7 +1529,8 @@ test_AES_cipheronly_mb_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_AESNI_MB_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)), BLKCIPHER_AES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1522,7 +1546,8 @@ test_AES_docsis_mb_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_AESNI_MB_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)), BLKCIPHER_AES_DOCSIS_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1538,7 +1563,8 @@ test_AES_docsis_qat_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_QAT_SYM_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)), BLKCIPHER_AES_DOCSIS_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1554,7 +1580,8 @@ test_DES_docsis_qat_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_QAT_SYM_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)), BLKCIPHER_DES_DOCSIS_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1570,7 +1597,8 @@ test_authonly_mb_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_AESNI_MB_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)), BLKCIPHER_AUTHONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1586,7 +1614,8 @@ test_AES_chain_mb_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_AESNI_MB_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)), BLKCIPHER_AES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1604,7 +1633,8 @@ test_AES_cipheronly_scheduler_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_SCHEDULER_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)), BLKCIPHER_AES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1620,7 +1650,8 @@ test_AES_chain_scheduler_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_SCHEDULER_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)), BLKCIPHER_AES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1636,7 +1667,8 @@ test_authonly_scheduler_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_SCHEDULER_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)), BLKCIPHER_AUTHONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1654,7 +1686,8 @@ test_AES_chain_openssl_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_OPENSSL_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)), BLKCIPHER_AES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1670,7 +1703,8 @@ test_AES_cipheronly_openssl_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_OPENSSL_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)), BLKCIPHER_AES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1686,7 +1720,8 @@ test_AES_chain_qat_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_QAT_SYM_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)), BLKCIPHER_AES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1702,7 +1737,8 @@ test_AES_cipheronly_qat_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_QAT_SYM_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)), BLKCIPHER_AES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1718,7 +1754,8 @@ test_AES_chain_dpaa2_sec_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_DPAA2_SEC_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)), BLKCIPHER_AES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1734,7 +1771,8 @@ test_AES_cipheronly_dpaa2_sec_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_DPAA2_SEC_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)), BLKCIPHER_AES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1750,7 +1788,8 @@ test_authonly_openssl_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_OPENSSL_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)), BLKCIPHER_AUTHONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1766,7 +1805,8 @@ test_AES_chain_armv8_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_ARMV8_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)), BLKCIPHER_AES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4691,7 +4731,8 @@ test_3DES_chain_qat_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_QAT_SYM_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)), BLKCIPHER_3DES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4707,7 +4748,8 @@ test_DES_cipheronly_qat_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_QAT_SYM_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)), BLKCIPHER_DES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4723,7 +4765,8 @@ test_DES_docsis_openssl_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_OPENSSL_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)), BLKCIPHER_DES_DOCSIS_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4739,7 +4782,8 @@ test_3DES_chain_dpaa2_sec_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_DPAA2_SEC_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)), BLKCIPHER_3DES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4755,7 +4799,8 @@ test_3DES_cipheronly_dpaa2_sec_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_DPAA2_SEC_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)), BLKCIPHER_3DES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4771,7 +4816,8 @@ test_3DES_cipheronly_qat_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_QAT_SYM_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)), BLKCIPHER_3DES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4787,7 +4833,8 @@ test_3DES_chain_openssl_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_OPENSSL_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)), BLKCIPHER_3DES_CHAIN_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -4803,7 +4850,8 @@ test_3DES_cipheronly_openssl_all(void) status = test_blockcipher_all_tests(ts_params->mbuf_pool, ts_params->op_mpool, ts_params->valid_devs[0], - RTE_CRYPTODEV_OPENSSL_PMD, + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)), BLKCIPHER_3DES_CIPHERONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -7818,8 +7866,9 @@ test_scheduler_attach_slave_op(void) char vdev_name[32]; /* create 2 AESNI_MB if necessary */ - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_AESNI_MB_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))); if (nb_devs < 2) { for (i = nb_devs; i < 2; i++) { snprintf(vdev_name, sizeof(vdev_name), "%s_%u", @@ -7840,7 +7889,8 @@ test_scheduler_attach_slave_op(void) struct rte_cryptodev_info info; rte_cryptodev_info_get(i, &info); - if (info.dev_type != RTE_CRYPTODEV_AESNI_MB_PMD) + if (info.driver_id != rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) continue; ret = rte_cryptodev_scheduler_slave_attach(sched_id, @@ -8607,14 +8657,16 @@ static struct unit_test_suite cryptodev_armv8_testsuite = { static int test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_type = RTE_CRYPTODEV_QAT_SYM_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); return unit_test_suite_runner(&cryptodev_qat_testsuite); } static int test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_type = RTE_CRYPTODEV_AESNI_MB_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); return unit_test_suite_runner(&cryptodev_aesni_mb_testsuite); } @@ -8622,7 +8674,8 @@ test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/) static int test_cryptodev_openssl(void) { - gbl_cryptodev_type = RTE_CRYPTODEV_OPENSSL_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)); return unit_test_suite_runner(&cryptodev_openssl_testsuite); } @@ -8630,7 +8683,8 @@ test_cryptodev_openssl(void) static int test_cryptodev_aesni_gcm(void) { - gbl_cryptodev_type = RTE_CRYPTODEV_AESNI_GCM_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)); return unit_test_suite_runner(&cryptodev_aesni_gcm_testsuite); } @@ -8638,7 +8692,8 @@ test_cryptodev_aesni_gcm(void) static int test_cryptodev_null(void) { - gbl_cryptodev_type = RTE_CRYPTODEV_NULL_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)); return unit_test_suite_runner(&cryptodev_null_testsuite); } @@ -8646,7 +8701,8 @@ test_cryptodev_null(void) static int test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_type = RTE_CRYPTODEV_SNOW3G_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)); return unit_test_suite_runner(&cryptodev_sw_snow3g_testsuite); } @@ -8654,7 +8710,8 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/) static int test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_type = RTE_CRYPTODEV_KASUMI_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_KASUMI_PMD)); return unit_test_suite_runner(&cryptodev_sw_kasumi_testsuite); } @@ -8662,7 +8719,8 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/) static int test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_type = RTE_CRYPTODEV_ZUC_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ZUC_PMD)); return unit_test_suite_runner(&cryptodev_sw_zuc_testsuite); } @@ -8670,7 +8728,8 @@ test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/) static int test_cryptodev_armv8(void) { - gbl_cryptodev_type = RTE_CRYPTODEV_ARMV8_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)); return unit_test_suite_runner(&cryptodev_armv8_testsuite); } @@ -8680,7 +8739,8 @@ test_cryptodev_armv8(void) static int test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_type = RTE_CRYPTODEV_SCHEDULER_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)); return unit_test_suite_runner(&cryptodev_scheduler_testsuite); } @@ -8691,7 +8751,8 @@ REGISTER_TEST_COMMAND(cryptodev_scheduler_autotest, test_cryptodev_scheduler); static int test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_type = RTE_CRYPTODEV_DPAA2_SEC_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite); } diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c index 603c776..c2c140a 100644 --- a/test/test/test_cryptodev_blockcipher.c +++ b/test/test/test_cryptodev_blockcipher.c @@ -53,7 +53,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, struct rte_mempool *mbuf_pool, struct rte_mempool *op_mpool, uint8_t dev_id, - enum rte_cryptodev_type cryptodev_type, + uint8_t driver_id, char *test_msg) { struct rte_mbuf *ibuf = NULL; @@ -79,6 +79,17 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, uint8_t tmp_src_buf[MBUF_SIZE]; uint8_t tmp_dst_buf[MBUF_SIZE]; + uint8_t openssl_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)); + uint8_t scheduler_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)); + uint8_t armv8_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)); + uint8_t aesni_mb_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); + uint8_t qat_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); + int nb_segs = 1; if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) { @@ -99,17 +110,14 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, memcpy(auth_key, tdata->auth_key.data, tdata->auth_key.len); - switch (cryptodev_type) { - case RTE_CRYPTODEV_QAT_SYM_PMD: - case RTE_CRYPTODEV_OPENSSL_PMD: - case RTE_CRYPTODEV_ARMV8_PMD: /* Fall through */ + if (driver_id == qat_pmd || + driver_id == openssl_pmd || + driver_id == armv8_pmd) { /* Fall through */ digest_len = tdata->digest.len; - break; - case RTE_CRYPTODEV_AESNI_MB_PMD: - case RTE_CRYPTODEV_SCHEDULER_PMD: + } else if (driver_id == aesni_mb_pmd || + driver_id == scheduler_pmd) { digest_len = tdata->digest.truncated_len; - break; - default: + } else { snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u FAILED: %s", __LINE__, "Unsupported PMD type"); @@ -592,7 +600,7 @@ int test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, struct rte_mempool *op_mpool, uint8_t dev_id, - enum rte_cryptodev_type cryptodev_type, + uint8_t driver_id, enum blockcipher_test_type test_type) { int status, overall_status = TEST_SUCCESS; @@ -602,6 +610,19 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, uint32_t target_pmd_mask = 0; const struct blockcipher_test_case *tcs = NULL; + uint8_t openssl_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)); + uint8_t dpaa2_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); + uint8_t scheduler_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)); + uint8_t armv8_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)); + uint8_t aesni_mb_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); + uint8_t qat_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); + switch (test_type) { case BLKCIPHER_AES_CHAIN_TYPE: n_test_cases = sizeof(aes_chain_test_cases) / @@ -647,29 +668,20 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, break; } - switch (cryptodev_type) { - case RTE_CRYPTODEV_AESNI_MB_PMD: + if (driver_id == aesni_mb_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB; - break; - case RTE_CRYPTODEV_QAT_SYM_PMD: + else if (driver_id == qat_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT; - break; - case RTE_CRYPTODEV_OPENSSL_PMD: + else if (driver_id == openssl_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL; - break; - case RTE_CRYPTODEV_ARMV8_PMD: + else if (driver_id == armv8_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8; - break; - case RTE_CRYPTODEV_SCHEDULER_PMD: + else if (driver_id == scheduler_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER; - break; - case RTE_CRYPTODEV_DPAA2_SEC_PMD: + else if (driver_id == dpaa2_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC; - break; - default: + else TEST_ASSERT(0, "Unrecognized cryptodev type"); - break; - } for (i = 0; i < n_test_cases; i++) { const struct blockcipher_test_case *tc = &tcs[i]; @@ -678,7 +690,7 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, continue; status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool, - dev_id, cryptodev_type, test_msg); + dev_id, driver_id, test_msg); printf(" %u) TestCase %s %s\n", test_index ++, tc->test_descr, test_msg); diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h index 004122f..f5058ef 100644 --- a/test/test/test_cryptodev_blockcipher.h +++ b/test/test/test_cryptodev_blockcipher.h @@ -126,7 +126,7 @@ int test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, struct rte_mempool *op_mpool, uint8_t dev_id, - enum rte_cryptodev_type cryptodev_type, + uint8_t driver_id, enum blockcipher_test_type test_type); #endif /* TEST_CRYPTODEV_BLOCKCIPHER_H_ */ diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c index d60028d..e943e6b 100644 --- a/test/test/test_cryptodev_perf.c +++ b/test/test/test_cryptodev_perf.c @@ -195,23 +195,35 @@ static const char *chain_mode_name(enum chain_mode mode) } } -static const char *pmd_name(enum rte_cryptodev_type pmd) +static const char *pmd_name(uint8_t driver_id) { - switch (pmd) { - case RTE_CRYPTODEV_NULL_PMD: return RTE_STR(CRYPTODEV_NAME_NULL_PMD); break; - case RTE_CRYPTODEV_AESNI_GCM_PMD: + uint8_t null_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)); + uint8_t dpaa2_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); + uint8_t snow3g_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)); + uint8_t aesni_gcm_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)); + uint8_t aesni_mb_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); + uint8_t qat_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); + + if (driver_id == null_pmd) + return RTE_STR(CRYPTODEV_NAME_NULL_PMD); + else if (driver_id == aesni_gcm_pmd) return RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD); - case RTE_CRYPTODEV_AESNI_MB_PMD: + else if (driver_id == aesni_mb_pmd) return RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD); - case RTE_CRYPTODEV_QAT_SYM_PMD: + else if (driver_id == qat_pmd) return RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD); - case RTE_CRYPTODEV_SNOW3G_PMD: + else if (driver_id == snow3g_pmd) return RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD); - case RTE_CRYPTODEV_DPAA2_SEC_PMD: + else if (driver_id == dpaa2_pmd) return RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD); - default: + else return ""; - } } static const char *cipher_algo_name(enum rte_crypto_cipher_algorithm cipher_algo) @@ -287,7 +299,7 @@ setup_test_string(struct rte_mempool *mpool, static struct crypto_testsuite_params testsuite_params = { NULL }; static struct crypto_unittest_params unittest_params; -static enum rte_cryptodev_type gbl_cryptodev_perftest_devtype; +static uint8_t gbl_driver_id; static int testsuite_setup(void) @@ -324,13 +336,16 @@ testsuite_setup(void) } /* Create an AESNI MB device if required */ - if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) { #ifndef RTE_LIBRTE_PMD_AESNI_MB RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL); @@ -342,13 +357,16 @@ testsuite_setup(void) } /* Create an AESNI GCM device if required */ - if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_GCM_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) { #ifndef RTE_LIBRTE_PMD_AESNI_GCM RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_GCM_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL); @@ -360,13 +378,16 @@ testsuite_setup(void) } /* Create a SNOW3G device if required */ - if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_SNOW3G_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) { #ifndef RTE_LIBRTE_PMD_SNOW3G RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL); @@ -378,14 +399,16 @@ testsuite_setup(void) } /* Create an OPENSSL device if required */ - if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_OPENSSL_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) { #ifndef RTE_LIBRTE_PMD_OPENSSL RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_OPENSSL_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD), @@ -398,14 +421,16 @@ testsuite_setup(void) } /* Create an ARMv8 device if required */ - if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_ARMV8_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) { #ifndef RTE_LIBRTE_PMD_ARMV8_CRYPTO RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif - nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_ARMV8_PMD); + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))); if (nb_devs < 1) { ret = rte_vdev_init( RTE_STR(CRYPTODEV_NAME_ARMV8_PMD), @@ -418,7 +443,8 @@ testsuite_setup(void) } #ifndef RTE_LIBRTE_PMD_QAT - if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))) { RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled " "in config file to run this testsuite.\n"); return TEST_FAILED; @@ -434,7 +460,7 @@ testsuite_setup(void) /* Search for the first valid */ for (i = 0; i < nb_devs; i++) { rte_cryptodev_info_get(i, &info); - if (info.dev_type == gbl_cryptodev_perftest_devtype) { + if (info.driver_id == gbl_driver_id) { ts_params->dev_id = i; valid_dev_id = 1; break; @@ -2093,8 +2119,9 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num) } while (num_received != num_to_submit) { - if (gbl_cryptodev_perftest_devtype == - RTE_CRYPTODEV_AESNI_MB_PMD) + if (gbl_driver_id == + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) rte_cryptodev_enqueue_burst(dev_num, 0, NULL, 0); @@ -2165,7 +2192,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams) printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, " "Packet Size %u bytes", - pmd_name(gbl_cryptodev_perftest_devtype), + pmd_name(gbl_driver_id), ts_params->dev_id, 0, chain_mode_name(pparams->chain), cipher_algo_name(pparams->cipher_algo), @@ -2209,8 +2236,9 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams) } while (num_ops_received != num_to_submit) { - if (gbl_cryptodev_perftest_devtype == - RTE_CRYPTODEV_AESNI_MB_PMD) + if (gbl_driver_id == + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) rte_cryptodev_enqueue_burst(ts_params->dev_id, 0, NULL, 0); start_cycles = rte_rdtsc_precise(); @@ -2360,7 +2388,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams) printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, " "auth_algo:%s, Packet Size %u bytes", - pmd_name(gbl_cryptodev_perftest_devtype), + pmd_name(gbl_driver_id), ts_params->dev_id, 0, chain_mode_name(pparams->chain), cipher_algo_name(pparams->cipher_algo), @@ -2495,7 +2523,7 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams) printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, " "auth_algo:%s, Packet Size %u bytes", - pmd_name(gbl_cryptodev_perftest_devtype), + pmd_name(gbl_driver_id), ts_params->dev_id, 0, chain_mode_name(pparams->chain), cipher_algo_name(pparams->cipher_algo), @@ -3410,7 +3438,8 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id, double cycles_B = cycles_buff / pparams->buf_size; double throughput = (ops_s * pparams->buf_size * 8) / 1000000; - if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))) { /* Cycle count misleading on HW devices for this test, so don't print */ printf("%4u\t%6.2f\t%10.2f\t n/a \t\t n/a " "\t\t n/a \t\t%8"PRIu64"\t%8"PRIu64, @@ -3845,7 +3874,7 @@ test_perf_snow3G_vary_pkt_size(void) for (k = 0; k < RTE_DIM(burst_sizes); k++) { printf("\nOn %s dev%u qp%u, %s, " "cipher algo:%s, auth algo:%s, burst_size: %d ops", - pmd_name(gbl_cryptodev_perftest_devtype), + pmd_name(gbl_driver_id), testsuite_params.dev_id, 0, chain_mode_name(params_set[i].chain), cipher_algo_name(params_set[i].cipher_algo), @@ -4726,7 +4755,8 @@ static struct unit_test_suite cryptodev_armv8_testsuite = { static int perftest_aesni_gcm_cryptodev(void) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_GCM_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)); return unit_test_suite_runner(&cryptodev_gcm_testsuite); } @@ -4734,7 +4764,8 @@ perftest_aesni_gcm_cryptodev(void) static int perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_MB_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); return unit_test_suite_runner(&cryptodev_aes_testsuite); } @@ -4742,7 +4773,8 @@ perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) static int perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); return unit_test_suite_runner(&cryptodev_testsuite); } @@ -4750,7 +4782,8 @@ perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) static int perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_SNOW3G_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)); return unit_test_suite_runner(&cryptodev_snow3g_testsuite); } @@ -4758,7 +4791,8 @@ perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) static int perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); return unit_test_suite_runner(&cryptodev_snow3g_testsuite); } @@ -4766,7 +4800,8 @@ perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) static int perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_OPENSSL_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)); return unit_test_suite_runner(&cryptodev_openssl_testsuite); } @@ -4774,7 +4809,8 @@ perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) static int perftest_qat_continual_cryptodev(void) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); return unit_test_suite_runner(&cryptodev_qat_continual_testsuite); } @@ -4782,7 +4818,8 @@ perftest_qat_continual_cryptodev(void) static int perftest_sw_armv8_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_ARMV8_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)); return unit_test_suite_runner(&cryptodev_armv8_testsuite); } @@ -4790,7 +4827,8 @@ perftest_sw_armv8_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) static int perftest_dpaa2_sec_cryptodev(void) { - gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_DPAA2_SEC_PMD; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite); } -- 2.5.0