DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure*
@ 2017-10-20 21:21 Declan Doherty
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
                   ` (5 more replies)
  0 siblings, 6 replies; 22+ messages in thread
From: Declan Doherty @ 2017-10-20 21:21 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

This patch set breaks the dependency of the cryptodev library on both the
virtual and PCI device infrastructure. 

It introduces new bus independent crypto PMD driver assist functions for 
parsing initialisation parameters, and creation/destruction of device
instances.

It deprecates all function calls to the bus dependent functions and
updates all crypto PMDs to use the newly introduced device independent
functions.

Declan Doherty (3):
  cryptodev: add new APIs to assist PMD initialisation
  cryptodev: break dependency on virtual device bus
  cryptodev: break dependency on rte_pci.h

 doc/guides/rel_notes/deprecation.rst           |   6 +
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  55 +++-----
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  72 +++++-----
 drivers/crypto/armv8/rte_armv8_pmd.c           |  41 ++----
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c         |  47 +++----
 drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 +++-----
 drivers/crypto/null/null_crypto_pmd.c          |  72 ++++------
 drivers/crypto/openssl/rte_openssl_pmd.c       |  42 ++----
 drivers/crypto/qat/qat_crypto.c                |   3 +-
 drivers/crypto/qat/rte_qat_cryptodev.c         |  55 ++++++--
 drivers/crypto/scheduler/scheduler_pmd.c       |  45 ++----
 drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
 drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++----
 drivers/crypto/zuc/rte_zuc_pmd.c               |  41 +++---
 lib/librte_cryptodev/Makefile                  |   2 -
 lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
 lib/librte_cryptodev/rte_cryptodev_pci.h       |  92 -------------
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 184 ++++++++++---------------
 lib/librte_cryptodev/rte_cryptodev_pmd.h       |  88 ++++++++++++
 lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 --------------
 lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
 23 files changed, 405 insertions(+), 680 deletions(-)
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h

-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation
  2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
@ 2017-10-20 21:21 ` Declan Doherty
  2017-10-24 11:03   ` De Lara Guarch, Pablo
  2017-10-24 14:09   ` Tomasz Duszynski
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 22+ messages in thread
From: Declan Doherty @ 2017-10-20 21:21 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

Adds new PMD assist functions which are bus independent for driver to
create and destroy new device instances.

Also includes function to parse parameters which can be passed to
driver on device initialisation.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 169 +++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev_pmd.h       |  88 +++++++++++++
 lib/librte_cryptodev/rte_cryptodev_version.map |   3 +
 4 files changed, 264 insertions(+), 4 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index fd0e3f1..86257b0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -60,10 +60,10 @@ extern const char **rte_cyptodev_names;
 		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
-#define CDEV_PMD_LOG_ERR(dev, ...) \
-	RTE_LOG(ERR, CRYPTODEV, \
-		RTE_FMT("[%s] %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			dev, __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+#define CDEV_LOG_INFO(...) \
+	RTE_LOG(INFO, CRYPTODEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
 #define CDEV_LOG_DEBUG(...) \
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index a57faad..6cb4419 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -40,6 +40,175 @@
  * Parse name from argument
  */
 static int
+rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	struct rte_cryptodev_pmd_init_params *params = extra_args;
+
+	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
+		CDEV_LOG_ERR("Invalid name %s, should be less than "
+				"%u bytes", value,
+				RTE_CRYPTODEV_NAME_MAX_LEN - 1);
+		return -1;
+	}
+
+	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
+
+	return 0;
+}
+
+/**
+ * Parse integer from argument
+ */
+static int
+rte_cryptodev_pmd_parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int *i = extra_args;
+
+	*i = atoi(value);
+	if (*i < 0) {
+		CDEV_LOG_ERR("Argument has to be positive.");
+		return -1;
+	}
+
+	return 0;
+}
+
+int
+rte_cryptodev_pmd_parse_input_args(
+		struct rte_cryptodev_pmd_init_params *params,
+		const char *args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+
+	if (args) {
+		kvlist = rte_kvargs_parse(args,	cryptodev_pmd_valid_params);
+		if (kvlist == NULL)
+			return -EINVAL;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
+				&rte_cryptodev_pmd_parse_integer_arg,
+				&params->max_nb_queue_pairs);
+		if (ret < 0)
+			goto free_kvlist;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
+				&rte_cryptodev_pmd_parse_integer_arg,
+				&params->max_nb_sessions);
+		if (ret < 0)
+			goto free_kvlist;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
+				&rte_cryptodev_pmd_parse_integer_arg,
+				&params->socket_id);
+		if (ret < 0)
+			goto free_kvlist;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_NAME_ARG,
+				&rte_cryptodev_pmd_parse_name_arg,
+				params);
+		if (ret < 0)
+			goto free_kvlist;
+	}
+
+free_kvlist:
+	rte_kvargs_free(kvlist);
+	return ret;
+}
+
+struct rte_cryptodev *
+rte_cryptodev_pmd_create(const char *name,
+		struct rte_device *device,
+		struct rte_cryptodev_pmd_init_params *params)
+{
+	struct rte_cryptodev *cryptodev;
+
+	if (params->name[0] != '\0') {
+		CDEV_LOG_INFO("[%s] User specified device name = %s\n",
+				device->driver->name, params->name);
+		name = params->name;
+	}
+
+	CDEV_LOG_INFO("[%s] Creating cryptodev %s\n",
+			device->driver->name, name);
+
+	CDEV_LOG_INFO("[%s] Initialisation parameters [ name: %s, "
+			"private data size:  %zu, "
+			"socket id: %d,"
+			"max queue pairs: %u, "
+			"max sessions: %u ]\n",
+			device->driver->name, name, params->private_data_size,
+			params->socket_id, params->max_nb_queue_pairs,
+			params->max_nb_sessions);
+
+	/* allocate device structure */
+	cryptodev = rte_cryptodev_pmd_allocate(name, params->socket_id);
+	if (cryptodev == NULL) {
+		CDEV_LOG_ERR("[%s] Failed to allocate crypto device for %s",
+				device->driver->name, name);
+		return NULL;
+	}
+
+	/* allocate private device structure */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		cryptodev->data->dev_private =
+				rte_zmalloc_socket("cryptodev device private",
+						params->private_data_size,
+						RTE_CACHE_LINE_SIZE,
+						params->socket_id);
+
+		if (cryptodev->data->dev_private == NULL) {
+			CDEV_LOG_ERR("[%s] Cannot allocate memory for "
+					"cryptodev %s private data",
+					device->driver->name, name);
+
+			rte_cryptodev_pmd_release_device(cryptodev);
+			return NULL;
+		}
+	}
+
+	cryptodev->device = device;
+
+	/* initialise user call-back tail queue */
+	TAILQ_INIT(&(cryptodev->link_intr_cbs));
+
+	return cryptodev;
+}
+
+
+
+int
+rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
+{
+	CDEV_LOG_INFO("Closing crypto device %s [%s]", cryptodev->data->name,
+			cryptodev->device->name);
+
+	/* free crypto device */
+	rte_cryptodev_pmd_release_device(cryptodev);
+
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		rte_free(cryptodev->data->dev_private);
+
+
+	cryptodev->device = NULL;
+	cryptodev->data = NULL;
+
+	return 0;
+}
+
+/**
+ * Parse name from argument
+ */
+static int
 rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index ba074e1..be9eb80 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -56,6 +56,35 @@ extern "C" {
 #include "rte_crypto.h"
 #include "rte_cryptodev.h"
 
+
+#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS	8
+#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS	2048
+
+#define RTE_CRYPTODEV_PMD_NAME_ARG			("name")
+#define RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG			("max_nb_queue_pairs")
+#define RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG		("max_nb_sessions")
+#define RTE_CRYPTODEV_PMD_SOCKET_ID_ARG			("socket_id")
+
+
+static const char * const cryptodev_pmd_valid_params[] = {
+	RTE_CRYPTODEV_PMD_NAME_ARG,
+	RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
+	RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
+	RTE_CRYPTODEV_PMD_SOCKET_ID_ARG
+};
+
+/**
+ * @internal
+ * Initialisation parameters for crypto devices
+ */
+struct rte_cryptodev_pmd_init_params {
+	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+	size_t private_data_size;
+	int socket_id;
+	unsigned int max_nb_queue_pairs;
+	unsigned int max_nb_sessions;
+};
+
 /** Global structure used for maintaining state of allocated crypto devices */
 struct rte_cryptodev_global {
 	struct rte_cryptodev *devs;	/**< Device information array */
@@ -392,6 +421,65 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
 extern int
 rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
 
+
+/**
+ * @internal
+ *
+ * PMD assist function to parse initialisation arguments for crypto driver
+ * when creating a new crypto PMD device instance.
+ *
+ * PMD driver should set default values for that PMD before calling function,
+ * these default values will be over-written with successfully parsed values
+ * from args string.
+ *
+ * @param	params	parsed PMD initialisation parameters
+ * @param	args	input argument string to parse
+ *
+ * @return
+ *  - 0 on success
+ *  - errno on failure
+ */
+int
+rte_cryptodev_pmd_parse_input_args(
+		struct rte_cryptodev_pmd_init_params *params,
+		const char *args);
+
+/**
+ * @internal
+ *
+ * PMD assist function to provide boiler plate code for crypto driver to create
+ * and allocate resources for a new crypto PMD device instance.
+ *
+ * @param	name	crypto device name.
+ * @param	device	base device instance
+ * @param	params	PMD initialisation parameters
+ *
+ * @return
+ *  - crypto device instance on success
+ *  - NULL on creation failure
+ */
+struct rte_cryptodev *
+rte_cryptodev_pmd_create(const char *name,
+		struct rte_device *device,
+		struct rte_cryptodev_pmd_init_params *params);
+
+/**
+ * @internal
+ *
+ * PMD assist function to provide boiler plate code for crypto driver to
+ * destroy and free resources associated with a crypto PMD device instance.
+ *
+ * @param	name	crypto device name.
+ * @param	device	base device instance
+ * @param	params	PMD initialisation parameters
+ *
+ * @return
+ *  - crypto device instance on success
+ *  - NULL on creation failure
+ */
+int
+rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);
+
 /**
  * Executes all the user application registered callbacks for the specific
  * device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 919b6cc..a0ea7bf 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -84,5 +84,8 @@ DPDK_17.11 {
 	global:
 
 	rte_cryptodev_name_get;
+	rte_cryptodev_pmd_create;
+	rte_cryptodev_pmd_destroy;
+	rte_cryptodev_pmd_parse_input_args;
 
 } DPDK_17.08;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus
  2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
@ 2017-10-20 21:21 ` Declan Doherty
  2017-10-24 11:18   ` De Lara Guarch, Pablo
                     ` (2 more replies)
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h Declan Doherty
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 22+ messages in thread
From: Declan Doherty @ 2017-10-20 21:21 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

Removes any dependency of librte_cryptodev on the virtual device
infrastructure code and removes the functions which were virtual
device specific.

Updates all virtual PMDs to remove dependencies on rte_cryptodev_vdev.h
and replaces those calls with the new bus independent functions.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  55 ++++--------
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  72 +++++++--------
 drivers/crypto/armv8/rte_armv8_pmd.c           |  41 +++------
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +--
 drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +--
 drivers/crypto/kasumi/rte_kasumi_pmd.c         |  47 ++++------
 drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 ++++--------
 drivers/crypto/null/null_crypto_pmd.c          |  72 ++++++---------
 drivers/crypto/openssl/rte_openssl_pmd.c       |  42 +++------
 drivers/crypto/scheduler/scheduler_pmd.c       |  45 +++-------
 drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
 drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++++-----
 drivers/crypto/zuc/rte_zuc_pmd.c               |  41 ++++-----
 lib/librte_cryptodev/Makefile                  |   1 -
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 120 -------------------------
 lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 ---------------------
 lib/librte_cryptodev/rte_cryptodev_version.map |   2 -
 17 files changed, 190 insertions(+), 573 deletions(-)
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 29c14e5..2dd2576 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -486,22 +485,24 @@ static int aesni_gcm_remove(struct rte_vdev_device *vdev);
 static int
 aesni_gcm_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct aesni_gcm_private *internals;
 	enum aesni_gcm_vector_mode vector_mode;
 
-	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)) {
 		GCM_LOG_ERR("AES instructions not supported by CPU");
 		return -EFAULT;
 	}
 
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+	if (dev == NULL) {
+		GCM_LOG_ERR("driver %s: create failed", init_params->name);
+		return -ENODEV;
+	}
+
 	/* Check CPU for supported vector instruction set */
 	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))
 		vector_mode = RTE_AESNI_GCM_AVX2;
@@ -510,14 +511,6 @@ aesni_gcm_create(const char *name,
 	else
 		vector_mode = RTE_AESNI_GCM_SSE;
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct aesni_gcm_private), init_params->socket_id,
-			vdev);
-	if (dev == NULL) {
-		GCM_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
-	}
-
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_aesni_gcm_pmd_ops;
 
@@ -552,22 +545,17 @@ aesni_gcm_create(const char *name,
 	internals->max_nb_sessions = init_params->max_nb_sessions;
 
 	return 0;
-
-init_error:
-	GCM_LOG_ERR("driver %s: create failed", init_params->name);
-
-	aesni_gcm_remove(vdev);
-	return -EFAULT;
 }
 
 static int
 aesni_gcm_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct aesni_gcm_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -576,17 +564,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return aesni_gcm_create(name, vdev, &init_params);
 }
@@ -594,6 +572,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
 static int
 aesni_gcm_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
@@ -603,7 +582,11 @@ aesni_gcm_remove(struct rte_vdev_device *vdev)
 	GCM_LOG_INFO("Closing AESNI crypto device %s on numa socket %u\n",
 			name, rte_socket_id());
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver aesni_gcm_pmd_drv = {
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 49242fc..440a09f 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -36,7 +36,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -715,15 +714,23 @@ static int cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_aesni_mb_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_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')
-		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)) {
+		MB_LOG_ERR("AES instructions not supported by CPU");
+		return -EFAULT;
+	}
+
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+	if (dev == NULL) {
+		MB_LOG_ERR("failed to create cryptodev vdev");
+		return -ENODEV;
+	}
 
 	/* Check CPU for supported vector instruction set */
 	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F))
@@ -735,14 +742,6 @@ cryptodev_aesni_mb_create(const char *name,
 	else
 		vector_mode = RTE_AESNI_MB_SSE;
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct aesni_mb_private), init_params->socket_id,
-			vdev);
-	if (dev == NULL) {
-		MB_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
-	}
-
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_aesni_mb_pmd_ops;
 
@@ -779,41 +778,33 @@ cryptodev_aesni_mb_create(const char *name,
 	internals->max_nb_sessions = init_params->max_nb_sessions;
 
 	return 0;
-init_error:
-	MB_LOG_ERR("driver %s: cryptodev_aesni_create failed",
-			init_params->name);
-
-	cryptodev_aesni_mb_remove(vdev);
-	return -EFAULT;
 }
 
 static int
 cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct aesni_mb_private),
 		rte_socket_id(),
-		""
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
-	const char *name;
-	const char *input_args;
+	const char *name, *args;
+	int retval;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
-	input_args = rte_vdev_device_args(vdev);
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+
+	args = rte_vdev_device_args(vdev);
+
+	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
+	if (retval) {
+		MB_LOG_ERR("Failed to parse initialisation arguments[%s]\n",
+				args);
+		return -EINVAL;
+	}
 
 	return cryptodev_aesni_mb_create(name, vdev, &init_params);
 }
@@ -821,6 +812,7 @@ cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
@@ -830,7 +822,11 @@ cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
 	RTE_LOG(INFO, PMD, "Closing AESNI crypto device %s on numa socket %u\n",
 			name, rte_socket_id());
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index dbe6bee..2d2f3ff 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -36,7 +36,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -759,7 +758,7 @@ armv8_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 static int
 cryptodev_armv8_crypto_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct armv8_crypto_private *internals;
@@ -786,14 +785,7 @@ cryptodev_armv8_crypto_create(const char *name,
 		return -EFAULT;
 	}
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-				sizeof(struct armv8_crypto_private),
-				init_params->socket_id,
-				vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -832,11 +824,12 @@ cryptodev_armv8_crypto_create(const char *name,
 static int
 cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct armv8_crypto_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -845,18 +838,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0') {
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	}
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_armv8_crypto_create(name, vdev, &init_params);
 }
@@ -865,6 +847,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
 static int
 cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
@@ -875,7 +858,11 @@ cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
 		"Closing ARMv8 crypto device %s on numa socket %u\n",
 		name, rte_socket_id());
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver armv8_crypto_pmd_drv = {
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0a466ba..2359ee6 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1990,16 +1990,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
 	if (ret)
 		return ret;
 
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	cryptodev->device = NULL;
-	cryptodev->data = NULL;
-
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_dpaa2_driver rte_dpaa2_sec_driver = {
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 53f004e..bb39b75 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -1517,19 +1517,7 @@ cryptodev_dpaa_sec_remove(struct rte_dpaa_device *dpaa_dev)
 	if (ret)
 		return ret;
 
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	PMD_INIT_LOG(INFO, "Closing dpaa crypto device %s",
-		     cryptodev->data->name);
-
-	cryptodev->device = NULL;
-	cryptodev->data = NULL;
-
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_dpaa_driver rte_dpaa_sec_driver = {
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 7a00bd3..03f0a86 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -553,15 +552,17 @@ static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_kasumi_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct kasumi_private *internals;
 	uint64_t cpu_flags = 0;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+	if (dev == NULL) {
+		KASUMI_LOG_ERR("failed to create cryptodev vdev");
+		goto init_error;
+	}
 
 	/* Check CPU for supported vector instruction set */
 	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX))
@@ -569,14 +570,6 @@ cryptodev_kasumi_create(const char *name,
 	else
 		cpu_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct kasumi_private), init_params->socket_id,
-			vdev);
-	if (dev == NULL) {
-		KASUMI_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
-	}
-
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_kasumi_pmd_ops;
 
@@ -605,11 +598,12 @@ cryptodev_kasumi_create(const char *name,
 static int
 cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct kasumi_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -619,17 +613,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_kasumi_create(name, vdev, &init_params);
 }
@@ -637,6 +621,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
@@ -647,7 +632,11 @@ cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
 			" on numa socket %u\n",
 			name, rte_socket_id());
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c
index 6a9c8da..63895c5 100644
--- a/drivers/crypto/mrvl/rte_mrvl_pmd.c
+++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c
@@ -36,7 +36,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -720,26 +719,14 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair,
 static int
 cryptodev_mrvl_crypto_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct mrvl_crypto_private *internals;
 	struct sam_init_params	sam_params;
 	int ret;
 
-	if (init_params->name[0] == '\0') {
-		ret = rte_cryptodev_pmd_create_dev_name(
-				init_params->name, name);
-
-		if (ret < 0) {
-			MRVL_CRYPTO_LOG_ERR("failed to create unique name");
-			return ret;
-		}
-	}
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-				sizeof(struct mrvl_crypto_private),
-				init_params->socket_id, vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -796,40 +783,28 @@ cryptodev_mrvl_crypto_create(const char *name,
 static int
 cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = { };
-	const char *name;
-	const char *input_args;
+	struct rte_cryptodev_pmd_init_params init_params = { };
+	const char *name, *args;
 	int ret;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
-	input_args = rte_vdev_device_args(vdev);
-
-	if (!input_args)
-		return -EINVAL;
+	args = rte_vdev_device_args(vdev);
 
+	init_params.private_data_size = sizeof(struct mrvl_crypto_private);
 	init_params.max_nb_queue_pairs = sam_get_num_inst() * SAM_HW_RING_NUM;
 	init_params.max_nb_sessions =
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
 	init_params.socket_id = rte_socket_id();
 
-	ret = rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
+	ret = rte_cryptodev_pmd_parse_input_args(&init_params, args);
 	if (ret) {
-		RTE_LOG(ERR, PMD, "Failed to parse input arguments\n");
-		return ret;
-	}
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0') {
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
+		RTE_LOG(ERR, PMD,
+			"Failed to parse initialisation arguments[%s]\n",
+			args);
+		return -EINVAL;
 	}
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
 
 	return cryptodev_mrvl_crypto_create(name, vdev, &init_params);
 }
@@ -843,6 +818,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
 static int
 cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name = rte_vdev_device_name(vdev);
 
 	if (name == NULL)
@@ -854,7 +830,11 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
 
 	sam_deinit();
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 /**
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index d5d2bb3..4b9a58a 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,6 @@
 #include <rte_common.h>
 #include <rte_config.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 
@@ -183,28 +182,19 @@ null_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	return nb_dequeued;
 }
 
-static int cryptodev_null_remove(const char *name);
-
 /** Create crypto device */
 static int
 cryptodev_null_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct null_crypto_private *internals;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct null_crypto_private),
-			init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
+		return -EFAULT;
 	}
 
 	dev->driver_id = cryptodev_driver_id;
