cryptodev: remove crypto device type enumeration
authorSlawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Fri, 30 Jun 2017 14:34:21 +0000 (15:34 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 6 Jul 2017 20:34:20 +0000 (22:34 +0200)
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@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
35 files changed:
doc/guides/prog_guide/cryptodev_lib.rst
doc/guides/rel_notes/deprecation.rst
doc/guides/rel_notes/release_17_08.rst
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
drivers/crypto/armv8/rte_armv8_pmd.c
drivers/crypto/armv8/rte_armv8_pmd_ops.c
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
drivers/crypto/kasumi/rte_kasumi_pmd.c
drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
drivers/crypto/null/null_crypto_pmd.c
drivers/crypto/null/null_crypto_pmd_ops.c
drivers/crypto/openssl/rte_openssl_pmd.c
drivers/crypto/openssl/rte_openssl_pmd_ops.c
drivers/crypto/qat/qat_crypto.c
drivers/crypto/qat/qat_crypto.h
drivers/crypto/qat/rte_qat_cryptodev.c
drivers/crypto/scheduler/rte_cryptodev_scheduler.c
drivers/crypto/scheduler/scheduler_pmd.c
drivers/crypto/scheduler/scheduler_pmd_ops.c
drivers/crypto/scheduler/scheduler_pmd_private.h
drivers/crypto/snow3g/rte_snow3g_pmd.c
drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
drivers/crypto/zuc/rte_zuc_pmd.c
drivers/crypto/zuc/rte_zuc_pmd_ops.c
lib/librte_cryptodev/rte_cryptodev.c
lib/librte_cryptodev/rte_cryptodev.h
lib/librte_cryptodev/rte_cryptodev_pmd.h
lib/librte_cryptodev/rte_cryptodev_version.map
test/test/test_cryptodev.c
test/test/test_cryptodev_blockcipher.c
test/test/test_cryptodev_blockcipher.h
test/test/test_cryptodev_perf.c

index f250c00..8feaece 100644 (file)
@@ -293,7 +293,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;
@@ -452,7 +452,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
index 511a898..042d4d7 100644 (file)
@@ -57,22 +57,10 @@ Deprecation Notices
 * cryptodev: All PMD names definitions will be moved to the individual PMDs
   in 17.08.
 
-* cryptodev: The following changes will be done in in 17.08:
-
-  - the device type enumeration ``rte_cryptodev_type`` will be removed
-  - the following structures will be changed: ``rte_cryptodev_session``,
-    ``rte_cryptodev_sym_session``, ``rte_cryptodev_info``, ``rte_cryptodev``
-  - the function ``rte_cryptodev_count_devtype`` will be replaced by
-    ``rte_cryptodev_device_count_by_driver``
-
 * cryptodev: API changes are planned for 17.08 for the sessions management
   to make it agnostic to the underlying devices, removing coupling with
   crypto PMDs, so a single session can be used on multiple devices.
 
-  - ``struct rte_cryptodev_sym_session``, dev_id, dev_type will be removed,
-    _private field changed to the indirect array of private data pointers of
-    all supported devices
-
   An API of followed functions will be changed to allow operate on multiple
   devices with one session:
 
index 24a2679..63f5530 100644 (file)
@@ -113,6 +113,7 @@ New Features
   * Added AEAD algorithm specific functions and structures, so it is not
     necessary to use a combination of cipher and authentication
     structures anymore.
+  * Added helper functions for crypto device driver identification.
 
 * **Updated dpaa2_sec crypto PMD.**
 
@@ -201,6 +202,15 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =========================================================
 
+* **Reworked rte_cryptodev library.**
+
+  The rte_cryptodev library has been reworked and updated. The following changes
+  have been made to it:
+
+  * The crypto device type enumeration has been removed from cryptodev library.
+  * The function ``rte_crypto_count_devtype()`` has been removed, and replaced
+    by the new function ``rte_crypto_count_by_driver()``.
+
 
 ABI Changes
 -----------
@@ -231,6 +241,10 @@ ABI Changes
   * Changed field size of digest length from uint32_t to uint16_t.
   * Removed AAD length.
 
+* Replaced ``dev_type`` enumeration with uint8_t ``driver_id`` in
+  ``rte_cryptodev_info``, ``rte_cryptodev`` and ``rte_cryptodev_sym_session``
+  structures.
+
 
 Shared Library Versions
 -----------------------
index 806df92..1ef83fa 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "aesni_gcm_pmd_private.h"
 
+static uint8_t cryptodev_driver_id;
 
 /** Parse crypto xform chain and set private session parameters */
 int
@@ -154,8 +155,8 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
        struct rte_crypto_sym_op *sym_op = op->sym;
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-               if (unlikely(sym_op->session->dev_type
-                                       != RTE_CRYPTODEV_AESNI_GCM_PMD))
+               if (unlikely(sym_op->session->driver_id !=
+                               cryptodev_driver_id))
                        return sess;
 
                sess = (struct aesni_gcm_session *)sym_op->session->_private;
@@ -521,7 +522,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 */
@@ -620,3 +621,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(aesni_gcm_pmd_drv, cryptodev_driver_id);
index ddc4c30..85c7485 100644 (file)
@@ -167,7 +167,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;
 
index 8a96fec..4dab849 100644 (file)
@@ -41,6 +41,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);
 
