module/crypto: reduce session mempool size
The initial implemenation of the module used a unique crypto session per operation. Later an optimization was made to use shared session, 1 for encrypt and 1 for decrypt. The size of the session pool and assocaited cache were not adjusted at the time. This patch reduces the session pool size to just 2 and uses 0 for session pool cache size. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: Ief3e867ec6bf4ff9c90d8ea60427ed8b85345275 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471692 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
88e48baaaf
commit
f614a7014c
@ -106,8 +106,8 @@ static pthread_mutex_t g_device_qp_lock = PTHREAD_MUTEX_INITIALIZER;
|
|||||||
*/
|
*/
|
||||||
#define NUM_MBUFS 32768
|
#define NUM_MBUFS 32768
|
||||||
#define POOL_CACHE_SIZE 256
|
#define POOL_CACHE_SIZE 256
|
||||||
#define NUM_SESSIONS 1024
|
#define NUM_SESSIONS 2
|
||||||
#define SESS_MEMPOOL_CACHE_SIZE 256
|
#define SESS_MEMPOOL_CACHE_SIZE 0
|
||||||
|
|
||||||
/* This is the max number of IOs we can supply to any crypto device QP at one time.
|
/* This is the max number of IOs we can supply to any crypto device QP at one time.
|
||||||
* It can vary between drivers.
|
* It can vary between drivers.
|
||||||
@ -323,7 +323,6 @@ vbdev_crypto_init_crypto_drivers(void)
|
|||||||
struct vbdev_dev *tmp_dev;
|
struct vbdev_dev *tmp_dev;
|
||||||
unsigned int max_sess_size = 0, sess_size;
|
unsigned int max_sess_size = 0, sess_size;
|
||||||
uint16_t num_lcores = rte_lcore_count();
|
uint16_t num_lcores = rte_lcore_count();
|
||||||
uint32_t cache_size;
|
|
||||||
|
|
||||||
/* Only the first call, via RPC or module init should init the crypto drivers. */
|
/* Only the first call, via RPC or module init should init the crypto drivers. */
|
||||||
if (g_session_mp != NULL) {
|
if (g_session_mp != NULL) {
|
||||||
@ -357,10 +356,10 @@ vbdev_crypto_init_crypto_drivers(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_size = spdk_min(RTE_MEMPOOL_CACHE_MAX_SIZE, NUM_SESSIONS / 2 / num_lcores);
|
|
||||||
#if RTE_VERSION >= RTE_VERSION_NUM(19, 02, 0, 0)
|
#if RTE_VERSION >= RTE_VERSION_NUM(19, 02, 0, 0)
|
||||||
g_session_mp_priv = rte_mempool_create("session_mp_priv", NUM_SESSIONS, max_sess_size, cache_size,
|
g_session_mp_priv = rte_mempool_create("session_mp_priv", NUM_SESSIONS, max_sess_size,
|
||||||
0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
|
SESS_MEMPOOL_CACHE_SIZE, 0, NULL, NULL, NULL,
|
||||||
|
NULL, SOCKET_ID_ANY, 0);
|
||||||
if (g_session_mp_priv == NULL) {
|
if (g_session_mp_priv == NULL) {
|
||||||
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;
|
||||||
@ -368,10 +367,11 @@ vbdev_crypto_init_crypto_drivers(void)
|
|||||||
|
|
||||||
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, cache_size, 0,
|
NUM_SESSIONS, 0, SESS_MEMPOOL_CACHE_SIZE, 0,
|
||||||
SOCKET_ID_ANY);
|
SOCKET_ID_ANY);
|
||||||
#else
|
#else
|
||||||
g_session_mp = rte_mempool_create("session_mp", NUM_SESSIONS, max_sess_size, cache_size,
|
g_session_mp = rte_mempool_create("session_mp", NUM_SESSIONS, max_sess_size,
|
||||||
|
SESS_MEMPOOL_CACHE_SIZE,
|
||||||
0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
|
0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
|
||||||
#endif
|
#endif
|
||||||
if (g_session_mp == NULL) {
|
if (g_session_mp == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user