@@ -224,61 +214,53 @@ cryptodev_null_create(const char *name,
 	internals->max_nb_sessions = init_params->max_nb_sessions;
 
 	return 0;
-
-init_error:
-	NULL_CRYPTO_LOG_ERR("driver %s: cryptodev_null_create failed",
-			init_params->name);
-	cryptodev_null_remove(init_params->name);
-
-	return -EFAULT;
 }
 
 /** Initialise null crypto device */
 static int
 cryptodev_null_probe(struct rte_vdev_device *dev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct null_crypto_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
-	const char *name;
+	const char *name, *args;
+	int retval;
 
 	name = rte_vdev_device_name(dev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
-		name, init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	args = rte_vdev_device_args(dev);
+
+	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
+	if (retval) {
+		RTE_LOG(ERR, PMD,
+			"Failed to parse initialisation arguments[%s]\n", args);
+		return -EINVAL;
+	}
 
 	return cryptodev_null_create(name, dev, &init_params);
 }
 
-/** Uninitialise null crypto device */
 static int
-cryptodev_null_remove(const char *name)
+cryptodev_null_remove_dev(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
+	const char *name;
+
+	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing null crypto device %s on numa socket %u\n",
-			name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
-}
-
-static int
-cryptodev_null_remove_dev(struct rte_vdev_device *dev)
-{
-	return cryptodev_null_remove(rte_vdev_device_name(dev));
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_null_pmd_drv = {
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 95c0236..25c1154 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -34,7 +34,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -1668,19 +1667,12 @@ openssl_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 static int
 cryptodev_openssl_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct openssl_private *internals;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct openssl_private),
-			init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		OPENSSL_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -1718,11 +1710,12 @@ cryptodev_openssl_create(const char *name,
 static int
 cryptodev_openssl_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct openssl_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -1732,17 +1725,7 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_openssl_create(name, vdev, &init_params);
 }
@@ -1751,17 +1734,18 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_openssl_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD,
-		"Closing OPENSSL crypto device %s on numa socket %u\n",
-		name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_openssl_pmd_drv = {
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 3170f7f..40ab304 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -33,7 +33,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -45,7 +44,7 @@
 uint8_t cryptodev_driver_id;
 
 struct scheduler_init_params {
-	struct rte_crypto_vdev_init_params def_p;
+	struct rte_cryptodev_pmd_init_params def_p;
 	uint32_t nb_slaves;
 	enum rte_cryptodev_scheduler_mode mode;
 	uint32_t enable_ordering;
@@ -107,21 +106,18 @@ cryptodev_scheduler_create(const char *name,
 	uint32_t i;
 	int ret;
 
-	if (init_params->def_p.name[0] == '\0')
-		snprintf(init_params->def_p.name,
-				sizeof(init_params->def_p.name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->def_p.name,
-			sizeof(struct scheduler_ctx),
-			init_params->def_p.socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device,
+			&init_params->def_p);
 	if (dev == NULL) {
 		CS_LOG_ERR("driver %s: failed to create cryptodev vdev",
 			name);
 		return -EFAULT;
 	}
 
+	if (init_params->wcmask != 0)
+		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
+			init_params->wcmask);
+
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_crypto_scheduler_pmd_ops;
 
@@ -240,10 +236,7 @@ cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
 					sched_ctx->slaves[i].dev_id);
 	}
 
-	RTE_LOG(INFO, PMD, "Closing Crypto Scheduler device %s on numa "
-		"socket %u\n", name, rte_socket_id());
-
-	return 0;
+	return rte_cryptodev_pmd_destroy(dev);
 }
 
 /** Parse integer from integer argument */
@@ -304,7 +297,7 @@ static int
 parse_name_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
-	struct rte_crypto_vdev_init_params *params = extra_args;
+	struct rte_cryptodev_pmd_init_params *params = extra_args;
 
 	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
 		CS_LOG_ERR("Invalid name %s, should be less than "
@@ -462,10 +455,11 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
 {
 	struct scheduler_init_params init_params = {
 		.def_p = {
-			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+			"",
+			sizeof(struct scheduler_ctx),
 			rte_socket_id(),
-			""
+			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 		},
 		.nb_slaves = 0,
 		.mode = CDEV_SCHED_MODE_NOT_SET,
@@ -481,19 +475,6 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
 	scheduler_parse_init_params(&init_params,
 				    rte_vdev_device_args(vdev));
 
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
-			name,
-			init_params.def_p.socket_id);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.def_p.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.def_p.max_nb_sessions);
-	if (init_params.def_p.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.def_p.name);
-	if (init_params.wcmask != 0)
-		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
-			init_params.wcmask);
 
 	return cryptodev_scheduler_create(name,
 					vdev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index d379534..fef686f 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -37,7 +37,6 @@
 #include <rte_dev.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_reorder.h>
 
 #include "scheduler_pmd_private.h"
@@ -347,7 +346,7 @@ scheduler_pmd_info_get(struct rte_cryptodev *dev,
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
 	uint32_t max_nb_sessions = sched_ctx->nb_slaves ?
-			UINT32_MAX : RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
+			UINT32_MAX : RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
 	uint32_t i;
 
 	if (!dev_info)
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 8e1d1ec..7cd6114 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -559,19 +558,13 @@ static int cryptodev_snow3g_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_snow3g_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct snow3g_private *internals;
 	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct snow3g_private), init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		SNOW3G_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -605,11 +598,12 @@ cryptodev_snow3g_create(const char *name,
 static int
 cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct snow3g_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -619,17 +613,7 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_snow3g_create(name, vdev, &init_params);
 }
@@ -637,17 +621,22 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_snow3g_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing SNOW 3G crypto device %s"
+	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
 			" on numa socket %u\n",
 			name, rte_socket_id());
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index f1f9291..fb894f1 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -463,19 +462,14 @@ static int cryptodev_zuc_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_zuc_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct zuc_private *internals;
 	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct zuc_private), init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		ZUC_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -509,11 +503,12 @@ cryptodev_zuc_create(const char *name,
 static int
 cryptodev_zuc_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct zuc_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -523,17 +518,7 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_zuc_create(name, vdev, &init_params);
 }
@@ -541,17 +526,23 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_zuc_remove(struct rte_vdev_device *vdev)
 {
+
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing ZUC crypto device %s"
+	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
 			" on numa socket %u\n",
 			name, rte_socket_id());
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_zuc_pmd_drv = {
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 6ac331b..4f70719 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -48,7 +48,6 @@ SYMLINK-y-include += rte_crypto.h
 SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
-SYMLINK-y-include += rte_cryptodev_vdev.h
 SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index 6cb4419..62acb47 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -32,7 +32,6 @@
 
 #include <rte_malloc.h>
 
-#include "rte_cryptodev_vdev.h"
 #include "rte_cryptodev_pci.h"
 #include "rte_cryptodev_pmd.h"
 
@@ -205,125 +204,6 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 	return 0;
 }
 
-/**
- * Parse name from argument
- */
-static int
-rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
-		const char *value, void *extra_args)
-{
-	struct rte_crypto_vdev_init_params *params = extra_args;
-
-	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
-		CDEV_LOG_ERR("Invalid name %s, should be less than "
-				"%u bytes", value,
-				RTE_CRYPTODEV_NAME_MAX_LEN - 1);
-		return -1;
-	}
-
-	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
-
-	return 0;
-}
-
-/**
- * Parse integer from argument
- */
-static int
-rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
-		const char *value, void *extra_args)
-{
-	int *i = extra_args;
-
-	*i = atoi(value);
-	if (*i < 0) {
-		CDEV_LOG_ERR("Argument has to be positive.");
-		return -1;
-	}
-
-	return 0;
-}
-
-struct rte_cryptodev *
-rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
-		int socket_id, struct rte_vdev_device *vdev)
-{
-	struct rte_cryptodev *cryptodev;
-
-	/* allocate device structure */
-	cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
-	if (cryptodev == NULL)
-		return NULL;
-
-	/* allocate private device structure */
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		cryptodev->data->dev_private =
-				rte_zmalloc_socket("cryptodev device private",
-						dev_private_size,
-						RTE_CACHE_LINE_SIZE,
-						socket_id);
-
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private device"
-					" data");
-	}
-
-	cryptodev->device = &vdev->device;
-
-	/* initialise user call-back tail queue */
-	TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
-	return cryptodev;
-}
-
-int
-rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
-		const char *input_args)
-{
-	struct rte_kvargs *kvlist = NULL;
-	int ret = 0;
-
-	if (params == NULL)
-		return -EINVAL;
-
-	if (input_args) {
-		kvlist = rte_kvargs_parse(input_args,
-				cryptodev_vdev_valid_params);
-		if (kvlist == NULL)
-			return -1;
-
-		ret = rte_kvargs_process(kvlist,
-					RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
-					&rte_cryptodev_vdev_parse_integer_arg,
-					&params->max_nb_queue_pairs);
-		if (ret < 0)
-			goto free_kvlist;
-
-		ret = rte_kvargs_process(kvlist,
-					RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
-					&rte_cryptodev_vdev_parse_integer_arg,
-					&params->max_nb_sessions);
-		if (ret < 0)
-			goto free_kvlist;
-
-		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
-					&rte_cryptodev_vdev_parse_integer_arg,
-					&params->socket_id);
-		if (ret < 0)
-			goto free_kvlist;
-
-		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
-					&rte_cryptodev_vdev_parse_name_arg,
-					params);
-		if (ret < 0)
-			goto free_kvlist;
-	}
-
-free_kvlist:
-	rte_kvargs_free(kvlist);
-	return ret;
-}
-
 int
 rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
 			size_t private_data_size,
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
deleted file mode 100644
index 94ab9d3..0000000
--- a/lib/librte_cryptodev/rte_cryptodev_vdev.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2017 Intel Corporation. All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of the copyright holder nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_CRYPTODEV_VDEV_H_
-#define _RTE_CRYPTODEV_VDEV_H_
-
-#include <rte_vdev.h>
-#include <inttypes.h>
-
-#include "rte_cryptodev.h"
-
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS	8
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS	2048
-
-#define RTE_CRYPTODEV_VDEV_NAME				("name")
-#define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG		("max_nb_queue_pairs")
-#define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG		("max_nb_sessions")
-#define RTE_CRYPTODEV_VDEV_SOCKET_ID			("socket_id")
-
-static const char * const cryptodev_vdev_valid_params[] = {
-	RTE_CRYPTODEV_VDEV_NAME,
-	RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
-	RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
-	RTE_CRYPTODEV_VDEV_SOCKET_ID
-};
-
-/**
- * @internal
- * Initialisation parameters for virtual crypto devices
- */
-struct rte_crypto_vdev_init_params {
-	unsigned int max_nb_queue_pairs;
-	unsigned int max_nb_sessions;
-	uint8_t socket_id;
-	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
-};
-
-/**
- * @internal
- * Creates a new virtual crypto device and returns the pointer
- * to that device.
- *
- * @param	name			PMD type name
- * @param	dev_private_size	Size of crypto PMDs private data
- * @param	socket_id		Socket to allocate resources on.
- * @param	vdev			Pointer to virtual device structure.
- *
- * @return
- *   - Cryptodev pointer if device is successfully created.
- *   - NULL if device cannot be created.
- */
-struct rte_cryptodev *
-rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
-		int socket_id, struct rte_vdev_device *vdev);
-
-/**
- * @internal
- * Parse virtual device initialisation parameters input arguments
- *
- * @params	params		Initialisation parameters with defaults set.
- * @params	input_args	Command line arguments
- *
- * @return
- * 0 on successful parse
- * <0 on failure to parse
- */
-int
-rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
-		const char *input_args);
-
-#endif /* _RTE_CRYPTODEV_VDEV_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a0ea7bf..d3e4515 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -73,8 +73,6 @@ DPDK_17.08 {
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
-	rte_cryptodev_vdev_parse_init_params;
-	rte_cryptodev_vdev_pmd_init;
 	rte_crypto_aead_algorithm_strings;
 	rte_crypto_aead_operation_strings;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h
  2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
@ 2017-10-20 21:21 ` Declan Doherty
  2017-10-24 11:23   ` De Lara Guarch, Pablo
  2017-10-23  9:21 ` [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Doherty, Declan
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 22+ messages in thread
From: Declan Doherty @ 2017-10-20 21:21 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

Removes any dependency of librte_cryptodev on the PCI device
infrastructure code and removes the functions which were virtual
device specific.

Updates QAT crypto PMD to remove dependencies on rte_cryptodev_pci.h
and replaces those calls with the new bus independent functions.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 doc/guides/rel_notes/deprecation.rst           |  6 ++
 drivers/crypto/qat/qat_crypto.c                |  3 +-
 drivers/crypto/qat/rte_qat_cryptodev.c         | 55 +++++++++++----
 lib/librte_cryptodev/Makefile                  |  1 -
 lib/librte_cryptodev/rte_cryptodev_pci.h       | 92 -------------------------
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 95 --------------------------
 lib/librte_cryptodev/rte_cryptodev_version.map |  2 -
 7 files changed, 51 insertions(+), 203 deletions(-)
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 52058f5..753dce8 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -74,6 +74,12 @@ Deprecation Notices
   ``rte_cryptodev`` respectively to support security protocol offloaded
   operations.
 
+* cryptodev: the following functions are deprecated and will be removed in
+  17.11:
+
+  - ``rte_cryptodev_pci_generic_probe``
+  - ``rte_cryptodev_pci_generic_remove``
+
 * cryptodev: the following function is deprecated starting from 17.08 and will
   be removed in 17.11:
 
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index ae73c78..87f232e 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -58,8 +58,9 @@
 #include <rte_spinlock.h>
 #include <rte_hexdump.h>
 #include <rte_crypto_sym.h>
-#include <rte_cryptodev_pci.h>
 #include <rte_byteorder.h>
+#include <rte_pci.h>
+
 #include <openssl/evp.h>
 
 #include "qat_logs.h"
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 3d9f3c8..701c5a6 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -34,8 +34,8 @@
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_malloc.h>
+#include <rte_pci.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_pci.h>
 
 #include "qat_crypto.h"
 #include "qat_logs.h"
@@ -97,15 +97,18 @@ static const struct rte_pci_id pci_id_qat_map[] = {
 };
 
 static int
-crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
+crypto_qat_create(const char *name, struct rte_pci_device *pci_dev,
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
+	struct rte_cryptodev *cryptodev;
 	struct qat_pmd_private *internals;
 
 	PMD_INIT_FUNC_TRACE();
-	PMD_DRV_LOG(DEBUG, "Found crypto device at %02x:%02x.%x",
-		RTE_DEV_TO_PCI(cryptodev->device)->addr.bus,
-		RTE_DEV_TO_PCI(cryptodev->device)->addr.devid,
-		RTE_DEV_TO_PCI(cryptodev->device)->addr.function);
+
+	cryptodev = rte_cryptodev_pmd_create(name, &pci_dev->device,
+			init_params);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
 	cryptodev->driver_id = cryptodev_qat_driver_id;
 	cryptodev->dev_ops = &crypto_qat_ops;
@@ -119,8 +122,8 @@ crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
 			RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
 
 	internals = cryptodev->data->dev_private;
-	internals->max_nb_sessions = RTE_QAT_PMD_MAX_NB_SESSIONS;
-	switch (RTE_DEV_TO_PCI(cryptodev->device)->id.device_id) {
+	internals->max_nb_sessions = init_params->max_nb_sessions;
+	switch (pci_dev->id.device_id) {
 	case 0x0443:
 		internals->qat_dev_gen = QAT_GEN1;
 		internals->qat_dev_capabilities = qat_gen1_capabilities;
@@ -151,15 +154,43 @@ crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
 }
 
 static int crypto_qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
-	struct rte_pci_device *pci_dev)
+		struct rte_pci_device *pci_dev)
 {
-	return rte_cryptodev_pci_generic_probe(pci_dev,
-		sizeof(struct qat_pmd_private), crypto_qat_dev_init);
+	struct rte_cryptodev_pmd_init_params init_params = {
+		.name = "",
+		.socket_id = rte_socket_id(),
+		.private_data_size = sizeof(struct qat_pmd_private),
+		.max_nb_sessions = RTE_QAT_PMD_MAX_NB_SESSIONS
+	};
+	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+	PMD_DRV_LOG(DEBUG, "Found QAT device at %02x:%02x.%x",
+			pci_dev->addr.bus,
+			pci_dev->addr.devid,
+			pci_dev->addr.function);
+
+	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
+
+	return crypto_qat_create(name, pci_dev, &init_params);
 }
 
 static int crypto_qat_pci_remove(struct rte_pci_device *pci_dev)
 {
-	return rte_cryptodev_pci_generic_remove(pci_dev, NULL);
+	struct rte_cryptodev *cryptodev;
+	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+	if (pci_dev == NULL)
+		return -EINVAL;
+
+	rte_pci_device_name(&pci_dev->addr, cryptodev_name,
+			sizeof(cryptodev_name));
+
+	cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	/* free crypto device */
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_pci_driver rte_qat_pmd = {
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 4f70719..696155f 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -48,7 +48,6 @@ SYMLINK-y-include += rte_crypto.h
 SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
-SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pci.h b/lib/librte_cryptodev/rte_cryptodev_pci.h
deleted file mode 100644
index 67eda96..0000000
--- a/lib/librte_cryptodev/rte_cryptodev_pci.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2017 Intel Corporation. All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of the copyright holder nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_CRYPTODEV_PCI_H_
-#define _RTE_CRYPTODEV_PCI_H_
-
-#include <rte_pci.h>
-#include "rte_cryptodev.h"
-
-/**
- * Initialisation function of a crypto driver invoked for each matching
- * crypto PCI device detected during the PCI probing phase.
- *
- * @param	dev	The dev pointer is the address of the *rte_cryptodev*
- *			structure associated with the matching device and which
- *			has been [automatically] allocated in the
- *			*rte_crypto_devices* array.
- *
- * @return
- *   - 0: Success, the device is properly initialised by the driver.
- *        In particular, the driver MUST have set up the *dev_ops* pointer
- *        of the *dev* structure.
- *   - <0: Error code of the device initialisation failure.
- */
-typedef int (*cryptodev_pci_init_t)(struct rte_cryptodev *dev);
-
-/**
- * Finalisation function of a driver invoked for each matching
- * PCI device detected during the PCI closing phase.
- *
- * @param	dev	The dev pointer is the address of the *rte_cryptodev*
- *			structure associated with the matching device and which
- *			has been [automatically] allocated in the
- *			*rte_crypto_devices* array.
- *
- *  * @return
- *   - 0: Success, the device is properly finalised by the driver.
- *        In particular, the driver MUST free the *dev_ops* pointer
- *        of the *dev* structure.
- *   - <0: Error code of the device initialisation failure.
- */
-typedef int (*cryptodev_pci_uninit_t)(struct rte_cryptodev *dev);
-
-/**
- * @internal
- * Wrapper for use by pci drivers as a .probe function to attach to a crypto
- * interface.
- */
-int
-rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
-			size_t private_data_size,
-			cryptodev_pci_init_t dev_init);
-
-/**
- * @internal
- * Wrapper for use by pci drivers as a .remove function to detach a crypto
- * interface.
- */
-int
-rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,
-		cryptodev_pci_uninit_t dev_uninit);
-
-#endif /* _RTE_CRYPTODEV_PCI_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index 62acb47..6269eaf 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -32,7 +32,6 @@
 
 #include <rte_malloc.h>
 
-#include "rte_cryptodev_pci.h"
 #include "rte_cryptodev_pmd.h"
 
 /**
@@ -183,8 +182,6 @@ rte_cryptodev_pmd_create(const char *name,
 	return cryptodev;
 }
 
-
-
 int
 rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 {
@@ -204,95 +201,3 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 	return 0;
 }
 
-int
-rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
-			size_t private_data_size,
-			cryptodev_pci_init_t dev_init)
-{
-	struct rte_cryptodev *cryptodev;
-
-	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
-
-	int retval;
-
-	rte_pci_device_name(&pci_dev->addr, cryptodev_name,
-			sizeof(cryptodev_name));
-
-	cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
-	if (cryptodev == NULL)
-		return -ENOMEM;
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		cryptodev->data->dev_private =
-				rte_zmalloc_socket(
-						"cryptodev private structure",
-						private_data_size,
-						RTE_CACHE_LINE_SIZE,
-						rte_socket_id());
-
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private "
-					"device data");
-	}
-
-	cryptodev->device = &pci_dev->device;
-
-	/* init user callbacks */
-	TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
-	/* Invoke PMD device initialization function */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
-	retval = dev_init(cryptodev);
-	if (retval == 0)
-		return 0;
-
-	CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
-			" failed", pci_dev->device.driver->name,
-			(unsigned int) pci_dev->id.vendor_id,
-			(unsigned int) pci_dev->id.device_id);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	return -ENXIO;
-}
-
-int
-rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,
-		cryptodev_pci_uninit_t dev_uninit)
-{
-	struct rte_cryptodev *cryptodev;
-	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
-	int ret;
-
-	if (pci_dev == NULL)
-		return -EINVAL;
-
-	rte_pci_device_name(&pci_dev->addr, cryptodev_name,
-			sizeof(cryptodev_name));
-
-	cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
-	if (cryptodev == NULL)
-		return -ENODEV;
-
-	/* Invoke PMD device uninit function */
-	if (dev_uninit) {
-		ret = dev_uninit(cryptodev);
-		if (ret)
-			return ret;
-	}
-
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	cryptodev->device = NULL;
-	cryptodev->data = NULL;
-
-	return 0;
-}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index d3e4515..4355166 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -68,8 +68,6 @@ DPDK_17.08 {
 	rte_cryptodev_get_aead_algo_enum;
 	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
-	rte_cryptodev_pci_generic_probe;
-	rte_cryptodev_pci_generic_remove;
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure*
  2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
                   ` (2 preceding siblings ...)
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h Declan Doherty
@ 2017-10-23  9:21 ` Doherty, Declan
  2017-10-25  0:50 ` Gaëtan Rivet
  2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
  5 siblings, 0 replies; 22+ messages in thread
From: Doherty, Declan @ 2017-10-23  9:21 UTC (permalink / raw)
  To: dev, pablo.de.lara.guarch, jerin.jacob, hemant.agrawal,
	roy.fan.zhang, fiona.trahe, jblunck, jianfeng.tan

Hey folks,

