bdev/crypto: do not create mempool for session private data

In DPDK 22.11 rte_cryptodev_sym_session_create() now takes
a single mempool with element size big enough to hold session
data and session private data.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6c9db063825843a903d1ff84dd8d77f198a841a1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15435
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Tomasz Zawadzki 2022-11-10 16:28:02 +01:00
parent 495055b054
commit 110d8411ec
2 changed files with 10 additions and 1 deletions

View File

@ -290,7 +290,9 @@ create_vbdev_dev(uint8_t index, uint16_t num_lcores)
struct rte_cryptodev_qp_conf qp_conf = { struct rte_cryptodev_qp_conf qp_conf = {
.nb_descriptors = qp_desc_nr, .nb_descriptors = qp_desc_nr,
.mp_session = g_session_mp, .mp_session = g_session_mp,
#if RTE_VERSION < RTE_VERSION_NUM(22, 11, 0, 0)
.mp_session_private = g_session_mp_priv, .mp_session_private = g_session_mp_priv,
#endif
}; };
/* Pre-setup all potential qpairs now and assign them in the channel /* Pre-setup all potential qpairs now and assign them in the channel
@ -458,6 +460,7 @@ vbdev_crypto_init_crypto_drivers(void)
} }
} }
#if RTE_VERSION < RTE_VERSION_NUM(22, 11, 0, 0)
g_session_mp_priv = rte_mempool_create("session_mp_priv", NUM_SESSIONS, max_sess_size, g_session_mp_priv = rte_mempool_create("session_mp_priv", NUM_SESSIONS, max_sess_size,
SESS_MEMPOOL_CACHE_SIZE, 0, NULL, NULL, NULL, SESS_MEMPOOL_CACHE_SIZE, 0, NULL, NULL, NULL,
NULL, SOCKET_ID_ANY, 0); NULL, SOCKET_ID_ANY, 0);
@ -465,10 +468,14 @@ vbdev_crypto_init_crypto_drivers(void)
SPDK_ERRLOG("Cannot create private session pool max size 0x%x\n", max_sess_size); SPDK_ERRLOG("Cannot create private session pool max size 0x%x\n", max_sess_size);
return -ENOMEM; return -ENOMEM;
} }
/* When session private data mempool allocated, the element size for the session mempool
* should be 0. */
max_sess_size = 0;
#endif
g_session_mp = rte_cryptodev_sym_session_pool_create( g_session_mp = rte_cryptodev_sym_session_pool_create(
"session_mp", "session_mp",
NUM_SESSIONS, 0, SESS_MEMPOOL_CACHE_SIZE, 0, NUM_SESSIONS, max_sess_size, SESS_MEMPOOL_CACHE_SIZE, 0,
SOCKET_ID_ANY); SOCKET_ID_ANY);
if (g_session_mp == NULL) { if (g_session_mp == NULL) {
SPDK_ERRLOG("Cannot create session pool max size 0x%x\n", max_sess_size); SPDK_ERRLOG("Cannot create session pool max size 0x%x\n", max_sess_size);

View File

@ -971,7 +971,9 @@ test_initdrivers(void)
CU_ASSERT(rc == 0); CU_ASSERT(rc == 0);
CU_ASSERT(g_mbuf_mp != NULL); CU_ASSERT(g_mbuf_mp != NULL);
CU_ASSERT(g_session_mp != NULL); CU_ASSERT(g_session_mp != NULL);
#if RTE_VERSION < RTE_VERSION_NUM(22, 11, 0, 0)
CU_ASSERT(g_session_mp_priv != NULL); CU_ASSERT(g_session_mp_priv != NULL);
#endif
init_cleanup(); init_cleanup();
MOCK_SET(rte_vdev_init, 0); MOCK_SET(rte_vdev_init, 0);
MOCK_CLEAR(rte_cryptodev_device_count_by_driver); MOCK_CLEAR(rte_cryptodev_device_count_by_driver);