cryptodev: change device configuration API
cover cryptodev: change device configuration API
This patchset changes the cryptodev library's device configuration API and updates all crypto PMD to comply with this change.
Fan Zhang (3):
cryptodev: change device configuration API
crypto/scheduler: improve slave configuration
doc: remove deprecation notice
app/test/test_cryptodev.c | 24 +----------------------- doc/guides/rel_notes/deprecation.rst | 4 ---- drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 3 ++- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 3 ++- drivers/crypto/armv8/rte_armv8_pmd_ops.c | 3 ++- drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 3 ++- drivers/crypto/null/null_crypto_pmd_ops.c | 3 ++- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 3 ++- drivers/crypto/qat/qat_crypto.c | 5 +++-- drivers/crypto/qat/qat_crypto.h | 3 ++- drivers/crypto/scheduler/scheduler_pmd_ops.c | 20 +++++++++++++++----- drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 3 ++- drivers/crypto/zuc/rte_zuc_pmd_ops.c | 3 ++- lib/librte_cryptodev/rte_cryptodev.c | 8 +++++++- lib/librte_cryptodev/rte_cryptodev_pmd.h | 4 +++- 15 files changed, 47 insertions(+), 45 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 cryptodev: change device configuration API
This patch changes the device configuration API for rte_cryptodev_ops function prototype, and update all cryptodev PMDs for this change.
--- drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 3 ++- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 3 ++- drivers/crypto/armv8/rte_armv8_pmd_ops.c | 3 ++- drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 3 ++- drivers/crypto/null/null_crypto_pmd_ops.c | 3 ++- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 3 ++- drivers/crypto/qat/qat_crypto.c | 5 +++-- drivers/crypto/qat/qat_crypto.h | 3 ++- drivers/crypto/scheduler/scheduler_pmd_ops.c | 6 ++++-- drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 3 ++- drivers/crypto/zuc/rte_zuc_pmd_ops.c | 3 ++- lib/librte_cryptodev/rte_cryptodev.c | 8 +++++++- lib/librte_cryptodev/rte_cryptodev_pmd.h | 4 +++- 13 files changed, 35 insertions(+), 15 deletions(-)
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c +2 -1
@@ -114,7 +114,8 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {/** Configure device */ static int -aesni_gcm_pmd_config(__rte_unused struct rte_cryptodev *dev) +aesni_gcm_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +2 -1
@@ -233,7 +233,8 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {/** Configure device */ static int -aesni_mb_pmd_config(__rte_unused struct rte_cryptodev *dev) +aesni_mb_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
drivers/crypto/armv8/rte_armv8_pmd_ops.c +2 -1
@@ -111,7 +111,8 @@ static const struct rte_cryptodev_capabilities/** Configure device */ static int -armv8_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev) +armv8_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
drivers/crypto/kasumi/rte_kasumi_pmd_ops.c +2 -1
@@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities kasumi_pmd_capabilities[] = {/** Configure device */ static int -kasumi_pmd_config(__rte_unused struct rte_cryptodev *dev) +kasumi_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
drivers/crypto/null/null_crypto_pmd_ops.c +2 -1
@@ -85,7 +85,8 @@ static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =/** Configure device */ static int -null_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev) +null_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
drivers/crypto/openssl/rte_openssl_pmd_ops.c +2 -1
@@ -449,7 +449,8 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {/** Configure device */ static int -openssl_pmd_config(__rte_unused struct rte_cryptodev *dev) +openssl_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
drivers/crypto/qat/qat_crypto.c +3 -2
@@ -1326,10 +1326,11 @@ void qat_crypto_sym_session_init(struct rte_mempool *mp, void *sym_sess) offsetof(struct rte_cryptodev_sym_session , _private); } -int qat_dev_config(__rte_unused struct rte_cryptodev *dev) +int qat_dev_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {PMD_INIT_FUNC_TRACE (); -return -ENOTSUP ; +return 0 ; } int qat_dev_start(__rte_unused struct rte_cryptodev *dev)
drivers/crypto/qat/qat_crypto.h +2 -1
@@ -85,7 +85,8 @@ struct qat_pmd_private {/**< Max number of sessions supported by device */ }; -int qat_dev_config (struct rte_cryptodev *dev); +int qat_dev_config (struct rte_cryptodev *dev, +struct rte_cryptodev_config *config);int qat_dev_start (struct rte_cryptodev *dev);void qat_dev_stop (struct rte_cryptodev *dev);int qat_dev_close (struct rte_cryptodev *dev);
drivers/crypto/scheduler/scheduler_pmd_ops.c +4 -2
@@ -43,7 +43,8 @@/** Configure device */ static int -scheduler_pmd_config (struct rte_cryptodev *dev) +scheduler_pmd_config (struct rte_cryptodev *dev, +struct rte_cryptodev_config *config) {struct scheduler_ctx *sched_ctx = dev->data->dev_private;uint32_t i;
@@ -54,7 +55,8 @@ scheduler_pmd_config(struct rte_cryptodev *dev)struct rte_cryptodev *slave_dev =rte_cryptodev_pmd_get_dev (slave_dev_id); - ret = (*slave_dev->dev_ops->dev_configure)(slave_dev); + ret = (*slave_dev->dev_ops->dev_configure)(slave_dev, + config);if (ret <0 )break ; }
drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +2 -1
@@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {/** Configure device */ static int -snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev) +snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
drivers/crypto/zuc/rte_zuc_pmd_ops.c +2 -1
@@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities zuc_pmd_capabilities[] = {/** Configure device */ static int -zuc_pmd_config(__rte_unused struct rte_cryptodev *dev) +zuc_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) {return 0 ; }
lib/librte_cryptodev/rte_cryptodev.c +7 -1
@@ -917,6 +917,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)return -EBUSY ; } +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->dev_configure, -ENOTSUP ); +/* Setup new number of queue pairs and reconfigure device. */ diag =rte_cryptodev_queue_pairs_config (dev, config->nb_queue_pairs, config->socket_id);
@@ -927,10 +929,14 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config) }/* Setup Session mempool for device */ -return rte_cryptodev_sym_session_pool_create (dev, + diag =rte_cryptodev_sym_session_pool_create (dev, config->session_mp.nb_objs, config->session_mp.cache_size, config->socket_id); +if (diag !=0 ) +return diag; + +return (*dev->dev_ops->dev_configure)(dev, config); }
lib/librte_cryptodev/rte_cryptodev_pmd.h +3 -1
@@ -201,10 +201,12 @@ extern struct rte_cryptodev *rte_cryptodevs;* Function used to configure device. * * @param dev Crypto device pointer +* config Crypto device configurations * * @return Returns 0 on success */ -typedef int (*cryptodev_configure_t )(struct rte_cryptodev *dev); +typedef int (*cryptodev_configure_t )(struct rte_cryptodev *dev, +struct rte_cryptodev_config *config);/** * Function used to start a configured device.
Signature · 1 line
2.7.4
Quoted 5 lines · Fan Zhang
This patch changes the device configuration API for
rte_cryptodev_opsfunction prototype, and update all cryptodev PMDs for this change.Signed-off-by Fan Zhang <[email protected]>---
...
Quoted 1 line
PATCH 2/3 crypto/scheduler: improve slave configuration
In reply to Fan ZhangSince the new device configuration API is updated, we can make use of this feature to the crypto scheduler PMD to configure its slaves automatically with the same configurations it got. As originally the slaves have to be manually configured one by one, this patch should help reducing the coding complexity.
--- app/test/test_cryptodev.c | 24 +----------------------- drivers/crypto/scheduler/scheduler_pmd_ops.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 28 deletions(-)
app/test/test_cryptodev.c +1 -23
@@ -7382,17 +7382,8 @@ test_scheduler_attach_slave_op(void) {struct crypto_testsuite_params *ts_params = &testsuite_params;uint8_t sched_id = ts_params->valid_devs[0 ]; -uint32_t nb_devs, qp_id, i, nb_devs_attached =0 ; +uint32_t nb_devs, i, nb_devs_attached =0 ;int ret; -struct rte_cryptodev_config config = { - .nb_queue_pairs =8 , - .socket_id =SOCKET_ID_ANY , - .session_mp = { - .nb_objs =2048 , - .cache_size =256 - } - }; -struct rte_cryptodev_qp_conf qp_conf = {2048 };/* create 2 AESNI_MB if necessary */ nb_devs = rte_cryptodev_count_devtype(
@@ -7418,19 +7409,6 @@ test_scheduler_attach_slave_op(void)if (info.dev_type !=RTE_CRYPTODEV_AESNI_MB_PMD )continue ; - ret =rte_cryptodev_configure (i, &config); -TEST_ASSERT (ret ==0 , -"Failed to configure device %u of pmd : %s" , i, -RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD )); - -for (qp_id =0 ; qp_id < info.max_nb_queue_pairs; qp_id++) { -TEST_ASSERT_SUCCESS (rte_cryptodev_queue_pair_setup ( - i, qp_id, &qp_conf, -rte_cryptodev_socket_id (i)), -"Failed to setup queue pair %u on " -"cryptodev %u" , qp_id, i); - } - ret =rte_cryptodev_scheduler_slave_attach (sched_id, (uint8_t )i);
drivers/crypto/scheduler/scheduler_pmd_ops.c +13 -5
@@ -52,11 +52,8 @@ scheduler_pmd_config(struct rte_cryptodev *dev,for (i =0 ; i < sched_ctx->nb_slaves; i++) {uint8_t slave_dev_id = sched_ctx->slaves[i].dev_id; -struct rte_cryptodev *slave_dev = -rte_cryptodev_pmd_get_dev (slave_dev_id); - ret = (*slave_dev->dev_ops->dev_configure)(slave_dev, - config); + ret =rte_cryptodev_configure (slave_dev_id, config);if (ret <0 )break ; }
@@ -340,11 +337,13 @@ scheduler_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)/** Setup a queue pair */ static int scheduler_pmd_qp_setup (struct rte_cryptodev *dev,uint16_t qp_id, - __rte_unused const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) +const struct rte_cryptodev_qp_conf *qp_conf,int socket_id) {struct scheduler_ctx *sched_ctx = dev->data->dev_private;struct scheduler_qp_ctx *qp_ctx;char name[RTE_CRYPTODEV_NAME_MAX_LEN ]; +uint32_t i; +int ret; if (snprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, "CRYTO_SCHE PMD %u QP %u",
@@ -357,6 +356,15 @@ scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,if (dev->data->queue_pairs[qp_id] !=NULL )scheduler_pmd_qp_release (dev, qp_id); +for (i =0 ; i < sched_ctx->nb_slaves; i++) { +uint8_t slave_id = sched_ctx->slaves[i].dev_id; + + ret =rte_cryptodev_queue_pair_setup (slave_id, qp_id, + qp_conf, socket_id); +if (ret <0 ) +return ret; + } +/* Allocate the queue pair data structure. */ qp_ctx =rte_zmalloc_socket (name,sizeof (*qp_ctx),RTE_CACHE_LINE_SIZE , socket_id);
Signature · 1 line
2.7.4
Re: [PATCH 2/3] crypto/scheduler: improve slave configuration
Quoted 8 lines · Fan Zhang
Since the new device configuration API is updated, we can make use of this feature to the crypto scheduler PMD to configure its slaves automatically with the same configurations it got. As originally the slaves have to be manually configured one by one, this patch should help reducing the coding complexity.
Signed-off-by Fan Zhang <[email protected]>---
...
Quoted 1 line
Re: [PATCH 2/3] crypto/scheduler: improve slave configuration
In reply to Fan ZhangQuoted 8 lines · Fan Zhang
Since the new device configuration API is updated, we can make use of this feature to the crypto scheduler PMD to configure its slaves automatically with the same configurations it got. As originally the slaves have to be manually configured one by one, this patch should help reducing the coding complexity.
Signed-off-by Fan Zhang <[email protected]>---
...
Quoted 1 line
This patch needs to rebased due to the movement of app/test/ to test/test
Re: [PATCH 2/3] crypto/scheduler: improve slave configuration
Quoted 17 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Declan Doherty
Sent: Thursday, March 23, 2017 3:10 PM
To: Zhang, Roy Fan; [email protected]
Cc: De Lara Guarch, Pablo
Subject: Re: [dpdk-dev] [PATCH 2/3]crypto/scheduler: improve slave configurationQuoted 6 lines · Fan Zhang
Since the new device configuration API is updated, we can make use of this feature to the crypto scheduler PMD to configure its slaves automatically with the same configurations it got. As originally the slaves have to be manually configured one by one, this patch should help reducing the coding complexity.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Fan Zhang <[email protected]>---
...
Quoted 1 line
This patch needs to rebased due to the movement of app/test/ to test/test
If there are no reworks required, I can do that myself when merging.
PATCH 3/3 doc: remove deprecation notice
In reply to Fan Zhang--- doc/guides/rel_notes/deprecation.rst | 4 ---- 1 file changed, 4 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -119,10 +119,6 @@ Deprecation Notices or VHOST feature, but KNI_VHOST which is a KNI feature enabled via a compile time option, and disabled by default. -* ABI changes are planned for 17.05 in the ``rte_cryptodev_ops`` structure. - A pointer to a rte_cryptodev_config structure will be added to the - function prototype ``cryptodev_configure_t``, as a new parameter. - * cryptodev: A new parameter ``max_nb_sessions_per_qp`` will be added to ``rte_cryptodev_info.sym``. Some drivers may support limited number of sessions per queue_pair. With this new parameter application will know
Signature · 1 line
2.7.4
Re: [PATCH 3/3] doc: remove deprecation notice
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, February 17, 2017 12:01 PM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>
Subject: [dpdk-dev] [PATCH 3/3] doc: remove deprecation noticeSigned-off-by Fan Zhang <[email protected]>
De Lara Guarch, Pablo
AppliedQuoted 35 lines
-----Original Message-----
From: Zhang, Roy Fan
Sent: Friday, February 17, 2017 12:01 PM
To: [email protected]
Cc: De Lara Guarch, Pablo
Subject: [PATCH 0/3] cryptodev: change device configuration APIThis patchset changes the cryptodev library's device configuration API and updates all crypto PMD to comply with this change.
Fan Zhang (3):
cryptodev: change device configuration API
crypto/scheduler: improve slave configuration
doc: remove deprecation noticeapp/test/test_cryptodev.c | 24 +----------------------- doc/guides/rel_notes/deprecation.rst | 4 ---- drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 3 ++- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 3 ++- drivers/crypto/armv8/rte_armv8_pmd_ops.c | 3 ++- drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 3 ++- drivers/crypto/null/null_crypto_pmd_ops.c | 3 ++- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 3 ++- drivers/crypto/qat/qat_crypto.c | 5 +++-- drivers/crypto/qat/qat_crypto.h | 3 ++- drivers/crypto/scheduler/scheduler_pmd_ops.c | 20 +++++++++++++++-- --- drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 3 ++- drivers/crypto/zuc/rte_zuc_pmd_ops.c | 3 ++- lib/librte_cryptodev/rte_cryptodev.c | 8 +++++++- lib/librte_cryptodev/rte_cryptodev_pmd.h | 4 +++- 15 files changed, 47 insertions(+), 45 deletions(-)
Quoted 2 lines
--
2.7.4
Applied to dpdk-next-crypto.
Thanks,
Pablo