to assist in the work of moving the PCI 
(http://dpdk.org/ml/archives/dev/2017-October/078803.html) and virtual 
bus (http://dpdk.org/ml/archives/dev/2017-October/077858.html, 
http://dpdk.org/ml/archives/dev/2017-October/078783.html) out of EAL 
I've put together this patch set which I think gives a clearer approach 
to breaking the dependency which the cryptodev library had on the bus 
infrastructure. It also allows the removal of some replicate boiler 
plate code in the crypto PMDs. Please have a look and make sure that I 
haven't introduced any problems to your respective PMDs.

Regards
Declan


On 20/10/2017 10:21 PM, Declan Doherty wrote:
> This patch set breaks the dependency of the cryptodev library on both the
> virtual and PCI device infrastructure.
> 
> It introduces new bus independent crypto PMD driver assist functions for
> parsing initialisation parameters, and creation/destruction of device
> instances.
> 
> It deprecates all function calls to the bus dependent functions and
> updates all crypto PMDs to use the newly introduced device independent
> functions.
> 
> Declan Doherty (3):
>    cryptodev: add new APIs to assist PMD initialisation
>    cryptodev: break dependency on virtual device bus
>    cryptodev: break dependency on rte_pci.h
> 
>   doc/guides/rel_notes/deprecation.rst           |   6 +
>   drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  55 +++-----
>   drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  72 +++++-----
>   drivers/crypto/armv8/rte_armv8_pmd.c           |  41 ++----
>   drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +-
>   drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +-
>   drivers/crypto/kasumi/rte_kasumi_pmd.c         |  47 +++----
>   drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 +++-----
>   drivers/crypto/null/null_crypto_pmd.c          |  72 ++++------
>   drivers/crypto/openssl/rte_openssl_pmd.c       |  42 ++----
>   drivers/crypto/qat/qat_crypto.c                |   3 +-
>   drivers/crypto/qat/rte_qat_cryptodev.c         |  55 ++++++--
>   drivers/crypto/scheduler/scheduler_pmd.c       |  45 ++----
>   drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
>   drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++----
>   drivers/crypto/zuc/rte_zuc_pmd.c               |  41 +++---
>   lib/librte_cryptodev/Makefile                  |   2 -
>   lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
>   lib/librte_cryptodev/rte_cryptodev_pci.h       |  92 -------------
>   lib/librte_cryptodev/rte_cryptodev_pmd.c       | 184 ++++++++++---------------
>   lib/librte_cryptodev/rte_cryptodev_pmd.h       |  88 ++++++++++++
>   lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 --------------
>   lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
>   23 files changed, 405 insertions(+), 680 deletions(-)
>   delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
>   delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
@ 2017-10-24 11:03   ` De Lara Guarch, Pablo
  2017-10-24 14:09   ` Tomasz Duszynski
  1 sibling, 0 replies; 22+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-24 11:03 UTC (permalink / raw)
  To: Doherty, Declan, dev; +Cc: Doherty, Declan

Hi Declan,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Friday, October 20, 2017 10:21 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD
> initialisation
> 
> Adds new PMD assist functions which are bus independent for driver to
> create and destroy new device instances.
> 
> Also includes function to parse parameters which can be passed to driver
> on device initialisation.
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>

...

> +struct rte_cryptodev *
> +rte_cryptodev_pmd_create(const char *name,
> +		struct rte_device *device,
> +		struct rte_cryptodev_pmd_init_params *params) {
> +	struct rte_cryptodev *cryptodev;
> +
> +	if (params->name[0] != '\0') {
> +		CDEV_LOG_INFO("[%s] User specified device name = %s\n",
> +				device->driver->name, params->name);
> +		name = params->name;
> +	}
> +
> +	CDEV_LOG_INFO("[%s] Creating cryptodev %s\n",
> +			device->driver->name, name);
> +
> +	CDEV_LOG_INFO("[%s] Initialisation parameters [ name: %s, "
> +			"private data size:  %zu, "
> +			"socket id: %d,"
> +			"max queue pairs: %u, "
> +			"max sessions: %u ]\n",
> +			device->driver->name, name, params-
> >private_data_size,
> +			params->socket_id, params->max_nb_queue_pairs,
> +			params->max_nb_sessions);

Testing this, I see the following:

CRYPTODEV: rte_cryptodev_pmd_create() line 140: [crypto_aesni_mb]
Creating cryptodev crypto_aesni_mb

CRYPTODEV: rte_cryptodev_pmd_create() line 149: [crypto_aesni_mb]
Initialisation parameters [ name: crypto_aesni_mb, private data size:  12,
socket id: 1,max queue pairs: 8, max sessions: 2048 ]

It looks too long to me. I would remove the first line (containing the line number),
and also the private data size in the initialization parameters,
as I think they are not giving any useful info for a user.

...

> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h
...

> +/**
> + * @internal
> + *
> + * PMD assist function to provide boiler plate code for crypto driver
> +to
> + * destroy and free resources associated with a crypto PMD device
> instance.
> + *
> + * @param	name	crypto device name.
> + * @param	device	base device instance
> + * @param	params	PMD initialisation parameters
> + *
> + * @return
> + *  - crypto device instance on success
> + *  - NULL on creation failure
> + */
> +int
> +rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);

Parameters and return value are wrong here.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
@ 2017-10-24 11:18   ` De Lara Guarch, Pablo
  2017-10-24 11:32   ` Akhil Goyal
  2017-10-25  6:18   ` Tomasz Duszynski
  2 siblings, 0 replies; 22+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-24 11:18 UTC (permalink / raw)
  To: Doherty, Declan, dev; +Cc: Doherty, Declan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Friday, October 20, 2017 10:21 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual
> device bus
> 
> Removes any dependency of librte_cryptodev on the virtual device
> infrastructure code and removes the functions which were virtual device
> specific.
> 
> Updates all virtual PMDs to remove dependencies on rte_cryptodev_vdev.h
> and replaces those calls with the new bus independent functions.
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>

...

> diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c
> b/drivers/crypto/snow3g/rte_snow3g_pmd.c

...

> rte_vdev_device *vdev)  static int  cryptodev_snow3g_remove(struct
> rte_vdev_device *vdev)  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
> 
>  	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
> 
> -	RTE_LOG(INFO, PMD, "Closing SNOW 3G crypto device %s"
> +	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"

This should not be changed.

...

> +++ b/drivers/crypto/zuc/rte_zuc_pmd.c

...

> static int  cryptodev_zuc_remove(struct rte_vdev_device *vdev)  {
> +
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
> 
>  	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
> 
> -	RTE_LOG(INFO, PMD, "Closing ZUC crypto device %s"
> +	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"

This should not be changed.

...

> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map
> b/lib/librte_cryptodev/rte_cryptodev_version.map
> index a0ea7bf..d3e4515 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -73,8 +73,6 @@ DPDK_17.08 {
>  	rte_cryptodev_sym_capability_check_aead;
>  	rte_cryptodev_sym_session_init;
>  	rte_cryptodev_sym_session_clear;
> -	rte_cryptodev_vdev_parse_init_params;
> -	rte_cryptodev_vdev_pmd_init;
>  	rte_crypto_aead_algorithm_strings;
>  	rte_crypto_aead_operation_strings;

Release notes should be updated, since these two functions are being removed.
Also, rte_cryptodev_vdev_pmd_init function was going to be declared static in this release,
so the note in deprecation.rst should be removed.

> 
> --
> 2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h Declan Doherty
@ 2017-10-24 11:23   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 22+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-24 11:23 UTC (permalink / raw)
  To: Doherty, Declan, dev; +Cc: Doherty, Declan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Friday, October 20, 2017 10:21 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h
> 

Check-git-log is complaining about this title because of the underscore.
I would replace rte_pci.h with "PCI".

...

> diff --git a/doc/guides/rel_notes/deprecation.rst
> b/doc/guides/rel_notes/deprecation.rst
> index 52058f5..753dce8 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -74,6 +74,12 @@ Deprecation Notices
>    ``rte_cryptodev`` respectively to support security protocol offloaded
>    operations.
> 
> +* cryptodev: the following functions are deprecated and will be removed
> +in
> +  17.11:
> +
> +  - ``rte_cryptodev_pci_generic_probe``
> +  - ``rte_cryptodev_pci_generic_remove``

This document is for functions that are going to be changed/removed
in future releases.
You are removing the functions in this release, so it should be called out
in release notes, under API changes, I think.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
  2017-10-24 11:18   ` De Lara Guarch, Pablo
@ 2017-10-24 11:32   ` Akhil Goyal
  2017-10-25  6:18   ` Tomasz Duszynski
  2 siblings, 0 replies; 22+ messages in thread
From: Akhil Goyal @ 2017-10-24 11:32 UTC (permalink / raw)
  To: Declan Doherty, dev

On 10/21/2017 2:51 AM, Declan Doherty wrote:
> Removes any dependency of librte_cryptodev on the virtual device
> infrastructure code and removes the functions which were virtual
> device specific.
> 
> Updates all virtual PMDs to remove dependencies on rte_cryptodev_vdev.h
> and replaces those calls with the new bus independent functions.
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> ---
>   drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  55 ++++--------
>   drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  72 +++++++--------
>   drivers/crypto/armv8/rte_armv8_pmd.c           |  41 +++------
>   drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +--
>   drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +--
>   drivers/crypto/kasumi/rte_kasumi_pmd.c         |  47 ++++------
>   drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 ++++--------
>   drivers/crypto/null/null_crypto_pmd.c          |  72 ++++++---------
>   drivers/crypto/openssl/rte_openssl_pmd.c       |  42 +++------
>   drivers/crypto/scheduler/scheduler_pmd.c       |  45 +++-------
>   drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
>   drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++++-----
>   drivers/crypto/zuc/rte_zuc_pmd.c               |  41 ++++-----
>   lib/librte_cryptodev/Makefile                  |   1 -
>   lib/librte_cryptodev/rte_cryptodev_pmd.c       | 120 -------------------------
>   lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 ---------------------
>   lib/librte_cryptodev/rte_cryptodev_version.map |   2 -
>   17 files changed, 190 insertions(+), 573 deletions(-)
>   delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
> 
> diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> index 29c14e5..2dd2576 100644
> --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> @@ -35,7 +35,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -486,22 +485,24 @@ static int aesni_gcm_remove(struct rte_vdev_device *vdev);
>   static int
>   aesni_gcm_create(const char *name,
>   		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct aesni_gcm_private *internals;
>   	enum aesni_gcm_vector_mode vector_mode;
>   
> -	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)) {
>   		GCM_LOG_ERR("AES instructions not supported by CPU");
>   		return -EFAULT;
>   	}
>   
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
> +	if (dev == NULL) {
> +		GCM_LOG_ERR("driver %s: create failed", init_params->name);
> +		return -ENODEV;
> +	}
> +
>   	/* Check CPU for supported vector instruction set */
>   	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))
>   		vector_mode = RTE_AESNI_GCM_AVX2;
> @@ -510,14 +511,6 @@ aesni_gcm_create(const char *name,
>   	else
>   		vector_mode = RTE_AESNI_GCM_SSE;
>   
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct aesni_gcm_private), init_params->socket_id,
> -			vdev);
> -	if (dev == NULL) {
> -		GCM_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> -	}
> -
>   	dev->driver_id = cryptodev_driver_id;
>   	dev->dev_ops = rte_aesni_gcm_pmd_ops;
>   
> @@ -552,22 +545,17 @@ aesni_gcm_create(const char *name,
>   	internals->max_nb_sessions = init_params->max_nb_sessions;
>   
>   	return 0;
> -
> -init_error:
> -	GCM_LOG_ERR("driver %s: create failed", init_params->name);
> -
> -	aesni_gcm_remove(vdev);
> -	return -EFAULT;
>   }
>   
>   static int
>   aesni_gcm_probe(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct aesni_gcm_private),
>   		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
>   	const char *name;
>   	const char *input_args;
> @@ -576,17 +564,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
>   	if (name == NULL)
>   		return -EINVAL;
>   	input_args = rte_vdev_device_args(vdev);
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>   
>   	return aesni_gcm_create(name, vdev, &init_params);
>   }
> @@ -594,6 +572,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
>   static int
>   aesni_gcm_remove(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
>   	const char *name;
>   
>   	name = rte_vdev_device_name(vdev);
> @@ -603,7 +582,11 @@ aesni_gcm_remove(struct rte_vdev_device *vdev)
>   	GCM_LOG_INFO("Closing AESNI crypto device %s on numa socket %u\n",
>   			name, rte_socket_id());
>   
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_vdev_driver aesni_gcm_pmd_drv = {
> diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> index 49242fc..440a09f 100644
> --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> @@ -36,7 +36,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -715,15 +714,23 @@ static int cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev);
>   static int
>   cryptodev_aesni_mb_create(const char *name,
>   			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_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')
> -		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)) {
> +		MB_LOG_ERR("AES instructions not supported by CPU");
> +		return -EFAULT;
> +	}
> +
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
> +	if (dev == NULL) {
> +		MB_LOG_ERR("failed to create cryptodev vdev");
> +		return -ENODEV;
> +	}
>   
>   	/* Check CPU for supported vector instruction set */
>   	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F))
> @@ -735,14 +742,6 @@ cryptodev_aesni_mb_create(const char *name,
>   	else
>   		vector_mode = RTE_AESNI_MB_SSE;
>   
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct aesni_mb_private), init_params->socket_id,
> -			vdev);
> -	if (dev == NULL) {
> -		MB_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> -	}
> -
>   	dev->driver_id = cryptodev_driver_id;
>   	dev->dev_ops = rte_aesni_mb_pmd_ops;
>   
> @@ -779,41 +778,33 @@ cryptodev_aesni_mb_create(const char *name,
>   	internals->max_nb_sessions = init_params->max_nb_sessions;
>   
>   	return 0;
> -init_error:
> -	MB_LOG_ERR("driver %s: cryptodev_aesni_create failed",
> -			init_params->name);
> -
> -	cryptodev_aesni_mb_remove(vdev);
> -	return -EFAULT;
>   }
>   
>   static int
>   cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct aesni_mb_private),
>   		rte_socket_id(),
> -		""
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
> -	const char *name;
> -	const char *input_args;
> +	const char *name, *args;
> +	int retval;
>   
>   	name = rte_vdev_device_name(vdev);
>   	if (name == NULL)
>   		return -EINVAL;
> -	input_args = rte_vdev_device_args(vdev);
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +
> +	args = rte_vdev_device_args(vdev);
> +
> +	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
> +	if (retval) {
> +		MB_LOG_ERR("Failed to parse initialisation arguments[%s]\n",
> +				args);
> +		return -EINVAL;
> +	}
>   
>   	return cryptodev_aesni_mb_create(name, vdev, &init_params);
>   }
> @@ -821,6 +812,7 @@ cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
>   static int
>   cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
>   	const char *name;
>   
>   	name = rte_vdev_device_name(vdev);
> @@ -830,7 +822,11 @@ cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
>   	RTE_LOG(INFO, PMD, "Closing AESNI crypto device %s on numa socket %u\n",
>   			name, rte_socket_id());
>   
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
> diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
> index dbe6bee..2d2f3ff 100644
> --- a/drivers/crypto/armv8/rte_armv8_pmd.c
> +++ b/drivers/crypto/armv8/rte_armv8_pmd.c
> @@ -36,7 +36,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -759,7 +758,7 @@ armv8_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
>   static int
>   cryptodev_armv8_crypto_create(const char *name,
>   			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct armv8_crypto_private *internals;
> @@ -786,14 +785,7 @@ cryptodev_armv8_crypto_create(const char *name,
>   		return -EFAULT;
>   	}
>   
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -				sizeof(struct armv8_crypto_private),
> -				init_params->socket_id,
> -				vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>   	if (dev == NULL) {
>   		ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
>   		goto init_error;
> @@ -832,11 +824,12 @@ cryptodev_armv8_crypto_create(const char *name,
>   static int
>   cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct armv8_crypto_private),
>   		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
>   	const char *name;
>   	const char *input_args;
> @@ -845,18 +838,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
>   	if (name == NULL)
>   		return -EINVAL;
>   	input_args = rte_vdev_device_args(vdev);
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0') {
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	}
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>   
>   	return cryptodev_armv8_crypto_create(name, vdev, &init_params);
>   }
> @@ -865,6 +847,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
>   static int
>   cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
>   	const char *name;
>   
>   	name = rte_vdev_device_name(vdev);
> @@ -875,7 +858,11 @@ cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
>   		"Closing ARMv8 crypto device %s on numa socket %u\n",
>   		name, rte_socket_id());
>   
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_vdev_driver armv8_crypto_pmd_drv = {
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 0a466ba..2359ee6 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -1990,16 +1990,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
>   	if (ret)
>   		return ret;
>   
> -	/* free crypto device */
> -	rte_cryptodev_pmd_release_device(cryptodev);
> -
> -	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> -		rte_free(cryptodev->data->dev_private);
> -
> -	cryptodev->device = NULL;
> -	cryptodev->data = NULL;
> -
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_dpaa2_driver rte_dpaa2_sec_driver = {
> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
> index 53f004e..bb39b75 100644
> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c
> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
> @@ -1517,19 +1517,7 @@ cryptodev_dpaa_sec_remove(struct rte_dpaa_device *dpaa_dev)
>   	if (ret)
>   		return ret;
>   
> -	/* free crypto device */
> -	rte_cryptodev_pmd_release_device(cryptodev);
> -
> -	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> -		rte_free(cryptodev->data->dev_private);
> -
> -	PMD_INIT_LOG(INFO, "Closing dpaa crypto device %s",
> -		     cryptodev->data->name);
> -
> -	cryptodev->device = NULL;
> -	cryptodev->data = NULL;
> -
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_dpaa_driver rte_dpaa_sec_driver = {
> diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
> index 7a00bd3..03f0a86 100644
> --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
> +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
> @@ -35,7 +35,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -553,15 +552,17 @@ static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
>   static int
>   cryptodev_kasumi_create(const char *name,
>   			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct kasumi_private *internals;
>   	uint64_t cpu_flags = 0;
>   
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
> +	if (dev == NULL) {
> +		KASUMI_LOG_ERR("failed to create cryptodev vdev");
> +		goto init_error;
> +	}
>   
>   	/* Check CPU for supported vector instruction set */
>   	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX))
> @@ -569,14 +570,6 @@ cryptodev_kasumi_create(const char *name,
>   	else
>   		cpu_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
>   
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct kasumi_private), init_params->socket_id,
> -			vdev);
> -	if (dev == NULL) {
> -		KASUMI_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> -	}
> -
>   	dev->driver_id = cryptodev_driver_id;
>   	dev->dev_ops = rte_kasumi_pmd_ops;
>   
> @@ -605,11 +598,12 @@ cryptodev_kasumi_create(const char *name,
>   static int
>   cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct kasumi_private),
>   		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
>   	const char *name;
>   	const char *input_args;
> @@ -619,17 +613,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
>   		return -EINVAL;
>   	input_args = rte_vdev_device_args(vdev);
>   
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>   
>   	return cryptodev_kasumi_create(name, vdev, &init_params);
>   }
> @@ -637,6 +621,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
>   static int
>   cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
>   	const char *name;
>   
>   	name = rte_vdev_device_name(vdev);
> @@ -647,7 +632,11 @@ cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
>   			" on numa socket %u\n",
>   			name, rte_socket_id());
>   
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
> diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c
> index 6a9c8da..63895c5 100644
> --- a/drivers/crypto/mrvl/rte_mrvl_pmd.c
> +++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c
> @@ -36,7 +36,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -720,26 +719,14 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair,
>   static int
>   cryptodev_mrvl_crypto_create(const char *name,
>   		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct mrvl_crypto_private *internals;
>   	struct sam_init_params	sam_params;
>   	int ret;
>   
> -	if (init_params->name[0] == '\0') {
> -		ret = rte_cryptodev_pmd_create_dev_name(
> -				init_params->name, name);
> -
> -		if (ret < 0) {
> -			MRVL_CRYPTO_LOG_ERR("failed to create unique name");
> -			return ret;
> -		}
> -	}
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -				sizeof(struct mrvl_crypto_private),
> -				init_params->socket_id, vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>   	if (dev == NULL) {
>   		MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
>   		goto init_error;
> @@ -796,40 +783,28 @@ cryptodev_mrvl_crypto_create(const char *name,
>   static int
>   cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = { };
> -	const char *name;
> -	const char *input_args;
> +	struct rte_cryptodev_pmd_init_params init_params = { };
> +	const char *name, *args;
>   	int ret;
>   
>   	name = rte_vdev_device_name(vdev);
>   	if (name == NULL)
>   		return -EINVAL;
> -	input_args = rte_vdev_device_args(vdev);
> -
> -	if (!input_args)
> -		return -EINVAL;
> +	args = rte_vdev_device_args(vdev);
>   
> +	init_params.private_data_size = sizeof(struct mrvl_crypto_private);
>   	init_params.max_nb_queue_pairs = sam_get_num_inst() * SAM_HW_RING_NUM;
>   	init_params.max_nb_sessions =
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
>   	init_params.socket_id = rte_socket_id();
>   
> -	ret = rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> +	ret = rte_cryptodev_pmd_parse_input_args(&init_params, args);
>   	if (ret) {
> -		RTE_LOG(ERR, PMD, "Failed to parse input arguments\n");
> -		return ret;
> -	}
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0') {
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> +		RTE_LOG(ERR, PMD,
> +			"Failed to parse initialisation arguments[%s]\n",
> +			args);
> +		return -EINVAL;
>   	}
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
>   
>   	return cryptodev_mrvl_crypto_create(name, vdev, &init_params);
>   }
> @@ -843,6 +818,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
>   static int
>   cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
>   	const char *name = rte_vdev_device_name(vdev);
>   
>   	if (name == NULL)
> @@ -854,7 +830,11 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
>   
>   	sam_deinit();
>   
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   /**
> diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
> index d5d2bb3..4b9a58a 100644
> --- a/drivers/crypto/null/null_crypto_pmd.c
> +++ b/drivers/crypto/null/null_crypto_pmd.c
> @@ -33,7 +33,6 @@
>   #include <rte_common.h>
>   #include <rte_config.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   
> @@ -183,28 +182,19 @@ null_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
>   	return nb_dequeued;
>   }
>   
> -static int cryptodev_null_remove(const char *name);
> -
>   /** Create crypto device */
>   static int
>   cryptodev_null_create(const char *name,
>   		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct null_crypto_private *internals;
>   
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct null_crypto_private),
> -			init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>   	if (dev == NULL) {
>   		NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> +		return -EFAULT;
>   	}
>   
>   	dev->driver_id = cryptodev_driver_id;
> @@ -224,61 +214,53 @@ cryptodev_null_create(const char *name,
>   	internals->max_nb_sessions = init_params->max_nb_sessions;
>   
>   	return 0;
> -
> -init_error:
> -	NULL_CRYPTO_LOG_ERR("driver %s: cryptodev_null_create failed",
> -			init_params->name);
> -	cryptodev_null_remove(init_params->name);
> -
> -	return -EFAULT;
>   }
>   
>   /** Initialise null crypto device */
>   static int
>   cryptodev_null_probe(struct rte_vdev_device *dev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct null_crypto_private),
>   		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
> -	const char *name;
> +	const char *name, *args;
> +	int retval;
>   
>   	name = rte_vdev_device_name(dev);
>   	if (name == NULL)
>   		return -EINVAL;
>   
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
> -		name, init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	args = rte_vdev_device_args(dev);
> +
> +	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
> +	if (retval) {
> +		RTE_LOG(ERR, PMD,
> +			"Failed to parse initialisation arguments[%s]\n", args);
> +		return -EINVAL;
> +	}
>   
>   	return cryptodev_null_create(name, dev, &init_params);
>   }
>   
> -/** Uninitialise null crypto device */
>   static int
> -cryptodev_null_remove(const char *name)
> +cryptodev_null_remove_dev(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
> +	const char *name;
> +
> +	name = rte_vdev_device_name(vdev);
>   	if (name == NULL)
>   		return -EINVAL;
>   
> -	RTE_LOG(INFO, PMD, "Closing null crypto device %s on numa socket %u\n",
> -			name, rte_socket_id());
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
>   
> -	return 0;
> -}
> -
> -static int
> -cryptodev_null_remove_dev(struct rte_vdev_device *dev)
> -{
> -	return cryptodev_null_remove(rte_vdev_device_name(dev));
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_vdev_driver cryptodev_null_pmd_drv = {
> diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
> index 95c0236..25c1154 100644
> --- a/drivers/crypto/openssl/rte_openssl_pmd.c
> +++ b/drivers/crypto/openssl/rte_openssl_pmd.c
> @@ -34,7 +34,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -1668,19 +1667,12 @@ openssl_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
>   static int
>   cryptodev_openssl_create(const char *name,
>   			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct openssl_private *internals;
>   
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct openssl_private),
> -			init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>   	if (dev == NULL) {
>   		OPENSSL_LOG_ERR("failed to create cryptodev vdev");
>   		goto init_error;
> @@ -1718,11 +1710,12 @@ cryptodev_openssl_create(const char *name,
>   static int
>   cryptodev_openssl_probe(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct openssl_private),
>   		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
>   	const char *name;
>   	const char *input_args;
> @@ -1732,17 +1725,7 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
>   		return -EINVAL;
>   	input_args = rte_vdev_device_args(vdev);
>   
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>   
>   	return cryptodev_openssl_create(name, vdev, &init_params);
>   }
> @@ -1751,17 +1734,18 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
>   static int
>   cryptodev_openssl_remove(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
>   	const char *name;
>   
>   	name = rte_vdev_device_name(vdev);
>   	if (name == NULL)
>   		return -EINVAL;
>   
> -	RTE_LOG(INFO, PMD,
> -		"Closing OPENSSL crypto device %s on numa socket %u\n",
> -		name, rte_socket_id());
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
>   
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_vdev_driver cryptodev_openssl_pmd_drv = {
> diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
> index 3170f7f..40ab304 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd.c
> @@ -33,7 +33,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -45,7 +44,7 @@
>   uint8_t cryptodev_driver_id;
>   
>   struct scheduler_init_params {
> -	struct rte_crypto_vdev_init_params def_p;
> +	struct rte_cryptodev_pmd_init_params def_p;
>   	uint32_t nb_slaves;
>   	enum rte_cryptodev_scheduler_mode mode;
>   	uint32_t enable_ordering;
> @@ -107,21 +106,18 @@ cryptodev_scheduler_create(const char *name,
>   	uint32_t i;
>   	int ret;
>   
> -	if (init_params->def_p.name[0] == '\0')
> -		snprintf(init_params->def_p.name,
> -				sizeof(init_params->def_p.name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->def_p.name,
> -			sizeof(struct scheduler_ctx),
> -			init_params->def_p.socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device,
> +			&init_params->def_p);
>   	if (dev == NULL) {
>   		CS_LOG_ERR("driver %s: failed to create cryptodev vdev",
>   			name);
>   		return -EFAULT;
>   	}
>   
> +	if (init_params->wcmask != 0)
> +		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
> +			init_params->wcmask);
> +
>   	dev->driver_id = cryptodev_driver_id;
>   	dev->dev_ops = rte_crypto_scheduler_pmd_ops;
>   
> @@ -240,10 +236,7 @@ cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
>   					sched_ctx->slaves[i].dev_id);
>   	}
>   
> -	RTE_LOG(INFO, PMD, "Closing Crypto Scheduler device %s on numa "
> -		"socket %u\n", name, rte_socket_id());
> -
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(dev);
>   }
>   
>   /** Parse integer from integer argument */
> @@ -304,7 +297,7 @@ static int
>   parse_name_arg(const char *key __rte_unused,
>   		const char *value, void *extra_args)
>   {
> -	struct rte_crypto_vdev_init_params *params = extra_args;
> +	struct rte_cryptodev_pmd_init_params *params = extra_args;
>   
>   	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
>   		CS_LOG_ERR("Invalid name %s, should be less than "
> @@ -462,10 +455,11 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
>   {
>   	struct scheduler_init_params init_params = {
>   		.def_p = {
> -			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +			"",
> +			sizeof(struct scheduler_ctx),
>   			rte_socket_id(),
> -			""
> +			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   		},
>   		.nb_slaves = 0,
>   		.mode = CDEV_SCHED_MODE_NOT_SET,
> @@ -481,19 +475,6 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
>   	scheduler_parse_init_params(&init_params,
>   				    rte_vdev_device_args(vdev));
>   
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
> -			name,
> -			init_params.def_p.socket_id);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.def_p.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.def_p.max_nb_sessions);
> -	if (init_params.def_p.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.def_p.name);
> -	if (init_params.wcmask != 0)
> -		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
> -			init_params.wcmask);
>   
>   	return cryptodev_scheduler_create(name,
>   					vdev,
> diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> index d379534..fef686f 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> @@ -37,7 +37,6 @@
>   #include <rte_dev.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_reorder.h>
>   
>   #include "scheduler_pmd_private.h"
> @@ -347,7 +346,7 @@ scheduler_pmd_info_get(struct rte_cryptodev *dev,
>   {
>   	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
>   	uint32_t max_nb_sessions = sched_ctx->nb_slaves ?
> -			UINT32_MAX : RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
> +			UINT32_MAX : RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
>   	uint32_t i;
>   
>   	if (!dev_info)
> diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
> index 8e1d1ec..7cd6114 100644
> --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
> +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
> @@ -35,7 +35,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -559,19 +558,13 @@ static int cryptodev_snow3g_remove(struct rte_vdev_device *vdev);
>   static int
>   cryptodev_snow3g_create(const char *name,
>   			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct snow3g_private *internals;
>   	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
>   
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct snow3g_private), init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>   	if (dev == NULL) {
>   		SNOW3G_LOG_ERR("failed to create cryptodev vdev");
>   		goto init_error;
> @@ -605,11 +598,12 @@ cryptodev_snow3g_create(const char *name,
>   static int
>   cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct snow3g_private),
>   		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
>   	const char *name;
>   	const char *input_args;
> @@ -619,17 +613,7 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
>   		return -EINVAL;
>   	input_args = rte_vdev_device_args(vdev);
>   
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>   
>   	return cryptodev_snow3g_create(name, vdev, &init_params);
>   }
> @@ -637,17 +621,22 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
>   static int
>   cryptodev_snow3g_remove(struct rte_vdev_device *vdev)
>   {
> +	struct rte_cryptodev *cryptodev;
>   	const char *name;
>   
>   	name = rte_vdev_device_name(vdev);
>   	if (name == NULL)
>   		return -EINVAL;
>   
> -	RTE_LOG(INFO, PMD, "Closing SNOW 3G crypto device %s"
> +	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
>   			" on numa socket %u\n",
>   			name, rte_socket_id());
>   
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>   }
>   
>   static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
> diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
> index f1f9291..fb894f1 100644
> --- a/drivers/crypto/zuc/rte_zuc_pmd.c
> +++ b/drivers/crypto/zuc/rte_zuc_pmd.c
> @@ -35,7 +35,6 @@
>   #include <rte_hexdump.h>
>   #include <rte_cryptodev.h>
>   #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>   #include <rte_vdev.h>
>   #include <rte_malloc.h>
>   #include <rte_cpuflags.h>
> @@ -463,19 +462,14 @@ static int cryptodev_zuc_remove(struct rte_vdev_device *vdev);
>   static int
>   cryptodev_zuc_create(const char *name,
>   		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>   {
>   	struct rte_cryptodev *dev;
>   	struct zuc_private *internals;
>   	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
>   
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
>   
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct zuc_private), init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>   	if (dev == NULL) {
>   		ZUC_LOG_ERR("failed to create cryptodev vdev");
>   		goto init_error;
> @@ -509,11 +503,12 @@ cryptodev_zuc_create(const char *name,
>   static int
>   cryptodev_zuc_probe(struct rte_vdev_device *vdev)
>   {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct zuc_private),
>   		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>   	};
>   	const char *name;
>   	const char *input_args;
> @@ -523,17 +518,7 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
>   		return -EINVAL;
>   	input_args = rte_vdev_device_args(vdev);
>   
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>   
>   	return cryptodev_zuc_create(name, vdev, &init_params);
>   }
> @@ -541,17 +526,23 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
>   static int
>   cryptodev_zuc_remove(struct rte_vdev_device *vdev)
>   {
> +
> +	struct rte_cryptodev *cryptodev;
>   	const char *name;
>   
>   	name = rte_vdev_device_name(vdev);
>   	if (name == NULL)
>   		return -EINVAL;
>   
> -	RTE_LOG(INFO, PMD, "Closing ZUC crypto device %s"
> +	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
>   			" on numa socket %u\n",
>   			name, rte_socket_id());
>   

TYPO..The log message is not correct in multiple files.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
  2017-10-24 11:03   ` De Lara Guarch, Pablo
@ 2017-10-24 14:09   ` Tomasz Duszynski
  2017-10-25  0:59     ` Gaëtan Rivet
  1 sibling, 1 reply; 22+ messages in thread
From: Tomasz Duszynski @ 2017-10-24 14:09 UTC (permalink / raw)
  To: Declan Doherty; +Cc: dev

Hi Declan,

Some comments inline.

On Fri, Oct 20, 2017 at 10:21:11PM +0100, Declan Doherty wrote:
> Adds new PMD assist functions which are bus independent for driver to
> create and destroy new device instances.
>
> Also includes function to parse parameters which can be passed to
> driver on device initialisation.
>
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> ---
>  lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
>  lib/librte_cryptodev/rte_cryptodev_pmd.c       | 169 +++++++++++++++++++++++++
>  lib/librte_cryptodev/rte_cryptodev_pmd.h       |  88 +++++++++++++
>  lib/librte_cryptodev/rte_cryptodev_version.map |   3 +
>  4 files changed, 264 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> index fd0e3f1..86257b0 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
> @@ -60,10 +60,10 @@ extern const char **rte_cyptodev_names;
>  		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
>  			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
>
> -#define CDEV_PMD_LOG_ERR(dev, ...) \
> -	RTE_LOG(ERR, CRYPTODEV, \
> -		RTE_FMT("[%s] %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> -			dev, __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
> +#define CDEV_LOG_INFO(...) \
> +	RTE_LOG(INFO, CRYPTODEV, \
> +		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> +			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
>
>  #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
>  #define CDEV_LOG_DEBUG(...) \
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> index a57faad..6cb4419 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> @@ -40,6 +40,175 @@
>   * Parse name from argument
>   */
>  static int
> +rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused,
> +		const char *value, void *extra_args)
> +{
> +	struct rte_cryptodev_pmd_init_params *params = extra_args;
> +
> +	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
> +		CDEV_LOG_ERR("Invalid name %s, should be less than "
> +				"%u bytes", value,
> +				RTE_CRYPTODEV_NAME_MAX_LEN - 1);
> +		return -1;
> +	}
> +
> +	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);

Would strcpy() do here? At this point we already know that name will
fit into params->name.

> +
> +	return 0;
> +}
> +
> +/**
> + * Parse integer from argument
> + */
> +static int
> +rte_cryptodev_pmd_parse_integer_arg(const char *key __rte_unused,
> +		const char *value, void *extra_args)
> +{
> +	int *i = extra_args;
> +
> +	*i = atoi(value);
> +	if (*i < 0) {
> +		CDEV_LOG_ERR("Argument has to be positive.");

Perhaps s/positive/non-negative ?
Number 0 looks like a valid argument.

> +		return -1;
> +	}
> +
> +	return 0;
> +}
> +
> +int
> +rte_cryptodev_pmd_parse_input_args(
> +		struct rte_cryptodev_pmd_init_params *params,
> +		const char *args)
> +{
> +	struct rte_kvargs *kvlist = NULL;
> +	int ret = 0;
> +
> +	if (params == NULL)
> +		return -EINVAL;
> +
> +	if (args) {
> +		kvlist = rte_kvargs_parse(args,	cryptodev_pmd_valid_params);
> +		if (kvlist == NULL)
> +			return -EINVAL;
> +
> +		ret = rte_kvargs_process(kvlist,
> +				RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
> +				&rte_cryptodev_pmd_parse_integer_arg,
> +				&params->max_nb_queue_pairs);
> +		if (ret < 0)
> +			goto free_kvlist;
> +
> +		ret = rte_kvargs_process(kvlist,
> +				RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
> +				&rte_cryptodev_pmd_parse_integer_arg,
> +				&params->max_nb_sessions);
> +		if (ret < 0)
> +			goto free_kvlist;
> +
> +		ret = rte_kvargs_process(kvlist,
> +				RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
> +				&rte_cryptodev_pmd_parse_integer_arg,
> +				&params->socket_id);
> +		if (ret < 0)
> +			goto free_kvlist;
> +
> +		ret = rte_kvargs_process(kvlist,
> +				RTE_CRYPTODEV_PMD_NAME_ARG,
> +				&rte_cryptodev_pmd_parse_name_arg,
> +				params);
> +		if (ret < 0)
> +			goto free_kvlist;
> +	}
> +
> +free_kvlist:
> +	rte_kvargs_free(kvlist);
> +	return ret;
> +}
> +
> +struct rte_cryptodev *
> +rte_cryptodev_pmd_create(const char *name,
> +		struct rte_device *device,
> +		struct rte_cryptodev_pmd_init_params *params)
> +{
> +	struct rte_cryptodev *cryptodev;
> +
> +	if (params->name[0] != '\0') {
> +		CDEV_LOG_INFO("[%s] User specified device name = %s\n",
> +				device->driver->name, params->name);
> +		name = params->name;
> +	}
> +
> +	CDEV_LOG_INFO("[%s] Creating cryptodev %s\n",
> +			device->driver->name, name);
> +
> +	CDEV_LOG_INFO("[%s] Initialisation parameters [ name: %s, "
> +			"private data size:  %zu, "
> +			"socket id: %d,"
> +			"max queue pairs: %u, "
> +			"max sessions: %u ]\n",
> +			device->driver->name, name, params->private_data_size,
> +			params->socket_id, params->max_nb_queue_pairs,
> +			params->max_nb_sessions);
> +
> +	/* allocate device structure */
> +	cryptodev = rte_cryptodev_pmd_allocate(name, params->socket_id);
> +	if (cryptodev == NULL) {
> +		CDEV_LOG_ERR("[%s] Failed to allocate crypto device for %s",
> +				device->driver->name, name);
> +		return NULL;
> +	}
> +
> +	/* allocate private device structure */
> +	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> +		cryptodev->data->dev_private =
> +				rte_zmalloc_socket("cryptodev device private",
> +						params->private_data_size,
> +						RTE_CACHE_LINE_SIZE,
> +						params->socket_id);
> +
> +		if (cryptodev->data->dev_private == NULL) {
> +			CDEV_LOG_ERR("[%s] Cannot allocate memory for "
> +					"cryptodev %s private data",
> +					device->driver->name, name);
> +
> +			rte_cryptodev_pmd_release_device(cryptodev);
> +			return NULL;
> +		}
> +	}
> +
> +	cryptodev->device = device;
> +
> +	/* initialise user call-back tail queue */
> +	TAILQ_INIT(&(cryptodev->link_intr_cbs));
> +
> +	return cryptodev;
> +}
> +
> +
> +
> +int
> +rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
> +{
> +	CDEV_LOG_INFO("Closing crypto device %s [%s]", cryptodev->data->name,
> +			cryptodev->device->name);
> +
> +	/* free crypto device */
> +	rte_cryptodev_pmd_release_device(cryptodev);
> +
> +	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> +		rte_free(cryptodev->data->dev_private);
> +
> +
> +	cryptodev->device = NULL;
> +	cryptodev->data = NULL;
> +
> +	return 0;
> +}
> +
> +/**
> + * Parse name from argument
> + */
> +static int
>  rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
>  		const char *value, void *extra_args)
>  {
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> index ba074e1..be9eb80 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> @@ -56,6 +56,35 @@ extern "C" {
>  #include "rte_crypto.h"
>  #include "rte_cryptodev.h"
>
> +
> +#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS	8
> +#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS	2048
> +
> +#define RTE_CRYPTODEV_PMD_NAME_ARG			("name")
> +#define RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG			("max_nb_queue_pairs")
> +#define RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG		("max_nb_sessions")
> +#define RTE_CRYPTODEV_PMD_SOCKET_ID_ARG			("socket_id")
> +
> +
> +static const char * const cryptodev_pmd_valid_params[] = {
> +	RTE_CRYPTODEV_PMD_NAME_ARG,
> +	RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
> +	RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
> +	RTE_CRYPTODEV_PMD_SOCKET_ID_ARG
> +};
> +
> +/**
> + * @internal
> + * Initialisation parameters for crypto devices
> + */
> +struct rte_cryptodev_pmd_init_params {
> +	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
> +	size_t private_data_size;
> +	int socket_id;
> +	unsigned int max_nb_queue_pairs;
> +	unsigned int max_nb_sessions;
> +};
> +
>  /** Global structure used for maintaining state of allocated crypto devices */
>  struct rte_cryptodev_global {
>  	struct rte_cryptodev *devs;	/**< Device information array */
> @@ -392,6 +421,65 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
>  extern int
>  rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
>
> +
> +/**
> + * @internal
> + *
> + * PMD assist function to parse initialisation arguments for crypto driver
> + * when creating a new crypto PMD device instance.
> + *
> + * PMD driver should set default values for that PMD before calling function,
> + * these default values will be over-written with successfully parsed values
> + * from args string.
> + *
> + * @param	params	parsed PMD initialisation parameters
> + * @param	args	input argument string to parse
> + *
> + * @return
> + *  - 0 on success
> + *  - errno on failure
> + */
> +int
> +rte_cryptodev_pmd_parse_input_args(
> +		struct rte_cryptodev_pmd_init_params *params,
> +		const char *args);
> +
> +/**
> + * @internal
> + *
> + * PMD assist function to provide boiler plate code for crypto driver to create
> + * and allocate resources for a new crypto PMD device instance.
> + *
> + * @param	name	crypto device name.
> + * @param	device	base device instance
> + * @param	params	PMD initialisation parameters
> + *
> + * @return
> + *  - crypto device instance on success
> + *  - NULL on creation failure
> + */
> +struct rte_cryptodev *
> +rte_cryptodev_pmd_create(const char *name,
> +		struct rte_device *device,
> +		struct rte_cryptodev_pmd_init_params *params);
> +
> +/**
> + * @internal
> + *
> + * PMD assist function to provide boiler plate code for crypto driver to
> + * destroy and free resources associated with a crypto PMD device instance.
> + *
> + * @param	name	crypto device name.
> + * @param	device	base device instance
> + * @param	params	PMD initialisation parameters
> + *
> + * @return
> + *  - crypto device instance on success
> + *  - NULL on creation failure
> + */
> +int
> +rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);
> +
>  /**
>   * Executes all the user application registered callbacks for the specific
>   * device.
> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
> index 919b6cc..a0ea7bf 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -84,5 +84,8 @@ DPDK_17.11 {
>  	global:
>
>  	rte_cryptodev_name_get;
> +	rte_cryptodev_pmd_create;
> +	rte_cryptodev_pmd_destroy;
> +	rte_cryptodev_pmd_parse_input_args;
>
>  } DPDK_17.08;
> --
> 2.9.4
>

--
- Tomasz Duszyński

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure*
  2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
                   ` (3 preceding siblings ...)
  2017-10-23  9:21 ` [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Doherty, Declan
@ 2017-10-25  0:50 ` Gaëtan Rivet
  2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
  5 siblings, 0 replies; 22+ messages in thread
From: Gaëtan Rivet @ 2017-10-25  0:50 UTC (permalink / raw)
  To: Declan Doherty; +Cc: dev

Hello Declan,

On Fri, Oct 20, 2017 at 10:21:10PM +0100, Declan Doherty wrote:
> This patch set breaks the dependency of the cryptodev library on both the
> virtual and PCI device infrastructure. 
> 
> It introduces new bus independent crypto PMD driver assist functions for 
> parsing initialisation parameters, and creation/destruction of device
> instances.
> 
> It deprecates all function calls to the bus dependent functions and
> updates all crypto PMDs to use the newly introduced device independent
> functions.
> 

I have tested your patchset with my PCI move series and had no issues.
I will add a dependency on your work in my next version.

Thanks!

> Declan Doherty (3):
>   cryptodev: add new APIs to assist PMD initialisation
>   cryptodev: break dependency on virtual device bus
>   cryptodev: break dependency on rte_pci.h
> 
>  doc/guides/rel_notes/deprecation.rst           |   6 +
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  55 +++-----
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  72 +++++-----
>  drivers/crypto/armv8/rte_armv8_pmd.c           |  41 ++----
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +-
>  drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +-
>  drivers/crypto/kasumi/rte_kasumi_pmd.c         |  47 +++----
>  drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 +++-----
>  drivers/crypto/null/null_crypto_pmd.c          |  72 ++++------
>  drivers/crypto/openssl/rte_openssl_pmd.c       |  42 ++----
>  drivers/crypto/qat/qat_crypto.c                |   3 +-
>  drivers/crypto/qat/rte_qat_cryptodev.c         |  55 ++++++--
>  drivers/crypto/scheduler/scheduler_pmd.c       |  45 ++----
>  drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
>  drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++----
>  drivers/crypto/zuc/rte_zuc_pmd.c               |  41 +++---
>  lib/librte_cryptodev/Makefile                  |   2 -
>  lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
>  lib/librte_cryptodev/rte_cryptodev_pci.h       |  92 -------------
>  lib/librte_cryptodev/rte_cryptodev_pmd.c       | 184 ++++++++++---------------
>  lib/librte_cryptodev/rte_cryptodev_pmd.h       |  88 ++++++++++++
>  lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 --------------
>  lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
>  23 files changed, 405 insertions(+), 680 deletions(-)
>  delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
>  delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
> 
> -- 
> 2.9.4
> 

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation
  2017-10-24 14:09   ` Tomasz Duszynski
@ 2017-10-25  0:59     ` Gaëtan Rivet
  0 siblings, 0 replies; 22+ messages in thread
From: Gaëtan Rivet @ 2017-10-25  0:59 UTC (permalink / raw)
  To: Tomasz Duszynski; +Cc: Declan Doherty, dev

On Tue, Oct 24, 2017 at 04:09:19PM +0200, Tomasz Duszynski wrote:
> Hi Declan,
> 
> Some comments inline.
> 
> On Fri, Oct 20, 2017 at 10:21:11PM +0100, Declan Doherty wrote:
> > Adds new PMD assist functions which are bus independent for driver to
> > create and destroy new device instances.
> >
> > Also includes function to parse parameters which can be passed to
> > driver on device initialisation.
> >
> > Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> > ---
> >  lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
> >  lib/librte_cryptodev/rte_cryptodev_pmd.c       | 169 +++++++++++++++++++++++++
> >  lib/librte_cryptodev/rte_cryptodev_pmd.h       |  88 +++++++++++++
> >  lib/librte_cryptodev/rte_cryptodev_version.map |   3 +
> >  4 files changed, 264 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> > index fd0e3f1..86257b0 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev.h
> > +++ b/lib/librte_cryptodev/rte_cryptodev.h
> > @@ -60,10 +60,10 @@ extern const char **rte_cyptodev_names;
> >  		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> >  			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
> >
> > -#define CDEV_PMD_LOG_ERR(dev, ...) \
> > -	RTE_LOG(ERR, CRYPTODEV, \
> > -		RTE_FMT("[%s] %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> > -			dev, __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
> > +#define CDEV_LOG_INFO(...) \
> > +	RTE_LOG(INFO, CRYPTODEV, \
> > +		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> > +			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
> >
> >  #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
> >  #define CDEV_LOG_DEBUG(...) \
> > diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> > index a57faad..6cb4419 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
> > +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> > @@ -40,6 +40,175 @@
> >   * Parse name from argument
> >   */
> >  static int
> > +rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused,
> > +		const char *value, void *extra_args)
> > +{
> > +	struct rte_cryptodev_pmd_init_params *params = extra_args;
> > +
> > +	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
> > +		CDEV_LOG_ERR("Invalid name %s, should be less than "
> > +				"%u bytes", value,
> > +				RTE_CRYPTODEV_NAME_MAX_LEN - 1);
> > +		return -1;
> > +	}
> > +
> > +	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
> 
> Would strcpy() do here? At this point we already know that name will
> fit into params->name.
> 

snprintf should be preferred to str(n)cpy, in order to ensure having the
terminating null byte.

> > --
> > 2.9.4
> >
> 
> --
> - Tomasz Duszyński

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus
  2017-10-20 21:21 ` [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
  2017-10-24 11:18   ` De Lara Guarch, Pablo
  2017-10-24 11:32   ` Akhil Goyal
@ 2017-10-25  6:18   ` Tomasz Duszynski
  2017-10-25  7:45     ` De Lara Guarch, Pablo
  2 siblings, 1 reply; 22+ messages in thread
From: Tomasz Duszynski @ 2017-10-25  6:18 UTC (permalink / raw)
  To: Declan Doherty; +Cc: dev

On Fri, Oct 20, 2017 at 10:21:12PM +0100, Declan Doherty wrote:
> Removes any dependency of librte_cryptodev on the virtual device
> infrastructure code and removes the functions which were virtual
> device specific.
>
> Updates all virtual PMDs to remove dependencies on rte_cryptodev_vdev.h
> and replaces those calls with the new bus independent functions.
>
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> ---
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  55 ++++--------
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  72 +++++++--------
>  drivers/crypto/armv8/rte_armv8_pmd.c           |  41 +++------
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +--
>  drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +--
>  drivers/crypto/kasumi/rte_kasumi_pmd.c         |  47 ++++------
>  drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 ++++--------
>  drivers/crypto/null/null_crypto_pmd.c          |  72 ++++++---------
>  drivers/crypto/openssl/rte_openssl_pmd.c       |  42 +++------
>  drivers/crypto/scheduler/scheduler_pmd.c       |  45 +++-------
>  drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
>  drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++++-----
>  drivers/crypto/zuc/rte_zuc_pmd.c               |  41 ++++-----
>  lib/librte_cryptodev/Makefile                  |   1 -
>  lib/librte_cryptodev/rte_cryptodev_pmd.c       | 120 -------------------------
>  lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 ---------------------
>  lib/librte_cryptodev/rte_cryptodev_version.map |   2 -
>  17 files changed, 190 insertions(+), 573 deletions(-)
>  delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
>
> diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> index 29c14e5..2dd2576 100644
> --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> @@ -35,7 +35,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -486,22 +485,24 @@ static int aesni_gcm_remove(struct rte_vdev_device *vdev);
>  static int
>  aesni_gcm_create(const char *name,
>  		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct aesni_gcm_private *internals;
>  	enum aesni_gcm_vector_mode vector_mode;
>
> -	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)) {
>  		GCM_LOG_ERR("AES instructions not supported by CPU");
>  		return -EFAULT;
>  	}
>
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
> +	if (dev == NULL) {
> +		GCM_LOG_ERR("driver %s: create failed", init_params->name);
> +		return -ENODEV;
> +	}
> +
>  	/* Check CPU for supported vector instruction set */
>  	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))
>  		vector_mode = RTE_AESNI_GCM_AVX2;
> @@ -510,14 +511,6 @@ aesni_gcm_create(const char *name,
>  	else
>  		vector_mode = RTE_AESNI_GCM_SSE;
>
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct aesni_gcm_private), init_params->socket_id,
> -			vdev);
> -	if (dev == NULL) {
> -		GCM_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> -	}
> -
>  	dev->driver_id = cryptodev_driver_id;
>  	dev->dev_ops = rte_aesni_gcm_pmd_ops;
>
> @@ -552,22 +545,17 @@ aesni_gcm_create(const char *name,
>  	internals->max_nb_sessions = init_params->max_nb_sessions;
>
>  	return 0;
> -
> -init_error:
> -	GCM_LOG_ERR("driver %s: create failed", init_params->name);
> -
> -	aesni_gcm_remove(vdev);
> -	return -EFAULT;
>  }
>
>  static int
>  aesni_gcm_probe(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct aesni_gcm_private),
>  		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
>  	const char *name;
>  	const char *input_args;
> @@ -576,17 +564,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
>  	if (name == NULL)
>  		return -EINVAL;
>  	input_args = rte_vdev_device_args(vdev);
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>
>  	return aesni_gcm_create(name, vdev, &init_params);
>  }
> @@ -594,6 +572,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
>  static int
>  aesni_gcm_remove(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
>
>  	name = rte_vdev_device_name(vdev);
> @@ -603,7 +582,11 @@ aesni_gcm_remove(struct rte_vdev_device *vdev)
>  	GCM_LOG_INFO("Closing AESNI crypto device %s on numa socket %u\n",
>  			name, rte_socket_id());
>
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver aesni_gcm_pmd_drv = {
> diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> index 49242fc..440a09f 100644
> --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> @@ -36,7 +36,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -715,15 +714,23 @@ static int cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev);
>  static int
>  cryptodev_aesni_mb_create(const char *name,
>  			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_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')
> -		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)) {
> +		MB_LOG_ERR("AES instructions not supported by CPU");
> +		return -EFAULT;
> +	}
> +
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
> +	if (dev == NULL) {
> +		MB_LOG_ERR("failed to create cryptodev vdev");
> +		return -ENODEV;
> +	}
>
>  	/* Check CPU for supported vector instruction set */
>  	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F))
> @@ -735,14 +742,6 @@ cryptodev_aesni_mb_create(const char *name,
>  	else
>  		vector_mode = RTE_AESNI_MB_SSE;
>
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct aesni_mb_private), init_params->socket_id,
> -			vdev);
> -	if (dev == NULL) {
> -		MB_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> -	}
> -
>  	dev->driver_id = cryptodev_driver_id;
>  	dev->dev_ops = rte_aesni_mb_pmd_ops;
>
> @@ -779,41 +778,33 @@ cryptodev_aesni_mb_create(const char *name,
>  	internals->max_nb_sessions = init_params->max_nb_sessions;
>
>  	return 0;
> -init_error:
> -	MB_LOG_ERR("driver %s: cryptodev_aesni_create failed",
> -			init_params->name);
> -
> -	cryptodev_aesni_mb_remove(vdev);
> -	return -EFAULT;
>  }
>
>  static int
>  cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct aesni_mb_private),
>  		rte_socket_id(),
> -		""
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
> -	const char *name;
> -	const char *input_args;
> +	const char *name, *args;
> +	int retval;
>
>  	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
> -	input_args = rte_vdev_device_args(vdev);
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +
> +	args = rte_vdev_device_args(vdev);
> +
> +	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
> +	if (retval) {
> +		MB_LOG_ERR("Failed to parse initialisation arguments[%s]\n",
> +				args);
> +		return -EINVAL;
> +	}
>
>  	return cryptodev_aesni_mb_create(name, vdev, &init_params);
>  }
> @@ -821,6 +812,7 @@ cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
>  static int
>  cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
>
>  	name = rte_vdev_device_name(vdev);
> @@ -830,7 +822,11 @@ cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
>  	RTE_LOG(INFO, PMD, "Closing AESNI crypto device %s on numa socket %u\n",
>  			name, rte_socket_id());
>
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
> diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
> index dbe6bee..2d2f3ff 100644
> --- a/drivers/crypto/armv8/rte_armv8_pmd.c
> +++ b/drivers/crypto/armv8/rte_armv8_pmd.c
> @@ -36,7 +36,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -759,7 +758,7 @@ armv8_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
>  static int
>  cryptodev_armv8_crypto_create(const char *name,
>  			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct armv8_crypto_private *internals;
> @@ -786,14 +785,7 @@ cryptodev_armv8_crypto_create(const char *name,
>  		return -EFAULT;
>  	}
>
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -				sizeof(struct armv8_crypto_private),
> -				init_params->socket_id,
> -				vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>  	if (dev == NULL) {
>  		ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
>  		goto init_error;
> @@ -832,11 +824,12 @@ cryptodev_armv8_crypto_create(const char *name,
>  static int
>  cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct armv8_crypto_private),
>  		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
>  	const char *name;
>  	const char *input_args;
> @@ -845,18 +838,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
>  	if (name == NULL)
>  		return -EINVAL;
>  	input_args = rte_vdev_device_args(vdev);
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0') {
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	}
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>
>  	return cryptodev_armv8_crypto_create(name, vdev, &init_params);
>  }
> @@ -865,6 +847,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
>  static int
>  cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
>
>  	name = rte_vdev_device_name(vdev);
> @@ -875,7 +858,11 @@ cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
>  		"Closing ARMv8 crypto device %s on numa socket %u\n",
>  		name, rte_socket_id());
>
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver armv8_crypto_pmd_drv = {
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 0a466ba..2359ee6 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -1990,16 +1990,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
>  	if (ret)
>  		return ret;
>
> -	/* free crypto device */
> -	rte_cryptodev_pmd_release_device(cryptodev);
> -
> -	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> -		rte_free(cryptodev->data->dev_private);
> -
> -	cryptodev->device = NULL;
> -	cryptodev->data = NULL;
> -
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_dpaa2_driver rte_dpaa2_sec_driver = {
> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
> index 53f004e..bb39b75 100644
> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c
> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
> @@ -1517,19 +1517,7 @@ cryptodev_dpaa_sec_remove(struct rte_dpaa_device *dpaa_dev)
>  	if (ret)
>  		return ret;
>
> -	/* free crypto device */
> -	rte_cryptodev_pmd_release_device(cryptodev);
> -
> -	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> -		rte_free(cryptodev->data->dev_private);
> -
> -	PMD_INIT_LOG(INFO, "Closing dpaa crypto device %s",
> -		     cryptodev->data->name);
> -
> -	cryptodev->device = NULL;
> -	cryptodev->data = NULL;
> -
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_dpaa_driver rte_dpaa_sec_driver = {
> diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
> index 7a00bd3..03f0a86 100644
> --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
> +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
> @@ -35,7 +35,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -553,15 +552,17 @@ static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
>  static int
>  cryptodev_kasumi_create(const char *name,
>  			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct kasumi_private *internals;
>  	uint64_t cpu_flags = 0;
>
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
> +	if (dev == NULL) {
> +		KASUMI_LOG_ERR("failed to create cryptodev vdev");
> +		goto init_error;
> +	}
>
>  	/* Check CPU for supported vector instruction set */
>  	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX))
> @@ -569,14 +570,6 @@ cryptodev_kasumi_create(const char *name,
>  	else
>  		cpu_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
>
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct kasumi_private), init_params->socket_id,
> -			vdev);
> -	if (dev == NULL) {
> -		KASUMI_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> -	}
> -
>  	dev->driver_id = cryptodev_driver_id;
>  	dev->dev_ops = rte_kasumi_pmd_ops;
>
> @@ -605,11 +598,12 @@ cryptodev_kasumi_create(const char *name,
>  static int
>  cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct kasumi_private),
>  		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
>  	const char *name;
>  	const char *input_args;
> @@ -619,17 +613,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
>  		return -EINVAL;
>  	input_args = rte_vdev_device_args(vdev);
>
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>
>  	return cryptodev_kasumi_create(name, vdev, &init_params);
>  }
> @@ -637,6 +621,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
>  static int
>  cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
>
>  	name = rte_vdev_device_name(vdev);
> @@ -647,7 +632,11 @@ cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
>  			" on numa socket %u\n",
>  			name, rte_socket_id());
>
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
> diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c
> index 6a9c8da..63895c5 100644
> --- a/drivers/crypto/mrvl/rte_mrvl_pmd.c
> +++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c
> @@ -36,7 +36,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -720,26 +719,14 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair,
>  static int
>  cryptodev_mrvl_crypto_create(const char *name,
>  		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct mrvl_crypto_private *internals;
>  	struct sam_init_params	sam_params;
>  	int ret;
>
> -	if (init_params->name[0] == '\0') {
> -		ret = rte_cryptodev_pmd_create_dev_name(
> -				init_params->name, name);
> -
> -		if (ret < 0) {
> -			MRVL_CRYPTO_LOG_ERR("failed to create unique name");
> -			return ret;
> -		}
> -	}
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -				sizeof(struct mrvl_crypto_private),
> -				init_params->socket_id, vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>  	if (dev == NULL) {
>  		MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
>  		goto init_error;
> @@ -796,40 +783,28 @@ cryptodev_mrvl_crypto_create(const char *name,
>  static int
>  cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = { };
> -	const char *name;
> -	const char *input_args;
> +	struct rte_cryptodev_pmd_init_params init_params = { };
> +	const char *name, *args;
>  	int ret;
>
>  	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
> -	input_args = rte_vdev_device_args(vdev);
> -
> -	if (!input_args)
> -		return -EINVAL;
> +	args = rte_vdev_device_args(vdev);
>
> +	init_params.private_data_size = sizeof(struct mrvl_crypto_private);
>  	init_params.max_nb_queue_pairs = sam_get_num_inst() * SAM_HW_RING_NUM;
>  	init_params.max_nb_sessions =
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
>  	init_params.socket_id = rte_socket_id();
>
> -	ret = rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> +	ret = rte_cryptodev_pmd_parse_input_args(&init_params, args);
>  	if (ret) {
> -		RTE_LOG(ERR, PMD, "Failed to parse input arguments\n");
> -		return ret;
> -	}
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0') {
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> +		RTE_LOG(ERR, PMD,
> +			"Failed to parse initialisation arguments[%s]\n",
> +			args);
> +		return -EINVAL;
>  	}
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
>
>  	return cryptodev_mrvl_crypto_create(name, vdev, &init_params);
>  }
> @@ -843,6 +818,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
>  static int
>  cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name = rte_vdev_device_name(vdev);
>
>  	if (name == NULL)
> @@ -854,7 +830,11 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
>
>  	sam_deinit();
>
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  /**
> diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
> index d5d2bb3..4b9a58a 100644
> --- a/drivers/crypto/null/null_crypto_pmd.c
> +++ b/drivers/crypto/null/null_crypto_pmd.c
> @@ -33,7 +33,6 @@
>  #include <rte_common.h>
>  #include <rte_config.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>
> @@ -183,28 +182,19 @@ null_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
>  	return nb_dequeued;
>  }
>
> -static int cryptodev_null_remove(const char *name);
> -
>  /** Create crypto device */
>  static int
>  cryptodev_null_create(const char *name,
>  		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct null_crypto_private *internals;
>
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct null_crypto_private),
> -			init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>  	if (dev == NULL) {
>  		NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
> -		goto init_error;
> +		return -EFAULT;
>  	}
>
>  	dev->driver_id = cryptodev_driver_id;
> @@ -224,61 +214,53 @@ cryptodev_null_create(const char *name,
>  	internals->max_nb_sessions = init_params->max_nb_sessions;
>
>  	return 0;
> -
> -init_error:
> -	NULL_CRYPTO_LOG_ERR("driver %s: cryptodev_null_create failed",
> -			init_params->name);
> -	cryptodev_null_remove(init_params->name);
> -
> -	return -EFAULT;
>  }
>
>  /** Initialise null crypto device */
>  static int
>  cryptodev_null_probe(struct rte_vdev_device *dev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct null_crypto_private),
>  		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
> -	const char *name;
> +	const char *name, *args;
> +	int retval;
>
>  	name = rte_vdev_device_name(dev);
>  	if (name == NULL)
>  		return -EINVAL;
>
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
> -		name, init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	args = rte_vdev_device_args(dev);
> +
> +	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
> +	if (retval) {
> +		RTE_LOG(ERR, PMD,
> +			"Failed to parse initialisation arguments[%s]\n", args);
> +		return -EINVAL;
> +	}
>
>  	return cryptodev_null_create(name, dev, &init_params);
>  }
>
> -/** Uninitialise null crypto device */
>  static int
> -cryptodev_null_remove(const char *name)
> +cryptodev_null_remove_dev(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
> +	const char *name;
> +
> +	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
>
> -	RTE_LOG(INFO, PMD, "Closing null crypto device %s on numa socket %u\n",
> -			name, rte_socket_id());
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
>
> -	return 0;
> -}
> -
> -static int
> -cryptodev_null_remove_dev(struct rte_vdev_device *dev)
> -{
> -	return cryptodev_null_remove(rte_vdev_device_name(dev));
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver cryptodev_null_pmd_drv = {
> diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
> index 95c0236..25c1154 100644
> --- a/drivers/crypto/openssl/rte_openssl_pmd.c
> +++ b/drivers/crypto/openssl/rte_openssl_pmd.c
> @@ -34,7 +34,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -1668,19 +1667,12 @@ openssl_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
>  static int
>  cryptodev_openssl_create(const char *name,
>  			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct openssl_private *internals;
>
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct openssl_private),
> -			init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>  	if (dev == NULL) {
>  		OPENSSL_LOG_ERR("failed to create cryptodev vdev");
>  		goto init_error;
> @@ -1718,11 +1710,12 @@ cryptodev_openssl_create(const char *name,
>  static int
>  cryptodev_openssl_probe(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct openssl_private),
>  		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
>  	const char *name;
>  	const char *input_args;
> @@ -1732,17 +1725,7 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
>  		return -EINVAL;
>  	input_args = rte_vdev_device_args(vdev);
>
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>
>  	return cryptodev_openssl_create(name, vdev, &init_params);
>  }
> @@ -1751,17 +1734,18 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
>  static int
>  cryptodev_openssl_remove(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
>
>  	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
>
> -	RTE_LOG(INFO, PMD,
> -		"Closing OPENSSL crypto device %s on numa socket %u\n",
> -		name, rte_socket_id());
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
>
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver cryptodev_openssl_pmd_drv = {
> diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
> index 3170f7f..40ab304 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd.c
> @@ -33,7 +33,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -45,7 +44,7 @@
>  uint8_t cryptodev_driver_id;
>
>  struct scheduler_init_params {
> -	struct rte_crypto_vdev_init_params def_p;
> +	struct rte_cryptodev_pmd_init_params def_p;
>  	uint32_t nb_slaves;
>  	enum rte_cryptodev_scheduler_mode mode;
>  	uint32_t enable_ordering;
> @@ -107,21 +106,18 @@ cryptodev_scheduler_create(const char *name,
>  	uint32_t i;
>  	int ret;
>
> -	if (init_params->def_p.name[0] == '\0')
> -		snprintf(init_params->def_p.name,
> -				sizeof(init_params->def_p.name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->def_p.name,
> -			sizeof(struct scheduler_ctx),
> -			init_params->def_p.socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device,
> +			&init_params->def_p);
>  	if (dev == NULL) {
>  		CS_LOG_ERR("driver %s: failed to create cryptodev vdev",
>  			name);
>  		return -EFAULT;
>  	}
>
> +	if (init_params->wcmask != 0)
> +		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
> +			init_params->wcmask);
> +
>  	dev->driver_id = cryptodev_driver_id;
>  	dev->dev_ops = rte_crypto_scheduler_pmd_ops;
>
> @@ -240,10 +236,7 @@ cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
>  					sched_ctx->slaves[i].dev_id);
>  	}
>
> -	RTE_LOG(INFO, PMD, "Closing Crypto Scheduler device %s on numa "
> -		"socket %u\n", name, rte_socket_id());
> -
> -	return 0;
> +	return rte_cryptodev_pmd_destroy(dev);
>  }
>
>  /** Parse integer from integer argument */
> @@ -304,7 +297,7 @@ static int
>  parse_name_arg(const char *key __rte_unused,
>  		const char *value, void *extra_args)
>  {
> -	struct rte_crypto_vdev_init_params *params = extra_args;
> +	struct rte_cryptodev_pmd_init_params *params = extra_args;
>
>  	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
>  		CS_LOG_ERR("Invalid name %s, should be less than "
> @@ -462,10 +455,11 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
>  {
>  	struct scheduler_init_params init_params = {
>  		.def_p = {
> -			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +			"",
> +			sizeof(struct scheduler_ctx),
>  			rte_socket_id(),
> -			""
> +			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  		},
>  		.nb_slaves = 0,
>  		.mode = CDEV_SCHED_MODE_NOT_SET,
> @@ -481,19 +475,6 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
>  	scheduler_parse_init_params(&init_params,
>  				    rte_vdev_device_args(vdev));
>
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
> -			name,
> -			init_params.def_p.socket_id);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.def_p.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.def_p.max_nb_sessions);
> -	if (init_params.def_p.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.def_p.name);
> -	if (init_params.wcmask != 0)
> -		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
> -			init_params.wcmask);
>
>  	return cryptodev_scheduler_create(name,
>  					vdev,
> diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> index d379534..fef686f 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> @@ -37,7 +37,6 @@
>  #include <rte_dev.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_reorder.h>
>
>  #include "scheduler_pmd_private.h"
> @@ -347,7 +346,7 @@ scheduler_pmd_info_get(struct rte_cryptodev *dev,
>  {
>  	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
>  	uint32_t max_nb_sessions = sched_ctx->nb_slaves ?
> -			UINT32_MAX : RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
> +			UINT32_MAX : RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
>  	uint32_t i;
>
>  	if (!dev_info)
> diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
> index 8e1d1ec..7cd6114 100644
> --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
> +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
> @@ -35,7 +35,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -559,19 +558,13 @@ static int cryptodev_snow3g_remove(struct rte_vdev_device *vdev);
>  static int
>  cryptodev_snow3g_create(const char *name,
>  			struct rte_vdev_device *vdev,
> -			struct rte_crypto_vdev_init_params *init_params)
> +			struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct snow3g_private *internals;
>  	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
>
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
> -
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct snow3g_private), init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>  	if (dev == NULL) {
>  		SNOW3G_LOG_ERR("failed to create cryptodev vdev");
>  		goto init_error;
> @@ -605,11 +598,12 @@ cryptodev_snow3g_create(const char *name,
>  static int
>  cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct snow3g_private),
>  		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
>  	const char *name;
>  	const char *input_args;
> @@ -619,17 +613,7 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
>  		return -EINVAL;
>  	input_args = rte_vdev_device_args(vdev);
>
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>
>  	return cryptodev_snow3g_create(name, vdev, &init_params);
>  }
> @@ -637,17 +621,22 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
>  static int
>  cryptodev_snow3g_remove(struct rte_vdev_device *vdev)
>  {
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
>
>  	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
>
> -	RTE_LOG(INFO, PMD, "Closing SNOW 3G crypto device %s"
> +	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
>  			" on numa socket %u\n",
>  			name, rte_socket_id());
>
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
> diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
> index f1f9291..fb894f1 100644
> --- a/drivers/crypto/zuc/rte_zuc_pmd.c
> +++ b/drivers/crypto/zuc/rte_zuc_pmd.c
> @@ -35,7 +35,6 @@
>  #include <rte_hexdump.h>
>  #include <rte_cryptodev.h>
>  #include <rte_cryptodev_pmd.h>
> -#include <rte_cryptodev_vdev.h>
>  #include <rte_vdev.h>
>  #include <rte_malloc.h>
>  #include <rte_cpuflags.h>
> @@ -463,19 +462,14 @@ static int cryptodev_zuc_remove(struct rte_vdev_device *vdev);
>  static int
>  cryptodev_zuc_create(const char *name,
>  		struct rte_vdev_device *vdev,
> -		struct rte_crypto_vdev_init_params *init_params)
> +		struct rte_cryptodev_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct zuc_private *internals;
>  	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
>
> -	if (init_params->name[0] == '\0')
> -		snprintf(init_params->name, sizeof(init_params->name),
> -				"%s", name);
>
> -	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
> -			sizeof(struct zuc_private), init_params->socket_id,
> -			vdev);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
>  	if (dev == NULL) {
>  		ZUC_LOG_ERR("failed to create cryptodev vdev");
>  		goto init_error;
> @@ -509,11 +503,12 @@ cryptodev_zuc_create(const char *name,
>  static int
>  cryptodev_zuc_probe(struct rte_vdev_device *vdev)
>  {
> -	struct rte_crypto_vdev_init_params init_params = {
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
> -		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
> +	struct rte_cryptodev_pmd_init_params init_params = {
> +		"",
> +		sizeof(struct zuc_private),
>  		rte_socket_id(),
> -		{0}
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
> +		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
>  	};
>  	const char *name;
>  	const char *input_args;
> @@ -523,17 +518,7 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
>  		return -EINVAL;
>  	input_args = rte_vdev_device_args(vdev);
>
> -	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
> -
> -	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
> -			init_params.socket_id);
> -	if (init_params.name[0] != '\0')
> -		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
> -			init_params.name);
> -	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
> -			init_params.max_nb_queue_pairs);
> -	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
> -			init_params.max_nb_sessions);
> +	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
>
>  	return cryptodev_zuc_create(name, vdev, &init_params);
>  }
> @@ -541,17 +526,23 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
>  static int
>  cryptodev_zuc_remove(struct rte_vdev_device *vdev)
>  {
> +
> +	struct rte_cryptodev *cryptodev;
>  	const char *name;
>
>  	name = rte_vdev_device_name(vdev);
>  	if (name == NULL)
>  		return -EINVAL;
>
> -	RTE_LOG(INFO, PMD, "Closing ZUC crypto device %s"
> +	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
>  			" on numa socket %u\n",
>  			name, rte_socket_id());
>
> -	return 0;
> +	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
> +	if (cryptodev == NULL)
> +		return -ENODEV;
> +
> +	return rte_cryptodev_pmd_destroy(cryptodev);
>  }
>
>  static struct rte_vdev_driver cryptodev_zuc_pmd_drv = {
> diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
> index 6ac331b..4f70719 100644
> --- a/lib/librte_cryptodev/Makefile
> +++ b/lib/librte_cryptodev/Makefile
> @@ -48,7 +48,6 @@ SYMLINK-y-include += rte_crypto.h
>  SYMLINK-y-include += rte_crypto_sym.h
>  SYMLINK-y-include += rte_cryptodev.h
>  SYMLINK-y-include += rte_cryptodev_pmd.h
> -SYMLINK-y-include += rte_cryptodev_vdev.h
>  SYMLINK-y-include += rte_cryptodev_pci.h
>
>  # versioning export map
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> index 6cb4419..62acb47 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> @@ -32,7 +32,6 @@
>
>  #include <rte_malloc.h>
>
> -#include "rte_cryptodev_vdev.h"
>  #include "rte_cryptodev_pci.h"
>  #include "rte_cryptodev_pmd.h"
>
> @@ -205,125 +204,6 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
>  	return 0;
>  }
>
> -/**
> - * Parse name from argument
> - */
> -static int
> -rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
> -		const char *value, void *extra_args)
> -{
> -	struct rte_crypto_vdev_init_params *params = extra_args;
> -
> -	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
> -		CDEV_LOG_ERR("Invalid name %s, should be less than "
> -				"%u bytes", value,
> -				RTE_CRYPTODEV_NAME_MAX_LEN - 1);
> -		return -1;
> -	}
> -
> -	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
> -
> -	return 0;
> -}
> -
> -/**
> - * Parse integer from argument
> - */
> -static int
> -rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
> -		const char *value, void *extra_args)
> -{
> -	int *i = extra_args;
> -
> -	*i = atoi(value);
> -	if (*i < 0) {
> -		CDEV_LOG_ERR("Argument has to be positive.");
> -		return -1;
> -	}
> -
> -	return 0;
> -}
> -
> -struct rte_cryptodev *
> -rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
> -		int socket_id, struct rte_vdev_device *vdev)
> -{
> -	struct rte_cryptodev *cryptodev;
> -
> -	/* allocate device structure */
> -	cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
> -	if (cryptodev == NULL)
> -		return NULL;
> -
> -	/* allocate private device structure */
> -	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> -		cryptodev->data->dev_private =
> -				rte_zmalloc_socket("cryptodev device private",
> -						dev_private_size,
> -						RTE_CACHE_LINE_SIZE,
> -						socket_id);
> -
> -		if (cryptodev->data->dev_private == NULL)
> -			rte_panic("Cannot allocate memzone for private device"
> -					" data");
> -	}
> -
> -	cryptodev->device = &vdev->device;
> -
> -	/* initialise user call-back tail queue */
> -	TAILQ_INIT(&(cryptodev->link_intr_cbs));
> -
> -	return cryptodev;
> -}
> -
> -int
> -rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
> -		const char *input_args)
> -{
> -	struct rte_kvargs *kvlist = NULL;
> -	int ret = 0;
> -
> -	if (params == NULL)
> -		return -EINVAL;
> -
> -	if (input_args) {
> -		kvlist = rte_kvargs_parse(input_args,
> -				cryptodev_vdev_valid_params);
> -		if (kvlist == NULL)
> -			return -1;
> -
> -		ret = rte_kvargs_process(kvlist,
> -					RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
> -					&rte_cryptodev_vdev_parse_integer_arg,
> -					&params->max_nb_queue_pairs);
> -		if (ret < 0)
> -			goto free_kvlist;
> -
> -		ret = rte_kvargs_process(kvlist,
> -					RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
> -					&rte_cryptodev_vdev_parse_integer_arg,
> -					&params->max_nb_sessions);
> -		if (ret < 0)
> -			goto free_kvlist;
> -
> -		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
> -					&rte_cryptodev_vdev_parse_integer_arg,
> -					&params->socket_id);
> -		if (ret < 0)
> -			goto free_kvlist;
> -
> -		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
> -					&rte_cryptodev_vdev_parse_name_arg,
> -					params);
> -		if (ret < 0)
> -			goto free_kvlist;
> -	}
> -
> -free_kvlist:
> -	rte_kvargs_free(kvlist);
> -	return ret;
> -}
> -
>  int
>  rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
>  			size_t private_data_size,
> diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
> deleted file mode 100644
> index 94ab9d3..0000000
> --- a/lib/librte_cryptodev/rte_cryptodev_vdev.h
> +++ /dev/null
> @@ -1,100 +0,0 @@
> -/*-
> - *   BSD LICENSE
> - *
> - *   Copyright(c) 2017 Intel Corporation. All rights reserved.
> - *
> - *   Redistribution and use in source and binary forms, with or without
> - *   modification, are permitted provided that the following conditions
> - *   are met:
> - *
> - *     * Redistributions of source code must retain the above copyright
> - *       notice, this list of conditions and the following disclaimer.
> - *     * Redistributions in binary form must reproduce the above copyright
> - *       notice, this list of conditions and the following disclaimer in
> - *       the documentation and/or other materials provided with the
> - *       distribution.
> - *     * Neither the name of the copyright holder nor the names of its
> - *       contributors may be used to endorse or promote products derived
> - *       from this software without specific prior written permission.
> - *
> - *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#ifndef _RTE_CRYPTODEV_VDEV_H_
> -#define _RTE_CRYPTODEV_VDEV_H_
> -
> -#include <rte_vdev.h>
> -#include <inttypes.h>
> -
> -#include "rte_cryptodev.h"
> -
> -#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS	8
> -#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS	2048
> -
> -#define RTE_CRYPTODEV_VDEV_NAME				("name")
> -#define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG		("max_nb_queue_pairs")
> -#define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG		("max_nb_sessions")
> -#define RTE_CRYPTODEV_VDEV_SOCKET_ID			("socket_id")
> -
> -static const char * const cryptodev_vdev_valid_params[] = {
> -	RTE_CRYPTODEV_VDEV_NAME,
> -	RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
> -	RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
> -	RTE_CRYPTODEV_VDEV_SOCKET_ID
> -};
> -
> -/**
> - * @internal
> - * Initialisation parameters for virtual crypto devices
> - */
> -struct rte_crypto_vdev_init_params {
> -	unsigned int max_nb_queue_pairs;
> -	unsigned int max_nb_sessions;
> -	uint8_t socket_id;
> -	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
> -};
> -
> -/**
> - * @internal
> - * Creates a new virtual crypto device and returns the pointer
> - * to that device.
> - *
> - * @param	name			PMD type name
> - * @param	dev_private_size	Size of crypto PMDs private data
> - * @param	socket_id		Socket to allocate resources on.
> - * @param	vdev			Pointer to virtual device structure.
> - *
> - * @return
> - *   - Cryptodev pointer if device is successfully created.
> - *   - NULL if device cannot be created.
> - */
> -struct rte_cryptodev *
> -rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
> -		int socket_id, struct rte_vdev_device *vdev);
> -
> -/**
> - * @internal
> - * Parse virtual device initialisation parameters input arguments
> - *
> - * @params	params		Initialisation parameters with defaults set.
> - * @params	input_args	Command line arguments
> - *
> - * @return
> - * 0 on successful parse
> - * <0 on failure to parse
> - */
> -int
> -rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
> -		const char *input_args);
> -
> -#endif /* _RTE_CRYPTODEV_VDEV_H_ */
> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
> index a0ea7bf..d3e4515 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -73,8 +73,6 @@ DPDK_17.08 {
>  	rte_cryptodev_sym_capability_check_aead;
>  	rte_cryptodev_sym_session_init;
>  	rte_cryptodev_sym_session_clear;
> -	rte_cryptodev_vdev_parse_init_params;
> -	rte_cryptodev_vdev_pmd_init;
>  	rte_crypto_aead_algorithm_strings;
>  	rte_crypto_aead_operation_strings;
>
> --
> 2.9.4
>

As for Marvell crypto pmd:
Tested-by: Tomasz Duszynski <tdu@semihalf.com>

Thanks.

--
- Tomasz Duszyński

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus
  2017-10-25  6:18   ` Tomasz Duszynski
@ 2017-10-25  7:45     ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 22+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-25  7:45 UTC (permalink / raw)
  To: Tomasz Duszynski, Doherty, Declan; +Cc: dev

Hi Tomasz,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Duszynski
> Sent: Wednesday, October 25, 2017 7:18 AM
> To: Doherty, Declan <declan.doherty@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on
> virtual device bus

...

> 
> As for Marvell crypto pmd:
> Tested-by: Tomasz Duszynski <tdu@semihalf.com>
> 

Thanks for testing this out.
Please, make sure to strip out the parts of the email that you are not commenting
(in this case, almost all of it), so it is easier to check for replies.

Pablo

> Thanks.
> 
> --
> - Tomasz Duszyński

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure
  2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
                   ` (4 preceding siblings ...)
  2017-10-25  0:50 ` Gaëtan Rivet
@ 2017-10-25 12:00 ` Declan Doherty
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
                     ` (4 more replies)
  5 siblings, 5 replies; 22+ messages in thread
From: Declan Doherty @ 2017-10-25 12:00 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

This patch set breaks the dependency of the cryptodev library on both the
virtual and PCI device infrastructure. 

It introduces new bus independent crypto PMD driver assist functions for
parsing initialisation parameters, and creation/destruction of device
instances.

It deprecates all function calls to the bus dependent functions and
updates all crypto PMDs to use the newly introduced device independent
functions.

V2:
- Add release notes updates for new APIs and API removals
- Addresses comments on string and unsigned integer parsing functions
- logging and doxygen comments tidy up

Declan Doherty (3):
  cryptodev: add new APIs to assist PMD initialisation
  cryptodev: break dependency on virtual device bus
  cryptodev: break dependency on PCI device bus

 doc/guides/rel_notes/deprecation.rst           |   5 -
 doc/guides/rel_notes/release_17_11.rst         |  20 +++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  56 +++----
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  73 ++++-----
 drivers/crypto/armv8/rte_armv8_pmd.c           |  41 ++---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c         |  49 ++----
 drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 +++----
 drivers/crypto/null/null_crypto_pmd.c          |  72 ++++-----
 drivers/crypto/openssl/rte_openssl_pmd.c       |  42 ++---
 drivers/crypto/qat/qat_crypto.c                |   3 +-
 drivers/crypto/qat/rte_qat_cryptodev.c         |  55 +++++--
 drivers/crypto/scheduler/scheduler_pmd.c       |  45 ++----
 drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
 drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++---
 drivers/crypto/zuc/rte_zuc_pmd.c               |  41 ++---
 lib/librte_cryptodev/Makefile                  |   2 -
 lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
 lib/librte_cryptodev/rte_cryptodev_pci.h       |  92 -----------
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 213 ++++++++++---------------
 lib/librte_cryptodev/rte_cryptodev_pmd.h       |  86 ++++++++++
 lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 ------------
 lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
 24 files changed, 424 insertions(+), 711 deletions(-)
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h

-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation
  2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
@ 2017-10-25 12:00   ` Declan Doherty
  2017-10-25 15:56     ` Trahe, Fiona
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 22+ messages in thread
From: Declan Doherty @ 2017-10-25 12:00 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

Adds new PMD assist functions which are bus independent for driver to
create and destroy new device instances.

Also includes function to parse parameters which can be passed to
driver on device initialisation.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 doc/guides/rel_notes/release_17_11.rst         |   6 +
 lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 168 +++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev_pmd.h       |  86 +++++++++++++
 lib/librte_cryptodev/rte_cryptodev_version.map |   3 +
 5 files changed, 267 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index e4e98f7..0a90db4 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -291,6 +291,12 @@ API Changes
   ``rte_log_get_global_level()``, ``rte_log_set_level()`` and
   ``rte_log_get_level()``.
 
+* **Add bus agnostic functions to crytpodev for PMD initialisation**
+
+  Adds new PMD assist functions ``rte_cryptodev_pmd_parse_input_args()``,
+  ``rte_cryptodev_pmd_create()`` and ``rte_cryptodev_pmd_destroy()`` which
+  are bus independent for driver to manage creation and destruction of new
+  device instances.
 
 ABI Changes
 -----------
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index fd0e3f1..e054c50 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -60,10 +60,10 @@ extern const char **rte_cyptodev_names;
 		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
-#define CDEV_PMD_LOG_ERR(dev, ...) \
-	RTE_LOG(ERR, CRYPTODEV, \
-		RTE_FMT("[%s] %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			dev, __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+#define CDEV_LOG_INFO(...) \
+	RTE_LOG(INFO, CRYPTODEV, \
+		RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
 #define CDEV_LOG_DEBUG(...) \
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index a57faad..ca6d459 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -40,6 +40,174 @@
  * Parse name from argument
  */
 static int
+rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	struct rte_cryptodev_pmd_init_params *params = extra_args;
+	int n;
+
+	n = snprintf(params->name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s",value);
+	if (n >= RTE_CRYPTODEV_NAME_MAX_LEN)
+		return -EINVAL;
+
+	return 0;
+}
+
+/**
+ * Parse unsigned integer from argument
+ */
+static int
+rte_cryptodev_pmd_parse_uint_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0)
+		return -EINVAL;
+
+	*((uint32_t *)extra_args) = i;
+	return 0;
+}
+
+int
+rte_cryptodev_pmd_parse_input_args(
+		struct rte_cryptodev_pmd_init_params *params,
+		const char *args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+
+	if (args) {
+		kvlist = rte_kvargs_parse(args,	cryptodev_pmd_valid_params);
+		if (kvlist == NULL)
+			return -EINVAL;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
+				&rte_cryptodev_pmd_parse_uint_arg,
+				&params->max_nb_queue_pairs);
+		if (ret < 0)
+			goto free_kvlist;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
+				&rte_cryptodev_pmd_parse_uint_arg,
+				&params->max_nb_sessions);
+		if (ret < 0)
+			goto free_kvlist;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
+				&rte_cryptodev_pmd_parse_uint_arg,
+				&params->socket_id);
+		if (ret < 0)
+			goto free_kvlist;
+
+		ret = rte_kvargs_process(kvlist,
+				RTE_CRYPTODEV_PMD_NAME_ARG,
+				&rte_cryptodev_pmd_parse_name_arg,
+				params);
+		if (ret < 0)
+			goto free_kvlist;
+	}
+
+free_kvlist:
+	rte_kvargs_free(kvlist);
+	return ret;
+}
+
+struct rte_cryptodev *
+rte_cryptodev_pmd_create(const char *name,
+		struct rte_device *device,
+		struct rte_cryptodev_pmd_init_params *params)
+{
+	struct rte_cryptodev *cryptodev;
+
+	if (params->name[0] != '\0') {
+		CDEV_LOG_INFO("[%s] User specified device name = %s\n",
+				device->driver->name, params->name);
+		name = params->name;
+	}
+
+	CDEV_LOG_INFO("[%s] - Creating cryptodev %s\n",
+			device->driver->name, name);
+
+	CDEV_LOG_INFO("[%s] - Initialisation parameters - name: %s,"
+			"socket id: %d, max queue pairs: %u, max sessions: %u",
+			device->driver->name, name,
+			params->socket_id, params->max_nb_queue_pairs,
+			params->max_nb_sessions);
+
+	/* allocate device structure */
+	cryptodev = rte_cryptodev_pmd_allocate(name, params->socket_id);
+	if (cryptodev == NULL) {
+		CDEV_LOG_ERR("[%s] Failed to allocate crypto device for %s",
+				device->driver->name, name);
+		return NULL;
+	}
+
+	/* allocate private device structure */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		cryptodev->data->dev_private =
+				rte_zmalloc_socket("cryptodev device private",
+						params->private_data_size,
+						RTE_CACHE_LINE_SIZE,
+						params->socket_id);
+
+		if (cryptodev->data->dev_private == NULL) {
+			CDEV_LOG_ERR("[%s] Cannot allocate memory for "
+					"cryptodev %s private data",
+					device->driver->name, name);
+
+			rte_cryptodev_pmd_release_device(cryptodev);
+			return NULL;
+		}
+	}
+
+	cryptodev->device = device;
+
+	/* initialise user call-back tail queue */
+	TAILQ_INIT(&(cryptodev->link_intr_cbs));
+
+	return cryptodev;
+}
+
+
+
+int
+rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
+{
+	int retval;
+
+	CDEV_LOG_INFO("[%s] Closing crypto device %s",
+			cryptodev->device->driver->name,
+			cryptodev->device->name);
+
+	/* free crypto device */
+	retval = rte_cryptodev_pmd_release_device(cryptodev);
+	if (retval)
+		return retval;
+
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		rte_free(cryptodev->data->dev_private);
+
+
+	cryptodev->device = NULL;
+	cryptodev->data = NULL;
+
+	return 0;
+}
+
+/**
+ * Parse name from argument
+ */
+static int
 rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index ba074e1..744405e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -56,6 +56,35 @@ extern "C" {
 #include "rte_crypto.h"
 #include "rte_cryptodev.h"
 
+
+#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS	8
+#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS	2048
+
+#define RTE_CRYPTODEV_PMD_NAME_ARG			("name")
+#define RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG			("max_nb_queue_pairs")
+#define RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG		("max_nb_sessions")
+#define RTE_CRYPTODEV_PMD_SOCKET_ID_ARG			("socket_id")
+
+
+static const char * const cryptodev_pmd_valid_params[] = {
+	RTE_CRYPTODEV_PMD_NAME_ARG,
+	RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
+	RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
+	RTE_CRYPTODEV_PMD_SOCKET_ID_ARG
+};
+
+/**
+ * @internal
+ * Initialisation parameters for crypto devices
+ */
+struct rte_cryptodev_pmd_init_params {
+	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+	size_t private_data_size;
+	int socket_id;
+	unsigned int max_nb_queue_pairs;
+	unsigned int max_nb_sessions;
+};
+
 /** Global structure used for maintaining state of allocated crypto devices */
 struct rte_cryptodev_global {
 	struct rte_cryptodev *devs;	/**< Device information array */
@@ -392,6 +421,63 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
 extern int
 rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
 
+
+/**
+ * @internal
+ *
+ * PMD assist function to parse initialisation arguments for crypto driver
+ * when creating a new crypto PMD device instance.
+ *
+ * PMD driver should set default values for that PMD before calling function,
+ * these default values will be over-written with successfully parsed values
+ * from args string.
+ *
+ * @param	params	parsed PMD initialisation parameters
+ * @param	args	input argument string to parse
+ *
+ * @return
+ *  - 0 on success
+ *  - errno on failure
+ */
+int
+rte_cryptodev_pmd_parse_input_args(
+		struct rte_cryptodev_pmd_init_params *params,
+		const char *args);
+
+/**
+ * @internal
+ *
+ * PMD assist function to provide boiler plate code for crypto driver to create
+ * and allocate resources for a new crypto PMD device instance.
+ *
+ * @param	name	crypto device name.
+ * @param	device	base device instance
+ * @param	params	PMD initialisation parameters
+ *
+ * @return
+ *  - crypto device instance on success
+ *  - NULL on creation failure
+ */
+struct rte_cryptodev *
+rte_cryptodev_pmd_create(const char *name,
+		struct rte_device *device,
+		struct rte_cryptodev_pmd_init_params *params);
+
+/**
+ * @internal
+ *
+ * PMD assist function to provide boiler plate code for crypto driver to
+ * destroy and free resources associated with a crypto PMD device instance.
+ *
+ * @param	cryptodev	crypto device handle.
+ *
+ * @return
+ *  - 0 on success
+ *  - errno on failure
+ */
+int
+rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);
+
 /**
  * Executes all the user application registered callbacks for the specific
  * device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 919b6cc..a0ea7bf 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -84,5 +84,8 @@ DPDK_17.11 {
 	global:
 
 	rte_cryptodev_name_get;
+	rte_cryptodev_pmd_create;
+	rte_cryptodev_pmd_destroy;
+	rte_cryptodev_pmd_parse_input_args;
 
 } DPDK_17.08;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus
  2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
@ 2017-10-25 12:00   ` Declan Doherty
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Declan Doherty @ 2017-10-25 12:00 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

Removes any dependency of librte_cryptodev on the virtual device
infrastructure code and removes the functions which were virtual
device specific.

Updates all virtual PMDs to remove dependencies on rte_cryptodev_vdev.h
and replaces those calls with the new bus independent functions.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 doc/guides/rel_notes/deprecation.rst           |   5 --
 doc/guides/rel_notes/release_17_11.rst         |   7 ++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  56 ++++--------
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  73 +++++++--------
 drivers/crypto/armv8/rte_armv8_pmd.c           |  41 +++------
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +--
 drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +--
 drivers/crypto/kasumi/rte_kasumi_pmd.c         |  49 ++++------
 drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 ++++--------
 drivers/crypto/null/null_crypto_pmd.c          |  72 ++++++---------
 drivers/crypto/openssl/rte_openssl_pmd.c       |  42 +++------
 drivers/crypto/scheduler/scheduler_pmd.c       |  45 +++-------
 drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
 drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 +++------
 drivers/crypto/zuc/rte_zuc_pmd.c               |  41 +++------
 lib/librte_cryptodev/Makefile                  |   1 -
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 120 -------------------------
 lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 ---------------------
 lib/librte_cryptodev/rte_cryptodev_version.map |   2 -
 19 files changed, 190 insertions(+), 589 deletions(-)
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 0d99251..ffd5e24 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -71,11 +71,6 @@ Deprecation Notices
 
   - ``rte_cryptodev_create_vdev``
 
-* cryptodev: the following function will be static in 17.11 and included
-  by all crypto drivers, therefore, will not be public:
-
-  - ``rte_cryptodev_vdev_pmd_init``
-
 * librte_meter: The API will change to accommodate configuration profiles.
   Most of the API functions will have an additional opaque parameter.
 
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 0a90db4..7755768 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -298,6 +298,13 @@ API Changes
   are bus independent for driver to manage creation and destruction of new
   device instances.
 
+* **Removed virtual device bus specific functions from librte_cryptodev.**
+
+  The functions ``rte_cryptodev_vdev_parse_init_params()`` and
+  ``rte_cryptodev_vdev_pmd_init()`` have been removed from librte_cryptodev
+  and have been replaced by non bus specific functions
+  ``rte_cryptodev_pmd_parse_input_args()`` and ``rte_cryptodev_pmd_create()``.
+
 ABI Changes
 -----------
 
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 29c14e5..1d18217 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -486,22 +485,24 @@ static int aesni_gcm_remove(struct rte_vdev_device *vdev);
 static int
 aesni_gcm_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct aesni_gcm_private *internals;
 	enum aesni_gcm_vector_mode vector_mode;
 
-	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)) {
 		GCM_LOG_ERR("AES instructions not supported by CPU");
 		return -EFAULT;
 	}
 
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+	if (dev == NULL) {
+		GCM_LOG_ERR("driver %s: create failed", init_params->name);
+		return -ENODEV;
+	}
+
 	/* Check CPU for supported vector instruction set */
 	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))
 		vector_mode = RTE_AESNI_GCM_AVX2;
@@ -510,14 +511,6 @@ aesni_gcm_create(const char *name,
 	else
 		vector_mode = RTE_AESNI_GCM_SSE;
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct aesni_gcm_private), init_params->socket_id,
-			vdev);
-	if (dev == NULL) {
-		GCM_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
-	}
-
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_aesni_gcm_pmd_ops;
 
@@ -552,22 +545,17 @@ aesni_gcm_create(const char *name,
 	internals->max_nb_sessions = init_params->max_nb_sessions;
 
 	return 0;
-
-init_error:
-	GCM_LOG_ERR("driver %s: create failed", init_params->name);
-
-	aesni_gcm_remove(vdev);
-	return -EFAULT;
 }
 
 static int
 aesni_gcm_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct aesni_gcm_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -576,17 +564,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return aesni_gcm_create(name, vdev, &init_params);
 }
@@ -594,16 +572,18 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
 static int
 aesni_gcm_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	GCM_LOG_INFO("Closing AESNI crypto device %s on numa socket %u\n",
-			name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver aesni_gcm_pmd_drv = {
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 49242fc..a589557 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -36,7 +36,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -715,15 +714,23 @@ static int cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_aesni_mb_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_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')
-		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)) {
+		MB_LOG_ERR("AES instructions not supported by CPU");
+		return -EFAULT;
+	}
+
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+	if (dev == NULL) {
+		MB_LOG_ERR("failed to create cryptodev vdev");
+		return -ENODEV;
+	}
 
 	/* Check CPU for supported vector instruction set */
 	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F))
@@ -735,14 +742,6 @@ cryptodev_aesni_mb_create(const char *name,
 	else
 		vector_mode = RTE_AESNI_MB_SSE;
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct aesni_mb_private), init_params->socket_id,
-			vdev);
-	if (dev == NULL) {
-		MB_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
-	}
-
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_aesni_mb_pmd_ops;
 
@@ -779,41 +778,33 @@ cryptodev_aesni_mb_create(const char *name,
 	internals->max_nb_sessions = init_params->max_nb_sessions;
 
 	return 0;
-init_error:
-	MB_LOG_ERR("driver %s: cryptodev_aesni_create failed",
-			init_params->name);
-
-	cryptodev_aesni_mb_remove(vdev);
-	return -EFAULT;
 }
 
 static int
 cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct aesni_mb_private),
 		rte_socket_id(),
-		""
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
-	const char *name;
-	const char *input_args;
+	const char *name, *args;
+	int retval;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
-	input_args = rte_vdev_device_args(vdev);
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+
+	args = rte_vdev_device_args(vdev);
+
+	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
+	if (retval) {
+		MB_LOG_ERR("Failed to parse initialisation arguments[%s]\n",
+				args);
+		return -EINVAL;
+	}
 
 	return cryptodev_aesni_mb_create(name, vdev, &init_params);
 }