@@ -353,8 +355,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
        struct aesni_mb_session *sess = NULL;
 
        if (op->sess_type == RTE_CRYPTO_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;
                }
 
@@ -707,7 +709,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 */
@@ -808,3 +810,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_MB_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_aesni_mb_pmd_drv, cryptodev_driver_id);
index ad32bf9..b5abb6c 100644 (file)
@@ -328,7 +328,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;
index 4a23ff1..7cce09f 100644 (file)
@@ -45,6 +45,8 @@
 
 #include "rte_armv8_pmd_private.h"
 
+static uint8_t cryptodev_driver_id;
+
 static int cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev);
 
 /**
@@ -554,8 +556,8 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
        if (op->sess_type == RTE_CRYPTO_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;
                }
@@ -818,7 +820,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 */
@@ -908,3 +910,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_ARMV8_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(armv8_crypto_drv, cryptodev_driver_id);
index 78ed770..1bce2ea 100644 (file)
@@ -180,7 +180,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;
index a708122..6bfa812 100644 (file)
@@ -76,6 +76,8 @@
 
 enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8;
 
+static uint8_t cryptodev_driver_id;
+
 static inline int
 build_authenc_gcm_fd(dpaa2_sec_session *sess,
                     struct rte_crypto_op *op,
@@ -1689,7 +1691,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;
        }
 }
 
@@ -1819,7 +1821,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;
@@ -1977,3 +1979,4 @@ static struct rte_dpaa2_driver rte_dpaa2_sec_driver = {
 };
 
 RTE_PMD_REGISTER_DPAA2(CRYPTODEV_NAME_DPAA2_SEC_PMD, rte_dpaa2_sec_driver);
+RTE_PMD_REGISTER_CRYPTO_DRIVER(rte_dpaa2_sec_driver, cryptodev_driver_id);
index 615a8ca..6c8da17 100644 (file)
@@ -48,6 +48,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)
@@ -164,8 +166,8 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
        struct kasumi_session *sess;
 
        if (op->sess_type == RTE_CRYPTO_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,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_kasumi_pmd_drv, cryptodev_driver_id);
index d4a02d8..5cb0024 100644 (file)
@@ -157,7 +157,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;
index 39dffea..84280ae 100644 (file)
@@ -39,6 +39,8 @@
 
 #include "null_crypto_pmd_private.h"
 
+static uint8_t cryptodev_driver_id;
+
 /** verify and set session parameters */
 int
 null_crypto_set_session_parameters(
@@ -97,7 +99,8 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
                if (unlikely(sym_op->session == NULL ||
-                            sym_op->session->dev_type != RTE_CRYPTODEV_NULL_PMD))
+                               sym_op->session->driver_id !=
+                                       cryptodev_driver_id))
                        return NULL;
 
                sess = (struct null_crypto_session *)sym_op->session->_private;
@@ -187,7 +190,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 */
@@ -272,3 +275,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_null_pmd_drv, cryptodev_driver_id);
index 3c943ee..a3f2e4c 100644 (file)
@@ -148,7 +148,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;
index f86cc10..d497a27 100644 (file)
@@ -45,6 +45,8 @@
 
 #define DES_BLOCK_SIZE 8
 
+static uint8_t cryptodev_driver_id;
+
 static int cryptodev_openssl_remove(struct rte_vdev_device *vdev);
 
 /*----------------------------------------------------------------------------*/
