* [dpdk-dev] [PATCH 01/12] cryptodev: store device pointer in virtual devices
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:34 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 02/12] cryptodev: set driver name for all devices Pablo de Lara
` (15 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Only non virtual devices were storing the pointer to
rte_device structure in rte_cryptodev, which will be needed
to retrieve the driver name for any device.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ++-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 +++-
drivers/crypto/armv8/rte_armv8_pmd.c | 3 ++-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ++-
drivers/crypto/null/null_crypto_pmd.c | 7 +++++--
drivers/crypto/openssl/rte_openssl_pmd.c | 3 ++-
drivers/crypto/scheduler/scheduler_pmd.c | 7 +++++--
drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ++-
drivers/crypto/zuc/rte_zuc_pmd.c | 3 ++-
lib/librte_cryptodev/rte_cryptodev.c | 4 +++-
lib/librte_cryptodev/rte_cryptodev.h | 1 +
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 ++-
12 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 101ef98..246f71e 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -450,7 +450,8 @@ aesni_gcm_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct aesni_gcm_private), init_params->socket_id);
+ sizeof(struct aesni_gcm_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
GCM_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 45b25c9..49d3f32 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -699,12 +699,14 @@ cryptodev_aesni_mb_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct aesni_mb_private), init_params->socket_id);
+ 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->device = &vdev->device;
dev->dev_type = RTE_CRYPTODEV_AESNI_MB_PMD;
dev->dev_ops = rte_aesni_mb_pmd_ops;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 3d603a5..29905d6 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -808,7 +808,8 @@ cryptodev_armv8_crypto_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct armv8_crypto_private),
- init_params->socket_id);
+ init_params->socket_id,
+ vdev);
if (dev == NULL) {
ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 9da9e89..a95f503 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -574,7 +574,8 @@ cryptodev_kasumi_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct kasumi_private), init_params->socket_id);
+ sizeof(struct kasumi_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
KASUMI_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 023450a..8124eba 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -166,6 +166,7 @@ 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 *dev;
@@ -177,12 +178,14 @@ cryptodev_null_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct null_crypto_private),
- init_params->socket_id);
+ init_params->socket_id,
+ vdev);
if (dev == NULL) {
NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
}
+ dev->device = &vdev->device;
dev->dev_type = RTE_CRYPTODEV_NULL_PMD;
dev->dev_ops = null_crypto_pmd_ops;
@@ -235,7 +238,7 @@ cryptodev_null_probe(struct rte_vdev_device *dev)
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_null_create(name, &init_params);
+ return cryptodev_null_create(name, dev, &init_params);
}
/** Uninitialise null crypto device */
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index f0c5ca3..13a5129 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -1277,7 +1277,8 @@ cryptodev_openssl_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct openssl_private),
- init_params->socket_id);
+ init_params->socket_id,
+ vdev);
if (dev == NULL) {
OPENSSL_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 0b63c20..acec102 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -89,7 +89,8 @@ const struct scheduler_parse_map scheduler_ordering_map[] = {
static int
cryptodev_scheduler_create(const char *name,
- struct scheduler_init_params *init_params)
+ struct rte_vdev_device *vdev,
+ struct scheduler_init_params *init_params)
{
struct rte_cryptodev *dev;
struct scheduler_ctx *sched_ctx;
@@ -103,7 +104,8 @@ cryptodev_scheduler_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->def_p.name,
sizeof(struct scheduler_ctx),
- init_params->def_p.socket_id);
+ init_params->def_p.socket_id,
+ vdev);
if (dev == NULL) {
CS_LOG_ERR("driver %s: failed to create cryptodev vdev",
name);
@@ -439,6 +441,7 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
init_params.def_p.name);
return cryptodev_scheduler_create(name,
+ vdev,
&init_params);
}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 960956c..f17c541 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -563,7 +563,8 @@ cryptodev_snow3g_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct snow3g_private), init_params->socket_id);
+ sizeof(struct snow3g_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
SNOW3G_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 1020544..ab42d06 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -463,7 +463,8 @@ cryptodev_zuc_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct zuc_private), init_params->socket_id);
+ sizeof(struct zuc_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
ZUC_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index b65cd9c..edd683c 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -673,7 +673,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
struct rte_cryptodev *
rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
- int socket_id)
+ int socket_id, struct rte_vdev_device *vdev)
{
struct rte_cryptodev *cryptodev;
@@ -695,6 +695,8 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
" data");
}
+ cryptodev->device = &vdev->device;
+
/* initialise user call-back tail queue */
TAILQ_INIT(&(cryptodev->link_intr_cbs));
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 88aeb87..f307b3b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -49,6 +49,7 @@ extern "C" {
#include "rte_crypto.h"
#include "rte_dev.h"
#include <rte_common.h>
+#include <rte_vdev.h>
#define CRYPTODEV_NAME_NULL_PMD crypto_null
/**< Null crypto PMD device name */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 17ef37c..ec4ca97 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -462,6 +462,7 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
* @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.
@@ -469,7 +470,7 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
*/
struct rte_cryptodev *
rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
- int socket_id);
+ int socket_id, struct rte_vdev_device *vdev);
/**
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 01/12] cryptodev: store device pointer in virtual devices
2017-05-24 15:27 ` [dpdk-dev] [PATCH 01/12] cryptodev: store device pointer in virtual devices Pablo de Lara
@ 2017-06-20 14:34 ` Declan Doherty
2017-06-20 17:29 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: Declan Doherty @ 2017-06-20 14:34 UTC (permalink / raw)
To: Pablo de Lara, thomas; +Cc: dev
On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> Only non virtual devices were storing the pointer to
> rte_device structure in rte_cryptodev, which will be needed
> to retrieve the driver name for any device.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
> diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> index 45b25c9..49d3f32 100644
> --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> @@ -699,12 +699,14 @@ cryptodev_aesni_mb_create(const char *name,
> }
>
> dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
> - sizeof(struct aesni_mb_private), init_params->socket_id);
> + 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->device = &vdev->device;
This is set in the rte_cryptodev_pmd_virtual_dev_init now so it isn't
needed here.
> dev->dev_type = RTE_CRYPTODEV_AESNI_MB_PMD;
> dev->dev_ops = rte_aesni_mb_pmd_ops;
>
> diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
> index 3d603a5..29905d6 100644
> --- a/drivers/crypto/armv8/rte_armv8_pmd.c
> +++ b/drivers/crypto/armv8/rte_armv8_pmd.c
> @@ -808,7 +808,8 @@ cryptodev_armv8_crypto_create(const char *name,
>
> dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
> sizeof(struct armv8_crypto_private),
> - init_params->socket_id);
> + init_params->socket_id,
> + vdev);
> if (dev == NULL) {
> ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
> goto init_error;
> diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
> index 9da9e89..a95f503 100644
> --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
> +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
> @@ -574,7 +574,8 @@ cryptodev_kasumi_create(const char *name,
> }
>
> dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
> - sizeof(struct kasumi_private), init_params->socket_id);
> + sizeof(struct kasumi_private), init_params->socket_id,
> + vdev);
> if (dev == NULL) {
> KASUMI_LOG_ERR("failed to create cryptodev vdev");
> goto init_error;
> diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
> index 023450a..8124eba 100644
> --- a/drivers/crypto/null/null_crypto_pmd.c
> +++ b/drivers/crypto/null/null_crypto_pmd.c
> @@ -166,6 +166,7 @@ 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 *dev;
> @@ -177,12 +178,14 @@ cryptodev_null_create(const char *name,
>
> dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
> sizeof(struct null_crypto_private),
> - init_params->socket_id);
> + init_params->socket_id,
> + vdev);
> if (dev == NULL) {
> NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
> goto init_error;
> }
>
> + dev->device = &vdev->device;
Same as above.
> dev->dev_type = RTE_CRYPTODEV_NULL_PMD;
> dev->dev_ops = null_crypto_pmd_ops;
>
> @@ -235,7 +238,7 @@ cryptodev_null_probe(struct rte_vdev_device *dev)
> RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
> init_params.max_nb_sessions);
>
> - return cryptodev_null_create(name, &init_params);
> + return cryptodev_null_create(name, dev, &init_params);
> }
>
> /** Uninitialise null crypto device */
..
>
Acked-by: Declan Doherty <declan.doherty@intel.com>
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 01/12] cryptodev: store device pointer in virtual devices
2017-06-20 14:34 ` Declan Doherty
@ 2017-06-20 17:29 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-20 17:29 UTC (permalink / raw)
To: Doherty, Declan, thomas; +Cc: dev
> -----Original Message-----
> From: Doherty, Declan
> Sent: Tuesday, June 20, 2017 3:34 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> thomas@monjalon.net
> Cc: dev@dpdk.org
> Subject: Re: [PATCH 01/12] cryptodev: store device pointer in virtual devices
>
> On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> > Only non virtual devices were storing the pointer to rte_device
> > structure in rte_cryptodev, which will be needed to retrieve the
> > driver name for any device.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> ...
>
> > diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> > b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> > index 45b25c9..49d3f32 100644
> > --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> > +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> > @@ -699,12 +699,14 @@ cryptodev_aesni_mb_create(const char *name,
> > }
> >
> > dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
> > - sizeof(struct aesni_mb_private), init_params-
> >socket_id);
> > + 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->device = &vdev->device;
>
> This is set in the rte_cryptodev_pmd_virtual_dev_init now so it isn't needed
> here.
Will fix in v2.
Thanks,
Pablo
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 02/12] cryptodev: set driver name for all devices
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
2017-05-24 15:27 ` [dpdk-dev] [PATCH 01/12] cryptodev: store device pointer in virtual devices Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:34 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 03/12] cryptodev: rename device retrieval argument Pablo de Lara
` (14 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
When retrieving device information for a crypto driver,
driver name was only set when it was a PCI driver.
Getting the driver name from rte_device structure
allows rte_cryptodev_get_info() function to return it
regardless they are virtual or physical devices.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index edd683c..a5a5c36 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1166,8 +1166,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
- if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.driver.name;
+ dev_info->driver_name = dev->device->driver->name;
}
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 03/12] cryptodev: rename device retrieval argument
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
2017-05-24 15:27 ` [dpdk-dev] [PATCH 01/12] cryptodev: store device pointer in virtual devices Pablo de Lara
2017-05-24 15:27 ` [dpdk-dev] [PATCH 02/12] cryptodev: set driver name for all devices Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:35 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval logic Pablo de Lara
` (13 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara, stable
rte_cryptodev_devices_get() function was parsing a crypto
device name as an argument, but the function actually
returns device identifiers of devices that share the
same crypto driver, so the argument should be driver name, instead.
Fixes: 38227c0e3ad2 ("cryptodev: retrieve device info")
CC: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.h | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a5a5c36..6880661 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -523,7 +523,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type)
}
uint8_t
-rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
+rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
uint8_t nb_devices)
{
uint8_t i, count = 0;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index f307b3b..89093f6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -464,9 +464,10 @@ extern uint8_t
rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
/**
- * Get number and identifiers of attached crypto device.
+ * Get number and identifiers of attached crypto devices that
+ * use the same crypto driver.
*
- * @param dev_name device name.
+ * @param driver_name driver name.
* @param devices output devices identifiers.
* @param nb_devices maximal number of devices.
*
@@ -474,7 +475,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
* Returns number of attached crypto device.
*/
uint8_t
-rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
+rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
uint8_t nb_devices);
/*
* Return the NUMA socket to which a device is connected
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 03/12] cryptodev: rename device retrieval argument
2017-05-24 15:27 ` [dpdk-dev] [PATCH 03/12] cryptodev: rename device retrieval argument Pablo de Lara
@ 2017-06-20 14:35 ` Declan Doherty
2017-06-20 17:28 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: Declan Doherty @ 2017-06-20 14:35 UTC (permalink / raw)
To: Pablo de Lara, thomas; +Cc: dev, stable
On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> rte_cryptodev_devices_get() function was parsing a crypto
> device name as an argument, but the function actually
> returns device identifiers of devices that share the
> same crypto driver, so the argument should be driver name, instead.
>
> Fixes: 38227c0e3ad2 ("cryptodev: retrieve device info")
> CC: stable@dpdk.org
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
> lib/librte_cryptodev/rte_cryptodev.c | 2 +-
> lib/librte_cryptodev/rte_cryptodev.h | 7 ++++---
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
> index a5a5c36..6880661 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -523,7 +523,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type)
> }
>
> uint8_t
> -rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
> +rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
> uint8_t nb_devices)
> {
> uint8_t i, count = 0;
Compilation breaks after this change, needs next patch to build
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> index f307b3b..89093f6 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
> @@ -464,9 +464,10 @@ extern uint8_t
> rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
>
> /**
> - * Get number and identifiers of attached crypto device.
> + * Get number and identifiers of attached crypto devices that
> + * use the same crypto driver.
> *
> - * @param dev_name device name.
> + * @param driver_name driver name.
> * @param devices output devices identifiers.
> * @param nb_devices maximal number of devices.
> *
> @@ -474,7 +475,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
> * Returns number of attached crypto device.
> */
> uint8_t
> -rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
> +rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
> uint8_t nb_devices);
> /*
> * Return the NUMA socket to which a device is connected
>
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 03/12] cryptodev: rename device retrieval argument
2017-06-20 14:35 ` Declan Doherty
@ 2017-06-20 17:28 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-20 17:28 UTC (permalink / raw)
To: Doherty, Declan, thomas; +Cc: dev, stable
> -----Original Message-----
> From: Doherty, Declan
> Sent: Tuesday, June 20, 2017 3:35 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> thomas@monjalon.net
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [PATCH 03/12] cryptodev: rename device retrieval argument
>
> On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> > rte_cryptodev_devices_get() function was parsing a crypto device name
> > as an argument, but the function actually returns device identifiers
> > of devices that share the same crypto driver, so the argument should
> > be driver name, instead.
> >
> > Fixes: 38227c0e3ad2 ("cryptodev: retrieve device info")
> > CC: stable@dpdk.org
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> > lib/librte_cryptodev/rte_cryptodev.c | 2 +-
> > lib/librte_cryptodev/rte_cryptodev.h | 7 ++++---
> > 2 files changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> > b/lib/librte_cryptodev/rte_cryptodev.c
> > index a5a5c36..6880661 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev.c
> > +++ b/lib/librte_cryptodev/rte_cryptodev.c
> > @@ -523,7 +523,7 @@ rte_cryptodev_count_devtype(enum
> > rte_cryptodev_type type) }
> >
> > uint8_t
> > -rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
> > +rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
> > uint8_t nb_devices)
> > {
> > uint8_t i, count = 0;
>
> Compilation breaks after this change, needs next patch to build
Yes, I forgot to change the variable name within the implementation.
I should better fix this and have it separated from the next one, though,
because this patch should be backported, but the following patch changes
the implementation, which requires patch 2.
So, I will send a v2 with the fix for this patch.
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval logic
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (2 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 03/12] cryptodev: rename device retrieval argument Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:35 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 05/12] cryptodev: only set PCI info when device is PCI Pablo de Lara
` (12 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
rte_cryptodev_devices_get() function returns an array of devices
sharing the same driver.
Instead of having two different paths depending on the device being
virtual or physical, retrieve the driver name from rte_device structure.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 6880661..53534ac 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -533,15 +533,10 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
for (i = 0; i < max_devs && count < nb_devices; i++) {
if (devs[i].attached == RTE_CRYPTODEV_ATTACHED) {
- const struct rte_cryptodev_driver *drv = devs[i].driver;
int cmp;
- if (drv)
- cmp = strncmp(drv->pci_drv.driver.name,
- dev_name, strlen(dev_name));
- else
- cmp = strncmp(devs[i].data->name,
- dev_name, strlen(dev_name));
+ cmp = strncmp(devs[i].device->driver->name, driver_name,
+ strlen(driver_name));
if (cmp == 0)
devices[count++] = devs[i].data->dev_id;
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval logic
2017-05-24 15:27 ` [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval logic Pablo de Lara
@ 2017-06-20 14:35 ` Declan Doherty
2017-06-20 17:29 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: Declan Doherty @ 2017-06-20 14:35 UTC (permalink / raw)
To: Pablo de Lara, thomas; +Cc: dev
On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> rte_cryptodev_devices_get() function returns an array of devices
> sharing the same driver.
>
> Instead of having two different paths depending on the device being
> virtual or physical, retrieve the driver name from rte_device structure.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
>
this should be squashed with the previous patch
Acked-by: Declan Doherty <declan.doherty@intel.com>
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval logic
2017-06-20 14:35 ` Declan Doherty
@ 2017-06-20 17:29 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-20 17:29 UTC (permalink / raw)
To: Doherty, Declan, thomas; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Tuesday, June 20, 2017 3:36 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> thomas@monjalon.net
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval
> logic
>
> On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> > rte_cryptodev_devices_get() function returns an array of devices
> > sharing the same driver.
> >
> > Instead of having two different paths depending on the device being
> > virtual or physical, retrieve the driver name from rte_device structure.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> ...
> >
>
> this should be squashed with the previous patch
As said, I will fix the previous one and leave this as it is.
Thanks,
Pablo
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 05/12] cryptodev: only set PCI info when device is PCI
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (3 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval logic Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:36 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 06/12] cryptodev: move vdev functions to a separate file Pablo de Lara
` (11 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Do not set PCI information in the device information structure
for any crypto device, just for the ones that are PCI, so
this is set internally in the PCI crypto PMDs (only QAT now).
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
drivers/crypto/qat/qat_crypto.c | 5 +++--
lib/librte_cryptodev/rte_cryptodev.c | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 386aa45..c3dbd6c 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -1240,8 +1240,8 @@ int qat_dev_close(struct rte_cryptodev *dev)
return 0;
}
-void qat_dev_info_get(__rte_unused struct rte_cryptodev *dev,
- struct rte_cryptodev_info *info)
+void qat_dev_info_get(struct rte_cryptodev *dev,
+ struct rte_cryptodev_info *info)
{
struct qat_pmd_private *internals = dev->data->dev_private;
@@ -1254,6 +1254,7 @@ void qat_dev_info_get(__rte_unused struct rte_cryptodev *dev,
info->capabilities = internals->qat_dev_capabilities;
info->sym.max_nb_sessions = internals->max_nb_sessions;
info->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD;
+ info->pci_dev = RTE_DEV_TO_PCI(dev->device);
}
}
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 53534ac..85e4936 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1160,7 +1160,6 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
- dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
dev_info->driver_name = dev->device->driver->name;
}
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 06/12] cryptodev: move vdev functions to a separate file
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (4 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 05/12] cryptodev: only set PCI info when device is PCI Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:36 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 07/12] cryptodev: release device if PCI device probing fails Pablo de Lara
` (10 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Move all functions handling virtual devices to a separate
header file "rte_cryptodev_vdev.h", in order to leave only
generic functions for any device in the rest of the files.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 1 +
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 1 +
drivers/crypto/armv8/rte_armv8_pmd.c | 1 +
drivers/crypto/kasumi/rte_kasumi_pmd.c | 1 +
drivers/crypto/null/null_crypto_pmd.c | 1 +
drivers/crypto/openssl/rte_openssl_pmd.c | 1 +
drivers/crypto/scheduler/scheduler_pmd.c | 52 +-----
drivers/crypto/scheduler/scheduler_pmd_ops.c | 1 +
drivers/crypto/snow3g/rte_snow3g_pmd.c | 1 +
drivers/crypto/zuc/rte_zuc_pmd.c | 1 +
lib/librte_cryptodev/Makefile | 1 +
lib/librte_cryptodev/rte_cryptodev.c | 149 ----------------
lib/librte_cryptodev/rte_cryptodev.h | 29 ---
lib/librte_cryptodev/rte_cryptodev_pmd.h | 18 --
lib/librte_cryptodev/rte_cryptodev_vdev.h | 236 +++++++++++++++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 10 +-
16 files changed, 248 insertions(+), 256 deletions(-)
create 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 246f71e..4d7aa4f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 49d3f32..80ab7ec 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -34,6 +34,7 @@
#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>
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 29905d6..8ed26db 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -36,6 +36,7 @@
#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>
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index a95f503..ac80473 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 8124eba..703434f 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,6 +33,7 @@
#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>
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 13a5129..a6438a8 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -34,6 +34,7 @@
#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>
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index acec102..53ebd5e 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -33,6 +33,7 @@
#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>
@@ -221,57 +222,6 @@ cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
return 0;
}
-static uint8_t
-number_of_sockets(void)
-{
- int sockets = 0;
- int i;
- const struct rte_memseg *ms = rte_eal_get_physmem_layout();
-
- for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
- if (sockets < ms[i].socket_id)
- sockets = ms[i].socket_id;
- }
-
- /* Number of sockets = maximum socket_id + 1 */
- return ++sockets;
-}
-
-/** Parse integer from integer argument */
-static int
-parse_integer_arg(const char *key __rte_unused,
- const char *value, void *extra_args)
-{
- int *i = (int *) extra_args;
-
- *i = atoi(value);
- if (*i < 0) {
- CS_LOG_ERR("Argument has to be positive.\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
-/** Parse name */
-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;
-
- if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
- CS_LOG_ERR("Invalid name %s, should be less than "
- "%u bytes.\n", value,
- RTE_CRYPTODEV_NAME_MAX_LEN - 1);
- return -EINVAL;
- }
-
- strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
-
- return 0;
-}
-
/** Parse slave */
static int
parse_slave_arg(const char *key __rte_unused,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 2b5858d..4fc8b91 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -37,6 +37,7 @@
#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"
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index f17c541..855be72 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index ab42d06..7681587 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 18f5e8c..4d37acf 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -48,6 +48,7 @@ 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
# versioning export map
EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 85e4936..2a84ee6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -101,18 +101,6 @@ struct rte_cryptodev_callback {
uint32_t active; /**< Callback is executing */
};
-#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 *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
-};
-
/**
* The crypto cipher algorithm strings identifiers.
* It could be used in application command line.
@@ -233,111 +221,6 @@ rte_crypto_auth_operation_strings[] = {
[RTE_CRYPTO_AUTH_OP_GENERATE] = "generate"
};
-static uint8_t
-number_of_sockets(void)
-{
- int sockets = 0;
- int i;
- const struct rte_memseg *ms = rte_eal_get_physmem_layout();
-
- for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
- if (sockets < ms[i].socket_id)
- sockets = ms[i].socket_id;
- }
-
- /* Number of sockets = maximum socket_id + 1 */
- return ++sockets;
-}
-
-/** Parse integer from integer argument */
-static int
-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;
-}
-
-/** Parse name */
-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;
-
- 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;
-}
-
-int
-rte_cryptodev_parse_vdev_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,
- &parse_integer_arg,
- ¶ms->max_nb_queue_pairs);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist,
- RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
- &parse_integer_arg,
- ¶ms->max_nb_sessions);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
- &parse_integer_arg,
- ¶ms->socket_id);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
- &parse_name_arg,
- params);
- if (ret < 0)
- goto free_kvlist;
-
- if (params->socket_id >= number_of_sockets()) {
- CDEV_LOG_ERR("Invalid socket id specified to create "
- "the virtual crypto device on");
- goto free_kvlist;
- }
- }
-
-free_kvlist:
- rte_kvargs_free(kvlist);
- return ret;
-}
-
const struct rte_cryptodev_symmetric_capability *
rte_cryptodev_sym_capability_get(uint8_t dev_id,
const struct rte_cryptodev_sym_capability_idx *idx)
@@ -666,38 +549,6 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
return 0;
}
-struct rte_cryptodev *
-rte_cryptodev_pmd_virtual_dev_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_pci_probe(struct rte_pci_driver *pci_drv,
struct rte_pci_device *pci_dev)
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 89093f6..7f6fbf0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -386,35 +386,6 @@ struct rte_cryptodev_stats {
#define RTE_CRYPTODEV_NAME_MAX_LEN (64)
/**< Max length of name of crypto PMD */
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048
-
-/**
- * @internal
- * Initialisation parameters for virtual crypto devices
- */
-struct rte_crypto_vdev_init_params {
- unsigned max_nb_queue_pairs;
- unsigned max_nb_sessions;
- uint8_t socket_id;
- char name[RTE_CRYPTODEV_NAME_MAX_LEN];
-};
-
-/**
- * Parse virtual device initialisation parameters input arguments
- * @internal
- *
- * @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_parse_vdev_init_params(
- struct rte_crypto_vdev_init_params *params,
- const char *input_args);
/**
* Create a virtual crypto device
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index ec4ca97..0efe282 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -456,24 +456,6 @@ struct rte_cryptodev *
rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
- * 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_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
- int socket_id, struct rte_vdev_device *vdev);
-
-
-/**
* Function for internal use by dummy drivers primarily, e.g. ring-based
* driver.
* Release the specified cryptodev device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
new file mode 100644
index 0000000..6ac337b
--- /dev/null
+++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h
@@ -0,0 +1,236 @@
+/*-
+ * 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>
+
+#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 *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
+ * Parse name from argument
+ */
+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;
+
+ 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;
+}
+
+/**
+ * @internal
+ * Parse integer from argument
+ */
+static int
+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;
+}
+
+/**
+ * @internal
+ * Return number of sockets with memory reserved
+ */
+static uint8_t
+number_of_sockets(void)
+{
+ int sockets = 0;
+ int i;
+ const struct rte_memseg *ms = rte_eal_get_physmem_layout();
+
+ for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
+ if (sockets < ms[i].socket_id)
+ sockets = ms[i].socket_id;
+ }
+
+ /* Number of sockets = maximum socket_id + 1 */
+ return ++sockets;
+}
+
+/**
+ * @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.
+ */
+static inline struct rte_cryptodev *
+rte_cryptodev_pmd_virtual_dev_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;
+}
+
+/**
+ * @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
+ */
+static inline int
+rte_cryptodev_parse_vdev_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,
+ &parse_integer_arg,
+ ¶ms->max_nb_queue_pairs);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist,
+ RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
+ &parse_integer_arg,
+ ¶ms->max_nb_sessions);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
+ &parse_integer_arg,
+ ¶ms->socket_id);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
+ &parse_name_arg,
+ params);
+ if (ret < 0)
+ goto free_kvlist;
+
+ if (params->socket_id >= number_of_sockets()) {
+ CDEV_LOG_ERR("Invalid socket id specified to create "
+ "the virtual crypto device on");
+ goto free_kvlist;
+ }
+ }
+
+free_kvlist:
+ rte_kvargs_free(kvlist);
+ return ret;
+}
+
+#endif /* _RTE_CRYPTODEV_VDEV_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 9ac510e..d519234 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -15,7 +15,6 @@ DPDK_16.04 {
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
rte_cryptodev_pmd_release_device;
- rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
rte_cryptodev_socket_id;
@@ -32,20 +31,13 @@ DPDK_16.04 {
local: *;
};
-DPDK_16.07 {
- global:
-
- rte_cryptodev_parse_vdev_init_params;
-
-} DPDK_16.04;
-
DPDK_16.11 {
global:
rte_cryptodev_pci_probe;
rte_cryptodev_pci_remove;
-} DPDK_16.07;
+} DPDK_16.04;
DPDK_17.02 {
global:
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 06/12] cryptodev: move vdev functions to a separate file
2017-05-24 15:27 ` [dpdk-dev] [PATCH 06/12] cryptodev: move vdev functions to a separate file Pablo de Lara
@ 2017-06-20 14:36 ` Declan Doherty
2017-06-20 21:46 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: Declan Doherty @ 2017-06-20 14:36 UTC (permalink / raw)
To: Pablo de Lara, thomas; +Cc: dev
On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> Move all functions handling virtual devices to a separate
> header file "rte_cryptodev_vdev.h", in order to leave only
> generic functions for any device in the rest of the files.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
> +++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h
> @@ -0,0 +1,236 @@
> +/*-
> + * 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>
> +
> +#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 *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
> + * Parse name from argument
> + */
> +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;
> +
> + 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;
> +}
> +
> +/**
> + * @internal
> + * Parse integer from argument
> + */
> +static int
> +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;
> +}
> +
> +/**
> + * @internal
> + * Return number of sockets with memory reserved
> + */
> +static uint8_t
> +number_of_sockets(void)
> +{
> + int sockets = 0;
> + int i;
> + const struct rte_memseg *ms = rte_eal_get_physmem_layout();
> +
> + for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
> + if (sockets < ms[i].socket_id)
> + sockets = ms[i].socket_id;
> + }
> +
> + /* Number of sockets = maximum socket_id + 1 */
> + return ++sockets;
> +}
> +
If the above functions need to be public then they should have a naming
prefix like outlined below.
> +/**
> + * @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.
> + */
> +static inline struct rte_cryptodev *
> +rte_cryptodev_pmd_virtual_dev_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;
> +}
> +
> +/**
> + * @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
> + */
> +static inline int
> +rte_cryptodev_parse_vdev_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,
> + &parse_integer_arg,
> + ¶ms->max_nb_queue_pairs);
> + if (ret < 0)
> + goto free_kvlist;
> +
> + ret = rte_kvargs_process(kvlist,
> + RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
> + &parse_integer_arg,
> + ¶ms->max_nb_sessions);
> + if (ret < 0)
> + goto free_kvlist;
> +
> + ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
> + &parse_integer_arg,
> + ¶ms->socket_id);
> + if (ret < 0)
> + goto free_kvlist;
> +
> + ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
> + &parse_name_arg,
> + params);
> + if (ret < 0)
> + goto free_kvlist;
> +
> + if (params->socket_id >= number_of_sockets()) {
> + CDEV_LOG_ERR("Invalid socket id specified to create "
> + "the virtual crypto device on");
> + goto free_kvlist;
> + }
> + }
> +
> +free_kvlist:
> + rte_kvargs_free(kvlist);
> + return ret;
> +}
> +
> +#endif /* _RTE_CRYPTODEV_VDEV_H_ */
> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
> index 9ac510e..d519234 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
...
>
Now that these APIs have been moved into a single header it would be
good to have consistent naming, rte_cryptodev_vdev_
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 06/12] cryptodev: move vdev functions to a separate file
2017-06-20 14:36 ` Declan Doherty
@ 2017-06-20 21:46 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-20 21:46 UTC (permalink / raw)
To: Doherty, Declan, thomas; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Tuesday, June 20, 2017 3:37 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> thomas@monjalon.net
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 06/12] cryptodev: move vdev functions to a
> separate file
>
> On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> > Move all functions handling virtual devices to a separate header file
> > "rte_cryptodev_vdev.h", in order to leave only generic functions for
> > any device in the rest of the files.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
>
> ...
>
> > +++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h
...
> > +/**
> > + * @internal
> > + * Return number of sockets with memory reserved */ static uint8_t
> > +number_of_sockets(void)
> > +{
> > + int sockets = 0;
> > + int i;
> > + const struct rte_memseg *ms = rte_eal_get_physmem_layout();
> > +
> > + for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
> > + if (sockets < ms[i].socket_id)
> > + sockets = ms[i].socket_id;
> > + }
> > +
> > + /* Number of sockets = maximum socket_id + 1 */
> > + return ++sockets;
> > +}
> > +
> If the above functions need to be public then they should have a naming prefix
> like outlined below.
They are used in the PMDs, for crypto vdevs, so I can include the prefix that you suggest,
except for the last one (number_of_sockets). I think this one should be substituted by a better function,
implemented in EAL, and used in this and other places.
I will send a separate patchset to address this.
>
> > +#endif /* _RTE_CRYPTODEV_VDEV_H_ */
> > diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map
> > b/lib/librte_cryptodev/rte_cryptodev_version.map
> > index 9ac510e..d519234 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev_version.map
>
> ...
>
> >
>
> Now that these APIs have been moved into a single header it would be good to
> have consistent naming, rte_cryptodev_vdev_
Will do this in v2.
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 07/12] cryptodev: release device if PCI device probing fails
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (5 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 06/12] cryptodev: move vdev functions to a separate file Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:36 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 08/12] cryptodev: add PCI driver helpers Pablo de Lara
` (9 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Call rte_cryptodev_pmd_release_device() if probing a
PCI crypto device, instead of accessing the variables
directly. This will be useful when rte_cryptodev_pci_probe()
gets moved to a separate file.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 2a84ee6..056ad56 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -540,9 +540,12 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
if (cryptodev == NULL)
return -EINVAL;
- ret = rte_cryptodev_close(cryptodev->data->dev_id);
- if (ret < 0)
- return ret;
+ /* Close device only if device operations have been set */
+ if (cryptodev->dev_ops) {
+ ret = rte_cryptodev_close(cryptodev->data->dev_id);
+ if (ret < 0)
+ return ret;
+ }
cryptodev->attached = RTE_CRYPTODEV_DETACHED;
cryptodev_globals.nb_devs--;
@@ -603,8 +606,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
rte_free(cryptodev->data->dev_private);
- cryptodev->attached = RTE_CRYPTODEV_DETACHED;
- cryptodev_globals.nb_devs--;
+ /* free crypto device */
+ rte_cryptodev_pmd_release_device(cryptodev);
return -ENXIO;
}
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 08/12] cryptodev: add PCI driver helpers
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (6 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 07/12] cryptodev: release device if PCI device probing fails Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:37 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 09/12] crypto/qat: do not use cryptodev driver Pablo de Lara
` (8 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Add PCI probe/remove/init/uninit functions in a separate
file rte_cryptodev_pci.h, which do not use cryptodev driver,
in order to be removed in next commits.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/Makefile | 1 +
lib/librte_cryptodev/rte_cryptodev_pci.h | 177 +++++++++++++++++++++++++++++++
2 files changed, 178 insertions(+)
create mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 4d37acf..2a31be3 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -49,6 +49,7 @@ 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
EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pci.h b/lib/librte_cryptodev/rte_cryptodev_pci.h
new file mode 100644
index 0000000..ea9a750
--- /dev/null
+++ b/lib/librte_cryptodev/rte_cryptodev_pci.h
@@ -0,0 +1,177 @@
+/*-
+ * 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>
+#include <rte_cryptodev_pmd.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.
+ */
+static inline 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;
+}
+
+/**
+ * @internal
+ * Wrapper for use by pci drivers as a .remove function to detach a crypto
+ * interface.
+ */
+static inline 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;
+}
+
+#endif /* _RTE_CRYPTODEV_PCI_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 09/12] crypto/qat: do not use cryptodev driver
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (7 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 08/12] cryptodev: add PCI driver helpers Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:37 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 10/12] crypto/dpaa2_sec: " Pablo de Lara
` (7 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
drivers/crypto/qat/qat_crypto.c | 1 +
drivers/crypto/qat/qat_qp.c | 8 +++++---
drivers/crypto/qat/rte_qat_cryptodev.c | 32 ++++++++++++++++++++------------
3 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index c3dbd6c..c94a308 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -60,6 +60,7 @@
#include <rte_spinlock.h>
#include <rte_hexdump.h>
#include <rte_crypto_sym.h>
+#include <rte_cryptodev_pci.h>
#include <openssl/evp.h>
#include "qat_logs.h"
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index a358ccd..3921c2e 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -36,6 +36,7 @@
#include <rte_malloc.h>
#include <rte_memzone.h>
#include <rte_cryptodev_pmd.h>
+#include <rte_pci.h>
#include <rte_atomic.h>
#include <rte_prefetch.h>
@@ -205,7 +206,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
adf_configure_queues(qp);
adf_queue_arb_enable(&qp->tx_q, qp->mmap_bar_addr);
snprintf(op_cookie_pool_name, RTE_RING_NAMESIZE, "%s_qp_op_%d_%hu",
- dev->driver->pci_drv.driver.name, dev->data->dev_id,
+ pci_dev->driver->driver.name, dev->data->dev_id,
queue_pair_id);
qp->op_cookie_pool = rte_mempool_lookup(op_cookie_pool_name);
@@ -355,11 +356,13 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
return -EINVAL;
}
+ pci_dev = RTE_DEV_TO_PCI(dev->device);
+
/*
* Allocate a memzone for the queue - create a unique name.
*/
snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d",
- dev->driver->pci_drv.driver.name, "qp_mem", dev->data->dev_id,
+ pci_dev->driver->driver.name, "qp_mem", dev->data->dev_id,
queue->hw_bundle_number, queue->hw_queue_number);
qp_mz = queue_dma_zone_reserve(queue->memz_name, queue_size_bytes,
socket_id);
@@ -408,7 +411,6 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
queue_base = BUILD_RING_BASE_ADDR(queue->base_phys_addr,
queue->queue_size);
- pci_dev = RTE_DEV_TO_PCI(dev->device);
io_addr = pci_dev->mem_resource[0].addr;
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1bdd30d..78d50fb 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -35,6 +35,7 @@
#include <rte_dev.h>
#include <rte_malloc.h>
#include <rte_cryptodev_pmd.h>
+#include <rte_cryptodev_pci.h>
#include "qat_crypto.h"
#include "qat_logs.h"
@@ -95,8 +96,7 @@ static const struct rte_pci_id pci_id_qat_map[] = {
};
static int
-crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_drv,
- struct rte_cryptodev *cryptodev)
+crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
{
struct qat_pmd_private *internals;
@@ -147,17 +147,25 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
return 0;
}
-static struct rte_cryptodev_driver rte_qat_pmd = {
- .pci_drv = {
- .id_table = pci_id_qat_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_cryptodev_pci_probe,
- .remove = rte_cryptodev_pci_remove,
- },
- .cryptodev_init = crypto_qat_dev_init,
- .dev_private_size = sizeof(struct qat_pmd_private),
+static int crypto_qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_cryptodev_pci_generic_probe(pci_dev,
+ sizeof(struct qat_pmd_private), crypto_qat_dev_init);
+}
+
+static int crypto_qat_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_cryptodev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_qat_pmd = {
+ .id_table = pci_id_qat_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = crypto_qat_pci_probe,
+ .remove = crypto_qat_pci_remove
};
-RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd);
RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 09/12] crypto/qat: do not use cryptodev driver
2017-05-24 15:27 ` [dpdk-dev] [PATCH 09/12] crypto/qat: do not use cryptodev driver Pablo de Lara
@ 2017-06-20 14:37 ` Declan Doherty
0 siblings, 0 replies; 57+ messages in thread
From: Declan Doherty @ 2017-06-20 14:37 UTC (permalink / raw)
To: Pablo de Lara, thomas; +Cc: dev
On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
> drivers/crypto/qat/qat_crypto.c | 1 +
> drivers/crypto/qat/qat_qp.c | 8 +++++---
> drivers/crypto/qat/rte_qat_cryptodev.c | 32 ++++++++++++++++++++------------
> 3 files changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
> index c3dbd6c..c94a308 100644
> --- a/drivers/crypto/qat/qat_crypto.c
...
>
Acked-by: Declan Doherty <declan.doherty@intel.com>
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 10/12] crypto/dpaa2_sec: do not use cryptodev driver
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (8 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 09/12] crypto/qat: do not use cryptodev driver Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-05-24 15:27 ` [dpdk-dev] [PATCH 11/12] cryptodev: remove unused PCI probe/remove Pablo de Lara
` (6 subsequent siblings)
16 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 4e01fe8..e32b27e 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1481,8 +1481,7 @@ static struct rte_cryptodev_ops crypto_ops = {
};
static int
-dpaa2_sec_uninit(const struct rte_cryptodev_driver *crypto_drv __rte_unused,
- struct rte_cryptodev *dev)
+dpaa2_sec_uninit(const struct rte_cryptodev *dev)
{
PMD_INIT_LOG(INFO, "Closing DPAA2_SEC device %s on numa socket %u\n",
dev->data->name, rte_socket_id());
@@ -1571,7 +1570,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
}
static int
-cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv,
+cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
struct rte_dpaa2_device *dpaa2_dev)
{
struct rte_cryptodev *cryptodev;
@@ -1599,7 +1598,6 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv,
dpaa2_dev->cryptodev = cryptodev;
cryptodev->device = &dpaa2_dev->device;
- cryptodev->driver = (struct rte_cryptodev_driver *)dpaa2_drv;
/* init user callbacks */
TAILQ_INIT(&(cryptodev->link_intr_cbs));
@@ -1627,7 +1625,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
if (cryptodev == NULL)
return -ENODEV;
- ret = dpaa2_sec_uninit(NULL, cryptodev);
+ ret = dpaa2_sec_uninit(cryptodev);
if (ret)
return ret;
@@ -1638,7 +1636,6 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
rte_free(cryptodev->data->dev_private);
cryptodev->device = NULL;
- cryptodev->driver = NULL;
cryptodev->data = NULL;
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 11/12] cryptodev: remove unused PCI probe/remove
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (9 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 10/12] crypto/dpaa2_sec: " Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:37 ` Declan Doherty
2017-05-24 15:27 ` [dpdk-dev] [PATCH 12/12] cryptodev: remove unused cryptodev driver Pablo de Lara
` (5 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 103 -------------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 13 ----
lib/librte_cryptodev/rte_cryptodev_version.map | 10 +--
3 files changed, 1 insertion(+), 125 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 056ad56..23a741c 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -47,7 +47,6 @@
#include <rte_debug.h>
#include <rte_dev.h>
#include <rte_interrupts.h>
-#include <rte_pci.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
@@ -552,108 +551,6 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
return 0;
}
-int
-rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
-{
- struct rte_cryptodev_driver *cryptodrv;
- struct rte_cryptodev *cryptodev;
-
- char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
-
- int retval;
-
- cryptodrv = (struct rte_cryptodev_driver *)pci_drv;
- if (cryptodrv == NULL)
- return -ENODEV;
-
- 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",
- cryptodrv->dev_private_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;
- cryptodev->driver = cryptodrv;
-
- /* init user callbacks */
- TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
- /* Invoke PMD device initialization function */
- retval = (*cryptodrv->cryptodev_init)(cryptodrv, cryptodev);
- if (retval == 0)
- return 0;
-
- CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_drv->driver.name,
- (unsigned) pci_dev->id.vendor_id,
- (unsigned) 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_remove(struct rte_pci_device *pci_dev)
-{
- const struct rte_cryptodev_driver *cryptodrv;
- 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;
-
- cryptodrv = (const struct rte_cryptodev_driver *)pci_dev->driver;
- if (cryptodrv == NULL)
- return -ENODEV;
-
- /* Invoke PMD device uninit function */
- if (*cryptodrv->cryptodev_uninit) {
- ret = (*cryptodrv->cryptodev_uninit)(cryptodrv, 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->driver = NULL;
- cryptodev->data = NULL;
-
- return 0;
-}
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 0efe282..6579170 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -482,19 +482,6 @@ void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
/**
- * Wrapper for use by pci drivers as a .probe function to attach to a crypto
- * interface.
- */
-int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev);
-
-/**
- * Wrapper for use by pci drivers as a .remove function to detach a crypto
- * interface.
- */
-int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
-
-/**
* @internal
* Create unique device name
*/
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index d519234..b6c8ab8 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -31,14 +31,6 @@ DPDK_16.04 {
local: *;
};
-DPDK_16.11 {
- global:
-
- rte_cryptodev_pci_probe;
- rte_cryptodev_pci_remove;
-
-} DPDK_16.04;
-
DPDK_17.02 {
global:
@@ -55,7 +47,7 @@ DPDK_17.02 {
rte_crypto_cipher_algorithm_strings;
rte_crypto_cipher_operation_strings;
-} DPDK_16.11;
+} DPDK_16.04;
DPDK_17.05 {
global:
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH 12/12] cryptodev: remove unused cryptodev driver
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (10 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 11/12] cryptodev: remove unused PCI probe/remove Pablo de Lara
@ 2017-05-24 15:27 ` Pablo de Lara
2017-06-20 14:37 ` Declan Doherty
2017-06-07 22:54 ` [dpdk-dev] [PATCH 00/12] Remove " Gaëtan Rivet
` (4 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-05-24 15:27 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 64 --------------------------------
2 files changed, 66 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 7f6fbf0..4e318f0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -694,8 +694,6 @@ struct rte_cryptodev {
enqueue_pkt_burst_t enqueue_burst;
/**< Pointer to PMD transmit function. */
- const struct rte_cryptodev_driver *driver;
- /**< Driver for this device */
struct rte_cryptodev_data *data;
/**< Pointer to device data */
struct rte_cryptodev_ops *dev_ops;
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 6579170..8e8b2ad 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -47,7 +47,6 @@ extern "C" {
#include <string.h>
#include <rte_dev.h>
-#include <rte_pci.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
@@ -68,69 +67,6 @@ struct rte_cryptodev_session {
__extension__ char _private[0];
};
-struct rte_cryptodev_driver;
-
-/**
- * Initialisation function of a crypto driver invoked for each matching
- * crypto PCI device detected during the PCI probing phase.
- *
- * @param drv The pointer to the [matching] crypto driver structure
- * supplied by the PMD when it registered itself.
- * @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_init_t)(struct rte_cryptodev_driver *drv,
- struct rte_cryptodev *dev);
-
-/**
- * Finalisation function of a driver invoked for each matching
- * PCI device detected during the PCI closing phase.
- *
- * @param drv The pointer to the [matching] driver structure supplied
- * by the PMD when it registered itself.
- * @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_uninit_t)(const struct rte_cryptodev_driver *drv,
- struct rte_cryptodev *dev);
-
-/**
- * The structure associated with a PMD driver.
- *
- * Each driver acts as a PCI driver and is represented by a generic
- * *crypto_driver* structure that holds:
- *
- * - An *rte_pci_driver* structure (which must be the first field).
- *
- * - The *cryptodev_init* function invoked for each matching PCI device.
- *
- * - The size of the private data to allocate for each matching device.
- */
-struct rte_cryptodev_driver {
- struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */
- unsigned dev_private_size; /**< Size of device private data. */
-
- cryptodev_init_t cryptodev_init; /**< Device init function. */
- cryptodev_uninit_t cryptodev_uninit; /**< Device uninit function. */
-};
-
-
/** Global structure used for maintaining state of allocated crypto devices */
struct rte_cryptodev_global {
struct rte_cryptodev *devs; /**< Device information array */
--
2.7.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (11 preceding siblings ...)
2017-05-24 15:27 ` [dpdk-dev] [PATCH 12/12] cryptodev: remove unused cryptodev driver Pablo de Lara
@ 2017-06-07 22:54 ` Gaëtan Rivet
2017-06-08 15:58 ` De Lara Guarch, Pablo
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (3 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Gaëtan Rivet @ 2017-06-07 22:54 UTC (permalink / raw)
To: Pablo de Lara; +Cc: declan.doherty, thomas, dev
Hi Pablo,
On Wed, May 24, 2017 at 04:27:02PM +0100, Pablo de Lara wrote:
> Following the same aproach taken for ethdev, this patch series
> removes the PCI specific structure cryptodev driver from rte_cryptodev.
>
> The patchset makes the following changes:
>
> - Moves the virtual and PCI device specific functions to separate files,
> so other cryptodev header files contain only device type agnostic functions.
>
> - Modifies device info retrieval function to set the driver name for all devices
> and set PCI info inside PCI device PMDs
>
> - Removes cryptodev driver structure from cryptodev library and drivers
> that were using it (QAT and dpaa2)
>
While most of the work seems to be done within this patchset, there are
still rte_pci.h includes in both:
lib/librte_cryptodev/rte_cryptodev.c:50:#include <rte_pci.h>
lib/librte_cryptodev/rte_cryptodev_pmd.h:50:#include <rte_pci.h>
This breaks the compilation when the PCI bus is compiled outside the EAL.
Would you be able to remove those last dependencies?
> There is still a vdev specific function, rte_cryptodev_create_vdev() in cryptodev.c.
> That function should be deprecated, as virtual devices should be created through
> EAL. A deprecation notice will be sent separately.
>
> Pablo de Lara (12):
> cryptodev: store device pointer in virtual devices
> cryptodev: set driver name for all devices
> cryptodev: rename device retrieval argument
> cryptodev: simplify device list retrieval logic
> cryptodev: only set PCI info when device is PCI
> cryptodev: move vdev functions to a separate file
> cryptodev: release device if PCI device probing fails
> cryptodev: add PCI driver helpers
> crypto/qat: do not use cryptodev driver
> crypto/dpaa2_sec: do not use cryptodev driver
> cryptodev: remove unused PCI probe/remove
> cryptodev: remove unused cryptodev driver
>
> drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 4 +-
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 5 +-
> drivers/crypto/armv8/rte_armv8_pmd.c | 4 +-
> drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 9 +-
> drivers/crypto/kasumi/rte_kasumi_pmd.c | 4 +-
> drivers/crypto/null/null_crypto_pmd.c | 8 +-
> drivers/crypto/openssl/rte_openssl_pmd.c | 4 +-
> drivers/crypto/qat/qat_crypto.c | 6 +-
> drivers/crypto/qat/qat_qp.c | 8 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 32 +--
> drivers/crypto/scheduler/scheduler_pmd.c | 59 +-----
> drivers/crypto/scheduler/scheduler_pmd_ops.c | 1 +
> drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 +-
> drivers/crypto/zuc/rte_zuc_pmd.c | 4 +-
> lib/librte_cryptodev/Makefile | 2 +
> lib/librte_cryptodev/rte_cryptodev.c | 272 +------------------------
> lib/librte_cryptodev/rte_cryptodev.h | 39 +---
> lib/librte_cryptodev/rte_cryptodev_pci.h | 177 ++++++++++++++++
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 94 ---------
> lib/librte_cryptodev/rte_cryptodev_vdev.h | 236 +++++++++++++++++++++
> lib/librte_cryptodev/rte_cryptodev_version.map | 18 +-
> 21 files changed, 497 insertions(+), 493 deletions(-)
> create mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
> create mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
>
> --
> 2.7.4
>
--
Gaëtan Rivet
6WIND
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
2017-06-07 22:54 ` [dpdk-dev] [PATCH 00/12] Remove " Gaëtan Rivet
@ 2017-06-08 15:58 ` De Lara Guarch, Pablo
2017-06-09 9:58 ` Gaëtan Rivet
0 siblings, 1 reply; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-08 15:58 UTC (permalink / raw)
To: Gaëtan Rivet; +Cc: Doherty, Declan, thomas, dev
Hi Gaetan,
> -----Original Message-----
> From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> Sent: Wednesday, June 07, 2017 11:55 PM
> To: De Lara Guarch, Pablo
> Cc: Doherty, Declan; thomas@monjalon.net; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
>
> Hi Pablo,
>
> On Wed, May 24, 2017 at 04:27:02PM +0100, Pablo de Lara wrote:
> > Following the same aproach taken for ethdev, this patch series
> > removes the PCI specific structure cryptodev driver from rte_cryptodev.
> >
> > The patchset makes the following changes:
> >
> > - Moves the virtual and PCI device specific functions to separate files,
> > so other cryptodev header files contain only device type agnostic
> functions.
> >
> > - Modifies device info retrieval function to set the driver name for all
> devices
> > and set PCI info inside PCI device PMDs
> >
> > - Removes cryptodev driver structure from cryptodev library and drivers
> > that were using it (QAT and dpaa2)
> >
>
> While most of the work seems to be done within this patchset, there are
> still rte_pci.h includes in both:
>
> lib/librte_cryptodev/rte_cryptodev.c:50:#include <rte_pci.h>
> lib/librte_cryptodev/rte_cryptodev_pmd.h:50:#include <rte_pci.h>
>
> This breaks the compilation when the PCI bus is compiled outside the EAL.
> Would you be able to remove those last dependencies?
These includes have been removed already in the patchset.
Have you applied all 12 patches?
Thanks,
Pablo
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
2017-06-08 15:58 ` De Lara Guarch, Pablo
@ 2017-06-09 9:58 ` Gaëtan Rivet
2017-06-09 10:01 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: Gaëtan Rivet @ 2017-06-09 9:58 UTC (permalink / raw)
To: De Lara Guarch, Pablo; +Cc: Doherty, Declan, thomas, dev
On Thu, Jun 08, 2017 at 03:58:16PM +0000, De Lara Guarch, Pablo wrote:
> Hi Gaetan,
>
> > -----Original Message-----
> > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> > Sent: Wednesday, June 07, 2017 11:55 PM
> > To: De Lara Guarch, Pablo
> > Cc: Doherty, Declan; thomas@monjalon.net; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
> >
> > Hi Pablo,
> >
> > On Wed, May 24, 2017 at 04:27:02PM +0100, Pablo de Lara wrote:
> > > Following the same aproach taken for ethdev, this patch series
> > > removes the PCI specific structure cryptodev driver from rte_cryptodev.
> > >
> > > The patchset makes the following changes:
> > >
> > > - Moves the virtual and PCI device specific functions to separate files,
> > > so other cryptodev header files contain only device type agnostic
> > functions.
> > >
> > > - Modifies device info retrieval function to set the driver name for all
> > devices
> > > and set PCI info inside PCI device PMDs
> > >
> > > - Removes cryptodev driver structure from cryptodev library and drivers
> > > that were using it (QAT and dpaa2)
> > >
> >
> > While most of the work seems to be done within this patchset, there are
> > still rte_pci.h includes in both:
> >
> > lib/librte_cryptodev/rte_cryptodev.c:50:#include <rte_pci.h>
> > lib/librte_cryptodev/rte_cryptodev_pmd.h:50:#include <rte_pci.h>
> >
> > This breaks the compilation when the PCI bus is compiled outside the EAL.
> > Would you be able to remove those last dependencies?
>
> These includes have been removed already in the patchset.
> Have you applied all 12 patches?
>
Ah yes, sorry, I must have missed a few.
I have some trouble applying the patch however, I will test the
integration with the PCI bus move after I resolve this.
> Thanks,
> Pablo
>
>
--
Gaëtan Rivet
6WIND
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
2017-06-09 9:58 ` Gaëtan Rivet
@ 2017-06-09 10:01 ` De Lara Guarch, Pablo
2017-06-09 10:29 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-09 10:01 UTC (permalink / raw)
To: Gaëtan Rivet; +Cc: Doherty, Declan, thomas, dev
> -----Original Message-----
> From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> Sent: Friday, June 09, 2017 10:58 AM
> To: De Lara Guarch, Pablo
> Cc: Doherty, Declan; thomas@monjalon.net; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
>
> On Thu, Jun 08, 2017 at 03:58:16PM +0000, De Lara Guarch, Pablo wrote:
> > Hi Gaetan,
> >
> > > -----Original Message-----
> > > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> > > Sent: Wednesday, June 07, 2017 11:55 PM
> > > To: De Lara Guarch, Pablo
> > > Cc: Doherty, Declan; thomas@monjalon.net; dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
> > >
> > > Hi Pablo,
> > >
> > > On Wed, May 24, 2017 at 04:27:02PM +0100, Pablo de Lara wrote:
> > > > Following the same aproach taken for ethdev, this patch series
> > > > removes the PCI specific structure cryptodev driver from
> rte_cryptodev.
> > > >
> > > > The patchset makes the following changes:
> > > >
> > > > - Moves the virtual and PCI device specific functions to separate files,
> > > > so other cryptodev header files contain only device type agnostic
> > > functions.
> > > >
> > > > - Modifies device info retrieval function to set the driver name for all
> > > devices
> > > > and set PCI info inside PCI device PMDs
> > > >
> > > > - Removes cryptodev driver structure from cryptodev library and
> drivers
> > > > that were using it (QAT and dpaa2)
> > > >
> > >
> > > While most of the work seems to be done within this patchset, there
> are
> > > still rte_pci.h includes in both:
> > >
> > > lib/librte_cryptodev/rte_cryptodev.c:50:#include <rte_pci.h>
> > > lib/librte_cryptodev/rte_cryptodev_pmd.h:50:#include <rte_pci.h>
> > >
> > > This breaks the compilation when the PCI bus is compiled outside the
> EAL.
> > > Would you be able to remove those last dependencies?
> >
> > These includes have been removed already in the patchset.
> > Have you applied all 12 patches?
> >
>
> Ah yes, sorry, I must have missed a few.
> I have some trouble applying the patch however, I will test the
> integration with the PCI bus move after I resolve this.
It might not apply cleanly after the latest patches that got merged.
I will send a rebased v2.
Pablo
>
> > Thanks,
> > Pablo
> >
> >
>
> --
> Gaëtan Rivet
> 6WIND
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
2017-06-09 10:01 ` De Lara Guarch, Pablo
@ 2017-06-09 10:29 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-09 10:29 UTC (permalink / raw)
To: De Lara Guarch, Pablo, Gaëtan Rivet; +Cc: Doherty, Declan, thomas, dev
Hi Gaetan,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Friday, June 09, 2017 11:02 AM
> To: Gaëtan Rivet
> Cc: Doherty, Declan; thomas@monjalon.net; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
>
>
>
> > -----Original Message-----
> > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> > Sent: Friday, June 09, 2017 10:58 AM
> > To: De Lara Guarch, Pablo
> > Cc: Doherty, Declan; thomas@monjalon.net; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
> >
> > On Thu, Jun 08, 2017 at 03:58:16PM +0000, De Lara Guarch, Pablo wrote:
> > > Hi Gaetan,
> > >
> > > > -----Original Message-----
> > > > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> > > > Sent: Wednesday, June 07, 2017 11:55 PM
> > > > To: De Lara Guarch, Pablo
> > > > Cc: Doherty, Declan; thomas@monjalon.net; dev@dpdk.org
> > > > Subject: Re: [dpdk-dev] [PATCH 00/12] Remove cryptodev driver
> > > >
> > > > Hi Pablo,
> > > >
> > > > On Wed, May 24, 2017 at 04:27:02PM +0100, Pablo de Lara wrote:
> > > > > Following the same aproach taken for ethdev, this patch series
> > > > > removes the PCI specific structure cryptodev driver from
> > rte_cryptodev.
> > > > >
> > > > > The patchset makes the following changes:
> > > > >
> > > > > - Moves the virtual and PCI device specific functions to separate
> files,
> > > > > so other cryptodev header files contain only device type agnostic
> > > > functions.
> > > > >
> > > > > - Modifies device info retrieval function to set the driver name for all
> > > > devices
> > > > > and set PCI info inside PCI device PMDs
> > > > >
> > > > > - Removes cryptodev driver structure from cryptodev library and
> > drivers
> > > > > that were using it (QAT and dpaa2)
> > > > >
> > > >
> > > > While most of the work seems to be done within this patchset, there
> > are
> > > > still rte_pci.h includes in both:
> > > >
> > > > lib/librte_cryptodev/rte_cryptodev.c:50:#include <rte_pci.h>
> > > > lib/librte_cryptodev/rte_cryptodev_pmd.h:50:#include <rte_pci.h>
> > > >
> > > > This breaks the compilation when the PCI bus is compiled outside the
> > EAL.
> > > > Would you be able to remove those last dependencies?
> > >
> > > These includes have been removed already in the patchset.
> > > Have you applied all 12 patches?
> > >
> >
> > Ah yes, sorry, I must have missed a few.
> > I have some trouble applying the patch however, I will test the
> > integration with the PCI bus move after I resolve this.
>
> It might not apply cleanly after the latest patches that got merged.
> I will send a rebased v2.
I am not sure which problem you are having. The patchset applies cleanly
on dpdk-next-crypto and dpdk.
>
> Pablo
>
> >
> > > Thanks,
> > > Pablo
> > >
> > >
> >
> > --
> > Gaëtan Rivet
> > 6WIND
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (12 preceding siblings ...)
2017-06-07 22:54 ` [dpdk-dev] [PATCH 00/12] Remove " Gaëtan Rivet
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 01/12] cryptodev: store device pointer in virtual devices Pablo de Lara
` (9 more replies)
2017-06-21 6:30 ` [dpdk-dev] [PATCH v2 10/12] crypto/dpaa2_sec: do not use cryptodev driver Pablo de Lara
` (2 subsequent siblings)
16 siblings, 10 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Following the same approach taken for ethdev, this patch series
removes the PCI specific structure cryptodev driver from rte_cryptodev.
The patchset makes the following changes:
- Moves the virtual and PCI device specific functions to separate files,
so other cryptodev header files contain only device type agnostic
functions.
- Modifies device info retrieval function to set the driver name for
all devices and set PCI info inside PCI device PMDs
- Removes cryptodev driver structure from cryptodev library and drivers
that were using it (QAT and DPAA2)
There is still a vdev specific function, rte_cryptodev_create_vdev()
in cryptodev.c. That function should be deprecated, as virtual devices
should be created through EAL.
A deprecation notice will be sent separately.
Changes in v2:
- Removed duplicated device setting
- Fixed compilation issue on a patch
- Added "rte_cryptodev_vdev" prefix in some functions
- Helper function (duplicated) has been removed, in
the dependent patchset
This patch set depends on the following patches:
"[PATCH v2 0/4] Socket ID check removal"
(http://dpdk.org/ml/archives/dev/2017-June/068412.html)
Pablo de Lara (12):
cryptodev: store device pointer in virtual devices
cryptodev: set driver name for all devices
cryptodev: rename device retrieval argument
cryptodev: simplify device list retrieval logic
cryptodev: only set PCI info when device is PCI
cryptodev: move vdev functions to a separate file
cryptodev: release device if PCI device probing fails
cryptodev: add PCI driver helpers
crypto/qat: do not use cryptodev driver
crypto/dpaa2_sec: do not use cryptodev driver
cryptodev: remove unused PCI probe/remove
cryptodev: remove unused cryptodev driver
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 4 +-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 +-
drivers/crypto/armv8/rte_armv8_pmd.c | 4 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 9 +-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 4 +-
drivers/crypto/null/null_crypto_pmd.c | 7 +-
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +-
drivers/crypto/qat/qat_crypto.c | 6 +-
drivers/crypto/qat/qat_qp.c | 8 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 32 ++--
drivers/crypto/scheduler/scheduler_pmd.c | 51 +----
drivers/crypto/scheduler/scheduler_pmd_ops.c | 1 +
drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 +-
drivers/crypto/zuc/rte_zuc_pmd.c | 4 +-
lib/librte_cryptodev/Makefile | 2 +
lib/librte_cryptodev/rte_cryptodev.c | 251 +------------------------
lib/librte_cryptodev/rte_cryptodev.h | 39 +---
lib/librte_cryptodev/rte_cryptodev_pci.h | 177 +++++++++++++++++
lib/librte_cryptodev/rte_cryptodev_pmd.h | 94 ---------
lib/librte_cryptodev/rte_cryptodev_vdev.h | 210 +++++++++++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 18 +-
21 files changed, 474 insertions(+), 459 deletions(-)
create mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
create mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 01/12] cryptodev: store device pointer in virtual devices
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 02/12] cryptodev: set driver name for all devices Pablo de Lara
` (8 subsequent siblings)
9 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Only non virtual devices were storing the pointer to
rte_device structure in rte_cryptodev, which will be needed
to retrieve the driver name for any device.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ++-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 ++-
drivers/crypto/armv8/rte_armv8_pmd.c | 3 ++-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ++-
drivers/crypto/null/null_crypto_pmd.c | 6 ++++--
drivers/crypto/openssl/rte_openssl_pmd.c | 3 ++-
drivers/crypto/scheduler/scheduler_pmd.c | 7 +++++--
drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ++-
drivers/crypto/zuc/rte_zuc_pmd.c | 3 ++-
lib/librte_cryptodev/rte_cryptodev.c | 4 +++-
lib/librte_cryptodev/rte_cryptodev.h | 1 +
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 ++-
12 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 101ef98..246f71e 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -450,7 +450,8 @@ aesni_gcm_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct aesni_gcm_private), init_params->socket_id);
+ sizeof(struct aesni_gcm_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
GCM_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 45b25c9..be38c31 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -699,7 +699,8 @@ cryptodev_aesni_mb_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct aesni_mb_private), init_params->socket_id);
+ sizeof(struct aesni_mb_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
MB_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 3d603a5..29905d6 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -808,7 +808,8 @@ cryptodev_armv8_crypto_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct armv8_crypto_private),
- init_params->socket_id);
+ init_params->socket_id,
+ vdev);
if (dev == NULL) {
ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 9da9e89..a95f503 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -574,7 +574,8 @@ cryptodev_kasumi_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct kasumi_private), init_params->socket_id);
+ sizeof(struct kasumi_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
KASUMI_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 023450a..49da8d4 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -166,6 +166,7 @@ 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 *dev;
@@ -177,7 +178,8 @@ cryptodev_null_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct null_crypto_private),
- init_params->socket_id);
+ init_params->socket_id,
+ vdev);
if (dev == NULL) {
NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
@@ -235,7 +237,7 @@ cryptodev_null_probe(struct rte_vdev_device *dev)
RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
init_params.max_nb_sessions);
- return cryptodev_null_create(name, &init_params);
+ return cryptodev_null_create(name, dev, &init_params);
}
/** Uninitialise null crypto device */
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index f0c5ca3..13a5129 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -1277,7 +1277,8 @@ cryptodev_openssl_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
sizeof(struct openssl_private),
- init_params->socket_id);
+ init_params->socket_id,
+ vdev);
if (dev == NULL) {
OPENSSL_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 29b16c9..50a196c 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -89,7 +89,8 @@ const struct scheduler_parse_map scheduler_ordering_map[] = {
static int
cryptodev_scheduler_create(const char *name,
- struct scheduler_init_params *init_params)
+ struct rte_vdev_device *vdev,
+ struct scheduler_init_params *init_params)
{
struct rte_cryptodev *dev;
struct scheduler_ctx *sched_ctx;
@@ -103,7 +104,8 @@ cryptodev_scheduler_create(const char *name,
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->def_p.name,
sizeof(struct scheduler_ctx),
- init_params->def_p.socket_id);
+ init_params->def_p.socket_id,
+ vdev);
if (dev == NULL) {
CS_LOG_ERR("driver %s: failed to create cryptodev vdev",
name);
@@ -417,6 +419,7 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
init_params.def_p.name);
return cryptodev_scheduler_create(name,
+ vdev,
&init_params);
}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 960956c..f17c541 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -563,7 +563,8 @@ cryptodev_snow3g_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct snow3g_private), init_params->socket_id);
+ sizeof(struct snow3g_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
SNOW3G_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 1020544..ab42d06 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -463,7 +463,8 @@ cryptodev_zuc_create(const char *name,
}
dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
- sizeof(struct zuc_private), init_params->socket_id);
+ sizeof(struct zuc_private), init_params->socket_id,
+ vdev);
if (dev == NULL) {
ZUC_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 81fd2bf..2b2f0fe 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -651,7 +651,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
struct rte_cryptodev *
rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
- int socket_id)
+ int socket_id, struct rte_vdev_device *vdev)
{
struct rte_cryptodev *cryptodev;
@@ -673,6 +673,8 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
" data");
}
+ cryptodev->device = &vdev->device;
+
/* initialise user call-back tail queue */
TAILQ_INIT(&(cryptodev->link_intr_cbs));
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 88aeb87..f307b3b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -49,6 +49,7 @@ extern "C" {
#include "rte_crypto.h"
#include "rte_dev.h"
#include <rte_common.h>
+#include <rte_vdev.h>
#define CRYPTODEV_NAME_NULL_PMD crypto_null
/**< Null crypto PMD device name */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 17ef37c..ec4ca97 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -462,6 +462,7 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
* @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.
@@ -469,7 +470,7 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
*/
struct rte_cryptodev *
rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
- int socket_id);
+ int socket_id, struct rte_vdev_device *vdev);
/**
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 02/12] cryptodev: set driver name for all devices
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 01/12] cryptodev: store device pointer in virtual devices Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 03/12] cryptodev: rename device retrieval argument Pablo de Lara
` (7 subsequent siblings)
9 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
When retrieving device information for a crypto driver,
driver name was only set when it was a PCI driver.
Getting the driver name from rte_device structure
allows rte_cryptodev_get_info() function to return it
regardless they are virtual or physical devices.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 2b2f0fe..cb3e236 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1144,8 +1144,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
- if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.driver.name;
+ dev_info->driver_name = dev->device->driver->name;
}
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 03/12] cryptodev: rename device retrieval argument
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 01/12] cryptodev: store device pointer in virtual devices Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 02/12] cryptodev: set driver name for all devices Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-23 12:54 ` Declan Doherty
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 04/12] cryptodev: simplify device list retrieval logic Pablo de Lara
` (6 subsequent siblings)
9 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara, stable
rte_cryptodev_devices_get() function was parsing a crypto
device name as an argument, but the function actually
returns device identifiers of devices that share the
same crypto driver, so the argument should be driver name, instead.
Fixes: 38227c0e3ad2 ("cryptodev: retrieve device info")
CC: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 6 +++---
lib/librte_cryptodev/rte_cryptodev.h | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index cb3e236..8875304 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -501,7 +501,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type)
}
uint8_t
-rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
+rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
uint8_t nb_devices)
{
uint8_t i, count = 0;
@@ -516,10 +516,10 @@ rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
if (drv)
cmp = strncmp(drv->pci_drv.driver.name,
- dev_name, strlen(dev_name));
+ driver_name, strlen(driver_name));
else
cmp = strncmp(devs[i].data->name,
- dev_name, strlen(dev_name));
+ driver_name, strlen(driver_name));
if (cmp == 0)
devices[count++] = devs[i].data->dev_id;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index f307b3b..89093f6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -464,9 +464,10 @@ extern uint8_t
rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
/**
- * Get number and identifiers of attached crypto device.
+ * Get number and identifiers of attached crypto devices that
+ * use the same crypto driver.
*
- * @param dev_name device name.
+ * @param driver_name driver name.
* @param devices output devices identifiers.
* @param nb_devices maximal number of devices.
*
@@ -474,7 +475,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
* Returns number of attached crypto device.
*/
uint8_t
-rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
+rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
uint8_t nb_devices);
/*
* Return the NUMA socket to which a device is connected
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 03/12] cryptodev: rename device retrieval argument
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 03/12] cryptodev: rename device retrieval argument Pablo de Lara
@ 2017-06-23 12:54 ` Declan Doherty
0 siblings, 0 replies; 57+ messages in thread
From: Declan Doherty @ 2017-06-23 12:54 UTC (permalink / raw)
To: Pablo de Lara, thomas; +Cc: dev, stable
On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> rte_cryptodev_devices_get() function was parsing a crypto
> device name as an argument, but the function actually
> returns device identifiers of devices that share the
> same crypto driver, so the argument should be driver name, instead.
>
> Fixes: 38227c0e3ad2 ("cryptodev: retrieve device info")
> CC: stable@dpdk.org
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
>
Acked-by: Declan Doherty <declan.doherty@intel.com>
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 04/12] cryptodev: simplify device list retrieval logic
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (2 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 03/12] cryptodev: rename device retrieval argument Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 05/12] cryptodev: only set PCI info when device is PCI Pablo de Lara
` (5 subsequent siblings)
9 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
rte_cryptodev_devices_get() function returns an array of devices
sharing the same driver.
Instead of having two different paths depending on the device being
virtual or physical, retrieve the driver name from rte_device structure.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 8875304..46b9adc 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -511,15 +511,11 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
for (i = 0; i < max_devs && count < nb_devices; i++) {
if (devs[i].attached == RTE_CRYPTODEV_ATTACHED) {
- const struct rte_cryptodev_driver *drv = devs[i].driver;
int cmp;
- if (drv)
- cmp = strncmp(drv->pci_drv.driver.name,
- driver_name, strlen(driver_name));
- else
- cmp = strncmp(devs[i].data->name,
- driver_name, strlen(driver_name));
+ cmp = strncmp(devs[i].device->driver->name,
+ driver_name,
+ strlen(driver_name));
if (cmp == 0)
devices[count++] = devs[i].data->dev_id;
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 05/12] cryptodev: only set PCI info when device is PCI
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (3 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 04/12] cryptodev: simplify device list retrieval logic Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file Pablo de Lara
` (4 subsequent siblings)
9 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Do not set PCI information in the device information structure
for any crypto device, just for the ones that are PCI, so
this is set internally in the PCI crypto PMDs (only QAT now).
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/crypto/qat/qat_crypto.c | 5 +++--
lib/librte_cryptodev/rte_cryptodev.c | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 37d8a58..0a14c2d 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -1240,8 +1240,8 @@ int qat_dev_close(struct rte_cryptodev *dev)
return 0;
}
-void qat_dev_info_get(__rte_unused struct rte_cryptodev *dev,
- struct rte_cryptodev_info *info)
+void qat_dev_info_get(struct rte_cryptodev *dev,
+ struct rte_cryptodev_info *info)
{
struct qat_pmd_private *internals = dev->data->dev_private;
@@ -1254,6 +1254,7 @@ void qat_dev_info_get(__rte_unused struct rte_cryptodev *dev,
info->capabilities = internals->qat_dev_capabilities;
info->sym.max_nb_sessions = internals->max_nb_sessions;
info->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD;
+ info->pci_dev = RTE_DEV_TO_PCI(dev->device);
}
}
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 46b9adc..8e5382d 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1139,7 +1139,6 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
- dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
dev_info->driver_name = dev->device->driver->name;
}
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (4 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 05/12] cryptodev: only set PCI info when device is PCI Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-23 12:52 ` Declan Doherty
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 07/12] cryptodev: release device if PCI device probing fails Pablo de Lara
` (3 subsequent siblings)
9 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Move all functions handling virtual devices to a separate
header file "rte_cryptodev_vdev.h", in order to leave only
generic functions for any device in the rest of the files.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 1 +
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 1 +
drivers/crypto/armv8/rte_armv8_pmd.c | 1 +
drivers/crypto/kasumi/rte_kasumi_pmd.c | 1 +
drivers/crypto/null/null_crypto_pmd.c | 1 +
drivers/crypto/openssl/rte_openssl_pmd.c | 1 +
drivers/crypto/scheduler/scheduler_pmd.c | 44 +-----
drivers/crypto/scheduler/scheduler_pmd_ops.c | 1 +
drivers/crypto/snow3g/rte_snow3g_pmd.c | 1 +
drivers/crypto/zuc/rte_zuc_pmd.c | 1 +
lib/librte_cryptodev/Makefile | 1 +
lib/librte_cryptodev/rte_cryptodev.c | 127 ---------------
lib/librte_cryptodev/rte_cryptodev.h | 29 ----
lib/librte_cryptodev/rte_cryptodev_pmd.h | 18 ---
lib/librte_cryptodev/rte_cryptodev_vdev.h | 210 +++++++++++++++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 10 +-
16 files changed, 226 insertions(+), 222 deletions(-)
create 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 246f71e..4d7aa4f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index be38c31..3e1e2ab 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -34,6 +34,7 @@
#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>
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 29905d6..8ed26db 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -36,6 +36,7 @@
#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>
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index a95f503..ac80473 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 49da8d4..47b8dad 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,6 +33,7 @@
#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>
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 13a5129..a6438a8 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -34,6 +34,7 @@
#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>
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 50a196c..ae8c974 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -33,6 +33,7 @@
#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>
@@ -221,41 +222,6 @@ cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
return 0;
}
-/** Parse integer from integer argument */
-static int
-parse_integer_arg(const char *key __rte_unused,
- const char *value, void *extra_args)
-{
- int *i = (int *) extra_args;
-
- *i = atoi(value);
- if (*i < 0) {
- CS_LOG_ERR("Argument has to be positive.\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
-/** Parse name */
-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;
-
- if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
- CS_LOG_ERR("Invalid name %s, should be less than "
- "%u bytes.\n", value,
- RTE_CRYPTODEV_NAME_MAX_LEN - 1);
- return -EINVAL;
- }
-
- strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
-
- return 0;
-}
-
/** Parse slave */
static int
parse_slave_arg(const char *key __rte_unused,
@@ -338,26 +304,26 @@ scheduler_parse_init_params(struct scheduler_init_params *params,
ret = rte_kvargs_process(kvlist,
RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
- &parse_integer_arg,
+ &rte_cryptodev_vdev_parse_integer_arg,
¶ms->def_p.max_nb_queue_pairs);
if (ret < 0)
goto free_kvlist;
ret = rte_kvargs_process(kvlist,
RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
- &parse_integer_arg,
+ &rte_cryptodev_vdev_parse_integer_arg,
¶ms->def_p.max_nb_sessions);
if (ret < 0)
goto free_kvlist;
ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
- &parse_integer_arg,
+ &rte_cryptodev_vdev_parse_integer_arg,
¶ms->def_p.socket_id);
if (ret < 0)
goto free_kvlist;
ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
- &parse_name_arg,
+ &rte_cryptodev_vdev_parse_name_arg,
¶ms->def_p);
if (ret < 0)
goto free_kvlist;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 2b5858d..4fc8b91 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -37,6 +37,7 @@
#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"
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index f17c541..855be72 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index ab42d06..7681587 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -35,6 +35,7 @@
#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>
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 18f5e8c..4d37acf 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -48,6 +48,7 @@ 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
# versioning export map
EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 8e5382d..c0cfe94 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -101,18 +101,6 @@ struct rte_cryptodev_callback {
uint32_t active; /**< Callback is executing */
};
-#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 *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
-};
-
/**
* The crypto cipher algorithm strings identifiers.
* It could be used in application command line.
@@ -233,89 +221,6 @@ rte_crypto_auth_operation_strings[] = {
[RTE_CRYPTO_AUTH_OP_GENERATE] = "generate"
};
-/** Parse integer from integer argument */
-static int
-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;
-}
-
-/** Parse name */
-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;
-
- 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;
-}
-
-int
-rte_cryptodev_parse_vdev_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,
- &parse_integer_arg,
- ¶ms->max_nb_queue_pairs);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist,
- RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
- &parse_integer_arg,
- ¶ms->max_nb_sessions);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
- &parse_integer_arg,
- ¶ms->socket_id);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
- &parse_name_arg,
- params);
- if (ret < 0)
- goto free_kvlist;
- }
-
-free_kvlist:
- rte_kvargs_free(kvlist);
- return ret;
-}
-
const struct rte_cryptodev_symmetric_capability *
rte_cryptodev_sym_capability_get(uint8_t dev_id,
const struct rte_cryptodev_sym_capability_idx *idx)
@@ -645,38 +550,6 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
return 0;
}
-struct rte_cryptodev *
-rte_cryptodev_pmd_virtual_dev_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_pci_probe(struct rte_pci_driver *pci_drv,
struct rte_pci_device *pci_dev)
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 89093f6..7f6fbf0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -386,35 +386,6 @@ struct rte_cryptodev_stats {
#define RTE_CRYPTODEV_NAME_MAX_LEN (64)
/**< Max length of name of crypto PMD */
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048
-
-/**
- * @internal
- * Initialisation parameters for virtual crypto devices
- */
-struct rte_crypto_vdev_init_params {
- unsigned max_nb_queue_pairs;
- unsigned max_nb_sessions;
- uint8_t socket_id;
- char name[RTE_CRYPTODEV_NAME_MAX_LEN];
-};
-
-/**
- * Parse virtual device initialisation parameters input arguments
- * @internal
- *
- * @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_parse_vdev_init_params(
- struct rte_crypto_vdev_init_params *params,
- const char *input_args);
/**
* Create a virtual crypto device
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index ec4ca97..0efe282 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -456,24 +456,6 @@ struct rte_cryptodev *
rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
- * 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_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
- int socket_id, struct rte_vdev_device *vdev);
-
-
-/**
* Function for internal use by dummy drivers primarily, e.g. ring-based
* driver.
* Release the specified cryptodev device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
new file mode 100644
index 0000000..82a57e5
--- /dev/null
+++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h
@@ -0,0 +1,210 @@
+/*-
+ * 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>
+
+#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
+ * 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;
+}
+
+/**
+ * @internal
+ * 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;
+}
+
+/**
+ * @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.
+ */
+static inline struct rte_cryptodev *
+rte_cryptodev_pmd_virtual_dev_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;
+}
+
+/**
+ * @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
+ */
+static inline int
+rte_cryptodev_parse_vdev_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,
+ ¶ms->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,
+ ¶ms->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,
+ ¶ms->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;
+}
+
+#endif /* _RTE_CRYPTODEV_VDEV_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 9ac510e..d519234 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -15,7 +15,6 @@ DPDK_16.04 {
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
rte_cryptodev_pmd_release_device;
- rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
rte_cryptodev_socket_id;
@@ -32,20 +31,13 @@ DPDK_16.04 {
local: *;
};
-DPDK_16.07 {
- global:
-
- rte_cryptodev_parse_vdev_init_params;
-
-} DPDK_16.04;
-
DPDK_16.11 {
global:
rte_cryptodev_pci_probe;
rte_cryptodev_pci_remove;
-} DPDK_16.07;
+} DPDK_16.04;
DPDK_17.02 {
global:
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file Pablo de Lara
@ 2017-06-23 12:52 ` Declan Doherty
2017-06-26 23:30 ` Thomas Monjalon
0 siblings, 1 reply; 57+ messages in thread
From: Declan Doherty @ 2017-06-23 12:52 UTC (permalink / raw)
To: Pablo de Lara, thomas; +Cc: dev
On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> Move all functions handling virtual devices to a separate
> header file "rte_cryptodev_vdev.h", in order to leave only
> generic functions for any device in the rest of the files.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
>
Acked-by: Declan Doherty <declan.doherty@intel.com>
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-23 12:52 ` Declan Doherty
@ 2017-06-26 23:30 ` Thomas Monjalon
2017-06-27 9:51 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: Thomas Monjalon @ 2017-06-26 23:30 UTC (permalink / raw)
To: Declan Doherty, Pablo de Lara; +Cc: dev
23/06/2017 14:52, Declan Doherty:
> On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> > Move all functions handling virtual devices to a separate
> > header file "rte_cryptodev_vdev.h", in order to leave only
> > generic functions for any device in the rest of the files.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> Acked-by: Declan Doherty <declan.doherty@intel.com>
This patch is moving some code from a .c to a .h.
The consequence is that driver are now compiling new functions
from the .h and require librte_kvargs to link with.
It is a build error in shared lib mode.
Please keep the code in a .c file if possible.
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-26 23:30 ` Thomas Monjalon
@ 2017-06-27 9:51 ` De Lara Guarch, Pablo
2017-06-27 14:28 ` Thomas Monjalon
0 siblings, 1 reply; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-27 9:51 UTC (permalink / raw)
To: Thomas Monjalon, Doherty, Declan; +Cc: dev
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Tuesday, June 27, 2017 12:31 AM
> To: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions
> to a separate file
>
> 23/06/2017 14:52, Declan Doherty:
> > On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> > > Move all functions handling virtual devices to a separate header
> > > file "rte_cryptodev_vdev.h", in order to leave only generic
> > > functions for any device in the rest of the files.
> > >
> > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> >
> > Acked-by: Declan Doherty <declan.doherty@intel.com>
>
> This patch is moving some code from a .c to a .h.
> The consequence is that driver are now compiling new functions from the .h
> and require librte_kvargs to link with.
> It is a build error in shared lib mode.
>
> Please keep the code in a .c file if possible.
Sorry about this. I just fixed it in the subtree, so pull it whenever you are ready.
Also, since ethdev have separated pci and vdev functions in separate .h files,
I preferred to be consistent and do the same.
Thanks,
Pablo
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-27 9:51 ` De Lara Guarch, Pablo
@ 2017-06-27 14:28 ` Thomas Monjalon
2017-06-27 15:11 ` Ferruh Yigit
0 siblings, 1 reply; 57+ messages in thread
From: Thomas Monjalon @ 2017-06-27 14:28 UTC (permalink / raw)
To: De Lara Guarch, Pablo; +Cc: dev, Doherty, Declan
27/06/2017 11:51, De Lara Guarch, Pablo:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 23/06/2017 14:52, Declan Doherty:
> > > On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> > > > Move all functions handling virtual devices to a separate header
> > > > file "rte_cryptodev_vdev.h", in order to leave only generic
> > > > functions for any device in the rest of the files.
> > > >
> > > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > >
> > > Acked-by: Declan Doherty <declan.doherty@intel.com>
> >
> > This patch is moving some code from a .c to a .h.
> > The consequence is that driver are now compiling new functions from the .h
> > and require librte_kvargs to link with.
> > It is a build error in shared lib mode.
> >
> > Please keep the code in a .c file if possible.
>
> Sorry about this. I just fixed it in the subtree, so pull it whenever you are ready.
> Also, since ethdev have separated pci and vdev functions in separate .h files,
> I preferred to be consistent and do the same.
There is no reason to implement these functions in .h files.
I prefer to keep them in a .c file and just export the proto in .h.
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-27 14:28 ` Thomas Monjalon
@ 2017-06-27 15:11 ` Ferruh Yigit
2017-06-27 16:09 ` Thomas Monjalon
0 siblings, 1 reply; 57+ messages in thread
From: Ferruh Yigit @ 2017-06-27 15:11 UTC (permalink / raw)
To: Thomas Monjalon, De Lara Guarch, Pablo; +Cc: dev, Doherty, Declan
On 6/27/2017 3:28 PM, Thomas Monjalon wrote:
> 27/06/2017 11:51, De Lara Guarch, Pablo:
>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
>>> 23/06/2017 14:52, Declan Doherty:
>>>> On 21/06/2017 7:28 AM, Pablo de Lara wrote:
>>>>> Move all functions handling virtual devices to a separate header
>>>>> file "rte_cryptodev_vdev.h", in order to leave only generic
>>>>> functions for any device in the rest of the files.
>>>>>
>>>>> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>>>>
>>>> Acked-by: Declan Doherty <declan.doherty@intel.com>
>>>
>>> This patch is moving some code from a .c to a .h.
>>> The consequence is that driver are now compiling new functions from the .h
>>> and require librte_kvargs to link with.
>>> It is a build error in shared lib mode.
>>>
>>> Please keep the code in a .c file if possible.
>>
>> Sorry about this. I just fixed it in the subtree, so pull it whenever you are ready.
>> Also, since ethdev have separated pci and vdev functions in separate .h files,
>> I preferred to be consistent and do the same.
>
> There is no reason to implement these functions in .h files.
> I prefer to keep them in a .c file and just export the proto in .h.
This is same in the eth_dev too.
These are helper functions, and implementing them in .h file has the
benefit of function goes into PMD library, and there is no dependency
from PMDs to librte_ether for these functions (there are dependencies
for other functions ..).
It looks acceptable for me for helper functions to be implemented in
header file. But if we decide to move them into .c file, .map file
should be updated to export them, and I suppose ethdev also should be
updated to be compatible.
Thanks,
ferruh
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-27 15:11 ` Ferruh Yigit
@ 2017-06-27 16:09 ` Thomas Monjalon
2017-06-27 17:11 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: Thomas Monjalon @ 2017-06-27 16:09 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev, De Lara Guarch, Pablo, Doherty, Declan
27/06/2017 17:11, Ferruh Yigit:
> On 6/27/2017 3:28 PM, Thomas Monjalon wrote:
> > 27/06/2017 11:51, De Lara Guarch, Pablo:
> >> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> >>> 23/06/2017 14:52, Declan Doherty:
> >>>> On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> >>>>> Move all functions handling virtual devices to a separate header
> >>>>> file "rte_cryptodev_vdev.h", in order to leave only generic
> >>>>> functions for any device in the rest of the files.
> >>>>>
> >>>>> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> >>>>
> >>>> Acked-by: Declan Doherty <declan.doherty@intel.com>
> >>>
> >>> This patch is moving some code from a .c to a .h.
> >>> The consequence is that driver are now compiling new functions from the .h
> >>> and require librte_kvargs to link with.
> >>> It is a build error in shared lib mode.
> >>>
> >>> Please keep the code in a .c file if possible.
> >>
> >> Sorry about this. I just fixed it in the subtree, so pull it whenever you are ready.
> >> Also, since ethdev have separated pci and vdev functions in separate .h files,
> >> I preferred to be consistent and do the same.
> >
> > There is no reason to implement these functions in .h files.
> > I prefer to keep them in a .c file and just export the proto in .h.
>
> This is same in the eth_dev too.
>
> These are helper functions, and implementing them in .h file has the
> benefit of function goes into PMD library, and there is no dependency
> from PMDs to librte_ether for these functions (there are dependencies
> for other functions ..).
>
> It looks acceptable for me for helper functions to be implemented in
> header file. But if we decide to move them into .c file, .map file
> should be updated to export them, and I suppose ethdev also should be
> updated to be compatible.
Yes we should avoid adding code in .h.
It is accepted only for performance reasons.
ethdev can be reworked later.
cryptodev can be improved now and avoid adding rte_devargs deps on PMDs.
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-27 16:09 ` Thomas Monjalon
@ 2017-06-27 17:11 ` De Lara Guarch, Pablo
2017-06-27 22:22 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-27 17:11 UTC (permalink / raw)
To: Thomas Monjalon, Yigit, Ferruh; +Cc: dev, Doherty, Declan
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Tuesday, June 27, 2017 5:09 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions
> to a separate file
>
> 27/06/2017 17:11, Ferruh Yigit:
> > On 6/27/2017 3:28 PM, Thomas Monjalon wrote:
> > > 27/06/2017 11:51, De Lara Guarch, Pablo:
> > >> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > >>> 23/06/2017 14:52, Declan Doherty:
> > >>>> On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> > >>>>> Move all functions handling virtual devices to a separate header
> > >>>>> file "rte_cryptodev_vdev.h", in order to leave only generic
> > >>>>> functions for any device in the rest of the files.
> > >>>>>
> > >>>>> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > >>>>
> > >>>> Acked-by: Declan Doherty <declan.doherty@intel.com>
> > >>>
> > >>> This patch is moving some code from a .c to a .h.
> > >>> The consequence is that driver are now compiling new functions
> > >>> from the .h and require librte_kvargs to link with.
> > >>> It is a build error in shared lib mode.
> > >>>
> > >>> Please keep the code in a .c file if possible.
> > >>
> > >> Sorry about this. I just fixed it in the subtree, so pull it whenever you
> are ready.
> > >> Also, since ethdev have separated pci and vdev functions in
> > >> separate .h files, I preferred to be consistent and do the same.
> > >
> > > There is no reason to implement these functions in .h files.
> > > I prefer to keep them in a .c file and just export the proto in .h.
> >
> > This is same in the eth_dev too.
> >
> > These are helper functions, and implementing them in .h file has the
> > benefit of function goes into PMD library, and there is no dependency
> > from PMDs to librte_ether for these functions (there are dependencies
> > for other functions ..).
> >
> > It looks acceptable for me for helper functions to be implemented in
> > header file. But if we decide to move them into .c file, .map file
> > should be updated to export them, and I suppose ethdev also should be
> > updated to be compatible.
>
> Yes we should avoid adding code in .h.
> It is accepted only for performance reasons.
> ethdev can be reworked later.
> cryptodev can be improved now and avoid adding rte_devargs deps on
> PMDs.
Ok, will make those changes shortly.
Pablo
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file
2017-06-27 17:11 ` De Lara Guarch, Pablo
@ 2017-06-27 22:22 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-27 22:22 UTC (permalink / raw)
To: De Lara Guarch, Pablo, Thomas Monjalon, Yigit, Ferruh
Cc: dev, Doherty, Declan
Hi,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Tuesday, June 27, 2017 6:12 PM
> To: Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions
> to a separate file
>
>
>
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Tuesday, June 27, 2017 5:09 PM
> > To: Yigit, Ferruh <ferruh.yigit@intel.com>
> > Cc: dev@dpdk.org; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>; Doherty, Declan
> > <declan.doherty@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev
> > functions to a separate file
> >
> > 27/06/2017 17:11, Ferruh Yigit:
> > > On 6/27/2017 3:28 PM, Thomas Monjalon wrote:
> > > > 27/06/2017 11:51, De Lara Guarch, Pablo:
> > > >> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > >>> 23/06/2017 14:52, Declan Doherty:
> > > >>>> On 21/06/2017 7:28 AM, Pablo de Lara wrote:
> > > >>>>> Move all functions handling virtual devices to a separate
> > > >>>>> header file "rte_cryptodev_vdev.h", in order to leave only
> > > >>>>> generic functions for any device in the rest of the files.
> > > >>>>>
> > > >>>>> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > > >>>>
> > > >>>> Acked-by: Declan Doherty <declan.doherty@intel.com>
> > > >>>
> > > >>> This patch is moving some code from a .c to a .h.
> > > >>> The consequence is that driver are now compiling new functions
> > > >>> from the .h and require librte_kvargs to link with.
> > > >>> It is a build error in shared lib mode.
> > > >>>
> > > >>> Please keep the code in a .c file if possible.
> > > >>
> > > >> Sorry about this. I just fixed it in the subtree, so pull it
> > > >> whenever you
> > are ready.
> > > >> Also, since ethdev have separated pci and vdev functions in
> > > >> separate .h files, I preferred to be consistent and do the same.
> > > >
> > > > There is no reason to implement these functions in .h files.
> > > > I prefer to keep them in a .c file and just export the proto in .h.
> > >
> > > This is same in the eth_dev too.
> > >
> > > These are helper functions, and implementing them in .h file has the
> > > benefit of function goes into PMD library, and there is no
> > > dependency from PMDs to librte_ether for these functions (there are
> > > dependencies for other functions ..).
> > >
> > > It looks acceptable for me for helper functions to be implemented in
> > > header file. But if we decide to move them into .c file, .map file
> > > should be updated to export them, and I suppose ethdev also should
> > > be updated to be compatible.
> >
> > Yes we should avoid adding code in .h.
> > It is accepted only for performance reasons.
> > ethdev can be reworked later.
> > cryptodev can be improved now and avoid adding rte_devargs deps on
> > PMDs.
>
> Ok, will make those changes shortly.
I have implemented these functions in a separated .c file and pushed it to dpdk-next-crypto.
Pablo
>
> Pablo
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 07/12] cryptodev: release device if PCI device probing fails
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (5 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 06/12] cryptodev: move vdev functions to a separate file Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 08/12] cryptodev: add PCI driver helpers Pablo de Lara
` (2 subsequent siblings)
9 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Call rte_cryptodev_pmd_release_device() if probing a
PCI crypto device, instead of accessing the variables
directly. This will be useful when rte_cryptodev_pci_probe()
gets moved to a separate file.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index c0cfe94..d02a4d0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -541,9 +541,12 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
if (cryptodev == NULL)
return -EINVAL;
- ret = rte_cryptodev_close(cryptodev->data->dev_id);
- if (ret < 0)
- return ret;
+ /* Close device only if device operations have been set */
+ if (cryptodev->dev_ops) {
+ ret = rte_cryptodev_close(cryptodev->data->dev_id);
+ if (ret < 0)
+ return ret;
+ }
cryptodev->attached = RTE_CRYPTODEV_DETACHED;
cryptodev_globals.nb_devs--;
@@ -604,8 +607,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
rte_free(cryptodev->data->dev_private);
- cryptodev->attached = RTE_CRYPTODEV_DETACHED;
- cryptodev_globals.nb_devs--;
+ /* free crypto device */
+ rte_cryptodev_pmd_release_device(cryptodev);
return -ENXIO;
}
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 08/12] cryptodev: add PCI driver helpers
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (6 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 07/12] cryptodev: release device if PCI device probing fails Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-29 21:21 ` Thomas Monjalon
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 09/12] crypto/qat: do not use cryptodev driver Pablo de Lara
2017-06-23 15:18 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure De Lara Guarch, Pablo
9 siblings, 1 reply; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Add PCI probe/remove/init/uninit functions in a separate
file rte_cryptodev_pci.h, which do not use cryptodev driver,
in order to be removed in next commits.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
lib/librte_cryptodev/Makefile | 1 +
lib/librte_cryptodev/rte_cryptodev_pci.h | 177 +++++++++++++++++++++++++++++++
2 files changed, 178 insertions(+)
create mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 4d37acf..2a31be3 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -49,6 +49,7 @@ 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
EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pci.h b/lib/librte_cryptodev/rte_cryptodev_pci.h
new file mode 100644
index 0000000..ea9a750
--- /dev/null
+++ b/lib/librte_cryptodev/rte_cryptodev_pci.h
@@ -0,0 +1,177 @@
+/*-
+ * 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>
+#include <rte_cryptodev_pmd.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.
+ */
+static inline 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;
+}
+
+/**
+ * @internal
+ * Wrapper for use by pci drivers as a .remove function to detach a crypto
+ * interface.
+ */
+static inline 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;
+}
+
+#endif /* _RTE_CRYPTODEV_PCI_H_ */
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 09/12] crypto/qat: do not use cryptodev driver
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (7 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 08/12] cryptodev: add PCI driver helpers Pablo de Lara
@ 2017-06-21 6:28 ` Pablo de Lara
2017-06-23 15:18 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure De Lara Guarch, Pablo
9 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:28 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/crypto/qat/qat_crypto.c | 1 +
drivers/crypto/qat/qat_qp.c | 8 +++++---
drivers/crypto/qat/rte_qat_cryptodev.c | 32 ++++++++++++++++++++------------
3 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 0a14c2d..8b7b2fa 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -60,6 +60,7 @@
#include <rte_spinlock.h>
#include <rte_hexdump.h>
#include <rte_crypto_sym.h>
+#include <rte_cryptodev_pci.h>
#include <openssl/evp.h>
#include "qat_logs.h"
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index a358ccd..3921c2e 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -36,6 +36,7 @@
#include <rte_malloc.h>
#include <rte_memzone.h>
#include <rte_cryptodev_pmd.h>
+#include <rte_pci.h>
#include <rte_atomic.h>
#include <rte_prefetch.h>
@@ -205,7 +206,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
adf_configure_queues(qp);
adf_queue_arb_enable(&qp->tx_q, qp->mmap_bar_addr);
snprintf(op_cookie_pool_name, RTE_RING_NAMESIZE, "%s_qp_op_%d_%hu",
- dev->driver->pci_drv.driver.name, dev->data->dev_id,
+ pci_dev->driver->driver.name, dev->data->dev_id,
queue_pair_id);
qp->op_cookie_pool = rte_mempool_lookup(op_cookie_pool_name);
@@ -355,11 +356,13 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
return -EINVAL;
}
+ pci_dev = RTE_DEV_TO_PCI(dev->device);
+
/*
* Allocate a memzone for the queue - create a unique name.
*/
snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d",
- dev->driver->pci_drv.driver.name, "qp_mem", dev->data->dev_id,
+ pci_dev->driver->driver.name, "qp_mem", dev->data->dev_id,
queue->hw_bundle_number, queue->hw_queue_number);
qp_mz = queue_dma_zone_reserve(queue->memz_name, queue_size_bytes,
socket_id);
@@ -408,7 +411,6 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
queue_base = BUILD_RING_BASE_ADDR(queue->base_phys_addr,
queue->queue_size);
- pci_dev = RTE_DEV_TO_PCI(dev->device);
io_addr = pci_dev->mem_resource[0].addr;
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1bdd30d..78d50fb 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -35,6 +35,7 @@
#include <rte_dev.h>
#include <rte_malloc.h>
#include <rte_cryptodev_pmd.h>
+#include <rte_cryptodev_pci.h>
#include "qat_crypto.h"
#include "qat_logs.h"
@@ -95,8 +96,7 @@ static const struct rte_pci_id pci_id_qat_map[] = {
};
static int
-crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_drv,
- struct rte_cryptodev *cryptodev)
+crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
{
struct qat_pmd_private *internals;
@@ -147,17 +147,25 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
return 0;
}
-static struct rte_cryptodev_driver rte_qat_pmd = {
- .pci_drv = {
- .id_table = pci_id_qat_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_cryptodev_pci_probe,
- .remove = rte_cryptodev_pci_remove,
- },
- .cryptodev_init = crypto_qat_dev_init,
- .dev_private_size = sizeof(struct qat_pmd_private),
+static int crypto_qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_cryptodev_pci_generic_probe(pci_dev,
+ sizeof(struct qat_pmd_private), crypto_qat_dev_init);
+}
+
+static int crypto_qat_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_cryptodev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_qat_pmd = {
+ .id_table = pci_id_qat_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = crypto_qat_pci_probe,
+ .remove = crypto_qat_pci_remove
};
-RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd);
RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
` (8 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 09/12] crypto/qat: do not use cryptodev driver Pablo de Lara
@ 2017-06-23 15:18 ` De Lara Guarch, Pablo
9 siblings, 0 replies; 57+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-23 15:18 UTC (permalink / raw)
To: Doherty, Declan, thomas; +Cc: dev
> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Wednesday, June 21, 2017 7:28 AM
> To: Doherty, Declan <declan.doherty@intel.com>; thomas@monjalon.net
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH v2 00/12] Remove cryptodev driver structure
>
> Following the same approach taken for ethdev, this patch series removes the
> PCI specific structure cryptodev driver from rte_cryptodev.
>
> The patchset makes the following changes:
>
> - Moves the virtual and PCI device specific functions to separate files,
> so other cryptodev header files contain only device type agnostic
> functions.
>
> - Modifies device info retrieval function to set the driver name for
> all devices and set PCI info inside PCI device PMDs
>
> - Removes cryptodev driver structure from cryptodev library and drivers
> that were using it (QAT and DPAA2)
>
> There is still a vdev specific function, rte_cryptodev_create_vdev() in
> cryptodev.c. That function should be deprecated, as virtual devices should be
> created through EAL.
> A deprecation notice will be sent separately.
>
> Changes in v2:
>
> - Removed duplicated device setting
>
> - Fixed compilation issue on a patch
>
> - Added "rte_cryptodev_vdev" prefix in some functions
>
> - Helper function (duplicated) has been removed, in
> the dependent patchset
>
> This patch set depends on the following patches:
> "[PATCH v2 0/4] Socket ID check removal"
> (http://dpdk.org/ml/archives/dev/2017-June/068412.html)
>
Applied to dpdk-next-crypto.
Pablo
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 10/12] crypto/dpaa2_sec: do not use cryptodev driver
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (13 preceding siblings ...)
2017-06-21 6:28 ` [dpdk-dev] [PATCH v2 00/12] Remove cryptodev driver structure Pablo de Lara
@ 2017-06-21 6:30 ` Pablo de Lara
2017-06-21 6:30 ` [dpdk-dev] [PATCH v2 11/12] cryptodev: remove unused PCI probe/remove Pablo de Lara
2017-06-21 6:30 ` [dpdk-dev] [PATCH v2 12/12] cryptodev: remove unused cryptodev driver Pablo de Lara
16 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:30 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 4e01fe8..e32b27e 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1481,8 +1481,7 @@ static struct rte_cryptodev_ops crypto_ops = {
};
static int
-dpaa2_sec_uninit(const struct rte_cryptodev_driver *crypto_drv __rte_unused,
- struct rte_cryptodev *dev)
+dpaa2_sec_uninit(const struct rte_cryptodev *dev)
{
PMD_INIT_LOG(INFO, "Closing DPAA2_SEC device %s on numa socket %u\n",
dev->data->name, rte_socket_id());
@@ -1571,7 +1570,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
}
static int
-cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv,
+cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
struct rte_dpaa2_device *dpaa2_dev)
{
struct rte_cryptodev *cryptodev;
@@ -1599,7 +1598,6 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv,
dpaa2_dev->cryptodev = cryptodev;
cryptodev->device = &dpaa2_dev->device;
- cryptodev->driver = (struct rte_cryptodev_driver *)dpaa2_drv;
/* init user callbacks */
TAILQ_INIT(&(cryptodev->link_intr_cbs));
@@ -1627,7 +1625,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
if (cryptodev == NULL)
return -ENODEV;
- ret = dpaa2_sec_uninit(NULL, cryptodev);
+ ret = dpaa2_sec_uninit(cryptodev);
if (ret)
return ret;
@@ -1638,7 +1636,6 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
rte_free(cryptodev->data->dev_private);
cryptodev->device = NULL;
- cryptodev->driver = NULL;
cryptodev->data = NULL;
return 0;
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 11/12] cryptodev: remove unused PCI probe/remove
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (14 preceding siblings ...)
2017-06-21 6:30 ` [dpdk-dev] [PATCH v2 10/12] crypto/dpaa2_sec: do not use cryptodev driver Pablo de Lara
@ 2017-06-21 6:30 ` Pablo de Lara
2017-06-21 6:30 ` [dpdk-dev] [PATCH v2 12/12] cryptodev: remove unused cryptodev driver Pablo de Lara
16 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:30 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 103 -------------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 13 ----
lib/librte_cryptodev/rte_cryptodev_version.map | 10 +--
3 files changed, 1 insertion(+), 125 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index d02a4d0..3d118b5 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -47,7 +47,6 @@
#include <rte_debug.h>
#include <rte_dev.h>
#include <rte_interrupts.h>
-#include <rte_pci.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
@@ -553,108 +552,6 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
return 0;
}
-int
-rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
-{
- struct rte_cryptodev_driver *cryptodrv;
- struct rte_cryptodev *cryptodev;
-
- char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
-
- int retval;
-
- cryptodrv = (struct rte_cryptodev_driver *)pci_drv;
- if (cryptodrv == NULL)
- return -ENODEV;
-
- 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",
- cryptodrv->dev_private_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;
- cryptodev->driver = cryptodrv;
-
- /* init user callbacks */
- TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
- /* Invoke PMD device initialization function */
- retval = (*cryptodrv->cryptodev_init)(cryptodrv, cryptodev);
- if (retval == 0)
- return 0;
-
- CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_drv->driver.name,
- (unsigned) pci_dev->id.vendor_id,
- (unsigned) 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_remove(struct rte_pci_device *pci_dev)
-{
- const struct rte_cryptodev_driver *cryptodrv;
- 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;
-
- cryptodrv = (const struct rte_cryptodev_driver *)pci_dev->driver;
- if (cryptodrv == NULL)
- return -ENODEV;
-
- /* Invoke PMD device uninit function */
- if (*cryptodrv->cryptodev_uninit) {
- ret = (*cryptodrv->cryptodev_uninit)(cryptodrv, 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->driver = NULL;
- cryptodev->data = NULL;
-
- return 0;
-}
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 0efe282..6579170 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -482,19 +482,6 @@ void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
/**
- * Wrapper for use by pci drivers as a .probe function to attach to a crypto
- * interface.
- */
-int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev);
-
-/**
- * Wrapper for use by pci drivers as a .remove function to detach a crypto
- * interface.
- */
-int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
-
-/**
* @internal
* Create unique device name
*/
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index d519234..b6c8ab8 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -31,14 +31,6 @@ DPDK_16.04 {
local: *;
};
-DPDK_16.11 {
- global:
-
- rte_cryptodev_pci_probe;
- rte_cryptodev_pci_remove;
-
-} DPDK_16.04;
-
DPDK_17.02 {
global:
@@ -55,7 +47,7 @@ DPDK_17.02 {
rte_crypto_cipher_algorithm_strings;
rte_crypto_cipher_operation_strings;
-} DPDK_16.11;
+} DPDK_16.04;
DPDK_17.05 {
global:
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread
* [dpdk-dev] [PATCH v2 12/12] cryptodev: remove unused cryptodev driver
2017-05-24 15:27 [dpdk-dev] [PATCH 00/12] Remove cryptodev driver Pablo de Lara
` (15 preceding siblings ...)
2017-06-21 6:30 ` [dpdk-dev] [PATCH v2 11/12] cryptodev: remove unused PCI probe/remove Pablo de Lara
@ 2017-06-21 6:30 ` Pablo de Lara
16 siblings, 0 replies; 57+ messages in thread
From: Pablo de Lara @ 2017-06-21 6:30 UTC (permalink / raw)
To: declan.doherty, thomas; +Cc: dev, Pablo de Lara
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 64 --------------------------------
2 files changed, 66 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 7f6fbf0..4e318f0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -694,8 +694,6 @@ struct rte_cryptodev {
enqueue_pkt_burst_t enqueue_burst;
/**< Pointer to PMD transmit function. */
- const struct rte_cryptodev_driver *driver;
- /**< Driver for this device */
struct rte_cryptodev_data *data;
/**< Pointer to device data */
struct rte_cryptodev_ops *dev_ops;
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 6579170..8e8b2ad 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -47,7 +47,6 @@ extern "C" {
#include <string.h>
#include <rte_dev.h>
-#include <rte_pci.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
@@ -68,69 +67,6 @@ struct rte_cryptodev_session {
__extension__ char _private[0];
};
-struct rte_cryptodev_driver;
-
-/**
- * Initialisation function of a crypto driver invoked for each matching
- * crypto PCI device detected during the PCI probing phase.
- *
- * @param drv The pointer to the [matching] crypto driver structure
- * supplied by the PMD when it registered itself.
- * @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_init_t)(struct rte_cryptodev_driver *drv,
- struct rte_cryptodev *dev);
-
-/**
- * Finalisation function of a driver invoked for each matching
- * PCI device detected during the PCI closing phase.
- *
- * @param drv The pointer to the [matching] driver structure supplied
- * by the PMD when it registered itself.
- * @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_uninit_t)(const struct rte_cryptodev_driver *drv,
- struct rte_cryptodev *dev);
-
-/**
- * The structure associated with a PMD driver.
- *
- * Each driver acts as a PCI driver and is represented by a generic
- * *crypto_driver* structure that holds:
- *
- * - An *rte_pci_driver* structure (which must be the first field).
- *
- * - The *cryptodev_init* function invoked for each matching PCI device.
- *
- * - The size of the private data to allocate for each matching device.
- */
-struct rte_cryptodev_driver {
- struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */
- unsigned dev_private_size; /**< Size of device private data. */
-
- cryptodev_init_t cryptodev_init; /**< Device init function. */
- cryptodev_uninit_t cryptodev_uninit; /**< Device uninit function. */
-};
-
-
/** Global structure used for maintaining state of allocated crypto devices */
struct rte_cryptodev_global {
struct rte_cryptodev *devs; /**< Device information array */
--
2.9.4
^ permalink raw reply [flat|nested] 57+ messages in thread