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 <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15433
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Tomasz Zawadzki 2022-11-10 16:31:45 +01:00 committed by Jim Harris
parent e0bce5b189
commit 5887eb321d
2 changed files with 12 additions and 6 deletions

View File

@ -147,8 +147,8 @@ struct vbdev_crypto {
struct spdk_bdev crypto_bdev; /* the crypto virtual bdev */ struct spdk_bdev crypto_bdev; /* the crypto virtual bdev */
struct vbdev_crypto_opts *opts; /* crypto options such as key, cipher */ struct vbdev_crypto_opts *opts; /* crypto options such as key, cipher */
uint32_t qp_desc_nr; /* number of qp descriptors */ uint32_t qp_desc_nr; /* number of qp descriptors */
struct rte_cryptodev_sym_session *session_encrypt; /* encryption session for this bdev */ void *session_encrypt; /* encryption session for this bdev */
struct rte_cryptodev_sym_session *session_decrypt; /* decryption 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 */ struct rte_crypto_sym_xform cipher_xform; /* crypto control struct for this bdev */
TAILQ_ENTRY(vbdev_crypto) link; TAILQ_ENTRY(vbdev_crypto) link;
struct spdk_thread *thread; /* thread where base device is opened */ struct spdk_thread *thread; /* thread where base device is opened */
@ -1378,15 +1378,15 @@ _vdev_dev_get(struct vbdev_crypto *vbdev)
} }
static void static void
_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *session) _cryptodev_sym_session_free(void *session)
{ {
rte_cryptodev_sym_session_free(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) _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; struct vbdev_dev *device;
int rc = 0; int rc = 0;

View File

@ -12,6 +12,7 @@
#include <rte_crypto.h> #include <rte_crypto.h>
#include <rte_cryptodev.h> #include <rte_cryptodev.h>
#include <rte_version.h>
#define MAX_TEST_BLOCKS 8192 #define MAX_TEST_BLOCKS 8192
struct rte_crypto_op *g_test_crypto_ops[MAX_TEST_BLOCKS]; 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 #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 static inline int
mock_rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, mock_rte_crypto_op_attach_sym_session(struct rte_crypto_op *op,
struct rte_cryptodev_sym_session *sess) struct rte_cryptodev_sym_session *sess)
#endif
{ {
return ut_rte_crypto_op_attach_sym_session; 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_V(rte_cryptodev_stop, (uint8_t dev_id));
DEFINE_STUB(rte_cryptodev_close, int, (uint8_t dev_id), 0); DEFINE_STUB(rte_cryptodev_close, int, (uint8_t dev_id), 0);
DEFINE_STUB(rte_cryptodev_sym_session_create, struct rte_cryptodev_sym_session *, 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, DEFINE_STUB(rte_cryptodev_sym_session_init, int, (uint8_t dev_id,
struct rte_cryptodev_sym_session *sess, struct rte_cryptodev_sym_session *sess,
struct rte_crypto_sym_xform *xforms, struct rte_mempool *mempool), 0); struct rte_crypto_sym_xform *xforms, struct rte_mempool *mempool), 0);