@@ -557,8 +559,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
        if (op->sess_type == RTE_CRYPTO_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  {
@@ -1404,7 +1406,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 */
@@ -1493,3 +1495,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_OPENSSL_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_openssl_pmd_drv, cryptodev_driver_id);
index 3a58eea..6093b61 100644 (file)
@@ -533,7 +533,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;
index e075076..e2c8e43 100644 (file)
@@ -1072,7 +1072,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;
        }
@@ -1433,7 +1434,7 @@ void qat_dev_info_get(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;
                info->pci_dev = RTE_DEV_TO_PCI(dev->device);
        }
 }
index f76f3ca..4151456 100644 (file)
@@ -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);
index 78d50fb..1c5ff77 100644 (file)
@@ -40,6 +40,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(struct rte_cryptodev *cryptodev)
                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;
@@ -168,4 +170,4 @@ static struct rte_pci_driver rte_qat_pmd = {
 
 RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
-
+RTE_PMD_REGISTER_CRYPTO_DRIVER(rte_qat_pmd, cryptodev_qat_driver_id);
index 95566d5..9c364c2 100644 (file)
@@ -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_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_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_driver_id) {
                CS_LOG_ERR("Operation not supported");
                return -ENOTSUP;
        }
@@ -370,7 +370,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_driver_id) {
                CS_LOG_ERR("Operation not supported");
                return -ENOTSUP;
        }
@@ -392,7 +392,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_driver_id) {
                CS_LOG_ERR("Operation not supported");
                return -ENOTSUP;
        }
@@ -420,7 +420,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_driver_id) {
                CS_LOG_ERR("Operation not supported");
                return -ENOTSUP;
        }
@@ -442,7 +442,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_driver_id) {
                CS_LOG_ERR("Operation not supported");
                return -ENOTSUP;
        }
@@ -499,7 +499,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_driver_id) {
                CS_LOG_ERR("Operation not supported");
                return -ENOTSUP;
        }
@@ -567,7 +567,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_driver_id) {
                CS_LOG_ERR("Operation not supported");
                return -ENOTSUP;
        }
index fefd6cc..b385851 100644 (file)
@@ -42,6 +42,8 @@
 #include "rte_cryptodev_scheduler.h"
 #include "scheduler_pmd_private.h"
 
+uint8_t cryptodev_driver_id;
+
 struct scheduler_init_params {
        struct rte_crypto_vdev_init_params def_p;
        uint32_t nb_slaves;
@@ -113,7 +115,7 @@ cryptodev_scheduler_create(const char *name,
                return -EFAULT;
        }
 
-       dev->dev_type = RTE_CRYPTODEV_SCHEDULER_PMD;
+       dev->driver_id = cryptodev_driver_id;
        dev->dev_ops = rte_crypto_scheduler_pmd_ops;
 
        sched_ctx = dev->data->dev_private;
@@ -436,3 +438,5 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SCHEDULER_PMD,
        "max_nb_sessions=<int> "
        "socket_id=<int> "
        "slave=<name>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_scheduler_pmd_drv,
+               cryptodev_driver_id);
index 4fc8b91..90e3734 100644 (file)
@@ -369,7 +369,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;
index 05a5916..efb2bbc 100644 (file)
@@ -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_driver_id;
+
 static __rte_always_inline uint16_t
 get_max_enqueue_order_count(struct rte_ring *order_ring, uint16_t nb_ops)
 {
index 8ada08f..18b6f86 100644 (file)
@@ -47,6 +47,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)
@@ -164,8 +166,8 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
        struct snow3g_session *sess;
 
        if (op->sess_type == RTE_CRYPTO_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;
@@ -562,7 +564,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. */
@@ -646,3 +648,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SNOW3G_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_snow3g_pmd_drv, cryptodev_driver_id);
index 3f02683..e3fa0fa 100644 (file)
@@ -157,7 +157,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;
index 2e8eaeb..7d2e37c 100644 (file)
@@ -46,6 +46,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)
@@ -163,8 +165,8 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
        struct zuc_session *sess;
 
        if (op->sess_type == RTE_CRYPTO_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;
@@ -468,7 +470,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. */
@@ -551,3 +553,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_ZUC_PMD,
        "max_nb_queue_pairs=<int> "
        "max_nb_sessions=<int> "
        "socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_zuc_pmd_drv, cryptodev_driver_id);
index 4775787..abfa0e2 100644 (file)
@@ -157,7 +157,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;
index 497f9ce..107632b 100644 (file)
@@ -452,12 +452,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++;
@@ -1101,7 +1101,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)
@@ -1268,7 +1268,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 */
@@ -1380,3 +1380,60 @@ rte_cryptodev_pmd_create_dev_name(char *name, const char *dev_name_prefix)
 
        return -1;
 }
