From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1A6E27CEF for ; Wed, 24 May 2017 17:27:01 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2017 08:26:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,386,1491289200"; d="scan'208";a="265893610" Received: from silpixa00381631.ir.intel.com (HELO silpixa00381631.ger.corp.intel.com) ([10.237.222.122]) by fmsmga004.fm.intel.com with ESMTP; 24 May 2017 08:26:52 -0700 From: Pablo de Lara To: declan.doherty@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, Pablo de Lara Date: Wed, 24 May 2017 16:27:03 +0100 Message-Id: <1495639634-74846-2-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495639634-74846-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1495639634-74846-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH 01/12] cryptodev: store device pointer in virtual devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 May 2017 15:27:02 -0000 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 --- 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 +#include #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