From e8f0d9603b2155154f6ab0b538bb76300b5be0ba Mon Sep 17 00:00:00 2001 From: paul luse Date: Mon, 4 Oct 2021 13:42:29 +0000 Subject: [PATCH] modules/crypto: remove dependency on rte_cryptodev_pmd.h Call rte_cryptodev_close() to free qpair memory instead of using an internal function. Signed-off-by: paul luse Change-Id: I1bd7f0dd86de83f278f6be3263cdf3fbd8e1c77f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9720 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Aleksey Marchuk --- module/bdev/crypto/vbdev_crypto.c | 16 +++------------- test/unit/lib/bdev/crypto.c/crypto_ut.c | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/module/bdev/crypto/vbdev_crypto.c b/module/bdev/crypto/vbdev_crypto.c index 16c965622..dfad1f96f 100644 --- a/module/bdev/crypto/vbdev_crypto.c +++ b/module/bdev/crypto/vbdev_crypto.c @@ -43,7 +43,6 @@ #include #include #include -#include #include /* Used to store IO context in mbuf */ @@ -1569,7 +1568,6 @@ vbdev_crypto_finish(void) struct bdev_names *name; struct vbdev_dev *device; struct device_qp *dev_qp; - unsigned i; int rc; while ((name = TAILQ_FIRST(&g_bdev_names))) { @@ -1583,21 +1581,13 @@ vbdev_crypto_finish(void) } while ((device = TAILQ_FIRST(&g_vbdev_devs))) { - struct rte_cryptodev *rte_dev; - TAILQ_REMOVE(&g_vbdev_devs, device, link); rte_cryptodev_stop(device->cdev_id); - - assert(device->cdev_id < RTE_CRYPTO_MAX_DEVS); - rte_dev = &rte_cryptodevs[device->cdev_id]; - - if (rte_dev->dev_ops->queue_pair_release != NULL) { - for (i = 0; i < device->cdev_info.max_nb_queue_pairs; i++) { - rte_dev->dev_ops->queue_pair_release(rte_dev, i); - } - } + rc = rte_cryptodev_close(device->cdev_id); + assert(rc == 0); free(device); } + rc = rte_vdev_uninit(AESNI_MB); if (rc) { SPDK_ERRLOG("%d from rte_vdev_uninit\n", rc); diff --git a/test/unit/lib/bdev/crypto.c/crypto_ut.c b/test/unit/lib/bdev/crypto.c/crypto_ut.c index 6dbc646cb..70d8c6668 100644 --- a/test/unit/lib/bdev/crypto.c/crypto_ut.c +++ b/test/unit/lib/bdev/crypto.c/crypto_ut.c @@ -40,7 +40,6 @@ #include #include -#include #define MAX_TEST_BLOCKS 8192 struct rte_crypto_op *g_test_crypto_ops[MAX_TEST_BLOCKS]; @@ -191,6 +190,7 @@ DEFINE_STUB(rte_cryptodev_sym_session_pool_create, struct rte_mempool *, (const int socket_id), (struct rte_mempool *)1); DEFINE_STUB(rte_cryptodev_start, int, (uint8_t dev_id), 0); DEFINE_STUB_V(rte_cryptodev_stop, (uint8_t dev_id)); +DEFINE_STUB(rte_cryptodev_close, int, (uint8_t dev_id), 0); DEFINE_STUB(rte_cryptodev_sym_session_create, struct rte_cryptodev_sym_session *, (struct rte_mempool *mempool), (struct rte_cryptodev_sym_session *)1); DEFINE_STUB(rte_cryptodev_sym_session_init, int, (uint8_t dev_id,