@@ -821,16 +812,18 @@ cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing AESNI crypto device %s on numa socket %u\n",
-			name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index dbe6bee..2d2f3ff 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -36,7 +36,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -759,7 +758,7 @@ armv8_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 static int
 cryptodev_armv8_crypto_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct armv8_crypto_private *internals;
@@ -786,14 +785,7 @@ cryptodev_armv8_crypto_create(const char *name,
 		return -EFAULT;
 	}
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-				sizeof(struct armv8_crypto_private),
-				init_params->socket_id,
-				vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -832,11 +824,12 @@ cryptodev_armv8_crypto_create(const char *name,
 static int
 cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct armv8_crypto_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -845,18 +838,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0') {
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	}
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_armv8_crypto_create(name, vdev, &init_params);
 }
@@ -865,6 +847,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
 static int
 cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
@@ -875,7 +858,11 @@ cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
 		"Closing ARMv8 crypto device %s on numa socket %u\n",
 		name, rte_socket_id());
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver armv8_crypto_pmd_drv = {
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index c67548e..dd19b9b 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2016,16 +2016,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
 	if (ret)
 		return ret;
 
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	cryptodev->device = NULL;
-	cryptodev->data = NULL;
-
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_dpaa2_driver rte_dpaa2_sec_driver = {
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 26a29a4..30a2a38 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -1529,19 +1529,7 @@ cryptodev_dpaa_sec_remove(struct rte_dpaa_device *dpaa_dev)
 	if (ret)
 		return ret;
 
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	PMD_INIT_LOG(INFO, "Closing dpaa crypto device %s",
-		     cryptodev->data->name);
-
-	cryptodev->device = NULL;
-	cryptodev->data = NULL;
-
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_dpaa_driver rte_dpaa_sec_driver = {
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 7a00bd3..7c1b56b 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -553,15 +552,17 @@ static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_kasumi_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct kasumi_private *internals;
 	uint64_t cpu_flags = 0;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+	if (dev == NULL) {
+		KASUMI_LOG_ERR("failed to create cryptodev vdev");
+		goto init_error;
+	}
 
 	/* Check CPU for supported vector instruction set */
 	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX))
@@ -569,14 +570,6 @@ cryptodev_kasumi_create(const char *name,
 	else
 		cpu_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct kasumi_private), init_params->socket_id,
-			vdev);
-	if (dev == NULL) {
-		KASUMI_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
-	}
-
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_kasumi_pmd_ops;
 
