static int aesni_gcm_remove(struct rte_vdev_device *vdev);
static int
-aesni_gcm_create(struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+aesni_gcm_create(const char *name,
+ struct rte_vdev_device *vdev,
+ struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct aesni_gcm_private *internals;
- if (init_params->name[0] == '\0') {
- int ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
-
- if (ret < 0) {
- GCM_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
/* Check CPU for support for AES instruction set */
if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AES)) {
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return aesni_gcm_create(vdev, &init_params);
+ return aesni_gcm_create(name, vdev, &init_params);
}
static int
static int cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev);
static int
-cryptodev_aesni_mb_create(struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+cryptodev_aesni_mb_create(const char *name,
+ struct rte_vdev_device *vdev,
+ struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct aesni_mb_private *internals;
enum aesni_mb_vector_mode vector_mode;
- if (init_params->name[0] == '\0') {
- int ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
-
- if (ret < 0) {
- MB_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
/* Check CPU for supported vector instruction set */
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F))
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_aesni_mb_create(vdev, &init_params);
+ return cryptodev_aesni_mb_create(name, vdev, &init_params);
}
static int
/** Create ARMv8 crypto device */
static int
-cryptodev_armv8_crypto_create(struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+cryptodev_armv8_crypto_create(const char *name,
+ struct rte_vdev_device *vdev,
+ struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct armv8_crypto_private *internals;
- int ret;
/* Check CPU for support for AES instruction set */
if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AES)) {
return -EFAULT;
}
- if (init_params->name[0] == '\0') {
- ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
-
- if (ret < 0) {
- ARMV8_CRYPTO_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct armv8_crypto_private),
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_armv8_crypto_create(vdev, &init_params);
+ return cryptodev_armv8_crypto_create(name, vdev, &init_params);
}
/** Uninitialise ARMv8 crypto device */
static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
static int
-cryptodev_kasumi_create(struct rte_vdev_device *vdev,
+cryptodev_kasumi_create(const char *name,
+ struct rte_vdev_device *vdev,
struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct kasumi_private *internals;
uint64_t cpu_flags = 0;
- if (init_params->name[0] == '\0') {
- int ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
-
- if (ret < 0) {
- KASUMI_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
/* Check CPU for supported vector instruction set */
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX))
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_kasumi_create(vdev, &init_params);
+ return cryptodev_kasumi_create(name, vdev, &init_params);
}
static int
/** Create crypto device */
static int
-cryptodev_null_create(struct rte_crypto_vdev_init_params *init_params)
+cryptodev_null_create(const char *name,
+ struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct null_crypto_private *internals;
- if (init_params->name[0] == '\0') {
- int ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_NULL_PMD));
-
- if (ret < 0) {
- NULL_CRYPTO_LOG_ERR("failed to create unique "
- "name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct null_crypto_private),
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_null_create(&init_params);
+ return cryptodev_null_create(name, &init_params);
}
/** Uninitialise null crypto device */
/** Create OPENSSL crypto device */
static int
-cryptodev_openssl_create(struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+cryptodev_openssl_create(const char *name,
+ struct rte_vdev_device *vdev,
+ struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct openssl_private *internals;
- if (init_params->name[0] == '\0') {
- int ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
-
- if (ret < 0) {
- OPENSSL_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct openssl_private),
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_openssl_create(vdev, &init_params);
+ return cryptodev_openssl_create(name, vdev, &init_params);
}
/** Uninitialise OPENSSL crypto device */
cryptodev_scheduler_create(const char *name,
struct scheduler_init_params *init_params)
{
- char crypto_dev_name[RTE_CRYPTODEV_NAME_MAX_LEN] = {0};
struct rte_cryptodev *dev;
struct scheduler_ctx *sched_ctx;
uint32_t i;
int ret;
- if (init_params->def_p.name[0] == '\0') {
- ret = rte_cryptodev_pmd_create_dev_name(
- crypto_dev_name,
- RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
+ if (init_params->def_p.name[0] == '\0')
+ snprintf(init_params->def_p.name,
+ sizeof(init_params->def_p.name),
+ "%s", name);
- if (ret < 0) {
- CS_LOG_ERR("failed to create unique name");
- return ret;
- }
- } else {
- strncpy(crypto_dev_name, init_params->def_p.name,
- RTE_CRYPTODEV_NAME_MAX_LEN - 1);
- }
-
- dev = rte_cryptodev_pmd_virtual_dev_init(crypto_dev_name,
+ dev = rte_cryptodev_pmd_virtual_dev_init(init_params->def_p.name,
sizeof(struct scheduler_ctx),
init_params->def_p.socket_id);
if (dev == NULL) {
RTE_LOG(INFO, PMD, " User defined name = %s\n",
init_params.def_p.name);
- return cryptodev_scheduler_create(rte_vdev_device_name(vdev),
- &init_params);
+ return cryptodev_scheduler_create(name,
+ &init_params);
}
static struct rte_vdev_driver cryptodev_scheduler_pmd_drv = {
static int cryptodev_snow3g_remove(struct rte_vdev_device *vdev);
static int
-cryptodev_snow3g_create(struct rte_vdev_device *vdev,
+cryptodev_snow3g_create(const char *name,
+ struct rte_vdev_device *vdev,
struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct snow3g_private *internals;
uint64_t cpu_flags = 0;
- if (init_params->name[0] == '\0') {
- int ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
-
- if (ret < 0) {
- SNOW3G_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
/* Check CPU for supported vector instruction set */
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1))
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_snow3g_create(vdev, &init_params);
+ return cryptodev_snow3g_create(name, vdev, &init_params);
}
static int
static int cryptodev_zuc_remove(struct rte_vdev_device *vdev);
static int
-cryptodev_zuc_create(struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+cryptodev_zuc_create(const char *name,
+ struct rte_vdev_device *vdev,
+ struct rte_crypto_vdev_init_params *init_params)
{
struct rte_cryptodev *dev;
struct zuc_private *internals;
uint64_t cpu_flags = 0;
- if (init_params->name[0] == '\0') {
- int ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name,
- RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
-
- if (ret < 0) {
- ZUC_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
+ if (init_params->name[0] == '\0')
+ snprintf(init_params->name, sizeof(init_params->name),
+ "%s", name);
/* Check CPU for supported vector instruction set */
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1))
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_zuc_create(vdev, &init_params);
+ return cryptodev_zuc_create(name, vdev, &init_params);
}
static int