+
+TAILQ_HEAD(cryptodev_driver_list, cryptodev_driver);
+
+static struct cryptodev_driver_list cryptodev_driver_list =
+       TAILQ_HEAD_INITIALIZER(cryptodev_driver_list);
+
+struct cryptodev_driver {
+       TAILQ_ENTRY(cryptodev_driver) next; /**< Next in list. */
+       const struct rte_driver *driver;
+       uint8_t id;
+};
+
+static uint8_t nb_drivers;
+
+int
+rte_cryptodev_driver_id_get(const char *name)
+{
+       struct cryptodev_driver *driver;
+       const char *driver_name;
+
+       if (name == NULL) {
+               RTE_LOG(DEBUG, CRYPTODEV, "name pointer NULL");
+               return -1;
+       }
+
+       TAILQ_FOREACH(driver, &cryptodev_driver_list, next) {
+               driver_name = driver->driver->name;
+               if (strncmp(driver_name, name, strlen(driver_name)) == 0)
+                       return driver->id;
+       }
+       return -1;
+}
+
+const char *
+rte_cryptodev_driver_name_get(uint8_t driver_id)
+{
+       struct cryptodev_driver *driver;
+
+       TAILQ_FOREACH(driver, &cryptodev_driver_list, next)
+               if (driver->id == driver_id)
+                       return driver->driver->name;
+       return NULL;
+}
+
+uint8_t
+rte_cryptodev_allocate_driver(const struct rte_driver *drv)
+{
+       struct cryptodev_driver *driver;
+
+       driver = malloc(sizeof(*driver));
+       driver->driver = drv;
+       driver->id = nb_drivers;
+
+       TAILQ_INSERT_TAIL(&cryptodev_driver_list, driver, next);
+
+       return nb_drivers++;
+}
index bd422fd..9c2a373 100644 (file)
@@ -74,21 +74,6 @@ extern "C" {
 #define CRYPTODEV_NAME_DPAA2_SEC_PMD   crypto_dpaa2_sec
 /**< 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 */
@@ -408,7 +393,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 */
@@ -512,13 +497,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 devices that
@@ -789,8 +774,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 */
@@ -927,8 +912,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);
@@ -1009,6 +994,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 -1 if no driver found
+ */
+int 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
+ */
+const char *rte_cryptodev_driver_name_get(uint8_t driver_id);
+
+/**
+ * @internal
+ * Allocate Cryptodev driver.
+ *
+ * @param driver
+ *   Pointer to rte_driver.
+ * @return
+ *  The driver type identifier
+ */
+uint8_t rte_cryptodev_allocate_driver(const struct rte_driver *driver);
+
+
+#define RTE_PMD_REGISTER_CRYPTO_DRIVER(drv, driver_id)\
+RTE_INIT(init_ ##driver_id);\
+static void init_ ##driver_id(void)\
+{\
+       driver_id = rte_cryptodev_allocate_driver(&(drv).driver);\
+}
+
 
 #ifdef __cplusplus
 }
index 8e8b2ad..f6aa84d 100644 (file)
@@ -60,7 +60,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);
 
