Commit f614a701 authored by paul luse's avatar paul luse Committed by Jim Harris
Browse files

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: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: Ief3e867ec6bf4ff9c90d8ea60427ed8b85345275
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471692


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 88e48baa
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -106,8 +106,8 @@ static pthread_mutex_t g_device_qp_lock = PTHREAD_MUTEX_INITIALIZER;
 */
#define NUM_MBUFS		32768
#define POOL_CACHE_SIZE		256
#define NUM_SESSIONS		1024
#define SESS_MEMPOOL_CACHE_SIZE 256
#define NUM_SESSIONS		2
#define SESS_MEMPOOL_CACHE_SIZE 0

/* This is the max number of IOs we can supply to any crypto device QP at one time.
 * It can vary between drivers.
@@ -323,7 +323,6 @@ vbdev_crypto_init_crypto_drivers(void)
	struct vbdev_dev *tmp_dev;
	unsigned int max_sess_size = 0, sess_size;
	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. */
	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)
	g_session_mp_priv = rte_mempool_create("session_mp_priv", NUM_SESSIONS, max_sess_size, cache_size,
					       0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
	g_session_mp_priv = rte_mempool_create("session_mp_priv", NUM_SESSIONS, max_sess_size,
					       SESS_MEMPOOL_CACHE_SIZE, 0, NULL, NULL, NULL,
					       NULL, SOCKET_ID_ANY, 0);
	if (g_session_mp_priv == NULL) {
		SPDK_ERRLOG("Cannot create private session pool max size 0x%x\n", max_sess_size);
		return -ENOMEM;
@@ -368,10 +367,11 @@ vbdev_crypto_init_crypto_drivers(void)

	g_session_mp = rte_cryptodev_sym_session_pool_create(
			       "session_mp",
			       NUM_SESSIONS, 0, cache_size, 0,
			       NUM_SESSIONS, 0, SESS_MEMPOOL_CACHE_SIZE, 0,
			       SOCKET_ID_ANY);
#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);
#endif
	if (g_session_mp == NULL) {