@@ -605,11 +598,12 @@ cryptodev_kasumi_create(const char *name,
 static int
 cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct kasumi_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -619,17 +613,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_kasumi_create(name, vdev, &init_params);
 }
@@ -637,17 +621,18 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
-			" on numa socket %u\n",
-			name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c
index 6a9c8da..63895c5 100644
--- a/drivers/crypto/mrvl/rte_mrvl_pmd.c
+++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c
@@ -36,7 +36,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -720,26 +719,14 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair,
 static int
 cryptodev_mrvl_crypto_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct mrvl_crypto_private *internals;
 	struct sam_init_params	sam_params;
 	int ret;
 
-	if (init_params->name[0] == '\0') {
-		ret = rte_cryptodev_pmd_create_dev_name(
-				init_params->name, name);
-
-		if (ret < 0) {
-			MRVL_CRYPTO_LOG_ERR("failed to create unique name");
-			return ret;
-		}
-	}
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-				sizeof(struct mrvl_crypto_private),
-				init_params->socket_id, vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -796,40 +783,28 @@ cryptodev_mrvl_crypto_create(const char *name,
 static int
 cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = { };
-	const char *name;
-	const char *input_args;
+	struct rte_cryptodev_pmd_init_params init_params = { };
+	const char *name, *args;
 	int ret;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
-	input_args = rte_vdev_device_args(vdev);
-
-	if (!input_args)
-		return -EINVAL;
+	args = rte_vdev_device_args(vdev);
 
+	init_params.private_data_size = sizeof(struct mrvl_crypto_private);
 	init_params.max_nb_queue_pairs = sam_get_num_inst() * SAM_HW_RING_NUM;
 	init_params.max_nb_sessions =
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
 	init_params.socket_id = rte_socket_id();
 
-	ret = rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
+	ret = rte_cryptodev_pmd_parse_input_args(&init_params, args);
 	if (ret) {
-		RTE_LOG(ERR, PMD, "Failed to parse input arguments\n");
-		return ret;
-	}
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0') {
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
+		RTE_LOG(ERR, PMD,
+			"Failed to parse initialisation arguments[%s]\n",
+			args);
+		return -EINVAL;
 	}
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
 
 	return cryptodev_mrvl_crypto_create(name, vdev, &init_params);
 }