index ea0b561..3ad7581 100644 (file)
@@ -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;
@@ -62,6 +61,10 @@ DPDK_17.05 {
 DPDK_17.08 {
        global:
 
+       rte_cryptodev_allocate_driver;
+       rte_cryptodev_device_count_by_driver;
+       rte_cryptodev_driver_id_get;
+       rte_cryptodev_driver_name_get;
        rte_cryptodev_get_aead_algo_enum;
        rte_cryptodev_pci_generic_probe;
        rte_cryptodev_pci_generic_remove;
index 2a060c8..2a71f72 100644 (file)
@@ -61,7 +61,7 @@
 #include "test_cryptodev_gcm_test_vectors.h"
 #include "test_cryptodev_hmac_test_vectors.h"
 
-static enum rte_cryptodev_type gbl_cryptodev_type;
+static int gbl_driver_id;
 
 struct crypto_testsuite_params {
        struct rte_mempool *mbuf_pool;
@@ -213,14 +213,11 @@ testsuite_setup(void)
        }
 
        /* Create an AESNI MB device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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);
@@ -233,14 +230,11 @@ testsuite_setup(void)
        }
 
        /* Create an AESNI GCM device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -251,13 +245,11 @@ testsuite_setup(void)
        }
 
        /* Create a SNOW 3G device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -268,13 +260,11 @@ testsuite_setup(void)
        }
 
        /* Create a KASUMI device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -285,13 +275,11 @@ testsuite_setup(void)
        }
 
        /* Create a ZUC device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -302,14 +290,11 @@ testsuite_setup(void)
        }
 
        /* Create a NULL device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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);
@@ -322,14 +307,11 @@ testsuite_setup(void)
        }
 
        /* Create an OPENSSL device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -342,14 +324,11 @@ testsuite_setup(void)
        }
 
        /* Create a ARMv8 device if required */
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -362,15 +341,12 @@ 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),
@@ -384,14 +360,6 @@ testsuite_setup(void)
        }
 #endif /* RTE_LIBRTE_PMD_CRYPTO_SCHEDULER */
 
-#ifndef RTE_LIBRTE_PMD_QAT
-       if (gbl_cryptodev_type == RTE_CRYPTODEV_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;
-       }
-#endif
-
        nb_devs = rte_cryptodev_count();
        if (nb_devs < 1) {
                RTE_LOG(ERR, USER1, "No crypto devices found?\n");
@@ -401,7 +369,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 +1309,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");
@@ -1502,7 +1471,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");
@@ -1518,7 +1488,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");
@@ -1534,7 +1505,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");
@@ -1550,7 +1522,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");
@@ -1566,7 +1539,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");
@@ -1582,7 +1556,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");
@@ -1600,7 +1575,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");
@@ -1616,7 +1592,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");
@@ -1632,7 +1609,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");
@@ -1650,7 +1628,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");
@@ -1666,7 +1645,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");
@@ -1682,7 +1662,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");
@@ -1698,7 +1679,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");
@@ -1714,7 +1696,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");
@@ -1730,7 +1713,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");
@@ -1746,7 +1730,8 @@ test_authonly_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(RTE_CRYPTODEV_DPAA2_SEC_PMD)),
                BLKCIPHER_AUTHONLY_TYPE);
 
        TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1762,7 +1747,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");
@@ -1778,7 +1764,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");
@@ -4524,7 +4511,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");
@@ -4540,7 +4528,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");
@@ -4556,7 +4545,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");
@@ -4572,7 +4562,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");
@@ -4588,7 +4579,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");
@@ -4604,7 +4596,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");
@@ -4620,7 +4613,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");
@@ -4636,7 +4630,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");
@@ -7661,8 +7656,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",
@@ -7683,7 +7679,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,
@@ -8683,14 +8680,31 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
+
        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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_aesni_mb_testsuite);
 }
@@ -8698,7 +8712,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_openssl_testsuite);
 }
@@ -8706,7 +8728,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_aesni_gcm_testsuite);
 }
@@ -8714,7 +8744,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "NULL PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_NULL is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_null_testsuite);
 }
@@ -8722,7 +8760,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_sw_snow3g_testsuite);
 }
@@ -8730,7 +8776,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_KASUMI is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_sw_kasumi_testsuite);
 }
@@ -8738,7 +8792,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_ZUC is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_sw_zuc_testsuite);
 }
@@ -8746,7 +8808,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_armv8_testsuite);
 }
@@ -8756,7 +8826,22 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "SCHEDULER PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_SCHEDULER is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
+
+       if (rte_cryptodev_driver_id_get(
+                               RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) == -1) {
+               RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
+                       " enabled in config file to run this testsuite.\n");
+               return TEST_FAILED;
+}
        return unit_test_suite_runner(&cryptodev_scheduler_testsuite);
 }
 
@@ -8767,7 +8852,16 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
+
        return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
 }
 
