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;
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
* 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:
* 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.**
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
-----------
* 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
-----------------------
#include "aesni_gcm_pmd_private.h"
+static uint8_t cryptodev_driver_id;
/** Parse crypto xform chain and set private session parameters */
int
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;
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 */
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
"socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(aesni_gcm_pmd_drv, cryptodev_driver_id);
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;
#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);
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;
}
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 */
"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);
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;
#include "rte_armv8_pmd_private.h"
+static uint8_t cryptodev_driver_id;
+
static int cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev);
/**
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;
}
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 */
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
"socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(armv8_crypto_drv, cryptodev_driver_id);
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;
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,
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;
}
}
}
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;
};
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);
#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)
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;
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. */
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
"socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_kasumi_pmd_drv, cryptodev_driver_id);
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;
#include "null_crypto_pmd_private.h"
+static uint8_t cryptodev_driver_id;
+
/** verify and set session parameters */
int
null_crypto_set_session_parameters(
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;
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 */
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
"socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_null_pmd_drv, cryptodev_driver_id);
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;
#define DES_BLOCK_SIZE 8
+static uint8_t cryptodev_driver_id;
+
static int cryptodev_openssl_remove(struct rte_vdev_device *vdev);
/*----------------------------------------------------------------------------*/
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 {
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 */
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
"socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_openssl_pmd_drv, cryptodev_driver_id);
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;
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;
}
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);
}
}
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);
#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()
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;
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);
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;
}
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");
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
#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;
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;
"max_nb_sessions=<int> "
"socket_id=<int> "
"slave=<name>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_scheduler_pmd_drv,
+ cryptodev_driver_id);
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;
uint16_t qp_id;
uint32_t nb_inflight_cops;
- enum rte_cryptodev_type dev_type;
+ uint8_t driver_id;
};
struct scheduler_ctx {
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)
{
#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)
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;
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. */
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
"socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_snow3g_pmd_drv, cryptodev_driver_id);
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;
#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)
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;
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. */
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
"socket_id=<int>");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cryptodev_zuc_pmd_drv, cryptodev_driver_id);
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;
}
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++;
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)
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 */
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++;
+}
#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 */
/** 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 */
/**
* 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
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 */
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);
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
}
RTE_STD_C11
struct {
uint8_t dev_id;
- enum rte_cryptodev_type type;
+ uint8_t driver_id;
struct rte_mempool *mp;
} __rte_aligned(8);
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;
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;
#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;
}
/* 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);
}
/* 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),
}
/* 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),
}
/* 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),
}
/* 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),
}
/* 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);
}
/* 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),
}
/* 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),
}
#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),
}
#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");
/* 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;
}
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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",
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,
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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;
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) {
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");
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;
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) /
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];
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);
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_ */
}
}
-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 *
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)
}
/* 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);
}
/* 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);
}
/* 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);
}
/* 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),
}
/* 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),
}
}
-#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");
/* 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;
}
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);
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],
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],
}
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();
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],
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],
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],
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,
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],
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}