@@ -843,6 +818,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
 static int
 cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name = rte_vdev_device_name(vdev);
 
 	if (name == NULL)
@@ -854,7 +830,11 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
 
 	sam_deinit();
 
-	return 0;
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 /**
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index d5d2bb3..4b9a58a 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,6 @@
 #include <rte_common.h>
 #include <rte_config.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 
@@ -183,28 +182,19 @@ null_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	return nb_dequeued;
 }
 
-static int cryptodev_null_remove(const char *name);
-
 /** Create crypto device */
 static int
 cryptodev_null_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct null_crypto_private *internals;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct null_crypto_private),
-			init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
-		goto init_error;
+		return -EFAULT;
 	}
 
 	dev->driver_id = cryptodev_driver_id;
@@ -224,61 +214,53 @@ cryptodev_null_create(const char *name,
 	internals->max_nb_sessions = init_params->max_nb_sessions;
 
 	return 0;
-
-init_error:
-	NULL_CRYPTO_LOG_ERR("driver %s: cryptodev_null_create failed",
-			init_params->name);
-	cryptodev_null_remove(init_params->name);
-
-	return -EFAULT;
 }
 
 /** Initialise null crypto device */
 static int
 cryptodev_null_probe(struct rte_vdev_device *dev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct null_crypto_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
-	const char *name;
+	const char *name, *args;
+	int retval;
 
 	name = rte_vdev_device_name(dev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
-		name, init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	args = rte_vdev_device_args(dev);
+
+	retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
+	if (retval) {
+		RTE_LOG(ERR, PMD,
+			"Failed to parse initialisation arguments[%s]\n", args);
+		return -EINVAL;
+	}
 
 	return cryptodev_null_create(name, dev, &init_params);
 }
 
-/** Uninitialise null crypto device */
 static int
-cryptodev_null_remove(const char *name)
+cryptodev_null_remove_dev(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
+	const char *name;
+
+	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing null crypto device %s on numa socket %u\n",
-			name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
-}
-
-static int
-cryptodev_null_remove_dev(struct rte_vdev_device *dev)
-{
-	return cryptodev_null_remove(rte_vdev_device_name(dev));
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_null_pmd_drv = {
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 95c0236..25c1154 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -34,7 +34,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -1668,19 +1667,12 @@ openssl_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 static int
 cryptodev_openssl_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct openssl_private *internals;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct openssl_private),
-			init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		OPENSSL_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -1718,11 +1710,12 @@ cryptodev_openssl_create(const char *name,
 static int
 cryptodev_openssl_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct openssl_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -1732,17 +1725,7 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_openssl_create(name, vdev, &init_params);
 }
@@ -1751,17 +1734,18 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_openssl_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD,
-		"Closing OPENSSL crypto device %s on numa socket %u\n",
-		name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_openssl_pmd_drv = {
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 3170f7f..40ab304 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -33,7 +33,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -45,7 +44,7 @@
 uint8_t cryptodev_driver_id;
 
 struct scheduler_init_params {
-	struct rte_crypto_vdev_init_params def_p;
+	struct rte_cryptodev_pmd_init_params def_p;
 	uint32_t nb_slaves;
 	enum rte_cryptodev_scheduler_mode mode;
 	uint32_t enable_ordering;
@@ -107,21 +106,18 @@ cryptodev_scheduler_create(const char *name,
 	uint32_t i;
 	int ret;
 
-	if (init_params->def_p.name[0] == '\0')
-		snprintf(init_params->def_p.name,
-				sizeof(init_params->def_p.name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->def_p.name,
-			sizeof(struct scheduler_ctx),
-			init_params->def_p.socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device,
+			&init_params->def_p);
 	if (dev == NULL) {
 		CS_LOG_ERR("driver %s: failed to create cryptodev vdev",
 			name);
 		return -EFAULT;
 	}
 
+	if (init_params->wcmask != 0)
+		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
+			init_params->wcmask);
+
 	dev->driver_id = cryptodev_driver_id;
 	dev->dev_ops = rte_crypto_scheduler_pmd_ops;
 
@@ -240,10 +236,7 @@ cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
 					sched_ctx->slaves[i].dev_id);
 	}
 
-	RTE_LOG(INFO, PMD, "Closing Crypto Scheduler device %s on numa "
-		"socket %u\n", name, rte_socket_id());
-
-	return 0;
+	return rte_cryptodev_pmd_destroy(dev);
 }
 
 /** Parse integer from integer argument */
@@ -304,7 +297,7 @@ static int
 parse_name_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
-	struct rte_crypto_vdev_init_params *params = extra_args;
+	struct rte_cryptodev_pmd_init_params *params = extra_args;
 
 	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
 		CS_LOG_ERR("Invalid name %s, should be less than "
@@ -462,10 +455,11 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
 {
 	struct scheduler_init_params init_params = {
 		.def_p = {
-			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-			RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+			"",
+			sizeof(struct scheduler_ctx),
 			rte_socket_id(),
-			""
+			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+			RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 		},
 		.nb_slaves = 0,
 		.mode = CDEV_SCHED_MODE_NOT_SET,
@@ -481,19 +475,6 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
 	scheduler_parse_init_params(&init_params,
 				    rte_vdev_device_args(vdev));
 
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
-			name,
-			init_params.def_p.socket_id);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.def_p.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.def_p.max_nb_sessions);
-	if (init_params.def_p.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.def_p.name);
-	if (init_params.wcmask != 0)
-		RTE_LOG(INFO, PMD, "  workers core mask = %"PRIx64"\n",
-			init_params.wcmask);
 
 	return cryptodev_scheduler_create(name,
 					vdev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index d379534..fef686f 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -37,7 +37,6 @@
 #include <rte_dev.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_reorder.h>
 
 #include "scheduler_pmd_private.h"
@@ -347,7 +346,7 @@ scheduler_pmd_info_get(struct rte_cryptodev *dev,
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
 	uint32_t max_nb_sessions = sched_ctx->nb_slaves ?
-			UINT32_MAX : RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
+			UINT32_MAX : RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
 	uint32_t i;
 
 	if (!dev_info)
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 8e1d1ec..fe7bb86 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -559,19 +558,13 @@ static int cryptodev_snow3g_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_snow3g_create(const char *name,
 			struct rte_vdev_device *vdev,
-			struct rte_crypto_vdev_init_params *init_params)
+			struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct snow3g_private *internals;
 	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
-
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct snow3g_private), init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		SNOW3G_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -605,11 +598,12 @@ cryptodev_snow3g_create(const char *name,
 static int
 cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct snow3g_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -619,17 +613,7 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_snow3g_create(name, vdev, &init_params);
 }
@@ -637,17 +621,18 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_snow3g_remove(struct rte_vdev_device *vdev)
 {
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing SNOW 3G crypto device %s"
-			" on numa socket %u\n",
-			name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index f1f9291..b99f6ec 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -35,7 +35,6 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -463,19 +462,14 @@ static int cryptodev_zuc_remove(struct rte_vdev_device *vdev);
 static int
 cryptodev_zuc_create(const char *name,
 		struct rte_vdev_device *vdev,
-		struct rte_crypto_vdev_init_params *init_params)
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
 	struct rte_cryptodev *dev;
 	struct zuc_private *internals;
 	uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
 
-	if (init_params->name[0] == '\0')
-		snprintf(init_params->name, sizeof(init_params->name),
-				"%s", name);
 
-	dev = rte_cryptodev_vdev_pmd_init(init_params->name,
-			sizeof(struct zuc_private), init_params->socket_id,
-			vdev);
+	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
 		ZUC_LOG_ERR("failed to create cryptodev vdev");
 		goto init_error;
@@ -509,11 +503,12 @@ cryptodev_zuc_create(const char *name,
 static int
 cryptodev_zuc_probe(struct rte_vdev_device *vdev)
 {
-	struct rte_crypto_vdev_init_params init_params = {
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
-		RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+	struct rte_cryptodev_pmd_init_params init_params = {
+		"",
+		sizeof(struct zuc_private),
 		rte_socket_id(),
-		{0}
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
 	};
 	const char *name;
 	const char *input_args;
@@ -523,17 +518,7 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
 		return -EINVAL;
 	input_args = rte_vdev_device_args(vdev);
 
-	rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
-	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
-	if (init_params.name[0] != '\0')
-		RTE_LOG(INFO, PMD, "  User defined name = %s\n",
-			init_params.name);
-	RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
-	RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+	rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
 
 	return cryptodev_zuc_create(name, vdev, &init_params);
 }
@@ -541,17 +526,19 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
 static int
 cryptodev_zuc_remove(struct rte_vdev_device *vdev)
 {
+
+	struct rte_cryptodev *cryptodev;
 	const char *name;
 
 	name = rte_vdev_device_name(vdev);
 	if (name == NULL)
 		return -EINVAL;
 
-	RTE_LOG(INFO, PMD, "Closing ZUC crypto device %s"
-			" on numa socket %u\n",
-			name, rte_socket_id());
+	cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
-	return 0;
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_vdev_driver cryptodev_zuc_pmd_drv = {
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index bb58ea1..0e019ed 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -50,7 +50,6 @@ SYMLINK-y-include += rte_crypto.h
 SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
-SYMLINK-y-include += rte_cryptodev_vdev.h
 SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index ca6d459..0b5741a 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -32,7 +32,6 @@
 
 #include <rte_malloc.h>
 
-#include "rte_cryptodev_vdev.h"
 #include "rte_cryptodev_pci.h"
 #include "rte_cryptodev_pmd.h"
 
@@ -204,125 +203,6 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 	return 0;
 }
 
-/**
- * Parse name from argument
- */
-static int
-rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
-		const char *value, void *extra_args)
-{
-	struct rte_crypto_vdev_init_params *params = extra_args;
-
-	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
-		CDEV_LOG_ERR("Invalid name %s, should be less than "
-				"%u bytes", value,
-				RTE_CRYPTODEV_NAME_MAX_LEN - 1);
-		return -1;
-	}
-
-	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
-
-	return 0;
-}
-
-/**
- * Parse integer from argument
- */
-static int
-rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
-		const char *value, void *extra_args)
-{
-	int *i = extra_args;
-
-	*i = atoi(value);
-	if (*i < 0) {
-		CDEV_LOG_ERR("Argument has to be positive.");
-		return -1;
-	}
-
-	return 0;
-}
-
-struct rte_cryptodev *
-rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
-		int socket_id, struct rte_vdev_device *vdev)
-{
-	struct rte_cryptodev *cryptodev;
-
-	/* allocate device structure */
-	cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
-	if (cryptodev == NULL)
-		return NULL;
-
-	/* allocate private device structure */
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		cryptodev->data->dev_private =
-				rte_zmalloc_socket("cryptodev device private",
-						dev_private_size,
-						RTE_CACHE_LINE_SIZE,
-						socket_id);
-
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private device"
-					" data");
-	}
-
-	cryptodev->device = &vdev->device;
-
-	/* initialise user call-back tail queue */
-	TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
-	return cryptodev;
-}
-
-int
-rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
-		const char *input_args)
-{
-	struct rte_kvargs *kvlist = NULL;
-	int ret = 0;
-
-	if (params == NULL)
-		return -EINVAL;
-
-	if (input_args) {
-		kvlist = rte_kvargs_parse(input_args,
-				cryptodev_vdev_valid_params);
-		if (kvlist == NULL)
-			return -1;
-
-		ret = rte_kvargs_process(kvlist,
-					RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
-					&rte_cryptodev_vdev_parse_integer_arg,
-					&params->max_nb_queue_pairs);
-		if (ret < 0)
-			goto free_kvlist;
-
-		ret = rte_kvargs_process(kvlist,
-					RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
-					&rte_cryptodev_vdev_parse_integer_arg,
-					&params->max_nb_sessions);
-		if (ret < 0)
-			goto free_kvlist;
-
-		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
-					&rte_cryptodev_vdev_parse_integer_arg,
-					&params->socket_id);
-		if (ret < 0)
-			goto free_kvlist;
-
-		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
-					&rte_cryptodev_vdev_parse_name_arg,
-					params);
-		if (ret < 0)
-			goto free_kvlist;
-	}
-
-free_kvlist:
-	rte_kvargs_free(kvlist);
-	return ret;
-}
-
 int
 rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
 			size_t private_data_size,
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
deleted file mode 100644
index 94ab9d3..0000000
--- a/lib/librte_cryptodev/rte_cryptodev_vdev.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2017 Intel Corporation. All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of the copyright holder nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_CRYPTODEV_VDEV_H_
-#define _RTE_CRYPTODEV_VDEV_H_
-
-#include <rte_vdev.h>
-#include <inttypes.h>
-
-#include "rte_cryptodev.h"
-
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS	8
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS	2048
-
-#define RTE_CRYPTODEV_VDEV_NAME				("name")
-#define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG		("max_nb_queue_pairs")
-#define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG		("max_nb_sessions")
-#define RTE_CRYPTODEV_VDEV_SOCKET_ID			("socket_id")
-
-static const char * const cryptodev_vdev_valid_params[] = {
-	RTE_CRYPTODEV_VDEV_NAME,
-	RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
-	RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
-	RTE_CRYPTODEV_VDEV_SOCKET_ID
-};
-
-/**
- * @internal
- * Initialisation parameters for virtual crypto devices
- */
-struct rte_crypto_vdev_init_params {
-	unsigned int max_nb_queue_pairs;
-	unsigned int max_nb_sessions;
-	uint8_t socket_id;
-	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
-};
-
-/**
- * @internal
- * Creates a new virtual crypto device and returns the pointer
- * to that device.
- *
- * @param	name			PMD type name
- * @param	dev_private_size	Size of crypto PMDs private data
- * @param	socket_id		Socket to allocate resources on.
- * @param	vdev			Pointer to virtual device structure.
- *
- * @return
- *   - Cryptodev pointer if device is successfully created.
- *   - NULL if device cannot be created.
- */
-struct rte_cryptodev *
-rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
-		int socket_id, struct rte_vdev_device *vdev);
-
-/**
- * @internal
- * Parse virtual device initialisation parameters input arguments
- *
- * @params	params		Initialisation parameters with defaults set.
- * @params	input_args	Command line arguments
- *
- * @return
- * 0 on successful parse
- * <0 on failure to parse
- */
-int
-rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
-		const char *input_args);
-
-#endif /* _RTE_CRYPTODEV_VDEV_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a0ea7bf..d3e4515 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -73,8 +73,6 @@ DPDK_17.08 {
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
-	rte_cryptodev_vdev_parse_init_params;
-	rte_cryptodev_vdev_pmd_init;
 	rte_crypto_aead_algorithm_strings;
 	rte_crypto_aead_operation_strings;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI device bus
  2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