index fc27dd6..0b512c2 100644 (file)
@@ -54,7 +54,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,
+       int driver_id,
        char *test_msg)
 {
        struct rte_mbuf *ibuf = NULL;
@@ -80,6 +80,19 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
        uint8_t tmp_src_buf[MBUF_SIZE];
        uint8_t tmp_dst_buf[MBUF_SIZE];
 
+       int openssl_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
+       int scheduler_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
+       int armv8_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
+       int aesni_mb_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+       int qat_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+       int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
+
        int nb_segs = 1;
 
        if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
@@ -100,18 +113,15 @@ 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_DPAA2_SEC_PMD:
-       case RTE_CRYPTODEV_QAT_SYM_PMD:
-       case RTE_CRYPTODEV_OPENSSL_PMD:
-       case RTE_CRYPTODEV_ARMV8_PMD: /* Fall through */
+       if (driver_id == dpaa2_sec_pmd ||
+                       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");
@@ -575,7 +585,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,
+       int driver_id,
        enum blockcipher_test_type test_type)
 {
        int status, overall_status = TEST_SUCCESS;
@@ -585,6 +595,19 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
        uint32_t target_pmd_mask = 0;
        const struct blockcipher_test_case *tcs = NULL;
 
+       int openssl_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
+       int dpaa2_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
+       int scheduler_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
+       int armv8_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
+       int aesni_mb_pmd = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+       int 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) /
@@ -630,29 +653,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];
@@ -661,7 +675,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);
index 004122f..22fb420 100644 (file)
@@ -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,
+       int driver_id,
        enum blockcipher_test_type test_type);
 
 #endif /* TEST_CRYPTODEV_BLOCKCIPHER_H_ */
index e3d0479..7193d18 100644 (file)
@@ -204,23 +204,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 struct rte_mbuf *
@@ -245,7 +257,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 int gbl_driver_id;
 
 static int
 testsuite_setup(void)
@@ -283,13 +295,11 @@ testsuite_setup(void)
                }
 
        /* Create an AESNI MB device if required */
-       if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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);
@@ -301,13 +311,11 @@ testsuite_setup(void)
        }
 
        /* Create an AESNI GCM device if required */
-       if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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);
@@ -319,13 +327,11 @@ testsuite_setup(void)
        }
 
        /* Create a SNOW3G device if required */
-       if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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);
@@ -337,14 +343,11 @@ testsuite_setup(void)
        }
 
        /* Create an OPENSSL device if required */
-       if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -357,14 +360,11 @@ testsuite_setup(void)
        }
 
        /* Create an ARMv8 device if required */
-       if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_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);
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_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),
@@ -376,14 +376,6 @@ testsuite_setup(void)
                }
        }
 
-#ifndef RTE_LIBRTE_PMD_QAT
-       if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_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;
-       }
-#endif
-
        nb_devs = rte_cryptodev_count();
        if (nb_devs < 1) {
                RTE_LOG(ERR, USER1, "No crypto devices found?\n");
@@ -393,7 +385,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 == (uint8_t) gbl_driver_id) {
                        ts_params->dev_id = i;
                        valid_dev_id = 1;
                        break;
@@ -2046,8 +2038,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);
 
@@ -2118,7 +2111,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
        if (pparams->chain == AEAD)
                printf("\nOn %s dev%u qp%u, %s, aead 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),
                        rte_crypto_aead_algorithm_strings[pparams->aead_algo],
@@ -2126,7 +2119,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
        else
                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),
                        rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
@@ -2170,8 +2163,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();
@@ -2322,7 +2316,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
        if (pparams->chain == AEAD)
                printf("\nOn %s dev%u qp%u, %s, aead_algo:%s, "
                        "key length:%u, 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),
                        rte_crypto_aead_algorithm_strings[pparams->aead_algo],
@@ -2331,7 +2325,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
        else
                printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
                        "key length:%u, 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),
                        rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
@@ -2464,7 +2458,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),
                        rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
@@ -3399,7 +3393,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,
@@ -3837,7 +3832,7 @@ test_perf_snow3G_vary_pkt_size(void)
                                params_set[i].auth_algo;
                        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),
                                rte_crypto_cipher_algorithm_strings[cipher_algo],
@@ -4683,7 +4678,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_gcm_testsuite);
 }
@@ -4691,7 +4694,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_aes_testsuite);
 }
@@ -4699,7 +4710,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_testsuite);
 }
@@ -4707,7 +4726,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
 }
@@ -4715,7 +4742,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
 }
@@ -4723,7 +4758,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "OpenSSL PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_openssl_testsuite);
 }
@@ -4731,7 +4774,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_qat_continual_testsuite);
 }
@@ -4739,7 +4790,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_armv8_testsuite);
 }
@@ -4747,7 +4806,15 @@ 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));
+
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if "
+                               "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled "
+                               "in config file to run this testsuite.\n");
+               return TEST_FAILED;
+       }
 
        return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
 }