From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by dpdk.org (Postfix) with ESMTP id 97E4F1B1BA for ; Wed, 25 Oct 2017 08:18:26 +0200 (CEST) Received: by mail-lf0-f65.google.com with SMTP id k40so26513639lfi.4 for ; Tue, 24 Oct 2017 23:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=x9G4u7qo67Dn4klTC4UaGnUcehC4TLd4uh/T3Wrstbo=; b=ePrOj/bEmdw0O2eBqkPFjZ2hEUnGywWkiAKu3oTFoPZpOXKc9+9HVU4SFRAMPYE+hT 15KmRJajP7R3ZjNnYcs0Gxu9dqn/4MnvipF+kJYxEqkRs1yq4v86QPOkGTV7vEveCTWM iKYYl6AJfBtwOixSmGIu21JQWppva9hu83iFgw229zZXieMsEKUMUEfCW1FDda2fWkRk 8FDGYgv1818vUdFjMiDdJtvMFEW1nbXyqk2bD1BPweDPZa+6odEBDND3gOWaOUbwB+yZ EUhKnmQa68OgYO1vSs5u2C7bUPz4CSMi7XOnJFXFFkcBmmMdjuwmElutEU38SQa3va2A zghQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=x9G4u7qo67Dn4klTC4UaGnUcehC4TLd4uh/T3Wrstbo=; b=sQ4ImTGmR1/vhAdNOUk5XE4GN+Jc6Aq26BH0xiV53ay5OiVWjHRZSRJ8khJwSqYxIH iVIZ684KR+AcQccEVb5w3h34icLig0UQD6FM7n1/ElIdkTG/11WuUWUYkvME5qCfXpWG USRHLHAOe/hWItPKqNWpF+s91GX60zvI+YZcjY9v2D2ZzN0+QMJedIusp+EkfVNvgQ+e 3i3WUpDY66afBpv8mXRJbFFCnnbrWtgFVZfTAeEzKHGFiof4X0bsbatFhJ7HXJ9WIYYX F8IcMlZdW+Mv4nMtJwNjOQnssTquhfqkbAOv+6t9zpCA8tvjJTIW1/TT/AwOD5AmEpIr gf/Q== X-Gm-Message-State: AMCzsaXcFQ4zee1ZdJERTYfdp9khAJASawlpdHCeyhW9WhSIl2Eo9asV 1KTHAOXaNmgKhJTrpz3JWBeUy/JurFE= X-Google-Smtp-Source: ABhQp+SIPPsh6UKrZeZen8o01L+i1C6IXSe35gMlKHLDLKKjQy9qokPgaWUavSniXiSTyVA5TFhILA== X-Received: by 10.46.23.85 with SMTP id l82mr7463858lje.178.1508912304733; Tue, 24 Oct 2017 23:18:24 -0700 (PDT) Received: from localhost (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id i137sm396943lfe.43.2017.10.24.23.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 23:18:23 -0700 (PDT) Date: Wed, 25 Oct 2017 08:18:22 +0200 From: Tomasz Duszynski To: Declan Doherty Cc: dev@dpdk.org Message-ID: <20171025061822.GB15441@tdu> References: <20171020212113.4543-1-declan.doherty@intel.com> <20171020212113.4543-3-declan.doherty@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20171020212113.4543-3-declan.doherty@intel.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus 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, 25 Oct 2017 06:18:26 -0000 On Fri, Oct 20, 2017 at 10:21:12PM +0100, Declan Doherty wrote: > Removes any dependency of librte_cryptodev on the virtual device > infrastructure code and removes the functions which were virtual > device specific. > > Updates all virtual PMDs to remove dependencies on rte_cryptodev_vdev.h > and replaces those calls with the new bus independent functions. > > Signed-off-by: Declan Doherty > --- > drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 55 ++++-------- > drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 72 +++++++-------- > drivers/crypto/armv8/rte_armv8_pmd.c | 41 +++------ > drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 11 +-- > drivers/crypto/dpaa_sec/dpaa_sec.c | 14 +-- > drivers/crypto/kasumi/rte_kasumi_pmd.c | 47 ++++------ > drivers/crypto/mrvl/rte_mrvl_pmd.c | 56 ++++-------- > drivers/crypto/null/null_crypto_pmd.c | 72 ++++++--------- > drivers/crypto/openssl/rte_openssl_pmd.c | 42 +++------ > drivers/crypto/scheduler/scheduler_pmd.c | 45 +++------- > drivers/crypto/scheduler/scheduler_pmd_ops.c | 3 +- > drivers/crypto/snow3g/rte_snow3g_pmd.c | 41 ++++----- > drivers/crypto/zuc/rte_zuc_pmd.c | 41 ++++----- > lib/librte_cryptodev/Makefile | 1 - > lib/librte_cryptodev/rte_cryptodev_pmd.c | 120 -------------------= ------ > lib/librte_cryptodev/rte_cryptodev_vdev.h | 100 -------------------= -- > lib/librte_cryptodev/rte_cryptodev_version.map | 2 - > 17 files changed, 190 insertions(+), 573 deletions(-) > delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h > > diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/ae= sni_gcm/aesni_gcm_pmd.c > index 29c14e5..2dd2576 100644 > --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c > +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c > @@ -35,7 +35,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -486,22 +485,24 @@ static int aesni_gcm_remove(struct rte_vdev_device = *vdev); > static int > aesni_gcm_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct aesni_gcm_private *internals; > enum aesni_gcm_vector_mode vector_mode; > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > - > /* Check CPU for support for AES instruction set */ > if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AES)) { > GCM_LOG_ERR("AES instructions not supported by CPU"); > return -EFAULT; > } > > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > + if (dev =3D=3D NULL) { > + GCM_LOG_ERR("driver %s: create failed", init_params->name); > + return -ENODEV; > + } > + > /* Check CPU for supported vector instruction set */ > if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) > vector_mode =3D RTE_AESNI_GCM_AVX2; > @@ -510,14 +511,6 @@ aesni_gcm_create(const char *name, > else > vector_mode =3D RTE_AESNI_GCM_SSE; > > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct aesni_gcm_private), init_params->socket_id, > - vdev); > - if (dev =3D=3D NULL) { > - GCM_LOG_ERR("failed to create cryptodev vdev"); > - goto init_error; > - } > - > dev->driver_id =3D cryptodev_driver_id; > dev->dev_ops =3D rte_aesni_gcm_pmd_ops; > > @@ -552,22 +545,17 @@ aesni_gcm_create(const char *name, > internals->max_nb_sessions =3D init_params->max_nb_sessions; > > return 0; > - > -init_error: > - GCM_LOG_ERR("driver %s: create failed", init_params->name); > - > - aesni_gcm_remove(vdev); > - return -EFAULT; > } > > static int > aesni_gcm_probe(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct aesni_gcm_private), > rte_socket_id(), > - {0} > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > const char *name; > const char *input_args; > @@ -576,17 +564,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev) > if (name =3D=3D NULL) > return -EINVAL; > input_args =3D rte_vdev_device_args(vdev); > - rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + rte_cryptodev_pmd_parse_input_args(&init_params, input_args); > > return aesni_gcm_create(name, vdev, &init_params); > } > @@ -594,6 +572,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev) > static int > aesni_gcm_remove(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > const char *name; > > name =3D rte_vdev_device_name(vdev); > @@ -603,7 +582,11 @@ aesni_gcm_remove(struct rte_vdev_device *vdev) > GCM_LOG_INFO("Closing AESNI crypto device %s on numa socket %u\n", > name, rte_socket_id()); > > - return 0; > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver aesni_gcm_pmd_drv =3D { > diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/= aesni_mb/rte_aesni_mb_pmd.c > index 49242fc..440a09f 100644 > --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c > +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c > @@ -36,7 +36,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -715,15 +714,23 @@ static int cryptodev_aesni_mb_remove(struct rte_vde= v_device *vdev); > static int > cryptodev_aesni_mb_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct aesni_mb_private *internals; > enum aesni_mb_vector_mode vector_mode; > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > + /* Check CPU for support for AES instruction set */ > + if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AES)) { > + MB_LOG_ERR("AES instructions not supported by CPU"); > + return -EFAULT; > + } > + > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > + if (dev =3D=3D NULL) { > + MB_LOG_ERR("failed to create cryptodev vdev"); > + return -ENODEV; > + } > > /* Check CPU for supported vector instruction set */ > if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) > @@ -735,14 +742,6 @@ cryptodev_aesni_mb_create(const char *name, > else > vector_mode =3D RTE_AESNI_MB_SSE; > > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct aesni_mb_private), init_params->socket_id, > - vdev); > - if (dev =3D=3D NULL) { > - MB_LOG_ERR("failed to create cryptodev vdev"); > - goto init_error; > - } > - > dev->driver_id =3D cryptodev_driver_id; > dev->dev_ops =3D rte_aesni_mb_pmd_ops; > > @@ -779,41 +778,33 @@ cryptodev_aesni_mb_create(const char *name, > internals->max_nb_sessions =3D init_params->max_nb_sessions; > > return 0; > -init_error: > - MB_LOG_ERR("driver %s: cryptodev_aesni_create failed", > - init_params->name); > - > - cryptodev_aesni_mb_remove(vdev); > - return -EFAULT; > } > > static int > cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct aesni_mb_private), > rte_socket_id(), > - "" > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > - const char *name; > - const char *input_args; > + const char *name, *args; > + int retval; > > name =3D rte_vdev_device_name(vdev); > if (name =3D=3D NULL) > return -EINVAL; > - input_args =3D rte_vdev_device_args(vdev); > - rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + > + args =3D rte_vdev_device_args(vdev); > + > + retval =3D rte_cryptodev_pmd_parse_input_args(&init_params, args); > + if (retval) { > + MB_LOG_ERR("Failed to parse initialisation arguments[%s]\n", > + args); > + return -EINVAL; > + } > > return cryptodev_aesni_mb_create(name, vdev, &init_params); > } > @@ -821,6 +812,7 @@ cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev) > static int > cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > const char *name; > > name =3D rte_vdev_device_name(vdev); > @@ -830,7 +822,11 @@ cryptodev_aesni_mb_remove(struct rte_vdev_device *vd= ev) > RTE_LOG(INFO, PMD, "Closing AESNI crypto device %s on numa socket %u\n", > name, rte_socket_id()); > > - return 0; > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv =3D { > diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/= rte_armv8_pmd.c > index dbe6bee..2d2f3ff 100644 > --- a/drivers/crypto/armv8/rte_armv8_pmd.c > +++ b/drivers/crypto/armv8/rte_armv8_pmd.c > @@ -36,7 +36,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -759,7 +758,7 @@ armv8_crypto_pmd_dequeue_burst(void *queue_pair, stru= ct rte_crypto_op **ops, > static int > cryptodev_armv8_crypto_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct armv8_crypto_private *internals; > @@ -786,14 +785,7 @@ cryptodev_armv8_crypto_create(const char *name, > return -EFAULT; > } > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > - > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct armv8_crypto_private), > - init_params->socket_id, > - vdev); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > if (dev =3D=3D NULL) { > ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev"); > goto init_error; > @@ -832,11 +824,12 @@ cryptodev_armv8_crypto_create(const char *name, > static int > cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct armv8_crypto_private), > rte_socket_id(), > - {0} > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > const char *name; > const char *input_args; > @@ -845,18 +838,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *= vdev) > if (name =3D=3D NULL) > return -EINVAL; > input_args =3D rte_vdev_device_args(vdev); > - rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') { > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - } > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + rte_cryptodev_pmd_parse_input_args(&init_params, input_args); > > return cryptodev_armv8_crypto_create(name, vdev, &init_params); > } > @@ -865,6 +847,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *v= dev) > static int > cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > const char *name; > > name =3D rte_vdev_device_name(vdev); > @@ -875,7 +858,11 @@ cryptodev_armv8_crypto_uninit(struct rte_vdev_device= *vdev) > "Closing ARMv8 crypto device %s on numa socket %u\n", > name, rte_socket_id()); > > - return 0; > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver armv8_crypto_pmd_drv =3D { > diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto= /dpaa2_sec/dpaa2_sec_dpseci.c > index 0a466ba..2359ee6 100644 > --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c > +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c > @@ -1990,16 +1990,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device= *dpaa2_dev) > if (ret) > return ret; > > - /* free crypto device */ > - rte_cryptodev_pmd_release_device(cryptodev); > - > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > - rte_free(cryptodev->data->dev_private); > - > - cryptodev->device =3D NULL; > - cryptodev->data =3D NULL; > - > - return 0; > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_dpaa2_driver rte_dpaa2_sec_driver =3D { > diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec= /dpaa_sec.c > index 53f004e..bb39b75 100644 > --- a/drivers/crypto/dpaa_sec/dpaa_sec.c > +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c > @@ -1517,19 +1517,7 @@ cryptodev_dpaa_sec_remove(struct rte_dpaa_device *= dpaa_dev) > if (ret) > return ret; > > - /* free crypto device */ > - rte_cryptodev_pmd_release_device(cryptodev); > - > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > - rte_free(cryptodev->data->dev_private); > - > - PMD_INIT_LOG(INFO, "Closing dpaa crypto device %s", > - cryptodev->data->name); > - > - cryptodev->device =3D NULL; > - cryptodev->data =3D NULL; > - > - return 0; > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_dpaa_driver rte_dpaa_sec_driver =3D { > diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasu= mi/rte_kasumi_pmd.c > index 7a00bd3..03f0a86 100644 > --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c > +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c > @@ -35,7 +35,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -553,15 +552,17 @@ static int cryptodev_kasumi_remove(struct rte_vdev_= device *vdev); > static int > cryptodev_kasumi_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct kasumi_private *internals; > uint64_t cpu_flags =3D 0; > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > + if (dev =3D=3D NULL) { > + KASUMI_LOG_ERR("failed to create cryptodev vdev"); > + goto init_error; > + } > > /* Check CPU for supported vector instruction set */ > if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX)) > @@ -569,14 +570,6 @@ cryptodev_kasumi_create(const char *name, > else > cpu_flags |=3D RTE_CRYPTODEV_FF_CPU_SSE; > > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct kasumi_private), init_params->socket_id, > - vdev); > - if (dev =3D=3D NULL) { > - KASUMI_LOG_ERR("failed to create cryptodev vdev"); > - goto init_error; > - } > - > dev->driver_id =3D cryptodev_driver_id; > dev->dev_ops =3D rte_kasumi_pmd_ops; > > @@ -605,11 +598,12 @@ cryptodev_kasumi_create(const char *name, > static int > cryptodev_kasumi_probe(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct kasumi_private), > rte_socket_id(), > - {0} > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > const char *name; > const char *input_args; > @@ -619,17 +613,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev) > return -EINVAL; > input_args =3D rte_vdev_device_args(vdev); > > - rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + rte_cryptodev_pmd_parse_input_args(&init_params, input_args); > > return cryptodev_kasumi_create(name, vdev, &init_params); > } > @@ -637,6 +621,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev) > static int > cryptodev_kasumi_remove(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > const char *name; > > name =3D rte_vdev_device_name(vdev); > @@ -647,7 +632,11 @@ cryptodev_kasumi_remove(struct rte_vdev_device *vdev) > " on numa socket %u\n", > name, rte_socket_id()); > > - return 0; > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver cryptodev_kasumi_pmd_drv =3D { > diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte= _mrvl_pmd.c > index 6a9c8da..63895c5 100644 > --- a/drivers/crypto/mrvl/rte_mrvl_pmd.c > +++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c > @@ -36,7 +36,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -720,26 +719,14 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair, > static int > cryptodev_mrvl_crypto_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct mrvl_crypto_private *internals; > struct sam_init_params sam_params; > int ret; > > - if (init_params->name[0] =3D=3D '\0') { > - ret =3D rte_cryptodev_pmd_create_dev_name( > - init_params->name, name); > - > - if (ret < 0) { > - MRVL_CRYPTO_LOG_ERR("failed to create unique name"); > - return ret; > - } > - } > - > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct mrvl_crypto_private), > - init_params->socket_id, vdev); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > if (dev =3D=3D NULL) { > MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev"); > goto init_error; > @@ -796,40 +783,28 @@ cryptodev_mrvl_crypto_create(const char *name, > static int > cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { }; > - const char *name; > - const char *input_args; > + struct rte_cryptodev_pmd_init_params init_params =3D { }; > + const char *name, *args; > int ret; > > name =3D rte_vdev_device_name(vdev); > if (name =3D=3D NULL) > return -EINVAL; > - input_args =3D rte_vdev_device_args(vdev); > - > - if (!input_args) > - return -EINVAL; > + args =3D rte_vdev_device_args(vdev); > > + init_params.private_data_size =3D sizeof(struct mrvl_crypto_private); > init_params.max_nb_queue_pairs =3D sam_get_num_inst() * SAM_HW_RING_NUM; > init_params.max_nb_sessions =3D > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS; > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS; > init_params.socket_id =3D rte_socket_id(); > > - ret =3D rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > + ret =3D rte_cryptodev_pmd_parse_input_args(&init_params, args); > if (ret) { > - RTE_LOG(ERR, PMD, "Failed to parse input arguments\n"); > - return ret; > - } > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') { > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > + RTE_LOG(ERR, PMD, > + "Failed to parse initialisation arguments[%s]\n", > + args); > + return -EINVAL; > } > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > > return cryptodev_mrvl_crypto_create(name, vdev, &init_params); > } > @@ -843,6 +818,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vd= ev) > static int > cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > const char *name =3D rte_vdev_device_name(vdev); > > if (name =3D=3D NULL) > @@ -854,7 +830,11 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device = *vdev) > > sam_deinit(); > > - return 0; > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > /** > diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/= null_crypto_pmd.c > index d5d2bb3..4b9a58a 100644 > --- a/drivers/crypto/null/null_crypto_pmd.c > +++ b/drivers/crypto/null/null_crypto_pmd.c > @@ -33,7 +33,6 @@ > #include > #include > #include > -#include > #include > #include > > @@ -183,28 +182,19 @@ null_crypto_pmd_dequeue_burst(void *queue_pair, str= uct rte_crypto_op **ops, > return nb_dequeued; > } > > -static int cryptodev_null_remove(const char *name); > - > /** Create crypto device */ > static int > cryptodev_null_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct null_crypto_private *internals; > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > - > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct null_crypto_private), > - init_params->socket_id, > - vdev); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > if (dev =3D=3D NULL) { > NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev"); > - goto init_error; > + return -EFAULT; > } > > dev->driver_id =3D cryptodev_driver_id; > @@ -224,61 +214,53 @@ cryptodev_null_create(const char *name, > internals->max_nb_sessions =3D init_params->max_nb_sessions; > > return 0; > - > -init_error: > - NULL_CRYPTO_LOG_ERR("driver %s: cryptodev_null_create failed", > - init_params->name); > - cryptodev_null_remove(init_params->name); > - > - return -EFAULT; > } > > /** Initialise null crypto device */ > static int > cryptodev_null_probe(struct rte_vdev_device *dev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct null_crypto_private), > rte_socket_id(), > - {0} > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > - const char *name; > + const char *name, *args; > + int retval; > > name =3D rte_vdev_device_name(dev); > if (name =3D=3D NULL) > return -EINVAL; > > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", > - name, init_params.socket_id); > - if (init_params.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + args =3D rte_vdev_device_args(dev); > + > + retval =3D rte_cryptodev_pmd_parse_input_args(&init_params, args); > + if (retval) { > + RTE_LOG(ERR, PMD, > + "Failed to parse initialisation arguments[%s]\n", args); > + return -EINVAL; > + } > > return cryptodev_null_create(name, dev, &init_params); > } > > -/** Uninitialise null crypto device */ > static int > -cryptodev_null_remove(const char *name) > +cryptodev_null_remove_dev(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > + const char *name; > + > + name =3D rte_vdev_device_name(vdev); > if (name =3D=3D NULL) > return -EINVAL; > > - RTE_LOG(INFO, PMD, "Closing null crypto device %s on numa socket %u\n", > - name, rte_socket_id()); > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > > - return 0; > -} > - > -static int > -cryptodev_null_remove_dev(struct rte_vdev_device *dev) > -{ > - return cryptodev_null_remove(rte_vdev_device_name(dev)); > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver cryptodev_null_pmd_drv =3D { > diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/op= enssl/rte_openssl_pmd.c > index 95c0236..25c1154 100644 > --- a/drivers/crypto/openssl/rte_openssl_pmd.c > +++ b/drivers/crypto/openssl/rte_openssl_pmd.c > @@ -34,7 +34,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -1668,19 +1667,12 @@ openssl_pmd_dequeue_burst(void *queue_pair, struc= t rte_crypto_op **ops, > static int > cryptodev_openssl_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct openssl_private *internals; > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > - > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct openssl_private), > - init_params->socket_id, > - vdev); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > if (dev =3D=3D NULL) { > OPENSSL_LOG_ERR("failed to create cryptodev vdev"); > goto init_error; > @@ -1718,11 +1710,12 @@ cryptodev_openssl_create(const char *name, > static int > cryptodev_openssl_probe(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct openssl_private), > rte_socket_id(), > - {0} > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > const char *name; > const char *input_args; > @@ -1732,17 +1725,7 @@ cryptodev_openssl_probe(struct rte_vdev_device *vd= ev) > return -EINVAL; > input_args =3D rte_vdev_device_args(vdev); > > - rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + rte_cryptodev_pmd_parse_input_args(&init_params, input_args); > > return cryptodev_openssl_create(name, vdev, &init_params); > } > @@ -1751,17 +1734,18 @@ cryptodev_openssl_probe(struct rte_vdev_device *v= dev) > static int > cryptodev_openssl_remove(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > const char *name; > > name =3D rte_vdev_device_name(vdev); > if (name =3D=3D NULL) > return -EINVAL; > > - RTE_LOG(INFO, PMD, > - "Closing OPENSSL crypto device %s on numa socket %u\n", > - name, rte_socket_id()); > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > > - return 0; > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver cryptodev_openssl_pmd_drv =3D { > diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/sc= heduler/scheduler_pmd.c > index 3170f7f..40ab304 100644 > --- a/drivers/crypto/scheduler/scheduler_pmd.c > +++ b/drivers/crypto/scheduler/scheduler_pmd.c > @@ -33,7 +33,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -45,7 +44,7 @@ > uint8_t cryptodev_driver_id; > > struct scheduler_init_params { > - struct rte_crypto_vdev_init_params def_p; > + struct rte_cryptodev_pmd_init_params def_p; > uint32_t nb_slaves; > enum rte_cryptodev_scheduler_mode mode; > uint32_t enable_ordering; > @@ -107,21 +106,18 @@ cryptodev_scheduler_create(const char *name, > uint32_t i; > int ret; > > - if (init_params->def_p.name[0] =3D=3D '\0') > - snprintf(init_params->def_p.name, > - sizeof(init_params->def_p.name), > - "%s", name); > - > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->def_p.name, > - sizeof(struct scheduler_ctx), > - init_params->def_p.socket_id, > - vdev); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, > + &init_params->def_p); > if (dev =3D=3D NULL) { > CS_LOG_ERR("driver %s: failed to create cryptodev vdev", > name); > return -EFAULT; > } > > + if (init_params->wcmask !=3D 0) > + RTE_LOG(INFO, PMD, " workers core mask =3D %"PRIx64"\n", > + init_params->wcmask); > + > dev->driver_id =3D cryptodev_driver_id; > dev->dev_ops =3D rte_crypto_scheduler_pmd_ops; > > @@ -240,10 +236,7 @@ cryptodev_scheduler_remove(struct rte_vdev_device *v= dev) > sched_ctx->slaves[i].dev_id); > } > > - RTE_LOG(INFO, PMD, "Closing Crypto Scheduler device %s on numa " > - "socket %u\n", name, rte_socket_id()); > - > - return 0; > + return rte_cryptodev_pmd_destroy(dev); > } > > /** Parse integer from integer argument */ > @@ -304,7 +297,7 @@ static int > parse_name_arg(const char *key __rte_unused, > const char *value, void *extra_args) > { > - struct rte_crypto_vdev_init_params *params =3D extra_args; > + struct rte_cryptodev_pmd_init_params *params =3D extra_args; > > if (strlen(value) >=3D RTE_CRYPTODEV_NAME_MAX_LEN - 1) { > CS_LOG_ERR("Invalid name %s, should be less than " > @@ -462,10 +455,11 @@ cryptodev_scheduler_probe(struct rte_vdev_device *v= dev) > { > struct scheduler_init_params init_params =3D { > .def_p =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + "", > + sizeof(struct scheduler_ctx), > rte_socket_id(), > - "" > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }, > .nb_slaves =3D 0, > .mode =3D CDEV_SCHED_MODE_NOT_SET, > @@ -481,19 +475,6 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vd= ev) > scheduler_parse_init_params(&init_params, > rte_vdev_device_args(vdev)); > > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", > - name, > - init_params.def_p.socket_id); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.def_p.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.def_p.max_nb_sessions); > - if (init_params.def_p.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.def_p.name); > - if (init_params.wcmask !=3D 0) > - RTE_LOG(INFO, PMD, " workers core mask =3D %"PRIx64"\n", > - init_params.wcmask); > > return cryptodev_scheduler_create(name, > vdev, > diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypt= o/scheduler/scheduler_pmd_ops.c > index d379534..fef686f 100644 > --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c > +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c > @@ -37,7 +37,6 @@ > #include > #include > #include > -#include > #include > > #include "scheduler_pmd_private.h" > @@ -347,7 +346,7 @@ scheduler_pmd_info_get(struct rte_cryptodev *dev, > { > struct scheduler_ctx *sched_ctx =3D dev->data->dev_private; > uint32_t max_nb_sessions =3D sched_ctx->nb_slaves ? > - UINT32_MAX : RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS; > + UINT32_MAX : RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS; > uint32_t i; > > if (!dev_info) > diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow= 3g/rte_snow3g_pmd.c > index 8e1d1ec..7cd6114 100644 > --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c > +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c > @@ -35,7 +35,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -559,19 +558,13 @@ static int cryptodev_snow3g_remove(struct rte_vdev_= device *vdev); > static int > cryptodev_snow3g_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct snow3g_private *internals; > uint64_t cpu_flags =3D RTE_CRYPTODEV_FF_CPU_SSE; > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > - > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct snow3g_private), init_params->socket_id, > - vdev); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > if (dev =3D=3D NULL) { > SNOW3G_LOG_ERR("failed to create cryptodev vdev"); > goto init_error; > @@ -605,11 +598,12 @@ cryptodev_snow3g_create(const char *name, > static int > cryptodev_snow3g_probe(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct snow3g_private), > rte_socket_id(), > - {0} > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > const char *name; > const char *input_args; > @@ -619,17 +613,7 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev) > return -EINVAL; > input_args =3D rte_vdev_device_args(vdev); > > - rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + rte_cryptodev_pmd_parse_input_args(&init_params, input_args); > > return cryptodev_snow3g_create(name, vdev, &init_params); > } > @@ -637,17 +621,22 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev) > static int > cryptodev_snow3g_remove(struct rte_vdev_device *vdev) > { > + struct rte_cryptodev *cryptodev; > const char *name; > > name =3D rte_vdev_device_name(vdev); > if (name =3D=3D NULL) > return -EINVAL; > > - RTE_LOG(INFO, PMD, "Closing SNOW 3G crypto device %s" > + RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s" > " on numa socket %u\n", > name, rte_socket_id()); > > - return 0; > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver cryptodev_snow3g_pmd_drv =3D { > diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zu= c_pmd.c > index f1f9291..fb894f1 100644 > --- a/drivers/crypto/zuc/rte_zuc_pmd.c > +++ b/drivers/crypto/zuc/rte_zuc_pmd.c > @@ -35,7 +35,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -463,19 +462,14 @@ static int cryptodev_zuc_remove(struct rte_vdev_dev= ice *vdev); > static int > cryptodev_zuc_create(const char *name, > struct rte_vdev_device *vdev, > - struct rte_crypto_vdev_init_params *init_params) > + struct rte_cryptodev_pmd_init_params *init_params) > { > struct rte_cryptodev *dev; > struct zuc_private *internals; > uint64_t cpu_flags =3D RTE_CRYPTODEV_FF_CPU_SSE; > > - if (init_params->name[0] =3D=3D '\0') > - snprintf(init_params->name, sizeof(init_params->name), > - "%s", name); > > - dev =3D rte_cryptodev_vdev_pmd_init(init_params->name, > - sizeof(struct zuc_private), init_params->socket_id, > - vdev); > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, init_params); > if (dev =3D=3D NULL) { > ZUC_LOG_ERR("failed to create cryptodev vdev"); > goto init_error; > @@ -509,11 +503,12 @@ cryptodev_zuc_create(const char *name, > static int > cryptodev_zuc_probe(struct rte_vdev_device *vdev) > { > - struct rte_crypto_vdev_init_params init_params =3D { > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, > - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS, > + struct rte_cryptodev_pmd_init_params init_params =3D { > + "", > + sizeof(struct zuc_private), > rte_socket_id(), > - {0} > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS > }; > const char *name; > const char *input_args; > @@ -523,17 +518,7 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev) > return -EINVAL; > input_args =3D rte_vdev_device_args(vdev); > > - rte_cryptodev_vdev_parse_init_params(&init_params, input_args); > - > - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, > - init_params.socket_id); > - if (init_params.name[0] !=3D '\0') > - RTE_LOG(INFO, PMD, " User defined name =3D %s\n", > - init_params.name); > - RTE_LOG(INFO, PMD, " Max number of queue pairs =3D %d\n", > - init_params.max_nb_queue_pairs); > - RTE_LOG(INFO, PMD, " Max number of sessions =3D %d\n", > - init_params.max_nb_sessions); > + rte_cryptodev_pmd_parse_input_args(&init_params, input_args); > > return cryptodev_zuc_create(name, vdev, &init_params); > } > @@ -541,17 +526,23 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev) > static int > cryptodev_zuc_remove(struct rte_vdev_device *vdev) > { > + > + struct rte_cryptodev *cryptodev; > const char *name; > > name =3D rte_vdev_device_name(vdev); > if (name =3D=3D NULL) > return -EINVAL; > > - RTE_LOG(INFO, PMD, "Closing ZUC crypto device %s" > + RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s" > " on numa socket %u\n", > name, rte_socket_id()); > > - return 0; > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > } > > static struct rte_vdev_driver cryptodev_zuc_pmd_drv =3D { > diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile > index 6ac331b..4f70719 100644 > --- a/lib/librte_cryptodev/Makefile > +++ b/lib/librte_cryptodev/Makefile > @@ -48,7 +48,6 @@ SYMLINK-y-include +=3D rte_crypto.h > SYMLINK-y-include +=3D rte_crypto_sym.h > SYMLINK-y-include +=3D rte_cryptodev.h > SYMLINK-y-include +=3D rte_cryptodev_pmd.h > -SYMLINK-y-include +=3D rte_cryptodev_vdev.h > SYMLINK-y-include +=3D rte_cryptodev_pci.h > > # versioning export map > diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_crypto= dev/rte_cryptodev_pmd.c > index 6cb4419..62acb47 100644 > --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c > +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c > @@ -32,7 +32,6 @@ > > #include > > -#include "rte_cryptodev_vdev.h" > #include "rte_cryptodev_pci.h" > #include "rte_cryptodev_pmd.h" > > @@ -205,125 +204,6 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cry= ptodev) > return 0; > } > > -/** > - * Parse name from argument > - */ > -static int > -rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused, > - const char *value, void *extra_args) > -{ > - struct rte_crypto_vdev_init_params *params =3D extra_args; > - > - if (strlen(value) >=3D RTE_CRYPTODEV_NAME_MAX_LEN - 1) { > - CDEV_LOG_ERR("Invalid name %s, should be less than " > - "%u bytes", value, > - RTE_CRYPTODEV_NAME_MAX_LEN - 1); > - return -1; > - } > - > - strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN); > - > - return 0; > -} > - > -/** > - * Parse integer from argument > - */ > -static int > -rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused, > - const char *value, void *extra_args) > -{ > - int *i =3D extra_args; > - > - *i =3D atoi(value); > - if (*i < 0) { > - CDEV_LOG_ERR("Argument has to be positive."); > - return -1; > - } > - > - return 0; > -} > - > -struct rte_cryptodev * > -rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size, > - int socket_id, struct rte_vdev_device *vdev) > -{ > - struct rte_cryptodev *cryptodev; > - > - /* allocate device structure */ > - cryptodev =3D rte_cryptodev_pmd_allocate(name, socket_id); > - if (cryptodev =3D=3D NULL) > - return NULL; > - > - /* allocate private device structure */ > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) { > - cryptodev->data->dev_private =3D > - rte_zmalloc_socket("cryptodev device private", > - dev_private_size, > - RTE_CACHE_LINE_SIZE, > - socket_id); > - > - if (cryptodev->data->dev_private =3D=3D NULL) > - rte_panic("Cannot allocate memzone for private device" > - " data"); > - } > - > - cryptodev->device =3D &vdev->device; > - > - /* initialise user call-back tail queue */ > - TAILQ_INIT(&(cryptodev->link_intr_cbs)); > - > - return cryptodev; > -} > - > -int > -rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params = *params, > - const char *input_args) > -{ > - struct rte_kvargs *kvlist =3D NULL; > - int ret =3D 0; > - > - if (params =3D=3D NULL) > - return -EINVAL; > - > - if (input_args) { > - kvlist =3D rte_kvargs_parse(input_args, > - cryptodev_vdev_valid_params); > - if (kvlist =3D=3D NULL) > - return -1; > - > - ret =3D 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 =3D 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 =3D 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 =3D rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME, > - &rte_cryptodev_vdev_parse_name_arg, > - params); > - if (ret < 0) > - goto free_kvlist; > - } > - > -free_kvlist: > - rte_kvargs_free(kvlist); > - return ret; > -} > - > int > rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev, > size_t private_data_size, > diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_crypt= odev/rte_cryptodev_vdev.h > deleted file mode 100644 > index 94ab9d3..0000000 > --- a/lib/librte_cryptodev/rte_cryptodev_vdev.h > +++ /dev/null > @@ -1,100 +0,0 @@ > -/*- > - * BSD LICENSE > - * > - * Copyright(c) 2017 Intel Corporation. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * > - * * Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * * Redistributions in binary form must reproduce the above copyrig= ht > - * 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 F= OR > - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTA= L, > - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF US= E, > - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON A= NY > - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE U= SE > - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > - */ > - > -#ifndef _RTE_CRYPTODEV_VDEV_H_ > -#define _RTE_CRYPTODEV_VDEV_H_ > - > -#include > -#include > - > -#include "rte_cryptodev.h" > - > -#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8 > -#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048 > - > -#define RTE_CRYPTODEV_VDEV_NAME ("name") > -#define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG ("max_nb_queue_pairs") > -#define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG ("max_nb_sessions") > -#define RTE_CRYPTODEV_VDEV_SOCKET_ID ("socket_id") > - > -static const char * const cryptodev_vdev_valid_params[] =3D { > - RTE_CRYPTODEV_VDEV_NAME, > - RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG, > - RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG, > - RTE_CRYPTODEV_VDEV_SOCKET_ID > -}; > - > -/** > - * @internal > - * Initialisation parameters for virtual crypto devices > - */ > -struct rte_crypto_vdev_init_params { > - unsigned int max_nb_queue_pairs; > - unsigned int max_nb_sessions; > - uint8_t socket_id; > - char name[RTE_CRYPTODEV_NAME_MAX_LEN]; > -}; > - > -/** > - * @internal > - * Creates a new virtual crypto device and returns the pointer > - * to that device. > - * > - * @param name PMD type name > - * @param dev_private_size Size of crypto PMDs private data > - * @param socket_id Socket to allocate resources on. > - * @param vdev Pointer to virtual device structure. > - * > - * @return > - * - Cryptodev pointer if device is successfully created. > - * - NULL if device cannot be created. > - */ > -struct rte_cryptodev * > -rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size, > - int socket_id, struct rte_vdev_device *vdev); > - > -/** > - * @internal > - * Parse virtual device initialisation parameters input arguments > - * > - * @params params Initialisation parameters with defaults set. > - * @params input_args Command line arguments > - * > - * @return > - * 0 on successful parse > - * <0 on failure to parse > - */ > -int > -rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params = *params, > - const char *input_args); > - > -#endif /* _RTE_CRYPTODEV_VDEV_H_ */ > diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_= cryptodev/rte_cryptodev_version.map > index a0ea7bf..d3e4515 100644 > --- a/lib/librte_cryptodev/rte_cryptodev_version.map > +++ b/lib/librte_cryptodev/rte_cryptodev_version.map > @@ -73,8 +73,6 @@ DPDK_17.08 { > rte_cryptodev_sym_capability_check_aead; > rte_cryptodev_sym_session_init; > rte_cryptodev_sym_session_clear; > - rte_cryptodev_vdev_parse_init_params; > - rte_cryptodev_vdev_pmd_init; > rte_crypto_aead_algorithm_strings; > rte_crypto_aead_operation_strings; > > -- > 2.9.4 > As for Marvell crypto pmd: Tested-by: Tomasz Duszynski Thanks. -- - Tomasz Duszy=C5=84ski