@ 2017-10-25 12:00   ` Declan Doherty
  2017-10-25 15:55     ` Trahe, Fiona
  2017-10-25 14:36   ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure De Lara Guarch, Pablo
  2017-10-25 16:06   ` De Lara Guarch, Pablo
  4 siblings, 1 reply; 22+ messages in thread
From: Declan Doherty @ 2017-10-25 12:00 UTC (permalink / raw)
  To: dev; +Cc: Declan Doherty

Removes any dependency of librte_cryptodev on the PCI device
infrastructure code and removes the functions which were virtual
device specific.

Updates QAT crypto PMD to remove dependencies on rte_cryptodev_pci.h
and replaces those calls with the new bus independent functions.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 doc/guides/rel_notes/release_17_11.rst         |  7 ++
 drivers/crypto/qat/qat_crypto.c                |  3 +-
 drivers/crypto/qat/rte_qat_cryptodev.c         | 55 +++++++++++----
 lib/librte_cryptodev/Makefile                  |  1 -
 lib/librte_cryptodev/rte_cryptodev_pci.h       | 92 -------------------------
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 95 --------------------------
 lib/librte_cryptodev/rte_cryptodev_version.map |  2 -
 7 files changed, 52 insertions(+), 203 deletions(-)
 delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h

diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 7755768..78170e1 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -305,6 +305,13 @@ API Changes
   and have been replaced by non bus specific functions
   ``rte_cryptodev_pmd_parse_input_args()`` and ``rte_cryptodev_pmd_create()``.
 
+* **Removed PCI device bus specific functions from librte_cryptodev.**
+
+  The functions ``rte_cryptodev_pci_generic_probe()`` and
+  ``rte_cryptodev_pci_generic_remove()`` have been removed from librte_cryptodev
+  and have been replaced by non bus specific functions
+  ``rte_cryptodev_pmd_create()`` and ``rte_cryptodev_pmd_destroy()``.
+
 ABI Changes
 -----------
 
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index ae73c78..87f232e 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -58,8 +58,9 @@
 #include <rte_spinlock.h>
 #include <rte_hexdump.h>
 #include <rte_crypto_sym.h>
-#include <rte_cryptodev_pci.h>
 #include <rte_byteorder.h>
+#include <rte_pci.h>
+
 #include <openssl/evp.h>
 
 #include "qat_logs.h"
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 3d9f3c8..701c5a6 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -34,8 +34,8 @@
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_malloc.h>
+#include <rte_pci.h>
 #include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_pci.h>
 
 #include "qat_crypto.h"
 #include "qat_logs.h"
@@ -97,15 +97,18 @@ static const struct rte_pci_id pci_id_qat_map[] = {
 };
 
 static int
-crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
+crypto_qat_create(const char *name, struct rte_pci_device *pci_dev,
+		struct rte_cryptodev_pmd_init_params *init_params)
 {
+	struct rte_cryptodev *cryptodev;
 	struct qat_pmd_private *internals;
 
 	PMD_INIT_FUNC_TRACE();
-	PMD_DRV_LOG(DEBUG, "Found crypto device at %02x:%02x.%x",
-		RTE_DEV_TO_PCI(cryptodev->device)->addr.bus,
-		RTE_DEV_TO_PCI(cryptodev->device)->addr.devid,
-		RTE_DEV_TO_PCI(cryptodev->device)->addr.function);
+
+	cryptodev = rte_cryptodev_pmd_create(name, &pci_dev->device,
+			init_params);
+	if (cryptodev == NULL)
+		return -ENODEV;
 
 	cryptodev->driver_id = cryptodev_qat_driver_id;
 	cryptodev->dev_ops = &crypto_qat_ops;
@@ -119,8 +122,8 @@ crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
 			RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
 
 	internals = cryptodev->data->dev_private;
-	internals->max_nb_sessions = RTE_QAT_PMD_MAX_NB_SESSIONS;
-	switch (RTE_DEV_TO_PCI(cryptodev->device)->id.device_id) {
+	internals->max_nb_sessions = init_params->max_nb_sessions;
+	switch (pci_dev->id.device_id) {
 	case 0x0443:
 		internals->qat_dev_gen = QAT_GEN1;
 		internals->qat_dev_capabilities = qat_gen1_capabilities;
@@ -151,15 +154,43 @@ crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
 }
 
 static int crypto_qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
-	struct rte_pci_device *pci_dev)
+		struct rte_pci_device *pci_dev)
 {
-	return rte_cryptodev_pci_generic_probe(pci_dev,
-		sizeof(struct qat_pmd_private), crypto_qat_dev_init);
+	struct rte_cryptodev_pmd_init_params init_params = {
+		.name = "",
+		.socket_id = rte_socket_id(),
+		.private_data_size = sizeof(struct qat_pmd_private),
+		.max_nb_sessions = RTE_QAT_PMD_MAX_NB_SESSIONS
+	};
+	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+	PMD_DRV_LOG(DEBUG, "Found QAT device at %02x:%02x.%x",
+			pci_dev->addr.bus,
+			pci_dev->addr.devid,
+			pci_dev->addr.function);
+
+	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
+
+	return crypto_qat_create(name, pci_dev, &init_params);
 }
 
 static int crypto_qat_pci_remove(struct rte_pci_device *pci_dev)
 {
-	return rte_cryptodev_pci_generic_remove(pci_dev, NULL);
+	struct rte_cryptodev *cryptodev;
+	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+	if (pci_dev == NULL)
+		return -EINVAL;
+
+	rte_pci_device_name(&pci_dev->addr, cryptodev_name,
+			sizeof(cryptodev_name));
+
+	cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
+	if (cryptodev == NULL)
+		return -ENODEV;
+
+	/* free crypto device */
+	return rte_cryptodev_pmd_destroy(cryptodev);
 }
 
 static struct rte_pci_driver rte_qat_pmd = {
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 0e019ed..ee00e8c 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -50,7 +50,6 @@ SYMLINK-y-include += rte_crypto.h
 SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
-SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pci.h b/lib/librte_cryptodev/rte_cryptodev_pci.h
deleted file mode 100644
index 67eda96..0000000
--- a/lib/librte_cryptodev/rte_cryptodev_pci.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2017 Intel Corporation. All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of the copyright holder nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_CRYPTODEV_PCI_H_
-#define _RTE_CRYPTODEV_PCI_H_
-
-#include <rte_pci.h>
-#include "rte_cryptodev.h"
-
-/**
- * Initialisation function of a crypto driver invoked for each matching
- * crypto PCI device detected during the PCI probing phase.
- *
- * @param	dev	The dev pointer is the address of the *rte_cryptodev*
- *			structure associated with the matching device and which
- *			has been [automatically] allocated in the
- *			*rte_crypto_devices* array.
- *
- * @return
- *   - 0: Success, the device is properly initialised by the driver.
- *        In particular, the driver MUST have set up the *dev_ops* pointer
- *        of the *dev* structure.
- *   - <0: Error code of the device initialisation failure.
- */
-typedef int (*cryptodev_pci_init_t)(struct rte_cryptodev *dev);
-
-/**
- * Finalisation function of a driver invoked for each matching
- * PCI device detected during the PCI closing phase.
- *
- * @param	dev	The dev pointer is the address of the *rte_cryptodev*
- *			structure associated with the matching device and which
- *			has been [automatically] allocated in the
- *			*rte_crypto_devices* array.
- *
- *  * @return
- *   - 0: Success, the device is properly finalised by the driver.
- *        In particular, the driver MUST free the *dev_ops* pointer
- *        of the *dev* structure.
- *   - <0: Error code of the device initialisation failure.
- */
-typedef int (*cryptodev_pci_uninit_t)(struct rte_cryptodev *dev);
-
-/**
- * @internal
- * Wrapper for use by pci drivers as a .probe function to attach to a crypto
- * interface.
- */
-int
-rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
-			size_t private_data_size,
-			cryptodev_pci_init_t dev_init);
-
-/**
- * @internal
- * Wrapper for use by pci drivers as a .remove function to detach a crypto
- * interface.
- */
-int
-rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,
-		cryptodev_pci_uninit_t dev_uninit);
-
-#endif /* _RTE_CRYPTODEV_PCI_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index 0b5741a..8d4b78a 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -32,7 +32,6 @@
 
 #include <rte_malloc.h>
 
-#include "rte_cryptodev_pci.h"
 #include "rte_cryptodev_pmd.h"
 
 /**
@@ -177,8 +176,6 @@ rte_cryptodev_pmd_create(const char *name,
 	return cryptodev;
 }
 
-
-
 int
 rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 {
@@ -203,95 +200,3 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 	return 0;
 }
 
-int
-rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
-			size_t private_data_size,
-			cryptodev_pci_init_t dev_init)
-{
-	struct rte_cryptodev *cryptodev;
-
-	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
-
-	int retval;
-
-	rte_pci_device_name(&pci_dev->addr, cryptodev_name,
-			sizeof(cryptodev_name));
-
-	cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
-	if (cryptodev == NULL)
-		return -ENOMEM;
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		cryptodev->data->dev_private =
-				rte_zmalloc_socket(
-						"cryptodev private structure",
-						private_data_size,
-						RTE_CACHE_LINE_SIZE,
-						rte_socket_id());
-
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private "
-					"device data");
-	}
-
-	cryptodev->device = &pci_dev->device;
-
-	/* init user callbacks */
-	TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
-	/* Invoke PMD device initialization function */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
-	retval = dev_init(cryptodev);
-	if (retval == 0)
-		return 0;
-
-	CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
-			" failed", pci_dev->device.driver->name,
-			(unsigned int) pci_dev->id.vendor_id,
-			(unsigned int) pci_dev->id.device_id);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	return -ENXIO;
-}
-
-int
-rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,
-		cryptodev_pci_uninit_t dev_uninit)
-{
-	struct rte_cryptodev *cryptodev;
-	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
-	int ret;
-
-	if (pci_dev == NULL)
-		return -EINVAL;
-
-	rte_pci_device_name(&pci_dev->addr, cryptodev_name,
-			sizeof(cryptodev_name));
-
-	cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
-	if (cryptodev == NULL)
-		return -ENODEV;
-
-	/* Invoke PMD device uninit function */
-	if (dev_uninit) {
-		ret = dev_uninit(cryptodev);
-		if (ret)
-			return ret;
-	}
-
-	/* free crypto device */
-	rte_cryptodev_pmd_release_device(cryptodev);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
-
-	cryptodev->device = NULL;
-	cryptodev->data = NULL;
-
-	return 0;
-}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index d3e4515..4355166 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -68,8 +68,6 @@ DPDK_17.08 {
 	rte_cryptodev_get_aead_algo_enum;
 	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
-	rte_cryptodev_pci_generic_probe;
-	rte_cryptodev_pci_generic_remove;
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure
  2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
                     ` (2 preceding siblings ...)
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
@ 2017-10-25 14:36   ` De Lara Guarch, Pablo
  2017-10-25 16:06   ` De Lara Guarch, Pablo
  4 siblings, 0 replies; 22+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-25 14:36 UTC (permalink / raw)
  To: Doherty, Declan, dev; +Cc: Doherty, Declan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Wednesday, October 25, 2017 1:01 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus
