From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) by dpdk.org (Postfix) with ESMTP id 5753FCF90 for ; Tue, 11 Apr 2017 17:44:41 +0200 (CEST) Received: by mail-wr0-f174.google.com with SMTP id o21so671142wrb.2 for ; Tue, 11 Apr 2017 08:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=4A+H7tm6LriNGJdUlOldu+01wfDJiq81X9CikRlZ0pc=; b=SXGmdKzpVZRwN/E4kiBmpglDO5EhLhWjCVAHd7ep1PPb64ohFGDwzsKkv8jewKVDSf +nF1avfC/TycmvStmyv9y0isB0iPatFvPz/csHVAeq4rfybY8/eSrw16PqIsQ/Xgrx7v MiBg5xuSJawcMm2V50C7tmoM9CD49xbSZS+qAqONb9gMs8DOsku3IhoDj8NtMS5WzMJM TdQyllQ0eaiKjWPC9ISlgnmw4zwpkNdFz9KfvG8OpP6+PUKENocnj3+B+FjojtTU5I+n pqF+Rfzf7V/Daoe78A2Rb23vSukJEOHPJKKI6CWJYrMRW0pf2RSazkAwC2OtpDuQ5CNm g+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4A+H7tm6LriNGJdUlOldu+01wfDJiq81X9CikRlZ0pc=; b=t2yYjw/vzsNKVoAnCod5umNw1Bga7gT6ZGUTYUjbaq/ZhxHgcyJcc87t0VRI9TxIFs SEKF0u3L2MvrSwK2soZ+KPrHYMAhXqFlx269wZsnABP4/c5Vo4DfI1qfiQXCIup2wHxA mrCKYIq0WG/PBRiRJmbve2PXakWzQnTvp3cX++1lzYyHMJQXodL3Y1arYuByXBOHiQGf eTyESKa8z3KfYy/er9uXojTPqYItdkKbVQ8CvM9qcTTKLMdjsIAq6y1BB7gwpTnEECfR pyX1aHfG+ZwVVou6XvgT9mMaRQiBsf8RColkWjg2g7IO9sDVjTdMVCE+iYGGgiX+f5Ru QJyg== X-Gm-Message-State: AN3rC/7lLzeDg30eNiMbYK++ub7Wtb0j04lRbpYybb5+DGIT/UB2e+6o0tEta5wcDIwx/Npp X-Received: by 10.223.183.21 with SMTP id l21mr16055382wre.191.1491925480635; Tue, 11 Apr 2017 08:44:40 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id v14sm2936830wmv.24.2017.04.11.08.44.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 08:44:39 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Tue, 11 Apr 2017 17:44:15 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: <1488797809-12917-1-git-send-email-jblunck@infradead.org> In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 11/12] crypto: use generic vdev for probe and remove 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: Tue, 11 Apr 2017 15:44:42 -0000 Signed-off-by: Gaetan Rivet --- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 20 ++++++++++++++------ drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 21 ++++++++++++++------- drivers/crypto/armv8/rte_armv8_pmd.c | 21 ++++++++++++++------- drivers/crypto/kasumi/rte_kasumi_pmd.c | 22 +++++++++++++++------- drivers/crypto/openssl/rte_openssl_pmd.c | 22 +++++++++++++++------- drivers/crypto/scheduler/scheduler_pmd.c | 17 +++++++++++------ drivers/crypto/snow3g/rte_snow3g_pmd.c | 22 +++++++++++++++------- drivers/crypto/zuc/rte_zuc_pmd.c | 22 +++++++++++++++------- 8 files changed, 113 insertions(+), 54 deletions(-) diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index ceec765..1705896 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -429,10 +429,11 @@ aesni_gcm_pmd_enqueue_burst(void *queue_pair, return nb_enqueued; } -static int aesni_gcm_remove(const char *name); +static int aesni_gcm_remove(struct rte_vdev_device *vdev); static int -aesni_gcm_create(struct rte_crypto_vdev_init_params *init_params) +aesni_gcm_create(struct rte_vdev_device *vdev, + struct rte_crypto_vdev_init_params *init_params) { struct rte_cryptodev *dev; struct aesni_gcm_private *internals; @@ -483,12 +484,12 @@ aesni_gcm_create(struct rte_crypto_vdev_init_params *init_params) init_error: GCM_LOG_ERR("driver %s: create failed", init_params->name); - aesni_gcm_remove(init_params->name); + aesni_gcm_remove(vdev); return -EFAULT; } static int -aesni_gcm_probe(const char *name, const char *input_args) +aesni_gcm_probe(struct rte_vdev_device *vdev) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -496,7 +497,11 @@ aesni_gcm_probe(const char *name, const char *input_args) rte_socket_id(), {0} }; + const char *name; + const char *input_args; + name = rte_vdev_device_name(vdev); + input_args = rte_vdev_device_args(vdev); rte_cryptodev_parse_vdev_init_params(&init_params, input_args); RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, @@ -509,12 +514,15 @@ aesni_gcm_probe(const char *name, const char *input_args) RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", init_params.max_nb_sessions); - return aesni_gcm_create(&init_params); + return aesni_gcm_create(vdev, &init_params); } static int -aesni_gcm_remove(const char *name) +aesni_gcm_remove(struct rte_vdev_device *vdev) { + const char *name; + + name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index be15d22..37b22ec 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -669,10 +669,11 @@ aesni_mb_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, return processed_jobs; } -static int cryptodev_aesni_mb_remove(const char *name); +static int cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev); static int -cryptodev_aesni_mb_create(struct rte_crypto_vdev_init_params *init_params) +cryptodev_aesni_mb_create(struct rte_vdev_device *vdev, + struct rte_crypto_vdev_init_params *init_params) { struct rte_cryptodev *dev; struct aesni_mb_private *internals; @@ -750,13 +751,12 @@ cryptodev_aesni_mb_create(struct rte_crypto_vdev_init_params *init_params) MB_LOG_ERR("driver %s: cryptodev_aesni_create failed", init_params->name); - cryptodev_aesni_mb_remove(init_params->name); + cryptodev_aesni_mb_remove(vdev); return -EFAULT; } static int -cryptodev_aesni_mb_probe(const char *name, - const char *input_args) +cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -764,7 +764,11 @@ cryptodev_aesni_mb_probe(const char *name, rte_socket_id(), "" }; + const char *name; + const char *input_args; + name = rte_vdev_device_name(vdev); + input_args = rte_vdev_device_args(vdev); rte_cryptodev_parse_vdev_init_params(&init_params, input_args); RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, @@ -777,12 +781,15 @@ cryptodev_aesni_mb_probe(const char *name, RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", init_params.max_nb_sessions); - return cryptodev_aesni_mb_create(&init_params); + return cryptodev_aesni_mb_create(vdev, &init_params); } static int -cryptodev_aesni_mb_remove(const char *name) +cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev) { + const char *name; + + name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c index 6376e9e..bf56bc6 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd.c +++ b/drivers/crypto/armv8/rte_armv8_pmd.c @@ -44,7 +44,7 @@ #include "rte_armv8_pmd_private.h" -static int cryptodev_armv8_crypto_uninit(const char *name); +static int cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev); /** * Pointers to the supported combined mode crypto functions are stored @@ -773,7 +773,8 @@ armv8_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, /** Create ARMv8 crypto device */ static int -cryptodev_armv8_crypto_create(struct rte_crypto_vdev_init_params *init_params) +cryptodev_armv8_crypto_create(struct rte_vdev_device *vdev, + struct rte_crypto_vdev_init_params *init_params) { struct rte_cryptodev *dev; struct armv8_crypto_private *internals; @@ -845,14 +846,13 @@ cryptodev_armv8_crypto_create(struct rte_crypto_vdev_init_params *init_params) "driver %s: cryptodev_armv8_crypto_create failed", init_params->name); - cryptodev_armv8_crypto_uninit(init_params->name); + cryptodev_armv8_crypto_uninit(vdev); return -EFAULT; } /** Initialise ARMv8 crypto device */ static int -cryptodev_armv8_crypto_init(const char *name, - const char *input_args) +cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -860,7 +860,11 @@ cryptodev_armv8_crypto_init(const char *name, rte_socket_id(), {0} }; + const char *name; + const char *input_args; + name = rte_vdev_device_name(vdev); + input_args = rte_vdev_device_args(vdev); rte_cryptodev_parse_vdev_init_params(&init_params, input_args); RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, @@ -874,13 +878,16 @@ cryptodev_armv8_crypto_init(const char *name, RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", init_params.max_nb_sessions); - return cryptodev_armv8_crypto_create(&init_params); + return cryptodev_armv8_crypto_create(vdev, &init_params); } /** Uninitialise ARMv8 crypto device */ static int -cryptodev_armv8_crypto_uninit(const char *name) +cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev) { + const char *name; + + name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 55bdb29..42fdd33 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -548,10 +548,11 @@ kasumi_pmd_dequeue_burst(void *queue_pair, return nb_dequeued; } -static int cryptodev_kasumi_remove(const char *name); +static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev); static int -cryptodev_kasumi_create(struct rte_crypto_vdev_init_params *init_params) +cryptodev_kasumi_create(struct rte_vdev_device *vdev, + struct rte_crypto_vdev_init_params *init_params) { struct rte_cryptodev *dev; struct kasumi_private *internals; @@ -606,13 +607,12 @@ cryptodev_kasumi_create(struct rte_crypto_vdev_init_params *init_params) KASUMI_LOG_ERR("driver %s: cryptodev_kasumi_create failed", init_params->name); - cryptodev_kasumi_remove(init_params->name); + cryptodev_kasumi_remove(vdev); return -EFAULT; } static int -cryptodev_kasumi_probe(const char *name, - const char *input_args) +cryptodev_kasumi_probe(struct rte_vdev_device *vdev) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -620,6 +620,11 @@ cryptodev_kasumi_probe(const char *name, rte_socket_id(), {0} }; + const char *name; + const char *input_args; + + name = rte_vdev_device_name(vdev); + input_args = rte_vdev_device_args(vdev); rte_cryptodev_parse_vdev_init_params(&init_params, input_args); @@ -633,12 +638,15 @@ cryptodev_kasumi_probe(const char *name, RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", init_params.max_nb_sessions); - return cryptodev_kasumi_create(&init_params); + return cryptodev_kasumi_create(vdev, &init_params); } static int -cryptodev_kasumi_remove(const char *name) +cryptodev_kasumi_remove(struct rte_vdev_device *vdev) { + const char *name; + + name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 5046eac..f3c8f83 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -44,7 +44,7 @@ #define DES_BLOCK_SIZE 8 -static int cryptodev_openssl_remove(const char *name); +static int cryptodev_openssl_remove(struct rte_vdev_device *vdev); /*----------------------------------------------------------------------------*/ @@ -1264,7 +1264,8 @@ openssl_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, /** Create OPENSSL crypto device */ static int -cryptodev_openssl_create(struct rte_crypto_vdev_init_params *init_params) +cryptodev_openssl_create(struct rte_vdev_device *vdev, + struct rte_crypto_vdev_init_params *init_params) { struct rte_cryptodev *dev; struct openssl_private *internals; @@ -1312,14 +1313,13 @@ cryptodev_openssl_create(struct rte_crypto_vdev_init_params *init_params) OPENSSL_LOG_ERR("driver %s: cryptodev_openssl_create failed", init_params->name); - cryptodev_openssl_remove(init_params->name); + cryptodev_openssl_remove(vdev); return -EFAULT; } /** Initialise OPENSSL crypto device */ static int -cryptodev_openssl_probe(const char *name, - const char *input_args) +cryptodev_openssl_probe(struct rte_vdev_device *vdev) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -1327,6 +1327,11 @@ cryptodev_openssl_probe(const char *name, rte_socket_id(), {0} }; + const char *name; + const char *input_args; + + name = rte_vdev_device_name(vdev); + input_args = rte_vdev_device_args(vdev); rte_cryptodev_parse_vdev_init_params(&init_params, input_args); @@ -1340,13 +1345,16 @@ cryptodev_openssl_probe(const char *name, RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", init_params.max_nb_sessions); - return cryptodev_openssl_create(&init_params); + return cryptodev_openssl_create(vdev, &init_params); } /** Uninitialise OPENSSL crypto device */ static int -cryptodev_openssl_remove(const char *name) +cryptodev_openssl_remove(struct rte_vdev_device *vdev) { + const char *name; + + name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c index b189fbd..7d9e376 100644 --- a/drivers/crypto/scheduler/scheduler_pmd.c +++ b/drivers/crypto/scheduler/scheduler_pmd.c @@ -193,14 +193,16 @@ cryptodev_scheduler_create(const char *name, } static int -cryptodev_scheduler_remove(const char *name) +cryptodev_scheduler_remove(struct rte_vdev_device *vdev) { + const char *name; struct rte_cryptodev *dev; struct scheduler_ctx *sched_ctx; - if (name == NULL) + if (vdev == NULL) return -EINVAL; + name = rte_vdev_device_name(vdev); dev = rte_cryptodev_pmd_get_named_dev(name); if (dev == NULL) return -EINVAL; @@ -413,7 +415,7 @@ scheduler_parse_init_params(struct scheduler_init_params *params, } static int -cryptodev_scheduler_probe(const char *name, const char *input_args) +cryptodev_scheduler_probe(struct rte_vdev_device *vdev) { struct scheduler_init_params init_params = { .def_p = { @@ -428,9 +430,11 @@ cryptodev_scheduler_probe(const char *name, const char *input_args) .enable_ordering = 0 }; - scheduler_parse_init_params(&init_params, input_args); + scheduler_parse_init_params(&init_params, + rte_vdev_device_args(vdev)); - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, + RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", + rte_vdev_device_name(vdev), init_params.def_p.socket_id); RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n", init_params.def_p.max_nb_queue_pairs); @@ -440,7 +444,8 @@ cryptodev_scheduler_probe(const char *name, const char *input_args) RTE_LOG(INFO, PMD, " User defined name = %s\n", init_params.def_p.name); - return cryptodev_scheduler_create(name, &init_params); + return cryptodev_scheduler_create(rte_vdev_device_name(vdev), + &init_params); } static struct rte_vdev_driver cryptodev_scheduler_pmd_drv = { diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index 1042b31..a31eaa8 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -539,10 +539,11 @@ snow3g_pmd_dequeue_burst(void *queue_pair, return nb_dequeued; } -static int cryptodev_snow3g_remove(const char *name); +static int cryptodev_snow3g_remove(struct rte_vdev_device *vdev); static int -cryptodev_snow3g_create(struct rte_crypto_vdev_init_params *init_params) +cryptodev_snow3g_create(struct rte_vdev_device *vdev, + struct rte_crypto_vdev_init_params *init_params) { struct rte_cryptodev *dev; struct snow3g_private *internals; @@ -595,13 +596,12 @@ cryptodev_snow3g_create(struct rte_crypto_vdev_init_params *init_params) SNOW3G_LOG_ERR("driver %s: cryptodev_snow3g_create failed", init_params->name); - cryptodev_snow3g_remove(init_params->name); + cryptodev_snow3g_remove(vdev); return -EFAULT; } static int -cryptodev_snow3g_probe(const char *name, - const char *input_args) +cryptodev_snow3g_probe(struct rte_vdev_device *vdev) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -609,6 +609,11 @@ cryptodev_snow3g_probe(const char *name, rte_socket_id(), {0} }; + const char *name; + const char *input_args; + + name = rte_vdev_device_name(vdev); + input_args = rte_vdev_device_args(vdev); rte_cryptodev_parse_vdev_init_params(&init_params, input_args); @@ -622,12 +627,15 @@ cryptodev_snow3g_probe(const char *name, RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", init_params.max_nb_sessions); - return cryptodev_snow3g_create(&init_params); + return cryptodev_snow3g_create(vdev, &init_params); } static int -cryptodev_snow3g_remove(const char *name) +cryptodev_snow3g_remove(struct rte_vdev_device *vdev) { + const char *name; + + name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c index 06ff503..5eec933 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -439,10 +439,11 @@ zuc_pmd_dequeue_burst(void *queue_pair, return nb_dequeued; } -static int cryptodev_zuc_remove(const char *name); +static int cryptodev_zuc_remove(struct rte_vdev_device *vdev); static int -cryptodev_zuc_create(struct rte_crypto_vdev_init_params *init_params) +cryptodev_zuc_create(struct rte_vdev_device *vdev, + struct rte_crypto_vdev_init_params *init_params) { struct rte_cryptodev *dev; struct zuc_private *internals; @@ -495,13 +496,12 @@ cryptodev_zuc_create(struct rte_crypto_vdev_init_params *init_params) ZUC_LOG_ERR("driver %s: cryptodev_zuc_create failed", init_params->name); - cryptodev_zuc_remove(init_params->name); + cryptodev_zuc_remove(vdev); return -EFAULT; } static int -cryptodev_zuc_probe(const char *name, - const char *input_args) +cryptodev_zuc_probe(struct rte_vdev_device *vdev) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -509,6 +509,11 @@ cryptodev_zuc_probe(const char *name, rte_socket_id(), {0} }; + const char *name; + const char *input_args; + + name = rte_vdev_device_name(vdev); + input_args = rte_vdev_device_args(vdev); rte_cryptodev_parse_vdev_init_params(&init_params, input_args); @@ -522,12 +527,15 @@ cryptodev_zuc_probe(const char *name, RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", init_params.max_nb_sessions); - return cryptodev_zuc_create(&init_params); + return cryptodev_zuc_create(vdev, &init_params); } static int -cryptodev_zuc_remove(const char *name) +cryptodev_zuc_remove(struct rte_vdev_device *vdev) { + const char *name; + + name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; -- 2.1.4