From 5887eb321de5a4352b82990fd19a75a73412d1cc Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Thu, 10 Nov 2022 16:31:45 +0100 Subject: [PATCH] bdev/crypto: do not track type of crypto session Starting with DPDK 22.11 the struct rte_cryptodev_sym_session is no longer part of public API. Instead the void * is used. There is no need for SPDK to track the type of session variable, so replace that with void * regardless of DPDK version. Change-Id: I29f82e87a593dd1886673fe2a56145da2dbe8354 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15433 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris --- module/bdev/crypto/vbdev_crypto.c | 10 +++++----- test/unit/lib/bdev/crypto.c/crypto_ut.c | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/module/bdev/crypto/vbdev_crypto.c b/module/bdev/crypto/vbdev_crypto.c index 7a4e08746..5614ddc28 100644 --- a/module/bdev/crypto/vbdev_crypto.c +++ b/module/bdev/crypto/vbdev_crypto.c @@ -147,8 +147,8 @@ struct vbdev_crypto { struct spdk_bdev crypto_bdev; /* the crypto virtual bdev */ struct vbdev_crypto_opts *opts; /* crypto options such as key, cipher */ uint32_t qp_desc_nr; /* number of qp descriptors */ - struct rte_cryptodev_sym_session *session_encrypt; /* encryption session for this bdev */ - struct rte_cryptodev_sym_session *session_decrypt; /* decryption session for this bdev */ + void *session_encrypt; /* encryption session for this bdev */ + void *session_decrypt; /* decryption session for this bdev */ struct rte_crypto_sym_xform cipher_xform; /* crypto control struct for this bdev */ TAILQ_ENTRY(vbdev_crypto) link; struct spdk_thread *thread; /* thread where base device is opened */ @@ -1378,15 +1378,15 @@ _vdev_dev_get(struct vbdev_crypto *vbdev) } static void -_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *session) +_cryptodev_sym_session_free(void *session) { rte_cryptodev_sym_session_free(session); } -static struct rte_cryptodev_sym_session * +static void * _cryptodev_sym_session_create(struct vbdev_crypto *vbdev, struct rte_crypto_sym_xform *xforms) { - struct rte_cryptodev_sym_session *session; + void *session; struct vbdev_dev *device; int rc = 0; diff --git a/test/unit/lib/bdev/crypto.c/crypto_ut.c b/test/unit/lib/bdev/crypto.c/crypto_ut.c index efddd58e6..d114e1ee2 100644 --- a/test/unit/lib/bdev/crypto.c/crypto_ut.c +++ b/test/unit/lib/bdev/crypto.c/crypto_ut.c @@ -12,6 +12,7 @@ #include #include +#include #define MAX_TEST_BLOCKS 8192 struct rte_crypto_op *g_test_crypto_ops[MAX_TEST_BLOCKS]; @@ -198,9 +199,14 @@ mock_rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, } #define rte_crypto_op_attach_sym_session mock_rte_crypto_op_attach_sym_session +#if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0) +static inline int +mock_rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, void *sess) +#else static inline int mock_rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, struct rte_cryptodev_sym_session *sess) +#endif { return ut_rte_crypto_op_attach_sym_session; } @@ -255,7 +261,7 @@ 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); + (struct rte_mempool *mempool), (void *)1); DEFINE_STUB(rte_cryptodev_sym_session_init, int, (uint8_t dev_id, struct rte_cryptodev_sym_session *sess, struct rte_crypto_sym_xform *xforms, struct rte_mempool *mempool), 0);