> infrastructure
> 
> This patch set breaks the dependency of the cryptodev library on both the
> virtual and PCI device infrastructure.
> 
> It introduces new bus independent crypto PMD driver assist functions for
> parsing initialisation parameters, and creation/destruction of device
> instances.
> 
> It deprecates all function calls to the bus dependent functions and updates
> all crypto PMDs to use the newly introduced device independent functions.
> 
> V2:
> - Add release notes updates for new APIs and API removals
> - Addresses comments on string and unsigned integer parsing functions
> - logging and doxygen comments tidy up
> 
> Declan Doherty (3):
>   cryptodev: add new APIs to assist PMD initialisation
>   cryptodev: break dependency on virtual device bus
>   cryptodev: break dependency on PCI device bus
> 
>  doc/guides/rel_notes/deprecation.rst           |   5 -
>  doc/guides/rel_notes/release_17_11.rst         |  20 +++
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  56 +++----
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  73 ++++-----
>  drivers/crypto/armv8/rte_armv8_pmd.c           |  41 ++---
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +-
>  drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +-
>  drivers/crypto/kasumi/rte_kasumi_pmd.c         |  49 ++----
>  drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 +++----
>  drivers/crypto/null/null_crypto_pmd.c          |  72 ++++-----
>  drivers/crypto/openssl/rte_openssl_pmd.c       |  42 ++---
>  drivers/crypto/qat/qat_crypto.c                |   3 +-
>  drivers/crypto/qat/rte_qat_cryptodev.c         |  55 +++++--
>  drivers/crypto/scheduler/scheduler_pmd.c       |  45 ++----
>  drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
>  drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++---
>  drivers/crypto/zuc/rte_zuc_pmd.c               |  41 ++---
>  lib/librte_cryptodev/Makefile                  |   2 -
>  lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
>  lib/librte_cryptodev/rte_cryptodev_pci.h       |  92 -----------
>  lib/librte_cryptodev/rte_cryptodev_pmd.c       | 213 ++++++++++-------------
> --
>  lib/librte_cryptodev/rte_cryptodev_pmd.h       |  86 ++++++++++
>  lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 ------------
>  lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
>  24 files changed, 424 insertions(+), 711 deletions(-)  delete mode 100644
> lib/librte_cryptodev/rte_cryptodev_pci.h
>  delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
> 
> --
> 2.9.4

Series-acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI device bus
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
@ 2017-10-25 15:55     ` Trahe, Fiona
  0 siblings, 0 replies; 22+ messages in thread
From: Trahe, Fiona @ 2017-10-25 15:55 UTC (permalink / raw)
  To: dev; +Cc: De Lara Guarch, Pablo, Doherty, Declan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Wednesday, October 25, 2017 1:01 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI device bus
> 
> Removes any dependency of librte_cryptodev on the PCI device
> infrastructure code and removes the functions which were virtual
> device specific.
> 
> Updates QAT crypto PMD to remove dependencies on rte_cryptodev_pci.h
> and replaces those calls with the new bus independent functions.
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation
  2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
@ 2017-10-25 15:56     ` Trahe, Fiona
  0 siblings, 0 replies; 22+ messages in thread
From: Trahe, Fiona @ 2017-10-25 15:56 UTC (permalink / raw)
  To: dev; +Cc: Doherty, Declan, De Lara Guarch, Pablo



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Wednesday, October 25, 2017 1:01 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation
> 
> Adds new PMD assist functions which are bus independent for driver to
> create and destroy new device instances.
> 
> Also includes function to parse parameters which can be passed to
> driver on device initialisation.
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure
  2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
                     ` (3 preceding siblings ...)
  2017-10-25 14:36   ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure De Lara Guarch, Pablo
@ 2017-10-25 16:06   ` De Lara Guarch, Pablo
  4 siblings, 0 replies; 22+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-25 16:06 UTC (permalink / raw)
  To: Doherty, Declan, dev; +Cc: Doherty, Declan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Wednesday, October 25, 2017 1:01 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus
> infrastructure
> 
> This patch set breaks the dependency of the cryptodev library on both the
> virtual and PCI device infrastructure.
> 
> It introduces new bus independent crypto PMD driver assist functions for
> parsing initialisation parameters, and creation/destruction of device
> instances.
> 
> It deprecates all function calls to the bus dependent functions and updates
> all crypto PMDs to use the newly introduced device independent functions.
> 
> V2:
> - Add release notes updates for new APIs and API removals
> - Addresses comments on string and unsigned integer parsing functions
> - logging and doxygen comments tidy up
> 
> Declan Doherty (3):
>   cryptodev: add new APIs to assist PMD initialisation
>   cryptodev: break dependency on virtual device bus
>   cryptodev: break dependency on PCI device bus
> 
>  doc/guides/rel_notes/deprecation.rst           |   5 -
>  doc/guides/rel_notes/release_17_11.rst         |  20 +++
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  56 +++----
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  73 ++++-----
>  drivers/crypto/armv8/rte_armv8_pmd.c           |  41 ++---
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  11 +-
>  drivers/crypto/dpaa_sec/dpaa_sec.c             |  14 +-
>  drivers/crypto/kasumi/rte_kasumi_pmd.c         |  49 ++----
>  drivers/crypto/mrvl/rte_mrvl_pmd.c             |  56 +++----
>  drivers/crypto/null/null_crypto_pmd.c          |  72 ++++-----
>  drivers/crypto/openssl/rte_openssl_pmd.c       |  42 ++---
>  drivers/crypto/qat/qat_crypto.c                |   3 +-
>  drivers/crypto/qat/rte_qat_cryptodev.c         |  55 +++++--
>  drivers/crypto/scheduler/scheduler_pmd.c       |  45 ++----
>  drivers/crypto/scheduler/scheduler_pmd_ops.c   |   3 +-
>  drivers/crypto/snow3g/rte_snow3g_pmd.c         |  41 ++---
>  drivers/crypto/zuc/rte_zuc_pmd.c               |  41 ++---
>  lib/librte_cryptodev/Makefile                  |   2 -
>  lib/librte_cryptodev/rte_cryptodev.h           |   8 +-
>  lib/librte_cryptodev/rte_cryptodev_pci.h       |  92 -----------
>  lib/librte_cryptodev/rte_cryptodev_pmd.c       | 213 ++++++++++-------------
> --
>  lib/librte_cryptodev/rte_cryptodev_pmd.h       |  86 ++++++++++
>  lib/librte_cryptodev/rte_cryptodev_vdev.h      | 100 ------------
>  lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
>  24 files changed, 424 insertions(+), 711 deletions(-)  delete mode 100644
> lib/librte_cryptodev/rte_cryptodev_pci.h
>  delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
> 
> --
> 2.9.4

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-10-25 16:07 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
2017-10-20 21:21 ` [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
2017-10-24 11:03   ` De Lara Guarch, Pablo
2017-10-24 14:09   ` Tomasz Duszynski
2017-10-25  0:59     ` Gaëtan Rivet
2017-10-20 21:21 ` [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
2017-10-24 11:18   ` De Lara Guarch, Pablo
2017-10-24 11:32   ` Akhil Goyal
2017-10-25  6:18   ` Tomasz Duszynski
2017-10-25  7:45     ` De Lara Guarch, Pablo
2017-10-20 21:21 ` [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h Declan Doherty
2017-10-24 11:23   ` De Lara Guarch, Pablo
2017-10-23  9:21 ` [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Doherty, Declan
2017-10-25  0:50 ` Gaëtan Rivet
2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
2017-10-25 15:56     ` Trahe, Fiona
2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
2017-10-25 15:55     ` Trahe, Fiona
2017-10-25 14:36   ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure De Lara Guarch, Pablo
2017-10-25 16:06   ` De Lara Guarch, Pablo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).