DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] lib/cryptodev: change qp conf and sym session
@ 2018-11-15 17:24 Fan Zhang
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 61+ messages in thread
From: Fan Zhang @ 2018-11-15 17:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal

This patchset changes the queue pair configure structure and sym session
structure for cryptodev. An RFC patch http://patchwork.dpdk.org/patch/43883/
has been sent to state the change.

This patchset targets 19.02 release.

Fan Zhang (2):
  cryptodev: change queue pair configure structure
  cryptodev: change symmetric session structure

 app/test-crypto-perf/cperf_ops.c                   |  11 +-
 app/test-crypto-perf/main.c                        |  93 +++++---
 config/common_base                                 |  24 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  10 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |   5 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |   2 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  10 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |   5 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +
 drivers/crypto/armv8/rte_armv8_pmd.c               |  10 +-
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |   5 +-
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |   2 +
 drivers/crypto/caam_jr/caam_jr.c                   |   3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |   5 +-
 drivers/crypto/ccp/ccp_pmd_private.h               |   2 +
 drivers/crypto/ccp/rte_ccp_pmd.c                   |   9 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |   3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |   3 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  10 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |   5 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |   2 +
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |   5 +-
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |   3 +
 drivers/crypto/null/null_crypto_pmd.c              |   5 +-
 drivers/crypto/null/null_crypto_pmd_ops.c          |   5 +-
 drivers/crypto/null/null_crypto_pmd_private.h      |   2 +
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |   3 +-
 drivers/crypto/openssl/rte_openssl_pmd.c           |  10 +-
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |   5 +-
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |   2 +
 drivers/crypto/qat/qat_sym_pmd.c                   |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |   5 +-
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  10 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |   5 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |   2 +
 drivers/crypto/virtio/virtio_cryptodev.c           |   6 +-
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  10 +-
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |   5 +-
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |   2 +
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |   2 +-
 examples/fips_validation/main.c                    |  43 +++-
 examples/ip_pipeline/cryptodev.c                   |   2 +-
 examples/l2fwd-crypto/main.c                       |  66 ++++--
 examples/vhost_crypto/main.c                       |  21 +-
 lib/librte_cryptodev/rte_cryptodev.c               | 147 +++++++++---
 lib/librte_cryptodev/rte_cryptodev.h               |  72 +++++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |   7 +-
 lib/librte_vhost/rte_vhost_crypto.h                |   9 +-
 lib/librte_vhost/vhost_crypto.c                    |   8 +-
 test/test/test_cryptodev.c                         | 253 ++++++++++++---------
 test/test/test_cryptodev_asym.c                    |   8 +-
 test/test/test_cryptodev_blockcipher.c             |   7 +-
 test/test/test_cryptodev_blockcipher.h             |   1 +
 test/test/test_event_crypto_adapter.c              |  35 ++-
 54 files changed, 664 insertions(+), 325 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure
  2018-11-15 17:24 [dpdk-dev] [PATCH 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
@ 2018-11-15 17:24 ` Fan Zhang
  2018-11-16 12:05   ` Ananyev, Konstantin
  2018-12-04 16:05   ` Trahe, Fiona
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure Fan Zhang
  2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
  2 siblings, 2 replies; 61+ messages in thread
From: Fan Zhang @ 2018-11-15 17:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal

This patch changes the cryptodev queue pair configure structure
to enable two mempool passed into cryptodev PMD simutaneously.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 app/test-crypto-perf/main.c                        |  6 ++--
 config/common_base                                 | 24 +++++++-------
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  7 ++--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |  5 +--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |  2 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  7 ++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  5 +--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |  2 ++
 drivers/crypto/armv8/rte_armv8_pmd.c               |  7 ++--
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |  5 +--
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |  2 ++
 drivers/crypto/caam_jr/caam_jr.c                   |  3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |  5 +--
 drivers/crypto/ccp/ccp_pmd_private.h               |  2 ++
 drivers/crypto/ccp/rte_ccp_pmd.c                   |  9 +++++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |  3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |  3 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  7 ++--
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |  5 +--
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |  2 ++
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |  5 +--
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |  3 ++
 drivers/crypto/null/null_crypto_pmd.c              |  5 +--
 drivers/crypto/null/null_crypto_pmd_ops.c          |  5 +--
 drivers/crypto/null/null_crypto_pmd_private.h      |  2 ++
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |  3 +-
 drivers/crypto/openssl/rte_openssl_pmd.c           |  7 ++--
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |  5 +--
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |  2 ++
 drivers/crypto/qat/qat_sym_pmd.c                   |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |  5 ++-
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  7 ++--
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |  5 +--
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |  2 ++
 drivers/crypto/virtio/virtio_cryptodev.c           |  6 ++--
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  7 ++--
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |  5 +--
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |  2 ++
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  2 +-
 examples/ip_pipeline/cryptodev.c                   |  2 +-
 examples/l2fwd-crypto/main.c                       |  4 ++-
 examples/vhost_crypto/main.c                       |  9 ++++--
 lib/librte_cryptodev/rte_cryptodev.c               |  5 ++-
 lib/librte_cryptodev/rte_cryptodev.h               |  7 ++--
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  3 +-
 test/test/test_cryptodev.c                         | 37 +++++++++-------------
 test/test/test_cryptodev_asym.c                    |  8 ++---
 test/test/test_event_crypto_adapter.c              |  5 +--
 48 files changed, 156 insertions(+), 115 deletions(-)

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 953e058c9..38a2e429f 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -218,6 +218,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 			session_pool_socket[socket_id] = sess_mp;
 		}
 
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
+
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
 			printf("Failed to configure cryptodev %u", cdev_id);
@@ -226,8 +229,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 
 		for (j = 0; j < opts->nb_qps; j++) {
 			ret = rte_cryptodev_queue_pair_setup(cdev_id, j,
-				&qp_conf, socket_id,
-				session_pool_socket[socket_id]);
+				&qp_conf, socket_id);
 			if (ret < 0) {
 				printf("Failed to setup queue pair %u on "
 					"cryptodev %u",	j, cdev_id);
diff --git a/config/common_base b/config/common_base
index d12ae98bc..f26a992fc 100644
--- a/config/common_base
+++ b/config/common_base
@@ -446,7 +446,7 @@ CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD=n
 #
 # Compile null PMD
 #
-CONFIG_RTE_LIBRTE_PMD_NULL=y
+CONFIG_RTE_LIBRTE_PMD_NULL=n
 
 #
 # Compile software PMD backed by PCAP files
@@ -525,13 +525,13 @@ CONFIG_RTE_LIBRTE_DPAA_MAX_CRYPTODEV=4
 #
 # Compile PMD for Cavium OCTEON TX crypto device
 #
-CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=y
+CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=n
 
 #
 # Compile PMD for QuickAssist based devices - see docs for details
 #
 CONFIG_RTE_LIBRTE_PMD_QAT=y
-CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n
+CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y
 #
 # Max. number of QuickAssist devices, which can be detected and attached
 #
@@ -551,33 +551,33 @@ CONFIG_RTE_MAX_VIRTIO_CRYPTO=32
 #
 # Compile PMD for AESNI backed device
 #
-CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y
 
 #
 # Compile PMD for Software backed device
 #
-CONFIG_RTE_LIBRTE_PMD_OPENSSL=n
+CONFIG_RTE_LIBRTE_PMD_OPENSSL=y
 
 #
 # Compile PMD for AESNI GCM device
 #
-CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=y
 
 #
 # Compile PMD for SNOW 3G device
 #
-CONFIG_RTE_LIBRTE_PMD_SNOW3G=n
+CONFIG_RTE_LIBRTE_PMD_SNOW3G=y
 CONFIG_RTE_LIBRTE_PMD_SNOW3G_DEBUG=n
 
 #
 # Compile PMD for KASUMI device
 #
-CONFIG_RTE_LIBRTE_PMD_KASUMI=n
+CONFIG_RTE_LIBRTE_PMD_KASUMI=y
 
 #
 # Compile PMD for ZUC device
 #
-CONFIG_RTE_LIBRTE_PMD_ZUC=n
+CONFIG_RTE_LIBRTE_PMD_ZUC=y
 
 # Compile PMD for Crypto Scheduler device
 #
@@ -601,7 +601,7 @@ CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO=n
 #
 # Compile generic security library
 #
-CONFIG_RTE_LIBRTE_SECURITY=y
+CONFIG_RTE_LIBRTE_SECURITY=n
 
 #
 # Compile generic compression device library
@@ -842,7 +842,7 @@ CONFIG_RTE_LIBRTE_METER=y
 #
 # Compile librte_classify
 #
-CONFIG_RTE_LIBRTE_FLOW_CLASSIFY=y
+CONFIG_RTE_LIBRTE_FLOW_CLASSIFY=n
 
 #
 # Compile librte_sched
@@ -939,7 +939,7 @@ CONFIG_RTE_PROC_INFO=n
 #
 # Compile the PMD test application
 #
-CONFIG_RTE_TEST_PMD=y
+CONFIG_RTE_TEST_PMD=n
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
 
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index ebdf7c35a..abc7a6d5f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -151,7 +151,8 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_gcm_session *)_sess_private_data;
@@ -159,7 +160,7 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_gcm_set_session_parameters(qp->ops,
 				sess, sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -419,7 +420,7 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index c343a393f..2f70f2a1a 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -201,7 +201,7 @@ aesni_gcm_pmd_qp_create_processed_pkts_ring(struct aesni_gcm_qp *qp,
 static int
 aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_gcm_qp *qp = NULL;
 	struct aesni_gcm_private *internals = dev->data->dev_private;
@@ -229,7 +229,8 @@ aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_pkts == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
index 92b041354..903e7503d 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
@@ -48,6 +48,8 @@ struct aesni_gcm_qp {
 	/**< Queue pair statistics */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	uint16_t id;
 	/**< Queue Pair Identifier */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 83250e32c..b0f5c4d67 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -668,7 +668,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_mb_session *)_sess_private_data;
@@ -676,7 +677,7 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_mb_set_session_parameters(qp->op_fns,
 				sess, op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -951,7 +952,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index f3eff2685..af3021616 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -566,7 +566,7 @@ aesni_mb_pmd_qp_create_processed_ops_ring(struct aesni_mb_qp *qp,
 static int
 aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_mb_qp *qp = NULL;
 	struct aesni_mb_private *internals = dev->data->dev_private;
@@ -604,7 +604,8 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
index d8021cdaa..923403336 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
@@ -131,6 +131,8 @@ struct aesni_mb_qp {
        /**< Ring for placing operations ready for processing */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t digest_idx;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 9d15fee53..3b2d7fb2f 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -514,7 +514,8 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct armv8_crypto_session *)_sess_private_data;
@@ -522,7 +523,7 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(armv8_crypto_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -656,7 +657,7 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
 		rte_mempool_put(qp->sess_mp, sess);
-		rte_mempool_put(qp->sess_mp, op->sym->session);
+		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
 	}
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index ae03117ea..a4fee83a8 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -220,7 +220,7 @@ armv8_crypto_pmd_qp_create_processed_ops_ring(struct armv8_crypto_qp *qp,
 static int
 armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct armv8_crypto_qp *qp = NULL;
 
@@ -245,7 +245,8 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_private.h b/drivers/crypto/armv8/rte_armv8_pmd_private.h
index 7feb021db..0afd9c7c5 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_private.h
+++ b/drivers/crypto/armv8/rte_armv8_pmd_private.h
@@ -116,6 +116,8 @@ struct armv8_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+       /**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index f505adf6b..45b281331 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1540,8 +1540,7 @@ static int
 caam_jr_queue_pair_setup(
 		struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct sec_job_ring_t *internals;
 	struct caam_jr_qp *qp = NULL;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 6984913f1..d5041f0ec 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -685,7 +685,7 @@ ccp_pmd_qp_create_batch_info_ring(struct ccp_qp *qp,
 static int
 ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 const struct rte_cryptodev_qp_conf *qp_conf,
-		 int socket_id, struct rte_mempool *session_pool)
+		 int socket_id)
 {
 	struct ccp_private *internals = dev->data->dev_private;
 	struct ccp_qp *qp;
@@ -726,7 +726,8 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	/* mempool for batch info */
 	qp->batch_mp = rte_mempool_create(
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 79752f687..7f2979e89 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -76,6 +76,8 @@ struct ccp_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_mempool *batch_mp;
 	/**< Session Mempool for batch info */
 	struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 92d8a9559..b4bb5528f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -179,7 +179,7 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
 							internals) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -241,6 +241,13 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	for (i = 0; i < nb_dequeued; i++)
 		if (unlikely(ops[i]->sess_type ==
 			     RTE_CRYPTO_OP_SESSIONLESS)) {
+			struct ccp_session *sess = (struct ccp_session *)
+					get_sym_session_private_data(
+						ops[i]->sym->session,
+						ccp_cryptodev_driver_id);
+
+			rte_mempool_put(qp->sess_mp_priv,
+					sess);
 			rte_mempool_put(qp->sess_mp,
 					ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 6095c6021..82220ac4f 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1518,8 +1518,7 @@ dpaa2_sec_queue_pair_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 static int
 dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
 	struct dpaa2_sec_qp *qp;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index d83e74541..c95e43b7f 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -1661,8 +1661,7 @@ dpaa_sec_queue_pair_release(struct rte_cryptodev *dev,
 static int
 dpaa_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa_sec_dev_private *internals;
 	struct dpaa_sec_qp *qp = NULL;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 239a1cf44..6df645a23 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -145,7 +145,8 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct kasumi_session *)_sess_private_data;
@@ -153,7 +154,7 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(kasumi_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -325,7 +326,7 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index 9e4bf1b52..a4982f091 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -192,7 +192,7 @@ kasumi_pmd_qp_create_processed_ops_ring(struct kasumi_qp *qp,
 static int
 kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
 
@@ -217,7 +217,8 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
index 488777ca8..76f746c03 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
@@ -36,6 +36,8 @@ struct kasumi_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index 9956f051f..ef520356f 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -633,7 +633,7 @@ mrvl_crypto_pmd_close(struct rte_cryptodev *dev)
 static int
 mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct mrvl_crypto_qp *qp = NULL;
 	char match[RTE_CRYPTODEV_NAME_MAX_LEN];
@@ -690,7 +690,8 @@ mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		if (sam_cio_init(&qp->cio_params, &qp->cio) < 0)
 			break;
 
-		qp->sess_mp = session_pool;
+		qp->sess_mp = qp_conf->mp_session;
+		qp->sess_mp_priv = qp_conf->mp_session_private;
 
 		memset(&qp->stats, 0, sizeof(qp->stats));
 		dev->data->queue_pairs[qp_id] = qp;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
index 6f8cf5624..deb80c55d 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
@@ -51,6 +51,9 @@ struct mrvl_crypto_qp {
 	/** Session Mempool. */
 	struct rte_mempool *sess_mp;
 
+	/** Session Private Data Mempool. */
+	struct rte_mempool *sess_mp_priv;
+
 	/** Queue pair statistics. */
 	struct rte_cryptodev_stats stats;
 
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 6e29a21a6..d5e3064f2 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -87,7 +87,8 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct null_crypto_session *)_sess_private_data;
@@ -95,7 +96,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(null_crypto_set_session_parameters(sess,
 				sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 2bdcd019e..941d62bed 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -184,7 +184,7 @@ null_crypto_pmd_qp_create_processed_pkts_ring(struct null_crypto_qp *qp,
 static int
 null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct null_crypto_private *internals = dev->data->dev_private;
 	struct null_crypto_qp *qp;
@@ -228,7 +228,8 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index d5905afd8..d7bfd9cc8 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,6 +31,8 @@ struct null_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 } __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 90d0c14b8..6a0cf83f4 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -186,8 +186,7 @@ static int
 otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
 		       uint16_t que_pair_id,
 		       const struct rte_cryptodev_qp_conf *qp_conf,
-		       int socket_id __rte_unused,
-		       struct rte_mempool *session_pool __rte_unused)
+		       int socket_id __rte_unused)
 {
 	void *cptvf = dev->data->dev_private;
 	struct cpt_instance *instance = NULL;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 11ea0d190..f985afa93 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -768,7 +768,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct openssl_session *)_sess_private_data;
@@ -776,7 +777,7 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(openssl_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -2027,7 +2028,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index c2b029ec2..202b0b534 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -710,7 +710,7 @@ openssl_pmd_qp_create_processed_ops_ring(struct openssl_qp *qp,
 static int
 openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct openssl_qp *qp = NULL;
 
@@ -735,7 +735,8 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_private.h b/drivers/crypto/openssl/rte_openssl_pmd_private.h
index a8f2c8482..43ac3813d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_private.h
+++ b/drivers/crypto/openssl/rte_openssl_pmd_private.h
@@ -64,6 +64,8 @@ struct openssl_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index c3f700406..31ccab32e 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -127,7 +127,7 @@ static int qat_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 
 static int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	const struct rte_cryptodev_qp_conf *qp_conf,
-	int socket_id, struct rte_mempool *session_pool __rte_unused)
+	int socket_id)
 {
 	struct qat_qp *qp;
 	int ret = 0;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 939105aa8..cf70218b7 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -390,8 +390,7 @@ scheduler_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 /** Setup a queue pair */
 static int
 scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
-	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-	struct rte_mempool *session_pool)
+	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
 	struct scheduler_qp_ctx *qp_ctx;
@@ -419,7 +418,7 @@ scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 * must be big enough for all the drivers used.
 		 */
 		ret = rte_cryptodev_queue_pair_setup(slave_id, qp_id,
-				qp_conf, socket_id, session_pool);
+				qp_conf, socket_id);
 		if (ret < 0)
 			return ret;
 	}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index a17536b77..7d131f780 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -147,7 +147,8 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct snow3g_session *)_sess_private_data;
@@ -155,7 +156,7 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(snow3g_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -340,7 +341,7 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
index cfbc9522a..fad483c75 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
@@ -193,7 +193,7 @@ snow3g_pmd_qp_create_processed_ops_ring(struct snow3g_qp *qp,
 static int
 snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
 
@@ -218,7 +218,8 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
index b7807b621..df5c6092b 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
@@ -36,6 +36,8 @@ struct snow3g_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[SNOW3G_DIGEST_LENGTH];
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 568b5a406..4bae3b865 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -36,8 +36,7 @@ static void virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev);
 static int virtio_crypto_qp_setup(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool);
+		int socket_id);
 static int virtio_crypto_qp_release(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id);
 static void virtio_crypto_dev_free_mbufs(struct rte_cryptodev *dev);
@@ -585,8 +584,7 @@ virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev)
 static int
 virtio_crypto_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool __rte_unused)
+		int socket_id)
 {
 	int ret;
 	struct virtqueue *vq;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 313f4590b..997c2092f 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -144,7 +144,8 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct zuc_session *)_sess_private_data;
@@ -152,7 +153,7 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(zuc_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -327,7 +328,7 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, sessions[i]);
+			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
index 6da396542..7bd985fc1 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
@@ -193,7 +193,7 @@ zuc_pmd_qp_create_processed_ops_ring(struct zuc_qp *qp,
 static int
 zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
 
@@ -218,7 +218,8 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_private.h b/drivers/crypto/zuc/rte_zuc_pmd_private.h
index 5e5906ddb..aa73c0016 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_private.h
+++ b/drivers/crypto/zuc/rte_zuc_pmd_private.h
@@ -36,6 +36,8 @@ struct zuc_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[ZUC_DIGEST_LENGTH];
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index 1480f6dd5..f031d8803 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -101,7 +101,7 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c
index c4ba72bec..b365810de 100644
--- a/examples/ip_pipeline/cryptodev.c
+++ b/examples/ip_pipeline/cryptodev.c
@@ -93,7 +93,7 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index f12fd266e..1df7ba743 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2443,9 +2443,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
-				socket_id, session_pool_socket[socket_id]);
+				socket_id);
 		if (retval < 0) {
 			printf("Failed to setup queue pair %u on cryptodev %u",
 					0, cdev_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index f08babd97..aa2727dfc 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -463,7 +463,7 @@ free_resource(void)
 int
 main(int argc, char *argv[])
 {
-	struct rte_cryptodev_qp_conf qp_conf = {NB_CRYPTO_DESCRIPTORS};
+	struct rte_cryptodev_qp_conf qp_conf;
 	struct rte_cryptodev_config config;
 	struct rte_cryptodev_info dev_info;
 	char name[128];
@@ -550,11 +550,14 @@ main(int argc, char *argv[])
 
 		options.infos[i] = info;
 
+		qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
+		qp_conf.mp_session = info->sess_pool;
+		qp_conf.mp_session_private = info->sess_pool;
+
 		for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
 			ret = rte_cryptodev_queue_pair_setup(info->cid, j,
 					&qp_conf, rte_lcore_to_socket_id(
-							lo->lcore_id),
-					info->sess_pool);
+							lo->lcore_id));
 			if (ret < 0) {
 				RTE_LOG(ERR, USER1, "Failed to configure qp\n");
 				goto error_exit;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a52eaaa45..11776b6ac 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -941,8 +941,7 @@ rte_cryptodev_close(uint8_t dev_id)
 
 int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool)
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 
 {
 	struct rte_cryptodev *dev;
@@ -967,7 +966,7 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
-			socket_id, session_pool);
+			socket_id);
 }
 
 
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 4099823f1..f9e7507da 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -495,6 +495,10 @@ enum rte_cryptodev_event_type {
 /** Crypto device queue pair configuration structure. */
 struct rte_cryptodev_qp_conf {
 	uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
+	struct rte_mempool *mp_session;
+	/**< The mempool for creating session in sessionless mode */
+	struct rte_mempool *mp_session_private;
+	/**< The mempool for creating sess private data in sessionless mode */
 };
 
 /**
@@ -689,8 +693,7 @@ rte_cryptodev_close(uint8_t dev_id);
  */
 extern int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool);
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
 
 /**
  * Get the number of queue pairs on a specific crypto device
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 1b6cafd17..f15c9af30 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -188,13 +188,12 @@ typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev,
  * @param	qp_id		Queue Pair Index
  * @param	qp_conf		Queue configuration structure
  * @param	socket_id	Socket Index
- * @param	session_pool	Pointer to device session mempool
  *
  * @return	Returns 0 on success.
  */
 typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev,
 		uint16_t qp_id,	const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool);
+		int socket_id);
 
 /**
  * Release memory resources allocated by given queue pair.
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 84065eb49..aac0b1f0b 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -461,12 +461,13 @@ testsuite_setup(void)
 			dev_id, ts_params->conf.nb_queue_pairs);
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, dev_id);
 	}
@@ -519,8 +520,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
@@ -709,13 +709,14 @@ test_queue_pair_descriptor_setup(void)
 	 * freed so are re-used if ring is released and re-created.
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
+	qp_conf.mp_session = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights "
 				"%u on qp %u on cryptodev %u",
@@ -729,8 +730,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -744,8 +744,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -760,8 +759,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -776,8 +774,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -791,8 +788,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -807,8 +803,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -824,8 +819,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
@@ -835,8 +829,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c
index a899f9973..0f6fc5767 100644
--- a/test/test/test_cryptodev_asym.c
+++ b/test/test/test_cryptodev_asym.c
@@ -383,11 +383,12 @@ testsuite_setup(void)
 
 	/* configure qp */
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u ASYM",
 			qp_id, dev_id);
 	}
@@ -449,8 +450,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index de258c346..54717870e 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -546,11 +546,12 @@ configure_cryptodev(void)
 			TEST_CDEV_ID, conf.nb_queue_pairs);
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	qp_conf.mp_session = params.session_mpool;
+	qp_conf.mp_session_private = params.session_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
-			rte_cryptodev_socket_id(TEST_CDEV_ID),
-			params.session_mpool),
+			rte_cryptodev_socket_id(TEST_CDEV_ID)),
 			"Failed to setup queue pair %u on cryptodev %u\n",
 			TEST_CDEV_QP_ID, TEST_CDEV_ID);
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure
  2018-11-15 17:24 [dpdk-dev] [PATCH 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
@ 2018-11-15 17:24 ` Fan Zhang
  2018-11-16  0:47   ` Ananyev, Konstantin
  2018-11-16 14:32   ` Ananyev, Konstantin
  2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
  2 siblings, 2 replies; 61+ messages in thread
From: Fan Zhang @ 2018-11-15 17:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal

This patch changes the symmetric session structure of cryptodev.
The symmetric session now contains extra information for secure
access purposes. The patch also includes the updates to the
PMDs, test applications, and examples to fit the change.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 app/test-crypto-perf/cperf_ops.c           |  11 +-
 app/test-crypto-perf/main.c                |  91 ++++++++----
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c   |   3 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |   3 +-
 drivers/crypto/armv8/rte_armv8_pmd.c       |   3 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c     |   3 +-
 drivers/crypto/openssl/rte_openssl_pmd.c   |   3 +-
 drivers/crypto/snow3g/rte_snow3g_pmd.c     |   3 +-
 drivers/crypto/zuc/rte_zuc_pmd.c           |   3 +-
 examples/fips_validation/main.c            |  43 ++++--
 examples/l2fwd-crypto/main.c               |  66 ++++++---
 examples/vhost_crypto/main.c               |  12 +-
 lib/librte_cryptodev/rte_cryptodev.c       | 142 +++++++++++++++----
 lib/librte_cryptodev/rte_cryptodev.h       |  65 ++++++++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |   4 +-
 lib/librte_vhost/rte_vhost_crypto.h        |   9 +-
 lib/librte_vhost/vhost_crypto.c            |   8 +-
 test/test/test_cryptodev.c                 | 220 +++++++++++++++++------------
 test/test/test_cryptodev_blockcipher.c     |   7 +-
 test/test/test_cryptodev_blockcipher.h     |   1 +
 test/test/test_event_crypto_adapter.c      |  32 +++--
 21 files changed, 515 insertions(+), 217 deletions(-)

diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 44808f50a..f59568b80 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -469,6 +469,7 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
 
 static struct rte_cryptodev_sym_session *
 cperf_create_session(struct rte_mempool *sess_mp,
+	struct rte_mempool *priv_mp,
 	uint8_t dev_id,
 	const struct cperf_options *options,
 	const struct cperf_test_vector *test_vector,
@@ -505,7 +506,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 *  auth only
 	 */
@@ -533,7 +534,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 * cipher and auth
 	 */
@@ -592,12 +593,12 @@ cperf_create_session(struct rte_mempool *sess_mp,
 			cipher_xform.next = &auth_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &cipher_xform, sess_mp);
+					sess, &cipher_xform, priv_mp);
 		} else { /* auth then cipher */
 			auth_xform.next = &cipher_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &auth_xform, sess_mp);
+					sess, &auth_xform, priv_mp);
 		}
 	} else { /* options->op_type == CPERF_AEAD */
 		aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -618,7 +619,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 
 		/* Create crypto session */
 		rte_cryptodev_sym_session_init(dev_id,
-					sess, &aead_xform, sess_mp);
+					sess, &aead_xform, priv_mp);
 	}
 
 	return sess;
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 38a2e429f..776bf6cc3 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -21,6 +21,10 @@
 #include "cperf_test_verify.h"
 #include "cperf_test_pmd_cyclecount.h"
 
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 const char *cperf_test_type_strs[] = {
 	[CPERF_TEST_TYPE_THROUGHPUT] = "throughput",
@@ -61,8 +65,60 @@ const struct cperf_test cperf_testmap[] = {
 };
 
 static int
-cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
-			struct rte_mempool *session_pool_socket[])
+fill_session_pool_socket(int32_t socket_id, uint32_t nb_sessions)
+{
+	char mp_name[RTE_MEMPOOL_NAMESIZE];
+	struct rte_mempool *sess_mp;
+
+	if (session_pool_socket[socket_id].priv_mp == NULL) {
+		uint32_t sess_size =
+			rte_cryptodev_sym_get_max_private_session_size();
+
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"priv_sess_mp_%u", socket_id);
+
+		sess_mp = rte_mempool_create(mp_name,
+					nb_sessions,
+					sess_size,
+					0, 0, NULL, NULL, NULL,
+					NULL, socket_id,
+					0);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].priv_mp = sess_mp;
+	}
+
+	if (session_pool_socket[socket_id].sess_mp == NULL) {
+
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"sess_mp_%u", socket_id);
+
+		sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
+					nb_sessions, 0, 0, socket_id);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].sess_mp = sess_mp;
+	}
+
+	return 0;
+}
+
+static int
+cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 {
 	uint8_t enabled_cdev_count = 0, nb_lcores, cdev_id;
 	uint32_t sessions_needed = 0;
@@ -194,32 +250,15 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 				"%u sessions\n", opts->nb_qps);
 			return -ENOTSUP;
 		}
-		if (session_pool_socket[socket_id] == NULL) {
-			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
-
-			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
-			sess_mp = rte_mempool_create(mp_name,
-						sessions_needed,
-						max_sess_size,
-						0,
-						0, NULL, NULL, NULL,
-						NULL, socket_id,
-						0);
-
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
-					socket_id);
-				return -ENOMEM;
-			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
-		}
+		ret = fill_session_pool_socket(socket_id, max_sess_size,
+				sessions_needed);
+		if (ret < 0)
+			return ret;
 
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index abc7a6d5f..18d83413f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -419,7 +419,8 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+				rte_cryptodev_sym_get_header_session_size(
+					op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b0f5c4d67..135a2d8cb 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -951,7 +951,8 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+				rte_cryptodev_sym_get_header_session_size(
+					op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 3b2d7fb2f..c2f99d488 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -655,7 +655,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct armv8_crypto_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+				rte_cryptodev_sym_get_header_session_size(
+					op->sym->session));
 		rte_mempool_put(qp->sess_mp, sess);
 		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 6df645a23..84a8b31bf 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -325,7 +325,8 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+				rte_cryptodev_sym_get_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index f985afa93..100f4db30 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -2027,7 +2027,8 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		openssl_reset_session(sess);
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+				rte_cryptodev_sym_get_header_session_size(
+					op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 7d131f780..5eee54df2 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -340,7 +340,8 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+				rte_cryptodev_sym_get_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 997c2092f..09ad889ec 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -327,7 +327,8 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+				rte_cryptodev_sym_get_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e7559c633..c48ac4c9c 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -29,6 +29,8 @@ struct cryptodev_fips_validate_env {
 	uint32_t is_path_folder;
 	uint32_t dev_id;
 	struct rte_mempool *mpool;
+	struct rte_mempool *sess_mpool;
+	struct rte_mempool *sess_priv_mpool;
 	struct rte_mempool *op_pool;
 	struct rte_mbuf *mbuf;
 	struct rte_crypto_op *op;
@@ -39,7 +41,9 @@ static int
 cryptodev_fips_validate_app_int(void)
 {
 	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
-	struct rte_cryptodev_qp_conf qp_conf = {128};
+	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+	uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
+			env.dev_id);
 	int ret;
 
 	ret = rte_cryptodev_configure(env.dev_id, &conf);
@@ -49,15 +53,21 @@ cryptodev_fips_validate_app_int(void)
 	env.mpool = rte_pktmbuf_pool_create("FIPS_MEMPOOL", 128, 0, 0,
 			UINT16_MAX, rte_socket_id());
 	if (!env.mpool)
-		return ret;
-
-	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
-			rte_socket_id(), env.mpool);
-	if (ret < 0)
-		return ret;
+		return -ENOMEM;
 
 	ret = -ENOMEM;
 
+	env.sess_mpool = rte_cryptodev_sym_session_pool_create(
+			"FIPS_SESS_MEMPOOL", 16, 0, 0, rte_socket_id());
+	if (!env.sess_mpool)
+		goto error_exit;
+
+	env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
+			16, sess_sz, 0, 0, NULL, NULL, NULL,
+			NULL, rte_socket_id(), 0);
+	if (!env.sess_priv_mpool)
+		goto error_exit;
+
 	env.op_pool = rte_crypto_op_pool_create(
 			"FIPS_OP_POOL",
 			RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -75,10 +85,23 @@ cryptodev_fips_validate_app_int(void)
 	if (!env.op)
 		goto error_exit;
 
+	qp_conf.mp_session = env.sess_mpool;
+	qp_conf.mp_session_private = env.sess_priv_mpool;
+
+	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
+			rte_socket_id());
+	if (ret < 0)
+		goto error_exit;
+
 	return 0;
 
 error_exit:
+
 	rte_mempool_free(env.mpool);
+	if (env.sess_mpool)
+		rte_mempool_free(env.sess_mpool);
+	if (env.sess_priv_mpool)
+		rte_mempool_free(env.sess_priv_mpool);
 	if (env.op_pool)
 		rte_mempool_free(env.op_pool);
 
@@ -93,6 +116,8 @@ cryptodev_fips_validate_app_uninit(void)
 	rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
 	rte_cryptodev_sym_session_free(env.sess);
 	rte_mempool_free(env.mpool);
+	rte_mempool_free(env.sess_mpool);
+	rte_mempool_free(env.sess_priv_mpool);
 	rte_mempool_free(env.op_pool);
 }
 
@@ -797,12 +822,12 @@ fips_run_test(void)
 	if (ret < 0)
 		return ret;
 
-	env.sess = rte_cryptodev_sym_session_create(env.mpool);
+	env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
 	if (!env.sess)
 		return -ENOMEM;
 
 	ret = rte_cryptodev_sym_session_init(env.dev_id,
-			env.sess, &xform, env.mpool);
+			env.sess, &xform, env.sess_priv_mpool);
 	if (ret < 0) {
 		RTE_LOG(ERR, USER1, "Error %i: Init session\n",
 				ret);
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 1df7ba743..1411184a4 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -221,7 +221,10 @@ static struct rte_eth_conf port_conf = {
 
 struct rte_mempool *l2fwd_pktmbuf_pool;
 struct rte_mempool *l2fwd_crypto_op_pool;
-struct rte_mempool *session_pool_socket[RTE_MAX_NUMA_NODES] = { 0 };
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 /* Per-port statistics struct */
 struct l2fwd_port_statistics {
@@ -645,7 +648,6 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		return NULL;
 
 	uint8_t socket_id = (uint8_t) retval;
-	struct rte_mempool *sess_mp = session_pool_socket[socket_id];
 
 	if (options->xform_chain == L2FWD_CRYPTO_AEAD) {
 		first_xform = &options->aead_xform;
@@ -661,13 +663,14 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		first_xform = &options->auth_xform;
 	}
 
-	session = rte_cryptodev_sym_session_create(sess_mp);
-
+	session = rte_cryptodev_sym_session_create(
+			session_pool_socket[socket_id].sess_mp);
 	if (session == NULL)
 		return NULL;
 
 	if (rte_cryptodev_sym_session_init(cdev_id, session,
-				first_xform, sess_mp) < 0)
+				first_xform,
+				session_pool_socket[socket_id].priv_mp) < 0)
 		return NULL;
 
 	return session;
@@ -2267,38 +2270,54 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 				rte_cryptodev_scheduler_slaves_get(cdev_id,
 								NULL);
 
-			sessions_needed = 2 * enabled_cdev_count * nb_slaves;
+			sessions_needed = enabled_cdev_count * nb_slaves;
 #endif
 		} else
-			sessions_needed = 2 * enabled_cdev_count;
+			sessions_needed = enabled_cdev_count;
 
-		if (session_pool_socket[socket_id] == NULL) {
+		if (session_pool_socket[socket_id].priv_mp == NULL) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
 
 			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
+				"priv_sess_mp_%u", socket_id);
 
-			/*
-			 * Create enough objects for session headers and
-			 * device private data
-			 */
-			sess_mp = rte_mempool_create(mp_name,
+			session_pool_socket[socket_id].priv_mp =
+					rte_mempool_create(mp_name,
 						sessions_needed,
 						max_sess_sz,
-						SESSION_POOL_CACHE_SIZE,
-						0, NULL, NULL, NULL,
+						0, 0, NULL, NULL, NULL,
 						NULL, socket_id,
 						0);
 
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
+			if (session_pool_socket[socket_id].priv_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
+					socket_id);
+				return -ENOMEM;
+			}
+
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+		}
+
+		if (session_pool_socket[socket_id].sess_mp == NULL) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+				"sess_mp_%u", socket_id);
+
+			session_pool_socket[socket_id].sess_mp =
+					rte_cryptodev_sym_session_pool_create(
+							mp_name,
+							sessions_needed,
+							0, 0, socket_id);
+
+			if (session_pool_socket[socket_id].sess_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
 					socket_id);
 				return -ENOMEM;
 			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
 		}
 
 		/* Set AEAD parameters */
@@ -2443,8 +2462,9 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
 				socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index aa2727dfc..8b2ebdb09 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,6 +46,7 @@ struct vhost_crypto_info {
 	int vids[MAX_NB_SOCKETS];
 	uint32_t nb_vids;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *cop_pool;
 	uint8_t cid;
 	uint32_t qid;
@@ -289,6 +290,7 @@ new_device(int vid)
 	}
 
 	ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
+			info->sess_priv_pool,
 			rte_lcore_to_socket_id(options.los[i].lcore_id));
 	if (ret) {
 		RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -527,11 +529,17 @@ main(int argc, char *argv[])
 		}
 
 		snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
-		info->sess_pool = rte_mempool_create(name, SESSION_MAP_ENTRIES,
+		info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
+				SESSION_MAP_ENTRIES, 0, 0,
+				rte_lcore_to_socket_id(lo->lcore_id));
+
+		snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
+		info->sess_priv_pool = rte_mempool_create(name,
+				SESSION_MAP_ENTRIES,
 				rte_cryptodev_sym_get_private_session_size(
 				info->cid), 64, 0, NULL, NULL, NULL, NULL,
 				rte_lcore_to_socket_id(lo->lcore_id), 0);
-		if (!info->sess_pool) {
+		if (!info->sess_priv_pool) {
 			RTE_LOG(ERR, USER1, "Failed to create mempool");
 			goto error_exit;
 		}
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 11776b6ac..920a32cd6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1143,7 +1143,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
 	rte_spinlock_unlock(&rte_cryptodev_cb_lock);
 }
 
-
 int
 rte_cryptodev_sym_session_init(uint8_t dev_id,
 		struct rte_cryptodev_sym_session *sess,
@@ -1160,12 +1159,15 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 		return -EINVAL;
 
 	index = dev->driver_id;
+	if (index > sess->nb_drivers)
+		return -EINVAL;
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
 
-	if (sess->sess_private_data[index] == NULL) {
+	if (sess->sess_data[index].refcnt == 0) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
-							sess, mp);
+			sess, mp);
+
 		if (ret < 0) {
 			CDEV_LOG_ERR(
 				"dev_id %d failed to configure session details",
@@ -1174,6 +1176,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 		}
 	}
 
+	sess->sess_data[index].refcnt++;
 	return 0;
 }
 
@@ -1212,10 +1215,70 @@ rte_cryptodev_asym_session_init(uint8_t dev_id,
 	return 0;
 }
 
+struct rte_cryptodev_sym_session_pool_private_data {
+	uint16_t nb_drivers;
+	/**< number of elements in sess_data array */
+	uint16_t priv_size;
+	/**< session private data will be placed after sess_data */
+};
+
+struct rte_mempool *
+rte_cryptodev_sym_session_pool_create(const char *name,
+	uint32_t nb_elts, uint32_t cache_size, uint16_t priv_size,
+	int socket_id)
+{
+	struct rte_mempool *mp;
+	uint32_t elt_size;
+	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+	elt_size = (uint32_t)rte_cryptodev_sym_get_header_session_size(NULL) +
+			priv_size;
+	mp = rte_mempool_create(name, nb_elts, elt_size, cache_size,
+			(uint32_t)(sizeof(*pool_priv)),
+			NULL, NULL, NULL, NULL,
+			socket_id, 0);
+	if (mp == NULL)
+		CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d\n",
+			__func__, name, rte_errno);
+
+	pool_priv = rte_mempool_get_priv(mp);
+	if (!pool_priv) {
+		CDEV_LOG_ERR("%s(name=%s) failed to get private data\n",
+			__func__, name);
+		rte_mempool_free(mp);
+		return NULL;
+	}
+
+	pool_priv->nb_drivers = nb_drivers;
+	pool_priv->priv_size = priv_size;
+
+	return mp;
+}
+
+static unsigned int
+rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
+{
+	return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
+			sess->priv_size;
+}
+
 struct rte_cryptodev_sym_session *
 rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 {
 	struct rte_cryptodev_sym_session *sess;
+	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+	if (!mp) {
+		CDEV_LOG_ERR("Invalid mempool\n");
+		return NULL;
+	}
+
+	pool_priv = rte_mempool_get_priv(mp);
+
+	if (!pool_priv || mp->private_data_size < sizeof(*pool_priv)) {
+		CDEV_LOG_ERR("Invalid mempool\n");
+		return NULL;
+	}
 
 	/* Allocate a session structure from the session pool */
 	if (rte_mempool_get(mp, (void **)&sess)) {
@@ -1226,7 +1289,12 @@ rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 	/* Clear device session pointer.
 	 * Include the flag indicating presence of user data
 	 */
-	memset(sess, 0, (sizeof(void *) * nb_drivers) + sizeof(uint8_t));
+	sess->nb_drivers = pool_priv->nb_drivers;
+	sess->priv_size = pool_priv->priv_size;
+	sess->userdata = 0;
+
+	memset(sess->sess_data, 0,
+			rte_cryptodev_sym_session_data_size(sess));
 
 	return sess;
 }
@@ -1255,12 +1323,17 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
 		struct rte_cryptodev_sym_session *sess)
 {
 	struct rte_cryptodev *dev;
+	uint8_t driver_id;
 
 	dev = rte_cryptodev_pmd_get_dev(dev_id);
 
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
+	driver_id = dev->driver_id;
+	if (--sess->sess_data[driver_id].refcnt != 0)
+		return -EBUSY;
+
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
 
 	dev->dev_ops->sym_session_clear(dev, sess);
@@ -1290,16 +1363,15 @@ int
 rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
 {
 	uint8_t i;
-	void *sess_priv;
 	struct rte_mempool *sess_mp;
 
 	if (sess == NULL)
 		return -EINVAL;
 
 	/* Check that all device private data has been freed */
+	/* Check that all device private data has been freed */
 	for (i = 0; i < nb_drivers; i++) {
-		sess_priv = get_sym_session_private_data(sess, i);
-		if (sess_priv != NULL)
+		if (sess->sess_data[i].refcnt != 0)
 			return -EBUSY;
 	}
 
@@ -1336,14 +1408,24 @@ rte_cryptodev_asym_session_free(struct rte_cryptodev_asym_session *sess)
 
 
 unsigned int
-rte_cryptodev_sym_get_header_session_size(void)
+rte_cryptodev_sym_get_header_session_size(
+		struct rte_cryptodev_sym_session *sess)
 {
 	/*
 	 * Header contains pointers to the private data
 	 * of all registered drivers, and a flag which
 	 * indicates presence of user data
 	 */
-	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
+	if (!sess) {
+		struct rte_cryptodev_sym_session s = {0};
+		s.nb_drivers = nb_drivers;
+		s.priv_size = 0;
+
+		return (unsigned int)(sizeof(s) +
+				rte_cryptodev_sym_session_data_size(&s));
+	} else
+		return (unsigned int)(sizeof(*sess) +
+				rte_cryptodev_sym_session_data_size(sess));
 }
 
 unsigned int __rte_experimental
@@ -1361,7 +1443,6 @@ unsigned int
 rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
 {
 	struct rte_cryptodev *dev;
-	unsigned int header_size = sizeof(void *) * nb_drivers;
 	unsigned int priv_sess_size;
 
 	if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
@@ -1374,19 +1455,27 @@ rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
 
 	priv_sess_size = (*dev->dev_ops->sym_session_get_size)(dev);
 
-	/*
-	 * If size is less than session header size,
-	 * return the latter, as this guarantees that
-	 * sessionless operations will work
-	 */
-	if (priv_sess_size < header_size)
-		return header_size;
-
 	return priv_sess_size;
 
 }
 
 unsigned int __rte_experimental
+rte_cryptodev_sym_get_max_private_session_size(void)
+{
+	unsigned int priv_sess_size = 0;
+	uint8_t dev_id;
+
+	for (dev_id = 0; dev_id < rte_cryptodev_count(); dev_id++) {
+		unsigned int dev_p_size =
+			rte_cryptodev_sym_get_private_session_size(dev_id);
+
+		priv_sess_size = RTE_MAX(priv_sess_size, dev_p_size);
+	}
+
+	return priv_sess_size;
+}
+
+unsigned int __rte_experimental
 rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
 {
 	struct rte_cryptodev *dev;
@@ -1415,15 +1504,10 @@ rte_cryptodev_sym_session_set_user_data(
 					void *data,
 					uint16_t size)
 {
-	uint16_t off_set = sizeof(void *) * nb_drivers;
-	uint8_t *user_data_present = (uint8_t *)sess + off_set;
-
-	if (sess == NULL)
+	if (sess == NULL || sess->priv_size < size)
 		return -EINVAL;
 
-	*user_data_present = 1;
-	off_set += sizeof(uint8_t);
-	rte_memcpy((uint8_t *)sess + off_set, data, size);
+	rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
 	return 0;
 }
 
@@ -1431,14 +1515,10 @@ void * __rte_experimental
 rte_cryptodev_sym_session_get_user_data(
 					struct rte_cryptodev_sym_session *sess)
 {
-	uint16_t off_set = sizeof(void *) * nb_drivers;
-	uint8_t *user_data_present = (uint8_t *)sess + off_set;
-
-	if (sess == NULL || !*user_data_present)
+	if (sess == NULL || sess->priv_size == 0)
 		return NULL;
 
-	off_set += sizeof(uint8_t);
-	return (uint8_t *)sess + off_set;
+	return (void *)(sess->sess_data + sess->nb_drivers);
 }
 
 /** Initialise rte_crypto_op mempool element */
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index f9e7507da..999253f1f 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -951,14 +951,22 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 			dev->data->queue_pairs[qp_id], ops, nb_ops);
 }
 
-
 /** Cryptodev symmetric crypto session
  * Each session is derived from a fixed xform chain. Therefore each session
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	__extension__ void *sess_private_data[0];
-	/**< Private symmetric session material */
+	uint64_t userdata;
+	/**< Can be used for external metadata */
+	uint16_t nb_drivers;
+	/**< number of elements in sess_data array */
+	uint16_t priv_size;
+	/**< session private data will be placed after sess_data */
+	__extension__ struct {
+		void *data;
+		uint16_t refcnt;
+	} sess_data[0];
+	/**< Driver specific session material, variable size */
 };
 
 /** Cryptodev asymmetric crypto session */
@@ -968,6 +976,31 @@ struct rte_cryptodev_asym_session {
 };
 
 /**
+ * Create a symmetric session mempool.
+ *
+ * @param name
+ *   The unique mempool name.
+ * @param nb_elts
+ *   The number of elements in the mempool.
+ * @param cache_size
+ *   The number of per-lcore cache elements
+ * @param priv_size
+ *   The private data size of each session.
+ * @param socket_id
+ *   The *socket_id* argument is the socket identifier in the case of
+ *   NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA
+ *   constraint for the reserved zone.
+ *
+ * @return
+ *  - On success return size of the session
+ *  - On failure returns 0
+ */
+struct rte_mempool *
+rte_cryptodev_sym_session_pool_create(const char *name,
+	uint32_t nb_elts, uint32_t cache_size, uint16_t priv_size,
+	int socket_id);
+
+/**
  * Create symmetric crypto session header (generic with no private data)
  *
  * @param   mempool    Symmetric session mempool to allocate session
@@ -1097,13 +1130,22 @@ rte_cryptodev_asym_session_clear(uint8_t dev_id,
 			struct rte_cryptodev_asym_session *sess);
 
 /**
- * Get the size of the header session, for all registered drivers.
+ * Get the size of the header session, for all registered drivers excluding
+ * the private data size
+ *
+ * @param sess
+ *   The sym cryptodev session pointer
  *
  * @return
- *   Size of the symmetric eader session.
+ *   - If sess is not NULL, return the size of the header session including
+ *   the private data size defined within sess.
+ *   - If sess is NULL, return the size of the header session excluded
+ *   the private data size. This way can be used for creating the session
+ *   mempool but the user has to add its private data to this return manually.
  */
 unsigned int
-rte_cryptodev_sym_get_header_session_size(void);
+rte_cryptodev_sym_get_header_session_size(
+		struct rte_cryptodev_sym_session *sess);
 
 /**
  * Get the size of the asymmetric session header, for all registered drivers.
@@ -1129,6 +1171,17 @@ unsigned int
 rte_cryptodev_sym_get_private_session_size(uint8_t dev_id);
 
 /**
+ * Get the maximum size of the private symmetric session data
+ * for all devices.
+ *
+ * @return
+ *   - Size of the maximum private data, if successful.
+ *   - 0 if there is no device in the system.
+ */
+unsigned int __rte_experimental
+rte_cryptodev_sym_get_max_private_session_size(void);
+
+/**
  * Get the size of the private data for asymmetric session
  * on device
  *
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index f15c9af30..0dbe33997 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -475,14 +475,14 @@ RTE_INIT(init_ ##driver_id)\
 static inline void *
 get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
 		uint8_t driver_id) {
-	return sess->sess_private_data[driver_id];
+	return sess->sess_data[driver_id].data;
 }
 
 static inline void
 set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
 		uint8_t driver_id, void *private_data)
 {
-	sess->sess_private_data[driver_id] = private_data;
+	sess->sess_data[driver_id].data = private_data;
 }
 
 static inline void *
diff --git a/lib/librte_vhost/rte_vhost_crypto.h b/lib/librte_vhost/rte_vhost_crypto.h
index f9fbc0548..d08e0ffab 100644
--- a/lib/librte_vhost/rte_vhost_crypto.h
+++ b/lib/librte_vhost/rte_vhost_crypto.h
@@ -26,8 +26,9 @@ enum rte_vhost_crypto_zero_copy {
  *  The identifier of DPDK Cryptodev, the same cryptodev_id can be assigned to
  *  multiple Vhost-crypto devices.
  * @param sess_pool
- *  The pointer to the created cryptodev session pool with the private data size
- *  matches the target DPDK Cryptodev.
+ *  The pointer to the created cryptodev session pool.
+ * @param sess_priv_pool
+ *  The pointer to the created cryptodev session private data mempool.
  * @param socket_id
  *  NUMA Socket ID to allocate resources on. *
  * @return
@@ -36,7 +37,9 @@ enum rte_vhost_crypto_zero_copy {
  */
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id);
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id);
 
 /**
  *  Free the Vhost-crypto instance
diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index dd01afc08..598196fb7 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -198,6 +198,7 @@ struct vhost_crypto {
 	struct rte_hash *session_map;
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *wb_pool;
 
 	/** DPDK cryptodev ID */
@@ -369,7 +370,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
 	}
 
 	if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
-			vcrypto->sess_pool) < 0) {
+			vcrypto->sess_priv_pool) < 0) {
 		VC_LOG_ERR("Failed to initialize session");
 		sess_param->session_id = -VIRTIO_CRYPTO_ERR;
 		return;
@@ -1293,7 +1294,9 @@ vhost_crypto_complete_one_vm_requests(struct rte_crypto_op **ops,
 
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id)
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id)
 {
 	struct virtio_net *dev = get_device(vid);
 	struct rte_hash_parameters params = {0};
@@ -1321,6 +1324,7 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
 	}
 
 	vcrypto->sess_pool = sess_pool;
+	vcrypto->sess_priv_pool = sess_priv_pool;
 	vcrypto->cid = cryptodev_id;
 	vcrypto->cache_session_id = UINT64_MAX;
 	vcrypto->last_session_id = 1;
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index aac0b1f0b..db58f9807 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -48,6 +48,7 @@ struct crypto_testsuite_params {
 	struct rte_mempool *large_mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config conf;
 	struct rte_cryptodev_qp_conf qp_conf;
 
@@ -444,17 +445,24 @@ testsuite_setup(void)
 		return TEST_FAILED;
 	}
 
-	ts_params->session_mpool = rte_mempool_create(
-				"test_sess_mp",
-				MAX_NB_SESSIONS * 2,
-				session_size,
-				0, 0, NULL, NULL, NULL,
-				NULL, SOCKET_ID_ANY,
-				0);
-
+	ts_params->session_mpool =
+			rte_cryptodev_sym_session_pool_create("test_sess_mp",
+					MAX_NB_SESSIONS, 0, 0, SOCKET_ID_ANY);
 	TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
 			"session mempool allocation failed");
 
+	ts_params->session_priv_mpool = rte_mempool_create(
+			"test_sess_mp_priv",
+			MAX_NB_SESSIONS,
+			session_size,
+			0, 0, NULL, NULL, NULL,
+			NULL, SOCKET_ID_ANY,
+			0);
+	TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
+			"session mempool allocation failed");
+
+
+
 	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
 			&ts_params->conf),
 			"Failed to configure cryptodev %u with %u qps",
@@ -462,7 +470,7 @@ testsuite_setup(void)
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	ts_params->qp_conf.mp_session = ts_params->session_mpool;
-	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -491,6 +499,11 @@ testsuite_teardown(void)
 	}
 
 	/* Free session mempools */
+	if (ts_params->session_priv_mpool != NULL) {
+		rte_mempool_free(ts_params->session_priv_mpool);
+		ts_params->session_priv_mpool = NULL;
+	}
+
 	if (ts_params->session_mpool != NULL) {
 		rte_mempool_free(ts_params->session_mpool);
 		ts_params->session_mpool = NULL;
@@ -710,7 +723,7 @@ test_queue_pair_descriptor_setup(void)
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
 	qp_conf.mp_session = ts_params->session_mpool;
-	qp_conf.mp_session_private = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -1337,7 +1350,7 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
 	/* Create crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate crypto op data structure */
@@ -1551,7 +1564,7 @@ test_AES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1570,7 +1583,7 @@ test_AES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1589,7 +1602,7 @@ test_AES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1608,7 +1621,7 @@ test_DES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1627,7 +1640,7 @@ test_authonly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1646,7 +1659,7 @@ test_authonly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1664,7 +1677,7 @@ test_AES_chain_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1685,7 +1698,7 @@ test_AES_cipheronly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1704,7 +1717,7 @@ test_AES_chain_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1723,7 +1736,7 @@ test_authonly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1744,7 +1757,7 @@ test_AES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1763,7 +1776,7 @@ test_AES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1782,7 +1795,7 @@ test_AES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1801,7 +1814,7 @@ test_AES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1820,7 +1833,7 @@ test_AES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1839,7 +1852,7 @@ test_AES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1858,7 +1871,7 @@ test_AES_cipheronly_virtio_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)),
@@ -1877,7 +1890,7 @@ test_AES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1896,7 +1909,7 @@ test_AES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1915,7 +1928,7 @@ test_authonly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1935,7 +1948,7 @@ test_AES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1954,7 +1967,7 @@ test_AES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1973,7 +1986,7 @@ test_authonly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1992,7 +2005,7 @@ test_AES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2011,7 +2024,7 @@ test_AES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2030,7 +2043,7 @@ test_authonly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2049,7 +2062,7 @@ test_authonly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -2068,7 +2081,7 @@ test_authonly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -2087,7 +2100,7 @@ test_AES_chain_armv8_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)),
@@ -2106,7 +2119,7 @@ test_AES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2125,7 +2138,7 @@ test_AES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2144,7 +2157,7 @@ test_authonly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2163,7 +2176,7 @@ test_3DES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2182,7 +2195,7 @@ test_3DES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2201,6 +2214,7 @@ test_AES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2219,6 +2233,7 @@ test_AES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2237,6 +2252,7 @@ test_3DES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2255,6 +2271,7 @@ test_3DES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2273,6 +2290,7 @@ test_authonly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2315,7 +2333,8 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2352,7 +2371,8 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2468,7 +2488,8 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2527,7 +2548,8 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2589,7 +2611,8 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -5075,7 +5098,7 @@ test_3DES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5094,7 +5117,7 @@ test_DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5113,7 +5136,7 @@ test_DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5132,7 +5155,7 @@ test_DES_docsis_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5151,7 +5174,7 @@ test_DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5169,7 +5192,7 @@ test_3DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5188,7 +5211,7 @@ test_DES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5207,7 +5230,7 @@ test_3DES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5226,7 +5249,7 @@ test_3DES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5245,7 +5268,7 @@ test_3DES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5264,7 +5287,7 @@ test_3DES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5283,7 +5306,7 @@ test_3DES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5302,7 +5325,7 @@ test_3DES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5321,7 +5344,7 @@ test_3DES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5340,7 +5363,7 @@ test_3DES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5359,7 +5382,7 @@ test_3DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5378,7 +5401,7 @@ test_3DES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5397,7 +5420,7 @@ test_3DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5443,7 +5466,8 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->aead_xform, ts_params->session_mpool);
+			&ut_params->aead_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -6728,7 +6752,7 @@ test_multi_session(void)
 
 		rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				sessions[i], &ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
 				i);
@@ -6766,7 +6790,7 @@ test_multi_session(void)
 	/* Next session create should fail */
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			sessions[i], &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NULL(sessions[i],
 			"Session creation succeeded unexpectedly!");
 
@@ -6847,7 +6871,7 @@ test_multi_session_random_usage(void)
 				ts_params->valid_devs[0],
 				sessions[i],
 				&ut_paramz[i].ut_params.auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
@@ -6925,7 +6949,7 @@ test_null_cipher_only_operation(void)
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				ut_params->sess,
 				&ut_params->cipher_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6998,7 +7022,7 @@ test_null_auth_only_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7077,7 +7101,7 @@ test_null_cipher_auth_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7165,7 +7189,7 @@ test_null_auth_cipher_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7235,7 +7259,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7253,7 +7277,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7294,7 +7318,7 @@ test_null_burst_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
@@ -7429,7 +7453,7 @@ static int create_gmac_session(uint8_t dev_id,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7809,7 +7833,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7862,7 +7886,7 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -8740,12 +8764,14 @@ test_scheduler_attach_slave_op(void)
 	for (i = 0; i < rte_cryptodev_count() && nb_devs_attached < 2;
 			i++) {
 		struct rte_cryptodev_info info;
+		unsigned int session_size;
 
 		rte_cryptodev_info_get(i, &info);
 		if (info.driver_id != rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
 			continue;
 
+		session_size = rte_cryptodev_sym_get_private_session_size(i);
 		/*
 		 * Create the session mempool again, since now there are new devices
 		 * to use the mempool.
@@ -8754,8 +8780,10 @@ test_scheduler_attach_slave_op(void)
 			rte_mempool_free(ts_params->session_mpool);
 			ts_params->session_mpool = NULL;
 		}
-		unsigned int session_size =
-			rte_cryptodev_sym_get_private_session_size(i);
+		if (ts_params->session_priv_mpool) {
+			rte_mempool_free(ts_params->session_priv_mpool);
+			ts_params->session_priv_mpool = NULL;
+		}
 
 		if (info.sym.max_nb_sessions != 0 &&
 				info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
@@ -8766,19 +8794,33 @@ test_scheduler_attach_slave_op(void)
 			return TEST_FAILED;
 		}
 		/*
-		 * Create mempool with maximum number of sessions * 2,
+		 * Create mempool with maximum number of sessions,
 		 * to include the session headers
 		 */
 		if (ts_params->session_mpool == NULL) {
-			ts_params->session_mpool = rte_mempool_create(
-					"test_sess_mp",
-					MAX_NB_SESSIONS * 2,
+			ts_params->session_mpool =
+				rte_cryptodev_sym_session_pool_create(
+						"test_sess_mp",
+						MAX_NB_SESSIONS, 0, 0,
+						SOCKET_ID_ANY);
+			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+					"session mempool allocation failed");
+		}
+
+		/*
+		 * Create mempool with maximum number of sessions,
+		 * to include device specific session private data
+		 */
+		if (ts_params->session_priv_mpool == NULL) {
+			ts_params->session_priv_mpool = rte_mempool_create(
+					"test_sess_mp_priv",
+					MAX_NB_SESSIONS,
 					session_size,
 					0, 0, NULL, NULL, NULL,
 					NULL, SOCKET_ID_ANY,
 					0);
 
-			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+			TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
 					"session mempool allocation failed");
 		}
 
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 1c3f29f6b..4d6f46a6e 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -25,6 +25,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 	struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	char *test_msg)
@@ -347,7 +348,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 		sess = rte_cryptodev_sym_session_create(sess_mpool);
 
 		rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
-				sess_mpool);
+				sess_priv_mpool);
 		if (!sess) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
@@ -615,6 +616,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type)
@@ -730,7 +732,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			continue;
 
 		status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
-			sess_mpool, dev_id, driver_id, test_msg);
+			sess_mpool, sess_priv_mpool, dev_id, driver_id,
+			test_msg);
 
 		printf("  %u) TestCase %s %s\n", test_index ++,
 			tc->test_descr, test_msg);
diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h
index f8bd85838..5c22d5da6 100644
--- a/test/test/test_cryptodev_blockcipher.h
+++ b/test/test/test_cryptodev_blockcipher.h
@@ -104,6 +104,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type);
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index 54717870e..b930dd9c3 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -61,6 +61,7 @@ struct event_crypto_adapter_test_params {
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config *config;
 	uint8_t crypto_event_port_id;
 };
@@ -193,12 +194,13 @@ test_op_forward_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		/* Create Crypto session*/
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
 							evdev, &cap);
@@ -381,7 +383,8 @@ test_op_new_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
@@ -396,7 +399,7 @@ test_op_new_mode(uint8_t session_less)
 						&m_data, sizeof(m_data));
 		}
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 		rte_crypto_op_attach_sym_session(op, sess);
 	} else {
 		struct rte_crypto_sym_xform *first_xform;
@@ -526,15 +529,20 @@ configure_cryptodev(void)
 	session_size = rte_cryptodev_sym_get_private_session_size(TEST_CDEV_ID);
 	session_size += sizeof(union rte_event_crypto_metadata);
 
-	params.session_mpool = rte_mempool_create(
-				"CRYPTO_ADAPTER_SESSION_MP",
-				MAX_NB_SESSIONS * 2,
+	params.session_mpool = rte_cryptodev_sym_session_pool_create(
+			"CRYPTO_ADAPTER_SESSION_MP",
+			MAX_NB_SESSIONS, 0, 0, SOCKET_ID_ANY);
+	TEST_ASSERT_NOT_NULL(params.session_mpool,
+			"session mempool allocation failed\n");
+
+	params.session_priv_mpool = rte_mempool_create(
+				"CRYPTO_ADAPTER_SESSION_MP_PRIV",
+				MAX_NB_SESSIONS,
 				session_size,
 				0, 0, NULL, NULL, NULL,
 				NULL, SOCKET_ID_ANY,
 				0);
-
-	TEST_ASSERT_NOT_NULL(params.session_mpool,
+	TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
 			"session mempool allocation failed\n");
 
 	rte_cryptodev_info_get(TEST_CDEV_ID, &info);
@@ -547,7 +555,7 @@ configure_cryptodev(void)
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	qp_conf.mp_session = params.session_mpool;
-	qp_conf.mp_session_private = params.session_mpool;
+	qp_conf.mp_session_private = params.session_priv_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -859,6 +867,10 @@ crypto_teardown(void)
 		rte_mempool_free(params.session_mpool);
 		params.session_mpool = NULL;
 	}
+	if (params.session_priv_mpool != NULL) {
+		rte_mempool_free(params.session_priv_mpool);
+		params.session_priv_mpool = NULL;
+	}
 
 	/* Free ops mempool */
 	if (params.op_mpool != NULL) {
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure Fan Zhang
@ 2018-11-16  0:47   ` Ananyev, Konstantin
  2018-11-16 14:32   ` Ananyev, Konstantin
  1 sibling, 0 replies; 61+ messages in thread
From: Ananyev, Konstantin @ 2018-11-16  0:47 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal

Hi Fan,

> -
>  /** Cryptodev symmetric crypto session
>   * Each session is derived from a fixed xform chain. Therefore each session
>   * has a fixed algo, key, op-type, digest_len etc.
>   */
>  struct rte_cryptodev_sym_session {
> -	__extension__ void *sess_private_data[0];
> -	/**< Private symmetric session material */
> +	uint64_t userdata;
> +	/**< Can be used for external metadata */
> +	uint16_t nb_drivers;
> +	/**< number of elements in sess_data array */
> +	uint16_t priv_size;
> +	/**< session private data will be placed after sess_data */
> +	__extension__ struct {
> +		void *data;
> +		uint16_t refcnt;
> +	} sess_data[0];
> +	/**< Driver specific session material, variable size */
>  };
> 

As discussed in the thread [1] to avoid naming collisions, it was
agreed to re-name 'userdata' field to 'opaque_data' and
'priv_size' to ' 'user_data_sz'.
Konstantin

[1] https://mails.dpdk.org/archives/dev/2018-November/118941.html

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
@ 2018-11-16 12:05   ` Ananyev, Konstantin
  2018-11-19 10:12     ` Zhang, Roy Fan
  2018-12-04 16:05   ` Trahe, Fiona
  1 sibling, 1 reply; 61+ messages in thread
From: Ananyev, Konstantin @ 2018-11-16 12:05 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal

Hi Fan,

> --- a/config/common_base
> +++ b/config/common_base
> @@ -446,7 +446,7 @@ CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD=n
>  #
>  # Compile null PMD
>  #
> -CONFIG_RTE_LIBRTE_PMD_NULL=y
> +CONFIG_RTE_LIBRTE_PMD_NULL=n
> 
>  #
>  # Compile software PMD backed by PCAP files
> @@ -525,13 +525,13 @@ CONFIG_RTE_LIBRTE_DPAA_MAX_CRYPTODEV=4
>  #
>  # Compile PMD for Cavium OCTEON TX crypto device
>  #
> -CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=y
> +CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=n
> 
>  #
>  # Compile PMD for QuickAssist based devices - see docs for details
>  #
>  CONFIG_RTE_LIBRTE_PMD_QAT=y
> -CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n
> +CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y
>  #
>  # Max. number of QuickAssist devices, which can be detected and attached
>  #
> @@ -551,33 +551,33 @@ CONFIG_RTE_MAX_VIRTIO_CRYPTO=32
>  #
>  # Compile PMD for AESNI backed device
>  #
> -CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
> +CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y
> 
>  #
>  # Compile PMD for Software backed device
>  #
> -CONFIG_RTE_LIBRTE_PMD_OPENSSL=n
> +CONFIG_RTE_LIBRTE_PMD_OPENSSL=y
> 
>  #
>  # Compile PMD for AESNI GCM device
>  #
> -CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=n
> +CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=y
> 
>  #
>  # Compile PMD for SNOW 3G device
>  #
> -CONFIG_RTE_LIBRTE_PMD_SNOW3G=n
> +CONFIG_RTE_LIBRTE_PMD_SNOW3G=y
>  CONFIG_RTE_LIBRTE_PMD_SNOW3G_DEBUG=n
> 
>  #
>  # Compile PMD for KASUMI device
>  #
> -CONFIG_RTE_LIBRTE_PMD_KASUMI=n
> +CONFIG_RTE_LIBRTE_PMD_KASUMI=y
> 
>  #
>  # Compile PMD for ZUC device
>  #
> -CONFIG_RTE_LIBRTE_PMD_ZUC=n
> +CONFIG_RTE_LIBRTE_PMD_ZUC=y
> 
>  # Compile PMD for Crypto Scheduler device
>  #
> @@ -601,7 +601,7 @@ CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO=n
>  #
>  # Compile generic security library
>  #
> -CONFIG_RTE_LIBRTE_SECURITY=y
> +CONFIG_RTE_LIBRTE_SECURITY=n
> 
>  #
>  # Compile generic compression device library
> @@ -842,7 +842,7 @@ CONFIG_RTE_LIBRTE_METER=y
>  #
>  # Compile librte_classify
>  #
> -CONFIG_RTE_LIBRTE_FLOW_CLASSIFY=y
> +CONFIG_RTE_LIBRTE_FLOW_CLASSIFY=n
> 
>  #
>  # Compile librte_sched
> @@ -939,7 +939,7 @@ CONFIG_RTE_PROC_INFO=n
>  #
>  # Compile the PMD test application
>  #
> -CONFIG_RTE_TEST_PMD=y
> +CONFIG_RTE_TEST_PMD=n
>  CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
>  CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
> 

Not sure why config changes are needed.
Guess just by mistake?
Konstantin

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure Fan Zhang
  2018-11-16  0:47   ` Ananyev, Konstantin
@ 2018-11-16 14:32   ` Ananyev, Konstantin
  2018-11-19 10:11     ` Zhang, Roy Fan
  1 sibling, 1 reply; 61+ messages in thread
From: Ananyev, Konstantin @ 2018-11-16 14:32 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal

Hi Fan,

> 
> This patch changes the symmetric session structure of cryptodev.
> The symmetric session now contains extra information for secure
> access purposes. The patch also includes the updates to the
> PMDs, test applications, and examples to fit the change.

Few more comments from me in-line below.
Also a generic question - docs also might also need to be updated? 
Apart from that and naming collisions - looks good overall.
Konstantin

> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  app/test-crypto-perf/cperf_ops.c           |  11 +-
>  app/test-crypto-perf/main.c                |  91 ++++++++----
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c   |   3 +-
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |   3 +-
>  drivers/crypto/armv8/rte_armv8_pmd.c       |   3 +-
>  drivers/crypto/kasumi/rte_kasumi_pmd.c     |   3 +-
>  drivers/crypto/openssl/rte_openssl_pmd.c   |   3 +-
>  drivers/crypto/snow3g/rte_snow3g_pmd.c     |   3 +-
>  drivers/crypto/zuc/rte_zuc_pmd.c           |   3 +-
>  examples/fips_validation/main.c            |  43 ++++--
>  examples/l2fwd-crypto/main.c               |  66 ++++++---
>  examples/vhost_crypto/main.c               |  12 +-

Shouldn't ipsec-secgw also be updated?

>  lib/librte_cryptodev/rte_cryptodev.c       | 142 +++++++++++++++----
>  lib/librte_cryptodev/rte_cryptodev.h       |  65 ++++++++-
>  lib/librte_cryptodev/rte_cryptodev_pmd.h   |   4 +-
>  lib/librte_vhost/rte_vhost_crypto.h        |   9 +-
>  lib/librte_vhost/vhost_crypto.c            |   8 +-
>  test/test/test_cryptodev.c                 | 220 +++++++++++++++++------------
>  test/test/test_cryptodev_blockcipher.c     |   7 +-
>  test/test/test_cryptodev_blockcipher.h     |   1 +
>  test/test/test_event_crypto_adapter.c      |  32 +++--
>  21 files changed, 515 insertions(+), 217 deletions(-)
> 

...

> diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> index b0f5c4d67..135a2d8cb 100644
> --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> @@ -951,7 +951,8 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
>  	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
>  		memset(sess, 0, sizeof(struct aesni_mb_session));
>  		memset(op->sym->session, 0,
> -				rte_cryptodev_sym_get_header_session_size());
> +				rte_cryptodev_sym_get_header_session_size(
> +					op->sym->session));
>  		rte_mempool_put(qp->sess_mp_priv, sess);
>  		rte_mempool_put(qp->sess_mp, op->sym->session);
>  		op->sym->session = NULL;

As a generic one - all the drivers for session-less sessions assume that sess_mp is initialized with
DIM(sess_data[]) greater than their driver id.
It is a valid assumption, but should we add extra check in rte_cryptodev_queue_pair_setup()?

...

> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
> index 11776b6ac..920a32cd6 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -1143,7 +1143,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
>  	rte_spinlock_unlock(&rte_cryptodev_cb_lock);
>  }
> 
> -
>  int
>  rte_cryptodev_sym_session_init(uint8_t dev_id,
>  		struct rte_cryptodev_sym_session *sess,
> @@ -1160,12 +1159,15 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
>  		return -EINVAL;
> 
>  	index = dev->driver_id;
> +	if (index > sess->nb_drivers)
> +		return -EINVAL;
> 
>  	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
> 
> -	if (sess->sess_private_data[index] == NULL) {
> +	if (sess->sess_data[index].refcnt == 0) {
>  		ret = dev->dev_ops->sym_session_configure(dev, xforms,
> -							sess, mp);
> +			sess, mp);
> +
>  		if (ret < 0) {
>  			CDEV_LOG_ERR(
>  				"dev_id %d failed to configure session details",
> @@ -1174,6 +1176,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
>  		}
>  	}
> 
> +	sess->sess_data[index].refcnt++;
>  	return 0;
>  }
> 
> @@ -1212,10 +1215,70 @@ rte_cryptodev_asym_session_init(uint8_t dev_id,
>  	return 0;
>  }
> 
> +struct rte_cryptodev_sym_session_pool_private_data {
> +	uint16_t nb_drivers;
> +	/**< number of elements in sess_data array */
> +	uint16_t priv_size;
> +	/**< session private data will be placed after sess_data */
> +};
> +
> +struct rte_mempool *
> +rte_cryptodev_sym_session_pool_create(const char *name,
> +	uint32_t nb_elts, uint32_t cache_size, uint16_t priv_size,
> +	int socket_id)
> +{
> +	struct rte_mempool *mp;
> +	uint32_t elt_size;
> +	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
> +
> +	elt_size = (uint32_t)rte_cryptodev_sym_get_header_session_size(NULL) +
> +			priv_size;
> +	mp = rte_mempool_create(name, nb_elts, elt_size, cache_size,
> +			(uint32_t)(sizeof(*pool_priv)),
> +			NULL, NULL, NULL, NULL,
> +			socket_id, 0);
> +	if (mp == NULL)
> +		CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d\n",
> +			__func__, name, rte_errno);
> +
> +	pool_priv = rte_mempool_get_priv(mp);
> +	if (!pool_priv) {
> +		CDEV_LOG_ERR("%s(name=%s) failed to get private data\n",
> +			__func__, name);
> +		rte_mempool_free(mp);
> +		return NULL;
> +	}
> +
> +	pool_priv->nb_drivers = nb_drivers;
> +	pool_priv->priv_size = priv_size;
> +
> +	return mp;
> +}
> +
> +static unsigned int
> +rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
> +{
> +	return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
> +			sess->priv_size;
> +}
> +
>  struct rte_cryptodev_sym_session *
>  rte_cryptodev_sym_session_create(struct rte_mempool *mp)
>  {
>  	struct rte_cryptodev_sym_session *sess;
> +	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
> +
> +	if (!mp) {
> +		CDEV_LOG_ERR("Invalid mempool\n");
> +		return NULL;
> +	}
> +
> +	pool_priv = rte_mempool_get_priv(mp);
> +
> +	if (!pool_priv || mp->private_data_size < sizeof(*pool_priv)) {
> +		CDEV_LOG_ERR("Invalid mempool\n");
> +		return NULL;
> +	}
> 
>  	/* Allocate a session structure from the session pool */
>  	if (rte_mempool_get(mp, (void **)&sess)) {
> @@ -1226,7 +1289,12 @@ rte_cryptodev_sym_session_create(struct rte_mempool *mp)
>  	/* Clear device session pointer.
>  	 * Include the flag indicating presence of user data
>  	 */
> -	memset(sess, 0, (sizeof(void *) * nb_drivers) + sizeof(uint8_t));
> +	sess->nb_drivers = pool_priv->nb_drivers;
> +	sess->priv_size = pool_priv->priv_size;
> +	sess->userdata = 0;
> +
> +	memset(sess->sess_data, 0,
> +			rte_cryptodev_sym_session_data_size(sess));
> 
>  	return sess;
>  }
> @@ -1255,12 +1323,17 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
>  		struct rte_cryptodev_sym_session *sess)
>  {
>  	struct rte_cryptodev *dev;
> +	uint8_t driver_id;
> 
>  	dev = rte_cryptodev_pmd_get_dev(dev_id);
> 
>  	if (dev == NULL || sess == NULL)
>  		return -EINVAL;
> 
> +	driver_id = dev->driver_id;
> +	if (--sess->sess_data[driver_id].refcnt != 0)
> +		return -EBUSY;
> +
>  	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
> 
>  	dev->dev_ops->sym_session_clear(dev, sess);
> @@ -1290,16 +1363,15 @@ int
>  rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
>  {
>  	uint8_t i;
> -	void *sess_priv;
>  	struct rte_mempool *sess_mp;
> 
>  	if (sess == NULL)
>  		return -EINVAL;
> 
>  	/* Check that all device private data has been freed */
> +	/* Check that all device private data has been freed */
>  	for (i = 0; i < nb_drivers; i++) {

As Fiona pointed we have to use sess->nb_drivers here.

> -		sess_priv = get_sym_session_private_data(sess, i);
> -		if (sess_priv != NULL)
> +		if (sess->sess_data[i].refcnt != 0)
>  			return -EBUSY;
>  	}
> 
> @@ -1336,14 +1408,24 @@ rte_cryptodev_asym_session_free(struct rte_cryptodev_asym_session *sess)
> 
> 
>  unsigned int
> -rte_cryptodev_sym_get_header_session_size(void)
> +rte_cryptodev_sym_get_header_session_size(
> +		struct rte_cryptodev_sym_session *sess)

That's a change in the public API, np in general,
but I suppose needs to be documented (release notes?).

>  {
>  	/*
>  	 * Header contains pointers to the private data
>  	 * of all registered drivers, and a flag which
>  	 * indicates presence of user data
>  	 */
> -	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
> +	if (!sess) {
> +		struct rte_cryptodev_sym_session s = {0};
> +		s.nb_drivers = nb_drivers;
> +		s.priv_size = 0;
> +
> +		return (unsigned int)(sizeof(s) +
> +				rte_cryptodev_sym_session_data_size(&s));
> +	} else
> +		return (unsigned int)(sizeof(*sess) +
> +				rte_cryptodev_sym_session_data_size(sess));
>  }
> 
>  unsigned int __rte_experimental
> @@ -1361,7 +1443,6 @@ unsigned int
>  rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
>  {
>  	struct rte_cryptodev *dev;
> -	unsigned int header_size = sizeof(void *) * nb_drivers;
>  	unsigned int priv_sess_size;
> 
>  	if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
> @@ -1374,19 +1455,27 @@ rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
> 
>  	priv_sess_size = (*dev->dev_ops->sym_session_get_size)(dev);
> 
> -	/*
> -	 * If size is less than session header size,
> -	 * return the latter, as this guarantees that
> -	 * sessionless operations will work
> -	 */
> -	if (priv_sess_size < header_size)
> -		return header_size;
> -
>  	return priv_sess_size;
> 
>  }
> 
>  unsigned int __rte_experimental
> +rte_cryptodev_sym_get_max_private_session_size(void)
> +{
> +	unsigned int priv_sess_size = 0;
> +	uint8_t dev_id;
> +
> +	for (dev_id = 0; dev_id < rte_cryptodev_count(); dev_id++) {
> +		unsigned int dev_p_size =
> +			rte_cryptodev_sym_get_private_session_size(dev_id);
> +
> +		priv_sess_size = RTE_MAX(priv_sess_size, dev_p_size);
> +	}
> +
> +	return priv_sess_size;
> +}
> +
> +unsigned int __rte_experimental
>  rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
>  {
>  	struct rte_cryptodev *dev;
> @@ -1415,15 +1504,10 @@ rte_cryptodev_sym_session_set_user_data(
>  					void *data,
>  					uint16_t size)
>  {
> -	uint16_t off_set = sizeof(void *) * nb_drivers;
> -	uint8_t *user_data_present = (uint8_t *)sess + off_set;
> -
> -	if (sess == NULL)
> +	if (sess == NULL || sess->priv_size < size)
>  		return -EINVAL;
> 
> -	*user_data_present = 1;
> -	off_set += sizeof(uint8_t);
> -	rte_memcpy((uint8_t *)sess + off_set, data, size);
> +	rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
>  	return 0;
>  }
> 
> @@ -1431,14 +1515,10 @@ void * __rte_experimental
>  rte_cryptodev_sym_session_get_user_data(
>  					struct rte_cryptodev_sym_session *sess)
>  {
> -	uint16_t off_set = sizeof(void *) * nb_drivers;
> -	uint8_t *user_data_present = (uint8_t *)sess + off_set;
> -
> -	if (sess == NULL || !*user_data_present)
> +	if (sess == NULL || sess->priv_size == 0)
>  		return NULL;
> 
> -	off_set += sizeof(uint8_t);
> -	return (uint8_t *)sess + off_set;
> +	return (void *)(sess->sess_data + sess->nb_drivers);
>  }
> 
>  /** Initialise rte_crypto_op mempool element */
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> index f9e7507da..999253f1f 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
> @@ -951,14 +951,22 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
>  			dev->data->queue_pairs[qp_id], ops, nb_ops);
>  }
> 
> -
>  /** Cryptodev symmetric crypto session
>   * Each session is derived from a fixed xform chain. Therefore each session
>   * has a fixed algo, key, op-type, digest_len etc.
>   */
>  struct rte_cryptodev_sym_session {
> -	__extension__ void *sess_private_data[0];
> -	/**< Private symmetric session material */
> +	uint64_t userdata;
> +	/**< Can be used for external metadata */
> +	uint16_t nb_drivers;
> +	/**< number of elements in sess_data array */
> +	uint16_t priv_size;
> +	/**< session private data will be placed after sess_data */
> +	__extension__ struct {
> +		void *data;
> +		uint16_t refcnt;
> +	} sess_data[0];
> +	/**< Driver specific session material, variable size */
>  };
> 
>  /** Cryptodev asymmetric crypto session */
> @@ -968,6 +976,31 @@ struct rte_cryptodev_asym_session {
>  };
> 
>  /**
> + * Create a symmetric session mempool.
> + *
> + * @param name
> + *   The unique mempool name.
> + * @param nb_elts
> + *   The number of elements in the mempool.
> + * @param cache_size
> + *   The number of per-lcore cache elements
> + * @param priv_size
> + *   The private data size of each session.
> + * @param socket_id
> + *   The *socket_id* argument is the socket identifier in the case of
> + *   NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA
> + *   constraint for the reserved zone.
> + *
> + * @return
> + *  - On success return size of the session
> + *  - On failure returns 0
> + */
> +struct rte_mempool *
> +rte_cryptodev_sym_session_pool_create(const char *name,
> +	uint32_t nb_elts, uint32_t cache_size, uint16_t priv_size,
> +	int socket_id);

New function - needs experimental tag, I think.

> +
> +/**
>   * Create symmetric crypto session header (generic with no private data)
>   *
>   * @param   mempool    Symmetric session mempool to allocate session
> @@ -1097,13 +1130,22 @@ rte_cryptodev_asym_session_clear(uint8_t dev_id,
>  			struct rte_cryptodev_asym_session *sess);
> 
>  /**
> - * Get the size of the header session, for all registered drivers.
> + * Get the size of the header session, for all registered drivers excluding
> + * the private data size
> + *
> + * @param sess
> + *   The sym cryptodev session pointer
>   *
>   * @return
> - *   Size of the symmetric eader session.
> + *   - If sess is not NULL, return the size of the header session including
> + *   the private data size defined within sess.
> + *   - If sess is NULL, return the size of the header session excluded
> + *   the private data size. This way can be used for creating the session
> + *   mempool but the user has to add its private data to this return manually.
>   */
>  unsigned int
> -rte_cryptodev_sym_get_header_session_size(void);
> +rte_cryptodev_sym_get_header_session_size(
> +		struct rte_cryptodev_sym_session *sess);
> 
>  /**
>   * Get the size of the asymmetric session header, for all registered drivers.
> @@ -1129,6 +1171,17 @@ unsigned int
>  rte_cryptodev_sym_get_private_session_size(uint8_t dev_id);
> 
>  /**
> + * Get the maximum size of the private symmetric session data
> + * for all devices.
> + *
> + * @return
> + *   - Size of the maximum private data, if successful.
> + *   - 0 if there is no device in the system.
> + */
> +unsigned int __rte_experimental
> +rte_cryptodev_sym_get_max_private_session_size(void);
> +
> +/**
>   * Get the size of the private data for asymmetric session
>   * on device
>   *

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure
  2018-11-16 14:32   ` Ananyev, Konstantin
@ 2018-11-19 10:11     ` Zhang, Roy Fan
  0 siblings, 0 replies; 61+ messages in thread
From: Zhang, Roy Fan @ 2018-11-19 10:11 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev; +Cc: akhil.goyal

Hi Konstantin,
Thanks for the review. Comments inline.

> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Friday, November 16, 2018 2:32 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com
> Subject: RE: [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session
> structure
> 
> Hi Fan,
> 
> >
> > This patch changes the symmetric session structure of cryptodev.
> > The symmetric session now contains extra information for secure access
> > purposes. The patch also includes the updates to the PMDs, test
> > applications, and examples to fit the change.
> 
> Few more comments from me in-line below.
> Also a generic question - docs also might also need to be updated?
> Apart from that and naming collisions - looks good overall.
> Konstantin
> 
> As a generic one - all the drivers for session-less sessions assume that
> sess_mp is initialized with
> DIM(sess_data[]) greater than their driver id.
> It is a valid assumption, but should we add extra check in
> rte_cryptodev_queue_pair_setup()?
> 

[Fan: Ok, will do.]
 
> ...
> >  	/* Check that all device private data has been freed */
> > +	/* Check that all device private data has been freed */
> >  	for (i = 0; i < nb_drivers; i++) {
> 
> As Fiona pointed we have to use sess->nb_drivers here.
[Fan: Yes, you are right] 
> 
> > -		sess_priv = get_sym_session_private_data(sess, i);
> > -		if (sess_priv != NULL)
> > +		if (sess->sess_data[i].refcnt != 0)
> >  			return -EBUSY;
> >  	}
> >
> > @@ -1336,14 +1408,24 @@ rte_cryptodev_asym_session_free(struct
> > rte_cryptodev_asym_session *sess)
> >
> >
> >  unsigned int
> > -rte_cryptodev_sym_get_header_session_size(void)
> > +rte_cryptodev_sym_get_header_session_size(
> > +		struct rte_cryptodev_sym_session *sess)
> 
> That's a change in the public API, np in general, but I suppose needs to be
> documented (release notes?).

[Yest that's right, I will update this in V2]
> 
> >  {
> >  	/*
> >  	 * Header contains pointers to the private data
> >  	 * of all registered drivers, and a flag which
> >  	 * indicates presence of user data
> >  	 */
> > -	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
> > +	if (!sess) {
> > +		struct rte_cryptodev_sym_session s = {0};
> > +		s.nb_drivers = nb_drivers;
> > +		s.priv_size = 0;
> > +
> > +		return (unsigned int)(sizeof(s) +
> > +				rte_cryptodev_sym_session_data_size(&s));
> > +	} else
> > +		return (unsigned int)(sizeof(*sess) +
> > +
> 	rte_cryptodev_sym_session_data_size(sess));
> >  }
> >
> >  unsigned int __rte_experimental
> > @@ -1361,7 +1443,6 @@ unsigned int
> >  rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)  {
> >  	struct rte_cryptodev *dev;
> > -	unsigned int header_size = sizeof(void *) * nb_drivers;
> >  	unsigned int priv_sess_size;
> >
> >  	if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
> > @@ -1374,19 +1455,27 @@
> > rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
> >
> >  	priv_sess_size = (*dev->dev_ops->sym_session_get_size)(dev);
> >
> > -	/*
> > -	 * If size is less than session header size,
> > -	 * return the latter, as this guarantees that
> > -	 * sessionless operations will work
> > -	 */
> > -	if (priv_sess_size < header_size)
> > -		return header_size;
> > -
> >  	return priv_sess_size;
> >
> >  }
> >
> >  unsigned int __rte_experimental
> > +rte_cryptodev_sym_get_max_private_session_size(void)
> > +{
> > +	unsigned int priv_sess_size = 0;
> > +	uint8_t dev_id;
> > +
> > +	for (dev_id = 0; dev_id < rte_cryptodev_count(); dev_id++) {
> > +		unsigned int dev_p_size =
> > +
> 	rte_cryptodev_sym_get_private_session_size(dev_id);
> > +
> > +		priv_sess_size = RTE_MAX(priv_sess_size, dev_p_size);
> > +	}
> > +
> > +	return priv_sess_size;
> > +}
> > +
> > +unsigned int __rte_experimental
> >  rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)  {
> >  	struct rte_cryptodev *dev;
> > @@ -1415,15 +1504,10 @@ rte_cryptodev_sym_session_set_user_data(
> >  					void *data,
> >  					uint16_t size)
> >  {
> > -	uint16_t off_set = sizeof(void *) * nb_drivers;
> > -	uint8_t *user_data_present = (uint8_t *)sess + off_set;
> > -
> > -	if (sess == NULL)
> > +	if (sess == NULL || sess->priv_size < size)
> >  		return -EINVAL;
> >
> > -	*user_data_present = 1;
> > -	off_set += sizeof(uint8_t);
> > -	rte_memcpy((uint8_t *)sess + off_set, data, size);
> > +	rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
> >  	return 0;
> >  }
> >
> > @@ -1431,14 +1515,10 @@ void * __rte_experimental
> > rte_cryptodev_sym_session_get_user_data(
> >  					struct rte_cryptodev_sym_session
> *sess)  {
> > -	uint16_t off_set = sizeof(void *) * nb_drivers;
> > -	uint8_t *user_data_present = (uint8_t *)sess + off_set;
> > -
> > -	if (sess == NULL || !*user_data_present)
> > +	if (sess == NULL || sess->priv_size == 0)
> >  		return NULL;
> >
> > -	off_set += sizeof(uint8_t);
> > -	return (uint8_t *)sess + off_set;
> > +	return (void *)(sess->sess_data + sess->nb_drivers);
> >  }
> >
> >  /** Initialise rte_crypto_op mempool element */ diff --git
> > a/lib/librte_cryptodev/rte_cryptodev.h
> > b/lib/librte_cryptodev/rte_cryptodev.h
> > index f9e7507da..999253f1f 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev.h
> > +++ b/lib/librte_cryptodev/rte_cryptodev.h
> > @@ -951,14 +951,22 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id,
> uint16_t qp_id,
> >  			dev->data->queue_pairs[qp_id], ops, nb_ops);  }
> >
> > -
> >  /** Cryptodev symmetric crypto session
> >   * Each session is derived from a fixed xform chain. Therefore each session
> >   * has a fixed algo, key, op-type, digest_len etc.
> >   */
> >  struct rte_cryptodev_sym_session {
> > -	__extension__ void *sess_private_data[0];
> > -	/**< Private symmetric session material */
> > +	uint64_t userdata;
> > +	/**< Can be used for external metadata */
> > +	uint16_t nb_drivers;
> > +	/**< number of elements in sess_data array */
> > +	uint16_t priv_size;
> > +	/**< session private data will be placed after sess_data */
> > +	__extension__ struct {
> > +		void *data;
> > +		uint16_t refcnt;
> > +	} sess_data[0];
> > +	/**< Driver specific session material, variable size */
> >  };
> >
> >  /** Cryptodev asymmetric crypto session */ @@ -968,6 +976,31 @@
> > struct rte_cryptodev_asym_session {  };
> >
> >  /**
> > + * Create a symmetric session mempool.
> > + *
> > + * @param name
> > + *   The unique mempool name.
> > + * @param nb_elts
> > + *   The number of elements in the mempool.
> > + * @param cache_size
> > + *   The number of per-lcore cache elements
> > + * @param priv_size
> > + *   The private data size of each session.
> > + * @param socket_id
> > + *   The *socket_id* argument is the socket identifier in the case of
> > + *   NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA
> > + *   constraint for the reserved zone.
> > + *
> > + * @return
> > + *  - On success return size of the session
> > + *  - On failure returns 0
> > + */
> > +struct rte_mempool *
> > +rte_cryptodev_sym_session_pool_create(const char *name,
> > +	uint32_t nb_elts, uint32_t cache_size, uint16_t priv_size,
> > +	int socket_id);
> 
> New function - needs experimental tag, I think.
> 
> > +
> > +/**
> >   * Create symmetric crypto session header (generic with no private data)
> >   *
> >   * @param   mempool    Symmetric session mempool to allocate session
> > @@ -1097,13 +1130,22 @@ rte_cryptodev_asym_session_clear(uint8_t
> dev_id,
> >  			struct rte_cryptodev_asym_session *sess);
> >
> >  /**
> > - * Get the size of the header session, for all registered drivers.
> > + * Get the size of the header session, for all registered drivers
> > + excluding
> > + * the private data size
> > + *
> > + * @param sess
> > + *   The sym cryptodev session pointer
> >   *
> >   * @return
> > - *   Size of the symmetric eader session.
> > + *   - If sess is not NULL, return the size of the header session including
> > + *   the private data size defined within sess.
> > + *   - If sess is NULL, return the size of the header session excluded
> > + *   the private data size. This way can be used for creating the session
> > + *   mempool but the user has to add its private data to this return
> manually.
> >   */
> >  unsigned int
> > -rte_cryptodev_sym_get_header_session_size(void);
> > +rte_cryptodev_sym_get_header_session_size(
> > +		struct rte_cryptodev_sym_session *sess);
> >
> >  /**
> >   * Get the size of the asymmetric session header, for all registered drivers.
> > @@ -1129,6 +1171,17 @@ unsigned int
> >  rte_cryptodev_sym_get_private_session_size(uint8_t dev_id);
> >
> >  /**
> > + * Get the maximum size of the private symmetric session data
> > + * for all devices.
> > + *
> > + * @return
> > + *   - Size of the maximum private data, if successful.
> > + *   - 0 if there is no device in the system.
> > + */
> > +unsigned int __rte_experimental
> > +rte_cryptodev_sym_get_max_private_session_size(void);
> > +
> > +/**
> >   * Get the size of the private data for asymmetric session
> >   * on device
> >   *

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure
  2018-11-16 12:05   ` Ananyev, Konstantin
@ 2018-11-19 10:12     ` Zhang, Roy Fan
  0 siblings, 0 replies; 61+ messages in thread
From: Zhang, Roy Fan @ 2018-11-19 10:12 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev; +Cc: akhil.goyal

Hi Konstantin,

Ah, sorry they are added by mistake. Will not happen in V2.

Regards,
fan

> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Friday, November 16, 2018 12:06 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com
> Subject: RE: [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure
> structure
> 
> Hi Fan,
> 
> > --- a/config/common_base
> > +++ b/config/common_base
> > @@ -446,7 +446,7 @@ CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD=n
> >  #
> >  # Compile null PMD
> >  #
> > -CONFIG_RTE_LIBRTE_PMD_NULL=y
> > +CONFIG_RTE_LIBRTE_PMD_NULL=n
> >
> >  #
> >  # Compile software PMD backed by PCAP files @@ -525,13 +525,13 @@
> > CONFIG_RTE_LIBRTE_DPAA_MAX_CRYPTODEV=4
> >  #
> >  # Compile PMD for Cavium OCTEON TX crypto device  #
> > -CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=y
> > +CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=n
> >
> >  #
> >  # Compile PMD for QuickAssist based devices - see docs for details  #
> > CONFIG_RTE_LIBRTE_PMD_QAT=y -
> CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n
> > +CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y
> >  #
> >  # Max. number of QuickAssist devices, which can be detected and
> > attached  # @@ -551,33 +551,33 @@
> CONFIG_RTE_MAX_VIRTIO_CRYPTO=32  #
> > # Compile PMD for AESNI backed device  #
> > -CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
> > +CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y
> >
> >  #
> >  # Compile PMD for Software backed device
> >  #
> > -CONFIG_RTE_LIBRTE_PMD_OPENSSL=n
> > +CONFIG_RTE_LIBRTE_PMD_OPENSSL=y
> >
> >  #
> >  # Compile PMD for AESNI GCM device
> >  #
> > -CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=n
> > +CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=y
> >
> >  #
> >  # Compile PMD for SNOW 3G device
> >  #
> > -CONFIG_RTE_LIBRTE_PMD_SNOW3G=n
> > +CONFIG_RTE_LIBRTE_PMD_SNOW3G=y
> >  CONFIG_RTE_LIBRTE_PMD_SNOW3G_DEBUG=n
> >
> >  #
> >  # Compile PMD for KASUMI device
> >  #
> > -CONFIG_RTE_LIBRTE_PMD_KASUMI=n
> > +CONFIG_RTE_LIBRTE_PMD_KASUMI=y
> >
> >  #
> >  # Compile PMD for ZUC device
> >  #
> > -CONFIG_RTE_LIBRTE_PMD_ZUC=n
> > +CONFIG_RTE_LIBRTE_PMD_ZUC=y
> >
> >  # Compile PMD for Crypto Scheduler device
> >  #
> > @@ -601,7 +601,7 @@ CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO=n
> >  #
> >  # Compile generic security library
> >  #
> > -CONFIG_RTE_LIBRTE_SECURITY=y
> > +CONFIG_RTE_LIBRTE_SECURITY=n
> >
> >  #
> >  # Compile generic compression device library
> > @@ -842,7 +842,7 @@ CONFIG_RTE_LIBRTE_METER=y
> >  #
> >  # Compile librte_classify
> >  #
> > -CONFIG_RTE_LIBRTE_FLOW_CLASSIFY=y
> > +CONFIG_RTE_LIBRTE_FLOW_CLASSIFY=n
> >
> >  #
> >  # Compile librte_sched
> > @@ -939,7 +939,7 @@ CONFIG_RTE_PROC_INFO=n
> >  #
> >  # Compile the PMD test application
> >  #
> > -CONFIG_RTE_TEST_PMD=y
> > +CONFIG_RTE_TEST_PMD=n
> >  CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
> >  CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
> >
> 
> Not sure why config changes are needed.
> Guess just by mistake?
> Konstantin

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
  2018-11-16 12:05   ` Ananyev, Konstantin
@ 2018-12-04 16:05   ` Trahe, Fiona
  1 sibling, 0 replies; 61+ messages in thread
From: Trahe, Fiona @ 2018-12-04 16:05 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Trahe, Fiona

Hi Fan,


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Thursday, November 15, 2018 10:24 AM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com
> Subject: [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure
> 
> This patch changes the cryptodev queue pair configure structure
> to enable two mempool passed into cryptodev PMD simutaneously.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  app/test-crypto-perf/main.c                        |  6 ++--
>  config/common_base                                 | 24 +++++++-------

I don't think you intended to include all the common_base changes??
Apart from this, for cryptodev lib changes, qat, null and test code changes:
Acked-by: Fiona Trahe <fiona.trahe@@intel.com>

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session
  2018-11-15 17:24 [dpdk-dev] [PATCH 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
  2018-11-15 17:24 ` [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure Fan Zhang
@ 2018-12-11 10:34 ` Fan Zhang
  2018-12-11 10:34   ` [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure Fan Zhang
                     ` (3 more replies)
  2 siblings, 4 replies; 61+ messages in thread
From: Fan Zhang @ 2018-12-11 10:34 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, konstantin.ananyev

This patchset changes the queue pair configure structure and sym session
structure for cryptodev. An RFC patch http://patchwork.dpdk.org/patch/43883/
has been sent to state the change.

v2:
- Removed incorrect config/common_base change
- Added new API for existing session size
- Changed element name of symmetric session

Fan Zhang (2):
  cryptodev: change queue pair configure structure
  cryptodev: change symmetric session structure

 app/test-crypto-perf/cperf.h                       |   1 +
 app/test-crypto-perf/cperf_ops.c                   |  11 +-
 app/test-crypto-perf/cperf_ops.h                   |   2 +-
 app/test-crypto-perf/cperf_test_latency.c          |   5 +-
 app/test-crypto-perf/cperf_test_latency.h          |   1 +
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c   |   5 +-
 app/test-crypto-perf/cperf_test_pmd_cyclecount.h   |   1 +
 app/test-crypto-perf/cperf_test_throughput.c       |   5 +-
 app/test-crypto-perf/cperf_test_throughput.h       |   1 +
 app/test-crypto-perf/cperf_test_verify.c           |   5 +-
 app/test-crypto-perf/cperf_test_verify.h           |   1 +
 app/test-crypto-perf/main.c                        | 105 ++++++---
 doc/guides/rel_notes/release_19_02.rst             |  19 ++
 drivers/crypto/aesni_gcm/Makefile                  |   1 +
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  10 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |   5 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |   2 +
 drivers/crypto/aesni_gcm/meson.build               |   1 +
 drivers/crypto/aesni_mb/Makefile                   |   1 +
 drivers/crypto/aesni_mb/meson.build                |   1 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  10 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |   5 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +
 drivers/crypto/armv8/Makefile                      |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c               |  10 +-
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |   5 +-
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |   2 +
 drivers/crypto/caam_jr/caam_jr.c                   |   3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |   5 +-
 drivers/crypto/ccp/ccp_pmd_private.h               |   2 +
 drivers/crypto/ccp/rte_ccp_pmd.c                   |   9 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |   3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |   3 +-
 drivers/crypto/kasumi/Makefile                     |   1 +
 drivers/crypto/kasumi/meson.build                  |   1 +
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  10 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |   5 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |   2 +
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |   5 +-
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |   3 +
 drivers/crypto/null/null_crypto_pmd.c              |   5 +-
 drivers/crypto/null/null_crypto_pmd_ops.c          |   5 +-
 drivers/crypto/null/null_crypto_pmd_private.h      |   2 +
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |   3 +-
 drivers/crypto/openssl/Makefile                    |   1 +
 drivers/crypto/openssl/meson.build                 |   1 +
 drivers/crypto/openssl/rte_openssl_pmd.c           |  10 +-
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |   5 +-
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |   2 +
 drivers/crypto/qat/qat_sym_pmd.c                   |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |   5 +-
 drivers/crypto/snow3g/Makefile                     |   1 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  10 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |   5 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |   2 +
 drivers/crypto/virtio/virtio_cryptodev.c           |   6 +-
 drivers/crypto/zuc/Makefile                        |   1 +
 drivers/crypto/zuc/meson.build                     |   1 +
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  10 +-
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |   5 +-
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |   2 +
 drivers/net/softnic/rte_eth_softnic_cli.c          |  53 ++++-
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  52 ++++-
 drivers/net/softnic/rte_eth_softnic_internals.h    |   3 +
 examples/fips_validation/main.c                    |  43 +++-
 examples/ip_pipeline/cli.c                         |  49 ++--
 examples/ip_pipeline/cryptodev.c                   |  51 ++++-
 examples/ip_pipeline/cryptodev.h                   |   3 +
 examples/ip_pipeline/examples/flow_crypto.cli      |   9 +-
 examples/ipsec-secgw/ipsec-secgw.c                 |  51 +++--
 examples/ipsec-secgw/ipsec.c                       |   2 +-
 examples/ipsec-secgw/ipsec.h                       |   2 +
 examples/l2fwd-crypto/main.c                       |  66 ++++--
 examples/vhost_crypto/main.c                       |  22 +-
 lib/librte_cryptodev/Makefile                      |   1 +
 lib/librte_cryptodev/meson.build                   |   1 +
 lib/librte_cryptodev/rte_cryptodev.c               | 190 +++++++++++++---
 lib/librte_cryptodev/rte_cryptodev.h               |  72 +++++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  16 +-
 lib/librte_cryptodev/rte_cryptodev_version.map     |   2 +
 lib/librte_vhost/rte_vhost_crypto.h                |   9 +-
 lib/librte_vhost/vhost_crypto.c                    |   8 +-
 test/test/test_cryptodev.c                         | 253 ++++++++++++---------
 test/test/test_cryptodev_asym.c                    |   8 +-
 test/test/test_cryptodev_blockcipher.c             |   7 +-
 test/test/test_cryptodev_blockcipher.h             |   1 +
 test/test/test_event_crypto_adapter.c              |  35 ++-
 87 files changed, 981 insertions(+), 382 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure
  2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
@ 2018-12-11 10:34   ` Fan Zhang
  2018-12-17 19:31     ` Trahe, Fiona
  2018-12-11 10:34   ` [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure Fan Zhang
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 61+ messages in thread
From: Fan Zhang @ 2018-12-11 10:34 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, konstantin.ananyev

This patch changes the cryptodev queue pair configure structure
to enable two mempool passed into cryptodev PMD simutaneously.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 app/test-crypto-perf/main.c                        |  6 ++--
 doc/guides/rel_notes/release_19_02.rst             |  5 +++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  7 ++--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |  5 +--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |  2 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  7 ++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  5 +--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |  2 ++
 drivers/crypto/armv8/rte_armv8_pmd.c               |  7 ++--
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |  5 +--
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |  2 ++
 drivers/crypto/caam_jr/caam_jr.c                   |  3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |  5 +--
 drivers/crypto/ccp/ccp_pmd_private.h               |  2 ++
 drivers/crypto/ccp/rte_ccp_pmd.c                   |  9 +++++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |  3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |  3 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  7 ++--
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |  5 +--
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |  2 ++
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |  5 +--
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |  3 ++
 drivers/crypto/null/null_crypto_pmd.c              |  5 +--
 drivers/crypto/null/null_crypto_pmd_ops.c          |  5 +--
 drivers/crypto/null/null_crypto_pmd_private.h      |  2 ++
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |  3 +-
 drivers/crypto/openssl/rte_openssl_pmd.c           |  7 ++--
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |  5 +--
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |  2 ++
 drivers/crypto/qat/qat_sym_pmd.c                   |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |  5 ++-
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  7 ++--
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |  5 +--
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |  2 ++
 drivers/crypto/virtio/virtio_cryptodev.c           |  6 ++--
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  7 ++--
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |  5 +--
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |  2 ++
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  2 +-
 examples/ip_pipeline/cryptodev.c                   |  2 +-
 examples/ipsec-secgw/ipsec-secgw.c                 |  7 ++--
 examples/l2fwd-crypto/main.c                       |  4 ++-
 examples/vhost_crypto/main.c                       |  9 ++++--
 lib/librte_cryptodev/rte_cryptodev.c               |  5 ++-
 lib/librte_cryptodev/rte_cryptodev.h               |  7 ++--
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  3 +-
 test/test/test_cryptodev.c                         | 37 +++++++++-------------
 test/test/test_cryptodev_asym.c                    |  8 ++---
 test/test/test_event_crypto_adapter.c              |  5 +--
 49 files changed, 154 insertions(+), 105 deletions(-)

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 953e058c9..38a2e429f 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -218,6 +218,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 			session_pool_socket[socket_id] = sess_mp;
 		}
 
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
+
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
 			printf("Failed to configure cryptodev %u", cdev_id);
@@ -226,8 +229,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 
 		for (j = 0; j < opts->nb_qps; j++) {
 			ret = rte_cryptodev_queue_pair_setup(cdev_id, j,
-				&qp_conf, socket_id,
-				session_pool_socket[socket_id]);
+				&qp_conf, socket_id);
 			if (ret < 0) {
 				printf("Failed to setup queue pair %u on "
 					"cryptodev %u",	j, cdev_id);
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index a94fa86a7..633e06b41 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -19,6 +19,11 @@ DPDK Release 19.02
 
       xdg-open build/doc/html/guides/rel_notes/release_19_02.html
 
+* cryptodev: as shown in the the 18.08 deprecation notice, the structure
+  ``rte_cryptodev_qp_conf`` has been added two parameters of symmetric session
+  mempool and symmetric session private data mempool, and the last paramter of
+  ``rte_cryptodev_queue_pair_setup()`` is removed.
+
 
 New Features
 ------------
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index ebdf7c35a..abc7a6d5f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -151,7 +151,8 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_gcm_session *)_sess_private_data;
@@ -159,7 +160,7 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_gcm_set_session_parameters(qp->ops,
 				sess, sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -419,7 +420,7 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index c343a393f..2f70f2a1a 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -201,7 +201,7 @@ aesni_gcm_pmd_qp_create_processed_pkts_ring(struct aesni_gcm_qp *qp,
 static int
 aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_gcm_qp *qp = NULL;
 	struct aesni_gcm_private *internals = dev->data->dev_private;
@@ -229,7 +229,8 @@ aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_pkts == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
index 92b041354..903e7503d 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
@@ -48,6 +48,8 @@ struct aesni_gcm_qp {
 	/**< Queue pair statistics */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	uint16_t id;
 	/**< Queue Pair Identifier */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 83250e32c..b0f5c4d67 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -668,7 +668,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_mb_session *)_sess_private_data;
@@ -676,7 +677,7 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_mb_set_session_parameters(qp->op_fns,
 				sess, op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -951,7 +952,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index f3eff2685..af3021616 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -566,7 +566,7 @@ aesni_mb_pmd_qp_create_processed_ops_ring(struct aesni_mb_qp *qp,
 static int
 aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_mb_qp *qp = NULL;
 	struct aesni_mb_private *internals = dev->data->dev_private;
@@ -604,7 +604,8 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
index d8021cdaa..923403336 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
@@ -131,6 +131,8 @@ struct aesni_mb_qp {
        /**< Ring for placing operations ready for processing */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t digest_idx;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 9d15fee53..3b2d7fb2f 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -514,7 +514,8 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct armv8_crypto_session *)_sess_private_data;
@@ -522,7 +523,7 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(armv8_crypto_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -656,7 +657,7 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
 		rte_mempool_put(qp->sess_mp, sess);
-		rte_mempool_put(qp->sess_mp, op->sym->session);
+		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
 	}
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index ae03117ea..a4fee83a8 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -220,7 +220,7 @@ armv8_crypto_pmd_qp_create_processed_ops_ring(struct armv8_crypto_qp *qp,
 static int
 armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct armv8_crypto_qp *qp = NULL;
 
@@ -245,7 +245,8 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_private.h b/drivers/crypto/armv8/rte_armv8_pmd_private.h
index 7feb021db..0afd9c7c5 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_private.h
+++ b/drivers/crypto/armv8/rte_armv8_pmd_private.h
@@ -116,6 +116,8 @@ struct armv8_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+       /**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index f505adf6b..45b281331 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1540,8 +1540,7 @@ static int
 caam_jr_queue_pair_setup(
 		struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct sec_job_ring_t *internals;
 	struct caam_jr_qp *qp = NULL;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 6984913f1..d5041f0ec 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -685,7 +685,7 @@ ccp_pmd_qp_create_batch_info_ring(struct ccp_qp *qp,
 static int
 ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 const struct rte_cryptodev_qp_conf *qp_conf,
-		 int socket_id, struct rte_mempool *session_pool)
+		 int socket_id)
 {
 	struct ccp_private *internals = dev->data->dev_private;
 	struct ccp_qp *qp;
@@ -726,7 +726,8 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	/* mempool for batch info */
 	qp->batch_mp = rte_mempool_create(
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 79752f687..7f2979e89 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -76,6 +76,8 @@ struct ccp_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_mempool *batch_mp;
 	/**< Session Mempool for batch info */
 	struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 92d8a9559..b4bb5528f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -179,7 +179,7 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
 							internals) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -241,6 +241,13 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	for (i = 0; i < nb_dequeued; i++)
 		if (unlikely(ops[i]->sess_type ==
 			     RTE_CRYPTO_OP_SESSIONLESS)) {
+			struct ccp_session *sess = (struct ccp_session *)
+					get_sym_session_private_data(
+						ops[i]->sym->session,
+						ccp_cryptodev_driver_id);
+
+			rte_mempool_put(qp->sess_mp_priv,
+					sess);
 			rte_mempool_put(qp->sess_mp,
 					ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 6095c6021..82220ac4f 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1518,8 +1518,7 @@ dpaa2_sec_queue_pair_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 static int
 dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
 	struct dpaa2_sec_qp *qp;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index d83e74541..c95e43b7f 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -1661,8 +1661,7 @@ dpaa_sec_queue_pair_release(struct rte_cryptodev *dev,
 static int
 dpaa_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa_sec_dev_private *internals;
 	struct dpaa_sec_qp *qp = NULL;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 239a1cf44..6df645a23 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -145,7 +145,8 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct kasumi_session *)_sess_private_data;
@@ -153,7 +154,7 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(kasumi_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -325,7 +326,7 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index 9e4bf1b52..a4982f091 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -192,7 +192,7 @@ kasumi_pmd_qp_create_processed_ops_ring(struct kasumi_qp *qp,
 static int
 kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
 
@@ -217,7 +217,8 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
index 488777ca8..76f746c03 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
@@ -36,6 +36,8 @@ struct kasumi_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index 9956f051f..ef520356f 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -633,7 +633,7 @@ mrvl_crypto_pmd_close(struct rte_cryptodev *dev)
 static int
 mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct mrvl_crypto_qp *qp = NULL;
 	char match[RTE_CRYPTODEV_NAME_MAX_LEN];
@@ -690,7 +690,8 @@ mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		if (sam_cio_init(&qp->cio_params, &qp->cio) < 0)
 			break;
 
-		qp->sess_mp = session_pool;
+		qp->sess_mp = qp_conf->mp_session;
+		qp->sess_mp_priv = qp_conf->mp_session_private;
 
 		memset(&qp->stats, 0, sizeof(qp->stats));
 		dev->data->queue_pairs[qp_id] = qp;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
index 6f8cf5624..deb80c55d 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
@@ -51,6 +51,9 @@ struct mrvl_crypto_qp {
 	/** Session Mempool. */
 	struct rte_mempool *sess_mp;
 
+	/** Session Private Data Mempool. */
+	struct rte_mempool *sess_mp_priv;
+
 	/** Queue pair statistics. */
 	struct rte_cryptodev_stats stats;
 
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 6e29a21a6..d5e3064f2 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -87,7 +87,8 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct null_crypto_session *)_sess_private_data;
@@ -95,7 +96,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(null_crypto_set_session_parameters(sess,
 				sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 2bdcd019e..941d62bed 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -184,7 +184,7 @@ null_crypto_pmd_qp_create_processed_pkts_ring(struct null_crypto_qp *qp,
 static int
 null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct null_crypto_private *internals = dev->data->dev_private;
 	struct null_crypto_qp *qp;
@@ -228,7 +228,8 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index d5905afd8..d7bfd9cc8 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,6 +31,8 @@ struct null_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 } __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 90d0c14b8..6a0cf83f4 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -186,8 +186,7 @@ static int
 otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
 		       uint16_t que_pair_id,
 		       const struct rte_cryptodev_qp_conf *qp_conf,
-		       int socket_id __rte_unused,
-		       struct rte_mempool *session_pool __rte_unused)
+		       int socket_id __rte_unused)
 {
 	void *cptvf = dev->data->dev_private;
 	struct cpt_instance *instance = NULL;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 11ea0d190..f985afa93 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -768,7 +768,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct openssl_session *)_sess_private_data;
@@ -776,7 +777,7 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(openssl_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -2027,7 +2028,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index c2b029ec2..202b0b534 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -710,7 +710,7 @@ openssl_pmd_qp_create_processed_ops_ring(struct openssl_qp *qp,
 static int
 openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct openssl_qp *qp = NULL;
 
@@ -735,7 +735,8 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_private.h b/drivers/crypto/openssl/rte_openssl_pmd_private.h
index a8f2c8482..43ac3813d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_private.h
+++ b/drivers/crypto/openssl/rte_openssl_pmd_private.h
@@ -64,6 +64,8 @@ struct openssl_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index c3f700406..31ccab32e 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -127,7 +127,7 @@ static int qat_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 
 static int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	const struct rte_cryptodev_qp_conf *qp_conf,
-	int socket_id, struct rte_mempool *session_pool __rte_unused)
+	int socket_id)
 {
 	struct qat_qp *qp;
 	int ret = 0;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 939105aa8..cf70218b7 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -390,8 +390,7 @@ scheduler_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 /** Setup a queue pair */
 static int
 scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
-	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-	struct rte_mempool *session_pool)
+	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
 	struct scheduler_qp_ctx *qp_ctx;
@@ -419,7 +418,7 @@ scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 * must be big enough for all the drivers used.
 		 */
 		ret = rte_cryptodev_queue_pair_setup(slave_id, qp_id,
-				qp_conf, socket_id, session_pool);
+				qp_conf, socket_id);
 		if (ret < 0)
 			return ret;
 	}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index a17536b77..7d131f780 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -147,7 +147,8 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct snow3g_session *)_sess_private_data;
@@ -155,7 +156,7 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(snow3g_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -340,7 +341,7 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
index cfbc9522a..fad483c75 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
@@ -193,7 +193,7 @@ snow3g_pmd_qp_create_processed_ops_ring(struct snow3g_qp *qp,
 static int
 snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
 
@@ -218,7 +218,8 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
index b7807b621..df5c6092b 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
@@ -36,6 +36,8 @@ struct snow3g_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[SNOW3G_DIGEST_LENGTH];
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 568b5a406..4bae3b865 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -36,8 +36,7 @@ static void virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev);
 static int virtio_crypto_qp_setup(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool);
+		int socket_id);
 static int virtio_crypto_qp_release(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id);
 static void virtio_crypto_dev_free_mbufs(struct rte_cryptodev *dev);
@@ -585,8 +584,7 @@ virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev)
 static int
 virtio_crypto_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool __rte_unused)
+		int socket_id)
 {
 	int ret;
 	struct virtqueue *vq;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 313f4590b..997c2092f 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -144,7 +144,8 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct zuc_session *)_sess_private_data;
@@ -152,7 +153,7 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(zuc_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -327,7 +328,7 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, sessions[i]);
+			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
index 6da396542..7bd985fc1 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
@@ -193,7 +193,7 @@ zuc_pmd_qp_create_processed_ops_ring(struct zuc_qp *qp,
 static int
 zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
 
@@ -218,7 +218,8 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_private.h b/drivers/crypto/zuc/rte_zuc_pmd_private.h
index 5e5906ddb..aa73c0016 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_private.h
+++ b/drivers/crypto/zuc/rte_zuc_pmd_private.h
@@ -36,6 +36,8 @@ struct zuc_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[ZUC_DIGEST_LENGTH];
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index 1480f6dd5..f031d8803 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -101,7 +101,7 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c
index c4ba72bec..b365810de 100644
--- a/examples/ip_pipeline/cryptodev.c
+++ b/examples/ip_pipeline/cryptodev.c
@@ -93,7 +93,7 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 1bc0b5b50..a0ff8f7f7 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1493,10 +1493,13 @@ cryptodevs_init(void)
 					cdev_id);
 
 		qp_conf.nb_descriptors = CDEV_QUEUE_DESC;
+		qp_conf.mp_session =
+				socket_ctx[dev_conf.socket_id].session_pool;
+		qp_conf.mp_session_private =
+				socket_ctx[dev_conf.socket_id].session_pool;
 		for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
 			if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
-					&qp_conf, dev_conf.socket_id,
-					socket_ctx[dev_conf.socket_id].session_pool))
+					&qp_conf, dev_conf.socket_id))
 				rte_panic("Failed to setup queue %u for "
 						"cdev_id %u\n",	0, cdev_id);
 
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index f12fd266e..1df7ba743 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2443,9 +2443,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
-				socket_id, session_pool_socket[socket_id]);
+				socket_id);
 		if (retval < 0) {
 			printf("Failed to setup queue pair %u on cryptodev %u",
 					0, cdev_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index f08babd97..aa2727dfc 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -463,7 +463,7 @@ free_resource(void)
 int
 main(int argc, char *argv[])
 {
-	struct rte_cryptodev_qp_conf qp_conf = {NB_CRYPTO_DESCRIPTORS};
+	struct rte_cryptodev_qp_conf qp_conf;
 	struct rte_cryptodev_config config;
 	struct rte_cryptodev_info dev_info;
 	char name[128];
@@ -550,11 +550,14 @@ main(int argc, char *argv[])
 
 		options.infos[i] = info;
 
+		qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
+		qp_conf.mp_session = info->sess_pool;
+		qp_conf.mp_session_private = info->sess_pool;
+
 		for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
 			ret = rte_cryptodev_queue_pair_setup(info->cid, j,
 					&qp_conf, rte_lcore_to_socket_id(
-							lo->lcore_id),
-					info->sess_pool);
+							lo->lcore_id));
 			if (ret < 0) {
 				RTE_LOG(ERR, USER1, "Failed to configure qp\n");
 				goto error_exit;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a52eaaa45..11776b6ac 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -941,8 +941,7 @@ rte_cryptodev_close(uint8_t dev_id)
 
 int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool)
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 
 {
 	struct rte_cryptodev *dev;
@@ -967,7 +966,7 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
-			socket_id, session_pool);
+			socket_id);
 }
 
 
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 4099823f1..f9e7507da 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -495,6 +495,10 @@ enum rte_cryptodev_event_type {
 /** Crypto device queue pair configuration structure. */
 struct rte_cryptodev_qp_conf {
 	uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
+	struct rte_mempool *mp_session;
+	/**< The mempool for creating session in sessionless mode */
+	struct rte_mempool *mp_session_private;
+	/**< The mempool for creating sess private data in sessionless mode */
 };
 
 /**
@@ -689,8 +693,7 @@ rte_cryptodev_close(uint8_t dev_id);
  */
 extern int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool);
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
 
 /**
  * Get the number of queue pairs on a specific crypto device
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 1b6cafd17..f15c9af30 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -188,13 +188,12 @@ typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev,
  * @param	qp_id		Queue Pair Index
  * @param	qp_conf		Queue configuration structure
  * @param	socket_id	Socket Index
- * @param	session_pool	Pointer to device session mempool
  *
  * @return	Returns 0 on success.
  */
 typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev,
 		uint16_t qp_id,	const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool);
+		int socket_id);
 
 /**
  * Release memory resources allocated by given queue pair.
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 84065eb49..aac0b1f0b 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -461,12 +461,13 @@ testsuite_setup(void)
 			dev_id, ts_params->conf.nb_queue_pairs);
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, dev_id);
 	}
@@ -519,8 +520,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
@@ -709,13 +709,14 @@ test_queue_pair_descriptor_setup(void)
 	 * freed so are re-used if ring is released and re-created.
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
+	qp_conf.mp_session = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights "
 				"%u on qp %u on cryptodev %u",
@@ -729,8 +730,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -744,8 +744,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -760,8 +759,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -776,8 +774,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -791,8 +788,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -807,8 +803,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -824,8 +819,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
@@ -835,8 +829,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c
index a899f9973..0f6fc5767 100644
--- a/test/test/test_cryptodev_asym.c
+++ b/test/test/test_cryptodev_asym.c
@@ -383,11 +383,12 @@ testsuite_setup(void)
 
 	/* configure qp */
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u ASYM",
 			qp_id, dev_id);
 	}
@@ -449,8 +450,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index de258c346..54717870e 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -546,11 +546,12 @@ configure_cryptodev(void)
 			TEST_CDEV_ID, conf.nb_queue_pairs);
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	qp_conf.mp_session = params.session_mpool;
+	qp_conf.mp_session_private = params.session_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
-			rte_cryptodev_socket_id(TEST_CDEV_ID),
-			params.session_mpool),
+			rte_cryptodev_socket_id(TEST_CDEV_ID)),
 			"Failed to setup queue pair %u on cryptodev %u\n",
 			TEST_CDEV_QP_ID, TEST_CDEV_ID);
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure
  2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
  2018-12-11 10:34   ` [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure Fan Zhang
@ 2018-12-11 10:34   ` Fan Zhang
  2018-12-17 20:29     ` Trahe, Fiona
  2018-12-11 12:26   ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Ananyev, Konstantin
  2018-12-21 13:55   ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
  3 siblings, 1 reply; 61+ messages in thread
From: Fan Zhang @ 2018-12-11 10:34 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, konstantin.ananyev

This patch changes the symmetric session structure of cryptodev.
The symmetric session now contains extra information for secure
access purposes. The patch also includes the updates to the
PMDs, test applications, and examples to fit the change.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 app/test-crypto-perf/cperf.h                     |   1 +
 app/test-crypto-perf/cperf_ops.c                 |  11 +-
 app/test-crypto-perf/cperf_ops.h                 |   2 +-
 app/test-crypto-perf/cperf_test_latency.c        |   5 +-
 app/test-crypto-perf/cperf_test_latency.h        |   1 +
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c |   5 +-
 app/test-crypto-perf/cperf_test_pmd_cyclecount.h |   1 +
 app/test-crypto-perf/cperf_test_throughput.c     |   5 +-
 app/test-crypto-perf/cperf_test_throughput.h     |   1 +
 app/test-crypto-perf/cperf_test_verify.c         |   5 +-
 app/test-crypto-perf/cperf_test_verify.h         |   1 +
 app/test-crypto-perf/main.c                      | 103 +++++++----
 doc/guides/rel_notes/release_19_02.rst           |  14 ++
 drivers/crypto/aesni_gcm/Makefile                |   1 +
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c         |   3 +-
 drivers/crypto/aesni_gcm/meson.build             |   1 +
 drivers/crypto/aesni_mb/Makefile                 |   1 +
 drivers/crypto/aesni_mb/meson.build              |   1 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c       |   3 +-
 drivers/crypto/armv8/Makefile                    |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c             |   3 +-
 drivers/crypto/kasumi/Makefile                   |   1 +
 drivers/crypto/kasumi/meson.build                |   1 +
 drivers/crypto/kasumi/rte_kasumi_pmd.c           |   3 +-
 drivers/crypto/openssl/Makefile                  |   1 +
 drivers/crypto/openssl/meson.build               |   1 +
 drivers/crypto/openssl/rte_openssl_pmd.c         |   3 +-
 drivers/crypto/snow3g/Makefile                   |   1 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c           |   3 +-
 drivers/crypto/zuc/Makefile                      |   1 +
 drivers/crypto/zuc/meson.build                   |   1 +
 drivers/crypto/zuc/rte_zuc_pmd.c                 |   3 +-
 drivers/net/softnic/rte_eth_softnic_cli.c        |  53 +++++-
 drivers/net/softnic/rte_eth_softnic_cryptodev.c  |  50 +++++-
 drivers/net/softnic/rte_eth_softnic_internals.h  |   3 +
 examples/fips_validation/main.c                  |  43 ++++-
 examples/ip_pipeline/cli.c                       |  49 +++--
 examples/ip_pipeline/cryptodev.c                 |  49 ++++-
 examples/ip_pipeline/cryptodev.h                 |   3 +
 examples/ip_pipeline/examples/flow_crypto.cli    |   9 +-
 examples/ipsec-secgw/ipsec-secgw.c               |  48 +++--
 examples/ipsec-secgw/ipsec.c                     |   2 +-
 examples/ipsec-secgw/ipsec.h                     |   2 +
 examples/l2fwd-crypto/main.c                     |  66 ++++---
 examples/vhost_crypto/main.c                     |  13 +-
 lib/librte_cryptodev/Makefile                    |   1 +
 lib/librte_cryptodev/meson.build                 |   1 +
 lib/librte_cryptodev/rte_cryptodev.c             | 185 +++++++++++++++----
 lib/librte_cryptodev/rte_cryptodev.h             |  65 ++++++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h         |  13 +-
 lib/librte_cryptodev/rte_cryptodev_version.map   |   2 +
 lib/librte_vhost/rte_vhost_crypto.h              |   9 +-
 lib/librte_vhost/vhost_crypto.c                  |   8 +-
 test/test/test_cryptodev.c                       | 220 ++++++++++++++---------
 test/test/test_cryptodev_blockcipher.c           |   7 +-
 test/test/test_cryptodev_blockcipher.h           |   1 +
 test/test/test_event_crypto_adapter.c            |  32 ++--
 57 files changed, 836 insertions(+), 286 deletions(-)

diff --git a/app/test-crypto-perf/cperf.h b/app/test-crypto-perf/cperf.h
index db58228dc..2b0aad095 100644
--- a/app/test-crypto-perf/cperf.h
+++ b/app/test-crypto-perf/cperf.h
@@ -15,6 +15,7 @@ struct cperf_op_fns;
 
 typedef void  *(*cperf_constructor_t)(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 44808f50a..f59568b80 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -469,6 +469,7 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
 
 static struct rte_cryptodev_sym_session *
 cperf_create_session(struct rte_mempool *sess_mp,
+	struct rte_mempool *priv_mp,
 	uint8_t dev_id,
 	const struct cperf_options *options,
 	const struct cperf_test_vector *test_vector,
@@ -505,7 +506,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 *  auth only
 	 */
@@ -533,7 +534,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 * cipher and auth
 	 */
@@ -592,12 +593,12 @@ cperf_create_session(struct rte_mempool *sess_mp,
 			cipher_xform.next = &auth_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &cipher_xform, sess_mp);
+					sess, &cipher_xform, priv_mp);
 		} else { /* auth then cipher */
 			auth_xform.next = &cipher_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &auth_xform, sess_mp);
+					sess, &auth_xform, priv_mp);
 		}
 	} else { /* options->op_type == CPERF_AEAD */
 		aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -618,7 +619,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 
 		/* Create crypto session */
 		rte_cryptodev_sym_session_init(dev_id,
-					sess, &aead_xform, sess_mp);
+					sess, &aead_xform, priv_mp);
 	}
 
 	return sess;
diff --git a/app/test-crypto-perf/cperf_ops.h b/app/test-crypto-perf/cperf_ops.h
index 29e109f2a..ff125d12c 100644
--- a/app/test-crypto-perf/cperf_ops.h
+++ b/app/test-crypto-perf/cperf_ops.h
@@ -13,7 +13,7 @@
 
 
 typedef struct rte_cryptodev_sym_session *(*cperf_sessions_create_t)(
-		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_mp, struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		uint16_t iv_offset);
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index c9c98dc50..0fc3a6680 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -62,6 +62,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx)
 
 void *
 cperf_latency_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -86,8 +87,8 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp,
 		sizeof(struct rte_crypto_sym_op) +
 		sizeof(struct cperf_op_result *);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-			iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_latency.h b/app/test-crypto-perf/cperf_test_latency.h
index d3fc3218d..ed5b0a07b 100644
--- a/app/test-crypto-perf/cperf_test_latency.h
+++ b/app/test-crypto-perf/cperf_test_latency.h
@@ -17,6 +17,7 @@
 void *
 cperf_latency_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index c8d16db6d..92af5ec90 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -80,6 +80,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
 
 void *
 cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -106,8 +107,8 @@ cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 			sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(
-			sess_mp, dev_id, options, test_vector, iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.h b/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
index beb441991..3084038a1 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
@@ -18,6 +18,7 @@
 void *
 cperf_pmd_cyclecount_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index 8766d6e9b..2767f4ea8 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -47,6 +47,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
 
 void *
 cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -69,8 +70,8 @@ cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 		sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-					iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_throughput.h b/app/test-crypto-perf/cperf_test_throughput.h
index 439ec8e55..91e1a4b70 100644
--- a/app/test-crypto-perf/cperf_test_throughput.h
+++ b/app/test-crypto-perf/cperf_test_throughput.h
@@ -18,6 +18,7 @@
 void *
 cperf_throughput_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 9134b921e..0497cf9a1 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -51,6 +51,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx)
 
 void *
 cperf_verify_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -73,8 +74,8 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 		sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-			iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_verify.h b/app/test-crypto-perf/cperf_test_verify.h
index 9f70ad87b..ac2192ba9 100644
--- a/app/test-crypto-perf/cperf_test_verify.h
+++ b/app/test-crypto-perf/cperf_test_verify.h
@@ -18,6 +18,7 @@
 void *
 cperf_verify_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 38a2e429f..175c639fb 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -21,6 +21,10 @@
 #include "cperf_test_verify.h"
 #include "cperf_test_pmd_cyclecount.h"
 
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 const char *cperf_test_type_strs[] = {
 	[CPERF_TEST_TYPE_THROUGHPUT] = "throughput",
@@ -61,8 +65,58 @@ const struct cperf_test cperf_testmap[] = {
 };
 
 static int
-cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
-			struct rte_mempool *session_pool_socket[])
+fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
+		uint32_t nb_sessions)
+{
+	char mp_name[RTE_MEMPOOL_NAMESIZE];
+	struct rte_mempool *sess_mp;
+
+	if (session_pool_socket[socket_id].priv_mp == NULL) {
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"priv_sess_mp_%u", socket_id);
+
+		sess_mp = rte_mempool_create(mp_name,
+					nb_sessions,
+					session_priv_size,
+					0, 0, NULL, NULL, NULL,
+					NULL, socket_id,
+					0);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].priv_mp = sess_mp;
+	}
+
+	if (session_pool_socket[socket_id].sess_mp == NULL) {
+
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"sess_mp_%u", socket_id);
+
+		sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
+					nb_sessions, 0, 0, 0, socket_id);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].sess_mp = sess_mp;
+	}
+
+	return 0;
+}
+
+static int
+cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 {
 	uint8_t enabled_cdev_count = 0, nb_lcores, cdev_id;
 	uint32_t sessions_needed = 0;
@@ -177,11 +231,11 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 				rte_cryptodev_scheduler_slaves_get(cdev_id,
 								NULL);
 
-			sessions_needed = 2 * enabled_cdev_count *
+			sessions_needed = enabled_cdev_count *
 				opts->nb_qps * nb_slaves;
 #endif
 		} else
-			sessions_needed = 2 * enabled_cdev_count *
+			sessions_needed = enabled_cdev_count *
 						opts->nb_qps;
 
 		/*
@@ -194,32 +248,15 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 				"%u sessions\n", opts->nb_qps);
 			return -ENOTSUP;
 		}
-		if (session_pool_socket[socket_id] == NULL) {
-			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
-
-			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
-			sess_mp = rte_mempool_create(mp_name,
-						sessions_needed,
-						max_sess_size,
-						0,
-						0, NULL, NULL, NULL,
-						NULL, socket_id,
-						0);
-
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
-					socket_id);
-				return -ENOMEM;
-			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
-		}
+		ret = fill_session_pool_socket(socket_id, max_sess_size,
+				sessions_needed);
+		if (ret < 0)
+			return ret;
 
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
@@ -453,10 +490,7 @@ main(int argc, char **argv)
 	struct cperf_options opts = {0};
 	struct cperf_test_vector *t_vec = NULL;
 	struct cperf_op_fns op_fns;
-
 	void *ctx[RTE_MAX_LCORE] = { };
-	struct rte_mempool *session_pool_socket[RTE_MAX_NUMA_NODES] = { 0 };
-
 	int nb_cryptodevs = 0;
 	uint16_t total_nb_qps = 0;
 	uint8_t cdev_id, i;
@@ -489,8 +523,7 @@ main(int argc, char **argv)
 		goto err;
 	}
 
-	nb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs,
-			session_pool_socket);
+	nb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs);
 
 	if (!opts.silent)
 		cperf_options_dump(&opts);
@@ -558,7 +591,9 @@ main(int argc, char **argv)
 		uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
 
 		ctx[i] = cperf_testmap[opts.test].constructor(
-				session_pool_socket[socket_id], cdev_id, qp_id,
+				session_pool_socket[socket_id].sess_mp,
+				session_pool_socket[socket_id].priv_mp,
+				cdev_id, qp_id,
 				&opts, t_vec, &op_fns);
 		if (ctx[i] == NULL) {
 			RTE_LOG(ERR, USER1, "Test run constructor failed\n");
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 633e06b41..5c8e8b7ac 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -24,6 +24,20 @@ DPDK Release 19.02
   mempool and symmetric session private data mempool, and the last paramter of
   ``rte_cryptodev_queue_pair_setup()`` is removed.
 
+* cryptodev: as shown in the the 18.08 deprecation notice, the structure
+  ``rte_cryptodev_sym_session`` has been updated to contain more information
+  to ensure safely accessing driver private data and user data area. The
+  creation of mempool for ``rte_cryptodev_sym_session`` objects is now enforced
+  to use new function ``rte_cryptodev_sym_session_pool_create()`` so that
+  the correct session information is set. Failed to do so will cause
+  ``rte_cryptodev_sym_session_create()`` function call failed. With the change
+  cryptodev does no longer enforce using the same mempool for symmetric session
+  header and the driver specific private data, and prevent the segmentation
+  faults caused by the incorrect access to both the session's private data and
+  user data. All cryptodev related applications (test applications and sample
+  applications) have been updated to demonstrate how to use this new
+  method.
+ 
 
 New Features
 ------------
diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile
index 0a5c1a872..9241ad762 100644
--- a/drivers/crypto/aesni_gcm/Makefile
+++ b/drivers/crypto/aesni_gcm/Makefile
@@ -8,6 +8,7 @@ LIB = librte_pmd_aesni_gcm.a
 
 # build flags
 CFLAGS += -O3
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += $(WERROR_FLAGS)
 
 # library version
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index abc7a6d5f..948ff0763 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -419,7 +419,8 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/aesni_gcm/meson.build b/drivers/crypto/aesni_gcm/meson.build
index a02da1ef5..70f57ad73 100644
--- a/drivers/crypto/aesni_gcm/meson.build
+++ b/drivers/crypto/aesni_gcm/meson.build
@@ -8,5 +8,6 @@ else
 	ext_deps += lib
 endif
 
+allow_experimental_apis = true
 sources = files('aesni_gcm_pmd.c', 'aesni_gcm_pmd_ops.c')
 deps += ['bus_vdev']
diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile
index 806a95eb8..a6fa071ec 100644
--- a/drivers/crypto/aesni_mb/Makefile
+++ b/drivers/crypto/aesni_mb/Makefile
@@ -9,6 +9,7 @@ LIB = librte_pmd_aesni_mb.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/aesni_mb/meson.build b/drivers/crypto/aesni_mb/meson.build
index aae0995e5..39a436bc7 100644
--- a/drivers/crypto/aesni_mb/meson.build
+++ b/drivers/crypto/aesni_mb/meson.build
@@ -8,5 +8,6 @@ else
 	ext_deps += lib
 endif
 
+allow_experimental_apis = true
 sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
 deps += ['bus_vdev']
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b0f5c4d67..f3b270d09 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -951,7 +951,8 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile
index e862af72e..f71f6b14a 100644
--- a/drivers/crypto/armv8/Makefile
+++ b/drivers/crypto/armv8/Makefile
@@ -28,6 +28,7 @@ EXPORT_MAP := rte_pmd_armv8_version.map
 # external library dependencies
 CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)
 CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)/asm/include
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 3b2d7fb2f..0d4649adc 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -655,7 +655,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct armv8_crypto_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp, sess);
 		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile
index cafe94986..3de2f97ed 100644
--- a/drivers/crypto/kasumi/Makefile
+++ b/drivers/crypto/kasumi/Makefile
@@ -15,6 +15,7 @@ LIB = librte_pmd_kasumi.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/kasumi/meson.build b/drivers/crypto/kasumi/meson.build
index a09b0e251..80f13cd24 100644
--- a/drivers/crypto/kasumi/meson.build
+++ b/drivers/crypto/kasumi/meson.build
@@ -8,5 +8,6 @@ else
 	ext_deps += lib
 endif
 
+allow_experimental_apis = true
 sources = files('rte_kasumi_pmd.c', 'rte_kasumi_pmd_ops.c')
 deps += ['bus_vdev']
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 6df645a23..3abdb01a9 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -325,7 +325,8 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index 8fe086b90..ae6c3bcac 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -9,6 +9,7 @@ LIB = librte_pmd_openssl.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index c2a0dd8ba..77a6596d7 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -5,6 +5,7 @@ dep = dependency('libcrypto', required: false)
 if not dep.found()
 	build = false
 endif
+allow_experimental_apis = true
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index f985afa93..11f5b5f41 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -2027,7 +2027,8 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		openssl_reset_session(sess);
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile
index ee5027d0c..37f77dbf8 100644
--- a/drivers/crypto/snow3g/Makefile
+++ b/drivers/crypto/snow3g/Makefile
@@ -15,6 +15,7 @@ LIB = librte_pmd_snow3g.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 7d131f780..5fd94b686 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -340,7 +340,8 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile
index 68d84eebc..8d625aa01 100644
--- a/drivers/crypto/zuc/Makefile
+++ b/drivers/crypto/zuc/Makefile
@@ -15,6 +15,7 @@ LIB = librte_pmd_zuc.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/zuc/meson.build b/drivers/crypto/zuc/meson.build
index b8ca7107e..63f2a5298 100644
--- a/drivers/crypto/zuc/meson.build
+++ b/drivers/crypto/zuc/meson.build
@@ -8,5 +8,6 @@ else
 	ext_deps += lib
 endif
 
+allow_experimental_apis = true
 sources = files('rte_zuc_pmd.c', 'rte_zuc_pmd_ops.c')
 deps += ['bus_vdev']
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 997c2092f..637994dfd 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -327,7 +327,8 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 57b623377..3ff51744f 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1092,7 +1092,7 @@ cmd_tap(struct pmd_internals *softnic,
 
 /**
  * cryptodev <tap_name> dev <device_name> | dev_id <device_id>
- * queue <n_queues> <queue_size>
+ * queue <n_queues> <queue_size> max_sessions <n_sessions>
  **/
 
 static void
@@ -1106,7 +1106,7 @@ cmd_cryptodev(struct pmd_internals *softnic,
 	char *name;
 
 	memset(&params, 0, sizeof(params));
-	if (n_tokens != 7) {
+	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
 	}
@@ -1145,6 +1145,19 @@ cmd_cryptodev(struct pmd_internals *softnic,
 		return;
 	}
 
+	if (strcmp(tokens[7], "max_sessions")) {
+		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
+			"4");
+		return;
+	}
+
+	if (softnic_parser_read_uint32(&params.session_pool_size, tokens[8])
+			< 0) {
+		snprintf(out, out_size,	MSG_ARG_INVALID,
+			"q");
+		return;
+	}
+
 	if (softnic_cryptodev_create(softnic, name, &params) == NULL) {
 		snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
 		return;
@@ -1739,6 +1752,42 @@ cmd_table_action_profile(struct pmd_internals *softnic,
 		t0 += 1;
 	} /* decap */
 
+	if ((t0 < n_tokens) &&
+			(strcmp(tokens[t0], "sym_crypto") == 0)) {
+		struct softnic_cryptodev *cryptodev;
+
+		if (n_tokens < t0 + 5 ||
+				strcmp(tokens[t0 + 1], "dev") ||
+				strcmp(tokens[t0 + 3], "offset")) {
+			snprintf(out, out_size, MSG_ARG_MISMATCH,
+				"table action profile sym_crypto");
+			return;
+		}
+
+		cryptodev = softnic_cryptodev_find(softnic, tokens[t0 + 2]);
+		if (cryptodev == NULL) {
+			snprintf(out, out_size, MSG_ARG_INVALID,
+				"table action profile sym_crypto");
+			return;
+		}
+
+		p.sym_crypto.cryptodev_id = cryptodev->dev_id;
+
+		if (softnic_parser_read_uint32(&p.sym_crypto.op_offset,
+				tokens[t0 + 4]) != 0) {
+			snprintf(out, out_size, MSG_ARG_INVALID,
+					"table action profile sym_crypto");
+			return;
+		}
+
+		p.sym_crypto.mp_create = cryptodev->mp_create;
+		p.sym_crypto.mp_init = cryptodev->mp_init;
+
+		p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO;
+
+		t0 += 5;
+	} /* sym_crypto */
+
 	if (t0 < n_tokens) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index f031d8803..18a52ed05 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -11,6 +11,8 @@
 
 #include "rte_eth_softnic_internals.h"
 
+#define SOFTNIC_CRYPTO_SESSION_CACHE_SIZE 128
+
 int
 softnic_cryptodev_init(struct pmd_internals *p)
 {
@@ -61,13 +63,16 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	struct softnic_cryptodev *cryptodev;
 	uint32_t dev_id, i;
 	uint32_t socket_id;
+	uint32_t cache_size;
+	char mp_name[NAME_SIZE];
 	int status;
 
 	/* Check input params */
 	if ((name == NULL) ||
 		softnic_cryptodev_find(p, name) ||
 		(params->n_queues == 0) ||
-		(params->queue_size == 0))
+		(params->queue_size == 0) ||
+		(params->session_pool_size == 0))
 		return NULL;
 
 	if (params->dev_name) {
@@ -83,6 +88,12 @@ softnic_cryptodev_create(struct pmd_internals *p,
 		dev_id = params->dev_id;
 	}
 
+	cache_size = (params->session_pool_size / 2 <
+			SOFTNIC_CRYPTO_SESSION_CACHE_SIZE) ?
+					(params->session_pool_size / 2) :
+					SOFTNIC_CRYPTO_SESSION_CACHE_SIZE;
+
+
 	socket_id = rte_cryptodev_socket_id(dev_id);
 	rte_cryptodev_info_get(dev_id, &dev_info);
 
@@ -119,7 +130,44 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	cryptodev->dev_id = dev_id;
 	cryptodev->n_queues = params->n_queues;
 
+	snprintf(mp_name, NAME_SIZE, "%s_mp%u", name, dev_id);
+	cryptodev->mp_create = rte_cryptodev_sym_session_pool_create(
+			mp_name,
+			params->session_pool_size,
+			0,
+			cache_size,
+			0,
+			socket_id);
+	if (!cryptodev->mp_create)
+		goto error_exit;
+
+	snprintf(mp_name, NAME_SIZE, "%s_priv_mp%u", name, dev_id);
+	cryptodev->mp_init = rte_mempool_create(
+			mp_name,
+			params->session_pool_size,
+			rte_cryptodev_sym_get_private_session_size(dev_id),
+			cache_size,
+			0,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			socket_id,
+			0);
+	if (!cryptodev->mp_init)
+		goto error_exit;
+
 	TAILQ_INSERT_TAIL(&p->cryptodev_list, cryptodev, node);
 
 	return cryptodev;
+
+error_exit:
+	if (cryptodev->mp_create)
+		rte_mempool_free(cryptodev->mp_create);
+	if (cryptodev->mp_init)
+		rte_mempool_free(cryptodev->mp_init);
+
+	free(cryptodev);
+
+	return NULL;
 }
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h
index 31698b9f0..685058be6 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -286,6 +286,7 @@ struct softnic_cryptodev_params {
 	uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */
 	uint32_t n_queues;
 	uint32_t queue_size;
+	uint32_t session_pool_size;
 };
 
 struct softnic_cryptodev {
@@ -293,6 +294,8 @@ struct softnic_cryptodev {
 	char name[NAME_SIZE];
 	uint16_t dev_id;
 	uint32_t n_queues;
+	struct rte_mempool *mp_create;
+	struct rte_mempool *mp_init;
 };
 
 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e7559c633..588ffa16f 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -29,6 +29,8 @@ struct cryptodev_fips_validate_env {
 	uint32_t is_path_folder;
 	uint32_t dev_id;
 	struct rte_mempool *mpool;
+	struct rte_mempool *sess_mpool;
+	struct rte_mempool *sess_priv_mpool;
 	struct rte_mempool *op_pool;
 	struct rte_mbuf *mbuf;
 	struct rte_crypto_op *op;
@@ -39,7 +41,9 @@ static int
 cryptodev_fips_validate_app_int(void)
 {
 	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
-	struct rte_cryptodev_qp_conf qp_conf = {128};
+	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+	uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
+			env.dev_id);
 	int ret;
 
 	ret = rte_cryptodev_configure(env.dev_id, &conf);
@@ -49,15 +53,21 @@ cryptodev_fips_validate_app_int(void)
 	env.mpool = rte_pktmbuf_pool_create("FIPS_MEMPOOL", 128, 0, 0,
 			UINT16_MAX, rte_socket_id());
 	if (!env.mpool)
-		return ret;
-
-	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
-			rte_socket_id(), env.mpool);
-	if (ret < 0)
-		return ret;
+		return -ENOMEM;
 
 	ret = -ENOMEM;
 
+	env.sess_mpool = rte_cryptodev_sym_session_pool_create(
+			"FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+	if (!env.sess_mpool)
+		goto error_exit;
+
+	env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
+			16, sess_sz, 0, 0, NULL, NULL, NULL,
+			NULL, rte_socket_id(), 0);
+	if (!env.sess_priv_mpool)
+		goto error_exit;
+
 	env.op_pool = rte_crypto_op_pool_create(
 			"FIPS_OP_POOL",
 			RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -75,10 +85,23 @@ cryptodev_fips_validate_app_int(void)
 	if (!env.op)
 		goto error_exit;
 
+	qp_conf.mp_session = env.sess_mpool;
+	qp_conf.mp_session_private = env.sess_priv_mpool;
+
+	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
+			rte_socket_id());
+	if (ret < 0)
+		goto error_exit;
+
 	return 0;
 
 error_exit:
+
 	rte_mempool_free(env.mpool);
+	if (env.sess_mpool)
+		rte_mempool_free(env.sess_mpool);
+	if (env.sess_priv_mpool)
+		rte_mempool_free(env.sess_priv_mpool);
 	if (env.op_pool)
 		rte_mempool_free(env.op_pool);
 
@@ -93,6 +116,8 @@ cryptodev_fips_validate_app_uninit(void)
 	rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
 	rte_cryptodev_sym_session_free(env.sess);
 	rte_mempool_free(env.mpool);
+	rte_mempool_free(env.sess_mpool);
+	rte_mempool_free(env.sess_priv_mpool);
 	rte_mempool_free(env.op_pool);
 }
 
@@ -797,12 +822,12 @@ fips_run_test(void)
 	if (ret < 0)
 		return ret;
 
-	env.sess = rte_cryptodev_sym_session_create(env.mpool);
+	env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
 	if (!env.sess)
 		return -ENOMEM;
 
 	ret = rte_cryptodev_sym_session_init(env.dev_id,
-			env.sess, &xform, env.mpool);
+			env.sess, &xform, env.sess_priv_mpool);
 	if (ret < 0) {
 		RTE_LOG(ERR, USER1, "Error %i: Init session\n",
 				ret);
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..a92467e63 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -790,7 +790,8 @@ cmd_kni(char **tokens,
 static const char cmd_cryptodev_help[] =
 "cryptodev <cryptodev_name>\n"
 "   dev <device_name> | dev_id <device_id>\n"
-"   queue <n_queues> <queue_size>\n";
+"   queue <n_queues> <queue_size>\n"
+"   max_sessions <n_sessions>";
 
 static void
 cmd_cryptodev(char **tokens,
@@ -802,7 +803,7 @@ cmd_cryptodev(char **tokens,
 	char *name;
 
 	memset(&params, 0, sizeof(params));
-	if (n_tokens != 7) {
+	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
 	}
@@ -825,7 +826,7 @@ cmd_cryptodev(char **tokens,
 
 	if (strcmp(tokens[4], "queue")) {
 		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
-			"4");
+			"queue");
 		return;
 	}
 
@@ -841,6 +842,18 @@ cmd_cryptodev(char **tokens,
 		return;
 	}
 
+	if (strcmp(tokens[7], "max_sessions")) {
+		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
+			"max_sessions");
+		return;
+	}
+
+	if (parser_read_uint32(&params.session_pool_size, tokens[8]) < 0) {
+		snprintf(out, out_size,	MSG_ARG_INVALID,
+			"queue_size");
+		return;
+	}
+
 	if (cryptodev_create(name, &params) == NULL) {
 		snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
 		return;
@@ -1030,9 +1043,7 @@ static const char cmd_table_action_profile_help[] =
 "       stats none | pkts]\n"
 "   [stats pkts | bytes | both]\n"
 "   [time]\n"
-"   [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset> "
-"       mempool_create <mempool_name>\n"
-"       mempool_init <mempool_name>]\n"
+"   [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset>]\n"
 "   [tag]\n"
 "   [decap]\n";
 
@@ -1404,13 +1415,10 @@ cmd_table_action_profile(char **tokens,
 
 	if ((t0 < n_tokens) && (strcmp(tokens[t0], "sym_crypto") == 0)) {
 		struct cryptodev *cryptodev;
-		struct mempool *mempool;
 
-		if (n_tokens < t0 + 9 ||
+		if (n_tokens < t0 + 5 ||
 				strcmp(tokens[t0 + 1], "dev") ||
-				strcmp(tokens[t0 + 3], "offset") ||
-				strcmp(tokens[t0 + 5], "mempool_create") ||
-				strcmp(tokens[t0 + 7], "mempool_init")) {
+				strcmp(tokens[t0 + 3], "offset")) {
 			snprintf(out, out_size, MSG_ARG_MISMATCH,
 				"table action profile sym_crypto");
 			return;
@@ -1432,25 +1440,12 @@ cmd_table_action_profile(char **tokens,
 			return;
 		}
 
-		mempool = mempool_find(tokens[t0 + 6]);
-		if (mempool == NULL) {
-			snprintf(out, out_size, MSG_ARG_INVALID,
-				"table action profile sym_crypto");
-			return;
-		}
-		p.sym_crypto.mp_create = mempool->m;
-
-		mempool = mempool_find(tokens[t0 + 8]);
-		if (mempool == NULL) {
-			snprintf(out, out_size, MSG_ARG_INVALID,
-				"table action profile sym_crypto");
-			return;
-		}
-		p.sym_crypto.mp_init = mempool->m;
+		p.sym_crypto.mp_create = cryptodev->mp_create;
+		p.sym_crypto.mp_init = cryptodev->mp_init;
 
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO;
 
-		t0 += 9;
+		t0 += 5;
 	} /* sym_crypto */
 
 	if ((t0 < n_tokens) && (strcmp(tokens[t0], "tag") == 0)) {
diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c
index b365810de..ac1e38d6a 100644
--- a/examples/ip_pipeline/cryptodev.c
+++ b/examples/ip_pipeline/cryptodev.c
@@ -11,6 +11,8 @@
 
 #include "cryptodev.h"
 
+#define PIPELINE_CRYPTO_SESSION_CACHE_SIZE	128
+
 static struct cryptodev_list cryptodev_list;
 
 int
@@ -53,13 +55,16 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	struct cryptodev *cryptodev;
 	uint32_t dev_id, i;
 	uint32_t socket_id;
+	uint32_t cache_size;
+	char mp_name[NAME_SIZE];
 	int status;
 
 	/* Check input params */
 	if ((name == NULL) ||
 		cryptodev_find(name) ||
 		(params->n_queues == 0) ||
-		(params->queue_size == 0))
+		(params->queue_size == 0) ||
+		(params->session_pool_size == 0))
 		return NULL;
 
 	if (params->dev_name) {
@@ -75,6 +80,11 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 		dev_id = params->dev_id;
 	}
 
+	cache_size = (params->session_pool_size / 2 <
+			PIPELINE_CRYPTO_SESSION_CACHE_SIZE) ?
+					(params->session_pool_size / 2) :
+					PIPELINE_CRYPTO_SESSION_CACHE_SIZE;
+
 	socket_id = rte_cryptodev_socket_id(dev_id);
 	rte_cryptodev_info_get(dev_id, &dev_info);
 
@@ -111,7 +121,44 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	cryptodev->dev_id = dev_id;
 	cryptodev->n_queues = params->n_queues;
 
+	snprintf(mp_name, NAME_SIZE, "%s_mp%u", name, dev_id);
+	cryptodev->mp_create = rte_cryptodev_sym_session_pool_create(
+			mp_name,
+			params->session_pool_size,
+			0,
+			cache_size,
+			0,
+			socket_id);
+	if (!cryptodev->mp_create)
+		goto error_exit;
+
+	snprintf(mp_name, NAME_SIZE, "%s_mp_priv%u", name, dev_id);
+	cryptodev->mp_init = rte_mempool_create(
+			NULL,
+			params->session_pool_size,
+			rte_cryptodev_sym_get_private_session_size(dev_id),
+			cache_size,
+			0,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			socket_id,
+			0);
+	if (!cryptodev->mp_init)
+		goto error_exit;
+
 	TAILQ_INSERT_TAIL(&cryptodev_list, cryptodev, node);
 
 	return cryptodev;
+
+error_exit:
+	if (cryptodev->mp_create)
+		rte_mempool_free(cryptodev->mp_create);
+	if (cryptodev->mp_init)
+		rte_mempool_free(cryptodev->mp_init);
+
+	free(cryptodev);
+
+	return NULL;
 }
diff --git a/examples/ip_pipeline/cryptodev.h b/examples/ip_pipeline/cryptodev.h
index d06b3f2f1..d00434379 100644
--- a/examples/ip_pipeline/cryptodev.h
+++ b/examples/ip_pipeline/cryptodev.h
@@ -17,6 +17,8 @@ struct cryptodev {
 	char name[NAME_SIZE];
 	uint16_t dev_id;
 	uint32_t n_queues;
+	struct rte_mempool *mp_create;
+	struct rte_mempool *mp_init;
 };
 
 TAILQ_HEAD(cryptodev_list, cryptodev);
@@ -35,6 +37,7 @@ struct cryptodev_params {
 	uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */
 	uint32_t n_queues;
 	uint32_t queue_size;
+	uint32_t session_pool_size;
 };
 
 struct cryptodev *
diff --git a/examples/ip_pipeline/examples/flow_crypto.cli b/examples/ip_pipeline/examples/flow_crypto.cli
index 9b639deb7..849f9d5fe 100644
--- a/examples/ip_pipeline/examples/flow_crypto.cli
+++ b/examples/ip_pipeline/examples/flow_crypto.cli
@@ -21,14 +21,13 @@
 ; 5   Crypto Operation 1792             160
 
 mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 1
-mempool MEMPOOL_SESSION0 buffer 1024 pool 1024 cache 128 cpu 1
 
-link LINK0 dev 0000:81:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on
+link LINK0 dev 81:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on
 
 #Cryptodev
-cryptodev CRYPTO0 dev crypto_aesni_gcm0 queue 1 1024
+cryptodev CRYPTO0 dev crypto_aesni_gcm0 queue 1 1024 max_sessions 512
 
-table action profile AP0 ipv4 offset 270 fwd sym_crypto dev CRYPTO0 offset 1792 mempool_create MEMPOOL_SESSION0 mempool_init MEMPOOL_SESSION0
+table action profile AP0 ipv4 offset 270 fwd sym_crypto dev CRYPTO0 offset 1792
 table action profile AP1 ipv4 offset 270 fwd
 
 pipeline PIPELINE0 period 10 offset_port_id 0 cpu 1
@@ -46,7 +45,7 @@ pipeline PIPELINE0 table match stub action AP1
 pipeline PIPELINE0 port in 0 table 0
 pipeline PIPELINE0 port in 1 table 1
 
-thread 24 pipeline PIPELINE0 enable
+thread 2 pipeline PIPELINE0 enable
 
 pipeline PIPELINE0 table 0 rule add match default action fwd port 2
 
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a0ff8f7f7..fc102a396 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -55,7 +55,7 @@
 
 #define CDEV_QUEUE_DESC 2048
 #define CDEV_MAP_ENTRIES 16384
-#define CDEV_MP_NB_OBJS 2048
+#define CDEV_MP_NB_OBJS 1024
 #define CDEV_MP_CACHE_SZ 64
 #define MAX_QUEUE_PAIRS 1
 
@@ -820,11 +820,15 @@ main_loop(__attribute__((unused)) void *dummy)
 	qconf->inbound.sa_ctx = socket_ctx[socket_id].sa_in;
 	qconf->inbound.cdev_map = cdev_map_in;
 	qconf->inbound.session_pool = socket_ctx[socket_id].session_pool;
+	qconf->inbound.session_priv_pool =
+			socket_ctx[socket_id].session_priv_pool;
 	qconf->outbound.sp4_ctx = socket_ctx[socket_id].sp_ip4_out;
 	qconf->outbound.sp6_ctx = socket_ctx[socket_id].sp_ip6_out;
 	qconf->outbound.sa_ctx = socket_ctx[socket_id].sa_out;
 	qconf->outbound.cdev_map = cdev_map_out;
 	qconf->outbound.session_pool = socket_ctx[socket_id].session_pool;
+	qconf->outbound.session_priv_pool =
+			socket_ctx[socket_id].session_priv_pool;
 
 	if (qconf->nb_rx_queue == 0) {
 		RTE_LOG(INFO, IPSEC, "lcore %u has nothing to do\n", lcore_id);
@@ -1460,10 +1464,10 @@ cryptodevs_init(void)
 		dev_conf.nb_queue_pairs = qp;
 
 		uint32_t dev_max_sess = cdev_info.sym.max_nb_sessions;
-		if (dev_max_sess != 0 && dev_max_sess < (CDEV_MP_NB_OBJS / 2))
+		if (dev_max_sess != 0 && dev_max_sess < CDEV_MP_NB_OBJS)
 			rte_exit(EXIT_FAILURE,
 				"Device does not support at least %u "
-				"sessions", CDEV_MP_NB_OBJS / 2);
+				"sessions", CDEV_MP_NB_OBJS);
 
 		if (!socket_ctx[dev_conf.socket_id].session_pool) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
@@ -1471,6 +1475,19 @@ cryptodevs_init(void)
 
 			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
 					"sess_mp_%u", dev_conf.socket_id);
+			sess_mp = rte_cryptodev_sym_session_pool_create(
+					mp_name, CDEV_MP_NB_OBJS,
+					0, CDEV_MP_CACHE_SZ, 0,
+					dev_conf.socket_id);
+			socket_ctx[dev_conf.socket_id].session_pool = sess_mp;
+		}
+
+		if (!socket_ctx[dev_conf.socket_id].session_priv_pool) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			struct rte_mempool *sess_mp;
+
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+					"sess_mp_priv_%u", dev_conf.socket_id);
 			sess_mp = rte_mempool_create(mp_name,
 					CDEV_MP_NB_OBJS,
 					max_sess_sz,
@@ -1478,25 +1495,28 @@ cryptodevs_init(void)
 					0, NULL, NULL, NULL,
 					NULL, dev_conf.socket_id,
 					0);
-			if (sess_mp == NULL)
-				rte_exit(EXIT_FAILURE,
-					"Cannot create session pool on socket %d\n",
-					dev_conf.socket_id);
-			else
-				printf("Allocated session pool on socket %d\n",
-					dev_conf.socket_id);
-			socket_ctx[dev_conf.socket_id].session_pool = sess_mp;
+			socket_ctx[dev_conf.socket_id].session_priv_pool =
+					sess_mp;
 		}
 
+		if (!socket_ctx[dev_conf.socket_id].session_priv_pool ||
+				!socket_ctx[dev_conf.socket_id].session_pool)
+			rte_exit(EXIT_FAILURE,
+				"Cannot create session pool on socket %d\n",
+				dev_conf.socket_id);
+		else
+			printf("Allocated session pool on socket %d\n",
+					dev_conf.socket_id);
+
 		if (rte_cryptodev_configure(cdev_id, &dev_conf))
 			rte_panic("Failed to initialize cryptodev %u\n",
 					cdev_id);
 
 		qp_conf.nb_descriptors = CDEV_QUEUE_DESC;
 		qp_conf.mp_session =
-				socket_ctx[dev_conf.socket_id].session_pool;
+			socket_ctx[dev_conf.socket_id].session_pool;
 		qp_conf.mp_session_private =
-				socket_ctx[dev_conf.socket_id].session_pool;
+			socket_ctx[dev_conf.socket_id].session_priv_pool;
 		for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
 			if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
 					&qp_conf, dev_conf.socket_id))
@@ -1521,7 +1541,7 @@ cryptodevs_init(void)
 				snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
 						"sess_mp_%u", socket_id);
 				sess_mp = rte_mempool_create(mp_name,
-						CDEV_MP_NB_OBJS,
+						(CDEV_MP_NB_OBJS * 2),
 						max_sess_sz,
 						CDEV_MP_CACHE_SZ,
 						0, NULL, NULL, NULL,
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 3d415f1af..9dc6e173c 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -323,7 +323,7 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 				ipsec_ctx->session_pool);
 		rte_cryptodev_sym_session_init(ipsec_ctx->tbl[cdev_id_qp].id,
 				sa->crypto_session, sa->xforms,
-				ipsec_ctx->session_pool);
+				ipsec_ctx->session_priv_pool);
 
 		rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id,
 				&cdev_info);
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index c998c8076..f35552857 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -144,6 +144,7 @@ struct ipsec_ctx {
 	uint16_t last_qp;
 	struct cdev_qp tbl[MAX_QP_PER_LCORE];
 	struct rte_mempool *session_pool;
+	struct rte_mempool *session_priv_pool;
 	struct rte_mbuf *ol_pkts[MAX_PKT_BURST] __rte_aligned(sizeof(void *));
 	uint16_t ol_pkts_cnt;
 };
@@ -166,6 +167,7 @@ struct socket_ctx {
 	struct rt_ctx *rt_ip6;
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *session_pool;
+	struct rte_mempool *session_priv_pool;
 };
 
 struct cnt_blk {
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 1df7ba743..9982f07e9 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -221,7 +221,10 @@ static struct rte_eth_conf port_conf = {
 
 struct rte_mempool *l2fwd_pktmbuf_pool;
 struct rte_mempool *l2fwd_crypto_op_pool;
-struct rte_mempool *session_pool_socket[RTE_MAX_NUMA_NODES] = { 0 };
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 /* Per-port statistics struct */
 struct l2fwd_port_statistics {
@@ -645,7 +648,6 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		return NULL;
 
 	uint8_t socket_id = (uint8_t) retval;
-	struct rte_mempool *sess_mp = session_pool_socket[socket_id];
 
 	if (options->xform_chain == L2FWD_CRYPTO_AEAD) {
 		first_xform = &options->aead_xform;
@@ -661,13 +663,14 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		first_xform = &options->auth_xform;
 	}
 
-	session = rte_cryptodev_sym_session_create(sess_mp);
-
+	session = rte_cryptodev_sym_session_create(
+			session_pool_socket[socket_id].sess_mp);
 	if (session == NULL)
 		return NULL;
 
 	if (rte_cryptodev_sym_session_init(cdev_id, session,
-				first_xform, sess_mp) < 0)
+				first_xform,
+				session_pool_socket[socket_id].priv_mp) < 0)
 		return NULL;
 
 	return session;
@@ -2267,38 +2270,54 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 				rte_cryptodev_scheduler_slaves_get(cdev_id,
 								NULL);
 
-			sessions_needed = 2 * enabled_cdev_count * nb_slaves;
+			sessions_needed = enabled_cdev_count * nb_slaves;
 #endif
 		} else
-			sessions_needed = 2 * enabled_cdev_count;
+			sessions_needed = enabled_cdev_count;
 
-		if (session_pool_socket[socket_id] == NULL) {
+		if (session_pool_socket[socket_id].priv_mp == NULL) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
 
 			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
+				"priv_sess_mp_%u", socket_id);
 
-			/*
-			 * Create enough objects for session headers and
-			 * device private data
-			 */
-			sess_mp = rte_mempool_create(mp_name,
+			session_pool_socket[socket_id].priv_mp =
+					rte_mempool_create(mp_name,
 						sessions_needed,
 						max_sess_sz,
-						SESSION_POOL_CACHE_SIZE,
-						0, NULL, NULL, NULL,
+						0, 0, NULL, NULL, NULL,
 						NULL, socket_id,
 						0);
 
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
+			if (session_pool_socket[socket_id].priv_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
+					socket_id);
+				return -ENOMEM;
+			}
+
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+		}
+
+		if (session_pool_socket[socket_id].sess_mp == NULL) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+				"sess_mp_%u", socket_id);
+
+			session_pool_socket[socket_id].sess_mp =
+					rte_cryptodev_sym_session_pool_create(
+							mp_name,
+							sessions_needed,
+							0, 0, 0, socket_id);
+
+			if (session_pool_socket[socket_id].sess_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
 					socket_id);
 				return -ENOMEM;
 			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
 		}
 
 		/* Set AEAD parameters */
@@ -2443,8 +2462,9 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
 				socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index aa2727dfc..f8eb1f5c6 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,6 +46,7 @@ struct vhost_crypto_info {
 	int vids[MAX_NB_SOCKETS];
 	uint32_t nb_vids;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *cop_pool;
 	uint8_t cid;
 	uint32_t qid;
@@ -289,6 +290,7 @@ new_device(int vid)
 	}
 
 	ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
+			info->sess_priv_pool,
 			rte_lcore_to_socket_id(options.los[i].lcore_id));
 	if (ret) {
 		RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -448,6 +450,7 @@ free_resource(void)
 
 		rte_mempool_free(info->cop_pool);
 		rte_mempool_free(info->sess_pool);
+		rte_mempool_free(info->sess_priv_pool);
 
 		for (j = 0; j < lo->nb_sockets; j++) {
 			rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -527,11 +530,17 @@ main(int argc, char *argv[])
 		}
 
 		snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
-		info->sess_pool = rte_mempool_create(name, SESSION_MAP_ENTRIES,
+		info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
+				SESSION_MAP_ENTRIES, 0, 0, 0,
+				rte_lcore_to_socket_id(lo->lcore_id));
+
+		snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
+		info->sess_priv_pool = rte_mempool_create(name,
+				SESSION_MAP_ENTRIES,
 				rte_cryptodev_sym_get_private_session_size(
 				info->cid), 64, 0, NULL, NULL, NULL, NULL,
 				rte_lcore_to_socket_id(lo->lcore_id), 0);
-		if (!info->sess_pool) {
+		if (!info->sess_priv_pool || info->sess_pool) {
 			RTE_LOG(ERR, USER1, "Failed to create mempool");
 			goto error_exit;
 		}
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index a8f94c097..ade108b90 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -12,6 +12,7 @@ LIBABIVER := 5
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf
 LDLIBS += -lrte_kvargs
 
diff --git a/lib/librte_cryptodev/meson.build b/lib/librte_cryptodev/meson.build
index 990dd3d44..40ccce37a 100644
--- a/lib/librte_cryptodev/meson.build
+++ b/lib/librte_cryptodev/meson.build
@@ -2,6 +2,7 @@
 # Copyright(c) 2017 Intel Corporation
 
 version = 5
+allow_experimental_apis = true
 sources = files('rte_cryptodev.c', 'rte_cryptodev_pmd.c')
 headers = files('rte_cryptodev.h',
 	'rte_cryptodev_pmd.h',
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 11776b6ac..7ad084089 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -189,6 +189,16 @@ const char *rte_crypto_asym_op_strings[] = {
 	[RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE] = "sharedsecret_compute",
 };
 
+/**
+ * The private data structure stored in the session mempool private data.
+ */
+struct rte_cryptodev_sym_session_pool_private_data {
+	uint16_t nb_drivers;
+	/**< number of elements in sess_data array */
+	uint16_t user_data_sz;
+	/**< session user data will be placed after sess_data */
+};
+
 int
 rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum,
 		const char *algo_string)
@@ -951,7 +961,45 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EINVAL;
 	}
 
+	if (!qp_conf) {
+		CDEV_LOG_ERR("qp_conf cannot be NULL\n");
+		return -EINVAL;
+	}
+
+	if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
+			(!qp_conf->mp_session && qp_conf->mp_session_private)) {
+		CDEV_LOG_ERR("Invalid mempools\n");
+		return -EINVAL;
+	}
+
 	dev = &rte_crypto_devices[dev_id];
+
+	if (qp_conf->mp_session) {
+		struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+		uint32_t obj_size = qp_conf->mp_session->elt_size;
+		uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
+		struct rte_cryptodev_sym_session s = {0};
+
+		pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
+		if (!pool_priv || qp_conf->mp_session->private_data_size <
+				sizeof(*pool_priv)) {
+			CDEV_LOG_ERR("Invalid mempool\n");
+			return -EINVAL;
+		}
+
+		s.nb_drivers = pool_priv->nb_drivers;
+		s.user_data_sz = pool_priv->user_data_sz;
+
+		if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
+			obj_size) || (s.nb_drivers <= dev->driver_id) ||
+			rte_cryptodev_sym_get_private_session_size(dev_id) >
+				obj_priv_size) {
+			CDEV_LOG_ERR("Invalid mempool\n");
+			return -EINVAL;
+		}
+
+	}
+
 	if (queue_pair_id >= dev->data->nb_queue_pairs) {
 		CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id);
 		return -EINVAL;
@@ -969,7 +1017,6 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 			socket_id);
 }
 
-
 int
 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
 {
@@ -1143,7 +1190,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
 	rte_spinlock_unlock(&rte_cryptodev_cb_lock);
 }
 
-
 int
 rte_cryptodev_sym_session_init(uint8_t dev_id,
 		struct rte_cryptodev_sym_session *sess,
@@ -1160,12 +1206,15 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 		return -EINVAL;
 
 	index = dev->driver_id;
+	if (index > sess->nb_drivers)
+		return -EINVAL;
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
 
-	if (sess->sess_private_data[index] == NULL) {
+	if (sess->sess_data[index].refcnt == 0) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
-							sess, mp);
+			sess, mp);
+
 		if (ret < 0) {
 			CDEV_LOG_ERR(
 				"dev_id %d failed to configure session details",
@@ -1174,6 +1223,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 		}
 	}
 
+	sess->sess_data[index].refcnt++;
 	return 0;
 }
 
@@ -1212,10 +1262,70 @@ rte_cryptodev_asym_session_init(uint8_t dev_id,
 	return 0;
 }
 
+struct rte_mempool * __rte_experimental
+rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
+	uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
+	int socket_id)
+{
+	struct rte_mempool *mp;
+	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+	uint32_t obj_sz;
+
+	obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
+	if (obj_sz > elt_size)
+		CDEV_LOG_INFO("elt_size %u is expanded to %u\n", elt_size,
+				obj_sz);
+	else
+		obj_sz = elt_size;
+
+	mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
+			(uint32_t)(sizeof(*pool_priv)),
+			NULL, NULL, NULL, NULL,
+			socket_id, 0);
+	if (mp == NULL) {
+		CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d\n",
+			__func__, name, rte_errno);
+		return NULL;
+	}
+
+	pool_priv = rte_mempool_get_priv(mp);
+	if (!pool_priv) {
+		CDEV_LOG_ERR("%s(name=%s) failed to get private data\n",
+			__func__, name);
+		rte_mempool_free(mp);
+		return NULL;
+	}
+
+	pool_priv->nb_drivers = nb_drivers;
+	pool_priv->user_data_sz = user_data_size;
+
+	return mp;
+}
+
+static unsigned int
+rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
+{
+	return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
+			sess->user_data_sz;
+}
+
 struct rte_cryptodev_sym_session *
 rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 {
 	struct rte_cryptodev_sym_session *sess;
+	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+	if (!mp) {
+		CDEV_LOG_ERR("Invalid mempool\n");
+		return NULL;
+	}
+
+	pool_priv = rte_mempool_get_priv(mp);
+
+	if (!pool_priv || mp->private_data_size < sizeof(*pool_priv)) {
+		CDEV_LOG_ERR("Invalid mempool\n");
+		return NULL;
+	}
 
 	/* Allocate a session structure from the session pool */
 	if (rte_mempool_get(mp, (void **)&sess)) {
@@ -1226,7 +1336,12 @@ rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 	/* Clear device session pointer.
 	 * Include the flag indicating presence of user data
 	 */
-	memset(sess, 0, (sizeof(void *) * nb_drivers) + sizeof(uint8_t));
+	sess->nb_drivers = pool_priv->nb_drivers;
+	sess->user_data_sz= pool_priv->user_data_sz;
+	sess->opaque_data = 0;
+
+	memset(sess->sess_data, 0,
+			rte_cryptodev_sym_session_data_size(sess));
 
 	return sess;
 }
@@ -1255,12 +1370,17 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
 		struct rte_cryptodev_sym_session *sess)
 {
 	struct rte_cryptodev *dev;
+	uint8_t driver_id;
 
 	dev = rte_cryptodev_pmd_get_dev(dev_id);
 
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
+	driver_id = dev->driver_id;
+	if (--sess->sess_data[driver_id].refcnt != 0)
+		return -EBUSY;
+
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
 
 	dev->dev_ops->sym_session_clear(dev, sess);
@@ -1290,16 +1410,15 @@ int
 rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
 {
 	uint8_t i;
-	void *sess_priv;
 	struct rte_mempool *sess_mp;
 
 	if (sess == NULL)
 		return -EINVAL;
 
 	/* Check that all device private data has been freed */
-	for (i = 0; i < nb_drivers; i++) {
-		sess_priv = get_sym_session_private_data(sess, i);
-		if (sess_priv != NULL)
+	/* Check that all device private data has been freed */
+	for (i = 0; i < sess->nb_drivers; i++) {
+		if (sess->sess_data[i].refcnt != 0)
 			return -EBUSY;
 	}
 
@@ -1334,16 +1453,31 @@ rte_cryptodev_asym_session_free(struct rte_cryptodev_asym_session *sess)
 	return 0;
 }
 
-
 unsigned int
 rte_cryptodev_sym_get_header_session_size(void)
 {
 	/*
-	 * Header contains pointers to the private data
+	 * Header contains all dpointers to the private data
 	 * of all registered drivers, and a flag which
 	 * indicates presence of user data
 	 */
-	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
+	struct rte_cryptodev_sym_session s = {0};
+	s.nb_drivers = nb_drivers;
+	s.user_data_sz = 0;
+
+	return (unsigned int)(sizeof(s) +
+			rte_cryptodev_sym_session_data_size(&s));
+}
+
+unsigned int __rte_experimental
+rte_cryptodev_sym_get_existing_header_session_size(
+		struct rte_cryptodev_sym_session *sess)
+{
+	if (!sess)
+		return 0;
+	else
+		return (unsigned int)(sizeof(*sess) +
+				rte_cryptodev_sym_session_data_size(sess));
 }
 
 unsigned int __rte_experimental
@@ -1361,7 +1495,6 @@ unsigned int
 rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
 {
 	struct rte_cryptodev *dev;
-	unsigned int header_size = sizeof(void *) * nb_drivers;
 	unsigned int priv_sess_size;
 
 	if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
@@ -1374,14 +1507,6 @@ rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
 
 	priv_sess_size = (*dev->dev_ops->sym_session_get_size)(dev);
 
-	/*
-	 * If size is less than session header size,
-	 * return the latter, as this guarantees that
-	 * sessionless operations will work
-	 */
-	if (priv_sess_size < header_size)
-		return header_size;
-
 	return priv_sess_size;
 
 }
@@ -1415,15 +1540,13 @@ rte_cryptodev_sym_session_set_user_data(
 					void *data,
 					uint16_t size)
 {
-	uint16_t off_set = sizeof(void *) * nb_drivers;
-	uint8_t *user_data_present = (uint8_t *)sess + off_set;
-
 	if (sess == NULL)
 		return -EINVAL;
 
-	*user_data_present = 1;
-	off_set += sizeof(uint8_t);
-	rte_memcpy((uint8_t *)sess + off_set, data, size);
+	if (sess->user_data_sz < size)
+		return -ENOMEM;
+
+	rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
 	return 0;
 }
 
@@ -1431,14 +1554,10 @@ void * __rte_experimental
 rte_cryptodev_sym_session_get_user_data(
 					struct rte_cryptodev_sym_session *sess)
 {
-	uint16_t off_set = sizeof(void *) * nb_drivers;
-	uint8_t *user_data_present = (uint8_t *)sess + off_set;
-
-	if (sess == NULL || !*user_data_present)
+	if (sess == NULL || sess->user_data_sz == 0)
 		return NULL;
 
-	off_set += sizeof(uint8_t);
-	return (uint8_t *)sess + off_set;
+	return (void *)(sess->sess_data + sess->nb_drivers);
 }
 
 /** Initialise rte_crypto_op mempool element */
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index f9e7507da..698a859f3 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -951,14 +951,22 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 			dev->data->queue_pairs[qp_id], ops, nb_ops);
 }
 
-
 /** Cryptodev symmetric crypto session
  * Each session is derived from a fixed xform chain. Therefore each session
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	__extension__ void *sess_private_data[0];
-	/**< Private symmetric session material */
+	uint64_t opaque_data;
+	/**< Can be used for external metadata */
+	uint16_t nb_drivers;
+	/**< number of elements in sess_data array */
+	uint16_t user_data_sz;
+	/**< session user data will be placed after sess_data */
+	__extension__ struct {
+		void *data;
+		uint16_t refcnt;
+	} sess_data[0];
+	/**< Driver specific session material, variable size */
 };
 
 /** Cryptodev asymmetric crypto session */
@@ -968,6 +976,37 @@ struct rte_cryptodev_asym_session {
 };
 
 /**
+ * Create a symmetric session mempool.
+ *
+ * @param name
+ *   The unique mempool name.
+ * @param nb_elts
+ *   The number of elements in the mempool.
+ * @param elt_size
+ *   The size of the element. This value will be ignored if it is smaller than
+ *   the minimum session header size required for the system. For the user who
+ *   want to use the same mempool for sym session and session private data it
+ *   can be the maximum value of all existing devices' private data and session
+ *   header sizes.
+ * @param cache_size
+ *   The number of per-lcore cache elements
+ * @param priv_size
+ *   The private data size of each session.
+ * @param socket_id
+ *   The *socket_id* argument is the socket identifier in the case of
+ *   NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA
+ *   constraint for the reserved zone.
+ *
+ * @return
+ *  - On success return size of the session
+ *  - On failure returns 0
+ */
+struct rte_mempool * __rte_experimental
+rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
+	uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
+	int socket_id);
+
+/**
  * Create symmetric crypto session header (generic with no private data)
  *
  * @param   mempool    Symmetric session mempool to allocate session
@@ -1097,15 +1136,31 @@ rte_cryptodev_asym_session_clear(uint8_t dev_id,
 			struct rte_cryptodev_asym_session *sess);
 
 /**
- * Get the size of the header session, for all registered drivers.
+ * Get the size of the header session, for all registered drivers excluding
+ * the user data size.
  *
  * @return
- *   Size of the symmetric eader session.
+ *   Size of the symmetric header session.
  */
 unsigned int
 rte_cryptodev_sym_get_header_session_size(void);
 
 /**
+ * Get the size of the header session from created session.
+ *
+ * @param sess
+ *   The sym cryptodev session pointer
+ *
+ * @return
+ *   - If sess is not NULL, return the size of the header session including
+ *   the private data size defined within sess.
+ *   - If sess is NULL, return 0.
+ */
+unsigned int __rte_experimental
+rte_cryptodev_sym_get_existing_header_session_size(
+		struct rte_cryptodev_sym_session *sess);
+
+/**
  * Get the size of the asymmetric session header, for all registered drivers.
  *
  * @return
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index f15c9af30..defe05ea0 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -475,14 +475,23 @@ RTE_INIT(init_ ##driver_id)\
 static inline void *
 get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
 		uint8_t driver_id) {
-	return sess->sess_private_data[driver_id];
+	if (unlikely(sess->nb_drivers <= driver_id))
+		return NULL;
+
+	return sess->sess_data[driver_id].data;
 }
 
 static inline void
 set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
 		uint8_t driver_id, void *private_data)
 {
-	sess->sess_private_data[driver_id] = private_data;
+	if (unlikely(sess->nb_drivers <= driver_id)) {
+		CDEV_LOG_ERR("Set private data for driver %u not allowed\n",
+				driver_id);
+		return;
+	}
+
+	sess->sess_data[driver_id].data = private_data;
 }
 
 static inline void *
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a695b61dc..0d0f3bc28 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -105,4 +105,6 @@ EXPERIMENTAL {
 	rte_cryptodev_sym_session_set_user_data;
 	rte_crypto_asym_op_strings;
 	rte_crypto_asym_xform_strings;
+	rte_cryptodev_sym_session_pool_create;
+	rte_cryptodev_sym_get_existing_header_session_size;
 };
diff --git a/lib/librte_vhost/rte_vhost_crypto.h b/lib/librte_vhost/rte_vhost_crypto.h
index f9fbc0548..d08e0ffab 100644
--- a/lib/librte_vhost/rte_vhost_crypto.h
+++ b/lib/librte_vhost/rte_vhost_crypto.h
@@ -26,8 +26,9 @@ enum rte_vhost_crypto_zero_copy {
  *  The identifier of DPDK Cryptodev, the same cryptodev_id can be assigned to
  *  multiple Vhost-crypto devices.
  * @param sess_pool
- *  The pointer to the created cryptodev session pool with the private data size
- *  matches the target DPDK Cryptodev.
+ *  The pointer to the created cryptodev session pool.
+ * @param sess_priv_pool
+ *  The pointer to the created cryptodev session private data mempool.
  * @param socket_id
  *  NUMA Socket ID to allocate resources on. *
  * @return
@@ -36,7 +37,9 @@ enum rte_vhost_crypto_zero_copy {
  */
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id);
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id);
 
 /**
  *  Free the Vhost-crypto instance
diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index dd01afc08..598196fb7 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -198,6 +198,7 @@ struct vhost_crypto {
 	struct rte_hash *session_map;
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *wb_pool;
 
 	/** DPDK cryptodev ID */
@@ -369,7 +370,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
 	}
 
 	if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
-			vcrypto->sess_pool) < 0) {
+			vcrypto->sess_priv_pool) < 0) {
 		VC_LOG_ERR("Failed to initialize session");
 		sess_param->session_id = -VIRTIO_CRYPTO_ERR;
 		return;
@@ -1293,7 +1294,9 @@ vhost_crypto_complete_one_vm_requests(struct rte_crypto_op **ops,
 
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id)
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id)
 {
 	struct virtio_net *dev = get_device(vid);
 	struct rte_hash_parameters params = {0};
@@ -1321,6 +1324,7 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
 	}
 
 	vcrypto->sess_pool = sess_pool;
+	vcrypto->sess_priv_pool = sess_priv_pool;
 	vcrypto->cid = cryptodev_id;
 	vcrypto->cache_session_id = UINT64_MAX;
 	vcrypto->last_session_id = 1;
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index aac0b1f0b..b66e73486 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -48,6 +48,7 @@ struct crypto_testsuite_params {
 	struct rte_mempool *large_mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config conf;
 	struct rte_cryptodev_qp_conf qp_conf;
 
@@ -444,17 +445,24 @@ testsuite_setup(void)
 		return TEST_FAILED;
 	}
 
-	ts_params->session_mpool = rte_mempool_create(
-				"test_sess_mp",
-				MAX_NB_SESSIONS * 2,
-				session_size,
-				0, 0, NULL, NULL, NULL,
-				NULL, SOCKET_ID_ANY,
-				0);
-
+	ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
+			"test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+			SOCKET_ID_ANY);
 	TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
 			"session mempool allocation failed");
 
+	ts_params->session_priv_mpool = rte_mempool_create(
+			"test_sess_mp_priv",
+			MAX_NB_SESSIONS,
+			session_size,
+			0, 0, NULL, NULL, NULL,
+			NULL, SOCKET_ID_ANY,
+			0);
+	TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
+			"session mempool allocation failed");
+
+
+
 	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
 			&ts_params->conf),
 			"Failed to configure cryptodev %u with %u qps",
@@ -462,7 +470,7 @@ testsuite_setup(void)
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	ts_params->qp_conf.mp_session = ts_params->session_mpool;
-	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -491,6 +499,11 @@ testsuite_teardown(void)
 	}
 
 	/* Free session mempools */
+	if (ts_params->session_priv_mpool != NULL) {
+		rte_mempool_free(ts_params->session_priv_mpool);
+		ts_params->session_priv_mpool = NULL;
+	}
+
 	if (ts_params->session_mpool != NULL) {
 		rte_mempool_free(ts_params->session_mpool);
 		ts_params->session_mpool = NULL;
@@ -710,7 +723,7 @@ test_queue_pair_descriptor_setup(void)
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
 	qp_conf.mp_session = ts_params->session_mpool;
-	qp_conf.mp_session_private = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -1337,7 +1350,7 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
 	/* Create crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate crypto op data structure */
@@ -1551,7 +1564,7 @@ test_AES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1570,7 +1583,7 @@ test_AES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1589,7 +1602,7 @@ test_AES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1608,7 +1621,7 @@ test_DES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1627,7 +1640,7 @@ test_authonly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1646,7 +1659,7 @@ test_authonly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1664,7 +1677,7 @@ test_AES_chain_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1685,7 +1698,7 @@ test_AES_cipheronly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1704,7 +1717,7 @@ test_AES_chain_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1723,7 +1736,7 @@ test_authonly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1744,7 +1757,7 @@ test_AES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1763,7 +1776,7 @@ test_AES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1782,7 +1795,7 @@ test_AES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1801,7 +1814,7 @@ test_AES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1820,7 +1833,7 @@ test_AES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1839,7 +1852,7 @@ test_AES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1858,7 +1871,7 @@ test_AES_cipheronly_virtio_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)),
@@ -1877,7 +1890,7 @@ test_AES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1896,7 +1909,7 @@ test_AES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1915,7 +1928,7 @@ test_authonly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1935,7 +1948,7 @@ test_AES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1954,7 +1967,7 @@ test_AES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1973,7 +1986,7 @@ test_authonly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1992,7 +2005,7 @@ test_AES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2011,7 +2024,7 @@ test_AES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2030,7 +2043,7 @@ test_authonly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2049,7 +2062,7 @@ test_authonly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -2068,7 +2081,7 @@ test_authonly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -2087,7 +2100,7 @@ test_AES_chain_armv8_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)),
@@ -2106,7 +2119,7 @@ test_AES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2125,7 +2138,7 @@ test_AES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2144,7 +2157,7 @@ test_authonly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2163,7 +2176,7 @@ test_3DES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2182,7 +2195,7 @@ test_3DES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2201,6 +2214,7 @@ test_AES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2219,6 +2233,7 @@ test_AES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2237,6 +2252,7 @@ test_3DES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2255,6 +2271,7 @@ test_3DES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2273,6 +2290,7 @@ test_authonly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2315,7 +2333,8 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2352,7 +2371,8 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2468,7 +2488,8 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2527,7 +2548,8 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2589,7 +2611,8 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -5075,7 +5098,7 @@ test_3DES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5094,7 +5117,7 @@ test_DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5113,7 +5136,7 @@ test_DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5132,7 +5155,7 @@ test_DES_docsis_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5151,7 +5174,7 @@ test_DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5169,7 +5192,7 @@ test_3DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5188,7 +5211,7 @@ test_DES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5207,7 +5230,7 @@ test_3DES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5226,7 +5249,7 @@ test_3DES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5245,7 +5268,7 @@ test_3DES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5264,7 +5287,7 @@ test_3DES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5283,7 +5306,7 @@ test_3DES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5302,7 +5325,7 @@ test_3DES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5321,7 +5344,7 @@ test_3DES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5340,7 +5363,7 @@ test_3DES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5359,7 +5382,7 @@ test_3DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5378,7 +5401,7 @@ test_3DES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5397,7 +5420,7 @@ test_3DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5443,7 +5466,8 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->aead_xform, ts_params->session_mpool);
+			&ut_params->aead_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -6728,7 +6752,7 @@ test_multi_session(void)
 
 		rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				sessions[i], &ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
 				i);
@@ -6766,7 +6790,7 @@ test_multi_session(void)
 	/* Next session create should fail */
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			sessions[i], &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NULL(sessions[i],
 			"Session creation succeeded unexpectedly!");
 
@@ -6847,7 +6871,7 @@ test_multi_session_random_usage(void)
 				ts_params->valid_devs[0],
 				sessions[i],
 				&ut_paramz[i].ut_params.auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
@@ -6925,7 +6949,7 @@ test_null_cipher_only_operation(void)
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				ut_params->sess,
 				&ut_params->cipher_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6998,7 +7022,7 @@ test_null_auth_only_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7077,7 +7101,7 @@ test_null_cipher_auth_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7165,7 +7189,7 @@ test_null_auth_cipher_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7235,7 +7259,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7253,7 +7277,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7294,7 +7318,7 @@ test_null_burst_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
@@ -7429,7 +7453,7 @@ static int create_gmac_session(uint8_t dev_id,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7809,7 +7833,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7862,7 +7886,7 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -8740,12 +8764,14 @@ test_scheduler_attach_slave_op(void)
 	for (i = 0; i < rte_cryptodev_count() && nb_devs_attached < 2;
 			i++) {
 		struct rte_cryptodev_info info;
+		unsigned int session_size;
 
 		rte_cryptodev_info_get(i, &info);
 		if (info.driver_id != rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
 			continue;
 
+		session_size = rte_cryptodev_sym_get_private_session_size(i);
 		/*
 		 * Create the session mempool again, since now there are new devices
 		 * to use the mempool.
@@ -8754,8 +8780,10 @@ test_scheduler_attach_slave_op(void)
 			rte_mempool_free(ts_params->session_mpool);
 			ts_params->session_mpool = NULL;
 		}
-		unsigned int session_size =
-			rte_cryptodev_sym_get_private_session_size(i);
+		if (ts_params->session_priv_mpool) {
+			rte_mempool_free(ts_params->session_priv_mpool);
+			ts_params->session_priv_mpool = NULL;
+		}
 
 		if (info.sym.max_nb_sessions != 0 &&
 				info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
@@ -8766,19 +8794,33 @@ test_scheduler_attach_slave_op(void)
 			return TEST_FAILED;
 		}
 		/*
-		 * Create mempool with maximum number of sessions * 2,
+		 * Create mempool with maximum number of sessions,
 		 * to include the session headers
 		 */
 		if (ts_params->session_mpool == NULL) {
-			ts_params->session_mpool = rte_mempool_create(
-					"test_sess_mp",
-					MAX_NB_SESSIONS * 2,
+			ts_params->session_mpool =
+				rte_cryptodev_sym_session_pool_create(
+						"test_sess_mp",
+						MAX_NB_SESSIONS, 0, 0, 0,
+						SOCKET_ID_ANY);
+			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+					"session mempool allocation failed");
+		}
+
+		/*
+		 * Create mempool with maximum number of sessions,
+		 * to include device specific session private data
+		 */
+		if (ts_params->session_priv_mpool == NULL) {
+			ts_params->session_priv_mpool = rte_mempool_create(
+					"test_sess_mp_priv",
+					MAX_NB_SESSIONS,
 					session_size,
 					0, 0, NULL, NULL, NULL,
 					NULL, SOCKET_ID_ANY,
 					0);
 
-			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+			TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
 					"session mempool allocation failed");
 		}
 
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 1c3f29f6b..4d6f46a6e 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -25,6 +25,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 	struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	char *test_msg)
@@ -347,7 +348,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 		sess = rte_cryptodev_sym_session_create(sess_mpool);
 
 		rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
-				sess_mpool);
+				sess_priv_mpool);
 		if (!sess) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
@@ -615,6 +616,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type)
@@ -730,7 +732,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			continue;
 
 		status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
-			sess_mpool, dev_id, driver_id, test_msg);
+			sess_mpool, sess_priv_mpool, dev_id, driver_id,
+			test_msg);
 
 		printf("  %u) TestCase %s %s\n", test_index ++,
 			tc->test_descr, test_msg);
diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h
index f8bd85838..5c22d5da6 100644
--- a/test/test/test_cryptodev_blockcipher.h
+++ b/test/test/test_cryptodev_blockcipher.h
@@ -104,6 +104,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type);
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index 54717870e..f750ce3d8 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -61,6 +61,7 @@ struct event_crypto_adapter_test_params {
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config *config;
 	uint8_t crypto_event_port_id;
 };
@@ -193,12 +194,13 @@ test_op_forward_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		/* Create Crypto session*/
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
 							evdev, &cap);
@@ -381,7 +383,8 @@ test_op_new_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
@@ -396,7 +399,7 @@ test_op_new_mode(uint8_t session_less)
 						&m_data, sizeof(m_data));
 		}
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 		rte_crypto_op_attach_sym_session(op, sess);
 	} else {
 		struct rte_crypto_sym_xform *first_xform;
@@ -526,15 +529,20 @@ configure_cryptodev(void)
 	session_size = rte_cryptodev_sym_get_private_session_size(TEST_CDEV_ID);
 	session_size += sizeof(union rte_event_crypto_metadata);
 
-	params.session_mpool = rte_mempool_create(
-				"CRYPTO_ADAPTER_SESSION_MP",
-				MAX_NB_SESSIONS * 2,
+	params.session_mpool = rte_cryptodev_sym_session_pool_create(
+			"CRYPTO_ADAPTER_SESSION_MP",
+			MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+	TEST_ASSERT_NOT_NULL(params.session_mpool,
+			"session mempool allocation failed\n");
+
+	params.session_priv_mpool = rte_mempool_create(
+				"CRYPTO_ADAPTER_SESSION_MP_PRIV",
+				MAX_NB_SESSIONS,
 				session_size,
 				0, 0, NULL, NULL, NULL,
 				NULL, SOCKET_ID_ANY,
 				0);
-
-	TEST_ASSERT_NOT_NULL(params.session_mpool,
+	TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
 			"session mempool allocation failed\n");
 
 	rte_cryptodev_info_get(TEST_CDEV_ID, &info);
@@ -547,7 +555,7 @@ configure_cryptodev(void)
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	qp_conf.mp_session = params.session_mpool;
-	qp_conf.mp_session_private = params.session_mpool;
+	qp_conf.mp_session_private = params.session_priv_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -859,6 +867,10 @@ crypto_teardown(void)
 		rte_mempool_free(params.session_mpool);
 		params.session_mpool = NULL;
 	}
+	if (params.session_priv_mpool != NULL) {
+		rte_mempool_free(params.session_priv_mpool);
+		params.session_priv_mpool = NULL;
+	}
 
 	/* Free ops mempool */
 	if (params.op_mpool != NULL) {
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session
  2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
  2018-12-11 10:34   ` [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure Fan Zhang
  2018-12-11 10:34   ` [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure Fan Zhang
@ 2018-12-11 12:26   ` Ananyev, Konstantin
  2018-12-21 13:55   ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
  3 siblings, 0 replies; 61+ messages in thread
From: Ananyev, Konstantin @ 2018-12-11 12:26 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Tuesday, December 11, 2018 10:34 AM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session
> 
> This patchset changes the queue pair configure structure and sym session
> structure for cryptodev. An RFC patch http://patchwork.dpdk.org/patch/43883/
> has been sent to state the change.
> 
> v2:
> - Removed incorrect config/common_base change
> - Added new API for existing session size
> - Changed element name of symmetric session
> 
> Fan Zhang (2):
>   cryptodev: change queue pair configure structure
>   cryptodev: change symmetric session structure
> 
>  app/test-crypto-perf/cperf.h                       |   1 +
>  app/test-crypto-perf/cperf_ops.c                   |  11 +-
>  app/test-crypto-perf/cperf_ops.h                   |   2 +-
>  app/test-crypto-perf/cperf_test_latency.c          |   5 +-
>  app/test-crypto-perf/cperf_test_latency.h          |   1 +
>  app/test-crypto-perf/cperf_test_pmd_cyclecount.c   |   5 +-
>  app/test-crypto-perf/cperf_test_pmd_cyclecount.h   |   1 +
>  app/test-crypto-perf/cperf_test_throughput.c       |   5 +-
>  app/test-crypto-perf/cperf_test_throughput.h       |   1 +
>  app/test-crypto-perf/cperf_test_verify.c           |   5 +-
>  app/test-crypto-perf/cperf_test_verify.h           |   1 +
>  app/test-crypto-perf/main.c                        | 105 ++++++---
>  doc/guides/rel_notes/release_19_02.rst             |  19 ++
>  drivers/crypto/aesni_gcm/Makefile                  |   1 +
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  10 +-
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |   5 +-
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |   2 +
>  drivers/crypto/aesni_gcm/meson.build               |   1 +
>  drivers/crypto/aesni_mb/Makefile                   |   1 +
>  drivers/crypto/aesni_mb/meson.build                |   1 +
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  10 +-
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |   5 +-
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +
>  drivers/crypto/armv8/Makefile                      |   1 +
>  drivers/crypto/armv8/rte_armv8_pmd.c               |  10 +-
>  drivers/crypto/armv8/rte_armv8_pmd_ops.c           |   5 +-
>  drivers/crypto/armv8/rte_armv8_pmd_private.h       |   2 +
>  drivers/crypto/caam_jr/caam_jr.c                   |   3 +-
>  drivers/crypto/ccp/ccp_pmd_ops.c                   |   5 +-
>  drivers/crypto/ccp/ccp_pmd_private.h               |   2 +
>  drivers/crypto/ccp/rte_ccp_pmd.c                   |   9 +-
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |   3 +-
>  drivers/crypto/dpaa_sec/dpaa_sec.c                 |   3 +-
>  drivers/crypto/kasumi/Makefile                     |   1 +
>  drivers/crypto/kasumi/meson.build                  |   1 +
>  drivers/crypto/kasumi/rte_kasumi_pmd.c             |  10 +-
>  drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |   5 +-
>  drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |   2 +
>  drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |   5 +-
>  drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |   3 +
>  drivers/crypto/null/null_crypto_pmd.c              |   5 +-
>  drivers/crypto/null/null_crypto_pmd_ops.c          |   5 +-
>  drivers/crypto/null/null_crypto_pmd_private.h      |   2 +
>  drivers/crypto/octeontx/otx_cryptodev_ops.c        |   3 +-
>  drivers/crypto/openssl/Makefile                    |   1 +
>  drivers/crypto/openssl/meson.build                 |   1 +
>  drivers/crypto/openssl/rte_openssl_pmd.c           |  10 +-
>  drivers/crypto/openssl/rte_openssl_pmd_ops.c       |   5 +-
>  drivers/crypto/openssl/rte_openssl_pmd_private.h   |   2 +
>  drivers/crypto/qat/qat_sym_pmd.c                   |   2 +-
>  drivers/crypto/scheduler/scheduler_pmd_ops.c       |   5 +-
>  drivers/crypto/snow3g/Makefile                     |   1 +
>  drivers/crypto/snow3g/rte_snow3g_pmd.c             |  10 +-
>  drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |   5 +-
>  drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |   2 +
>  drivers/crypto/virtio/virtio_cryptodev.c           |   6 +-
>  drivers/crypto/zuc/Makefile                        |   1 +
>  drivers/crypto/zuc/meson.build                     |   1 +
>  drivers/crypto/zuc/rte_zuc_pmd.c                   |  10 +-
>  drivers/crypto/zuc/rte_zuc_pmd_ops.c               |   5 +-
>  drivers/crypto/zuc/rte_zuc_pmd_private.h           |   2 +
>  drivers/net/softnic/rte_eth_softnic_cli.c          |  53 ++++-
>  drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  52 ++++-
>  drivers/net/softnic/rte_eth_softnic_internals.h    |   3 +
>  examples/fips_validation/main.c                    |  43 +++-
>  examples/ip_pipeline/cli.c                         |  49 ++--
>  examples/ip_pipeline/cryptodev.c                   |  51 ++++-
>  examples/ip_pipeline/cryptodev.h                   |   3 +
>  examples/ip_pipeline/examples/flow_crypto.cli      |   9 +-
>  examples/ipsec-secgw/ipsec-secgw.c                 |  51 +++--
>  examples/ipsec-secgw/ipsec.c                       |   2 +-
>  examples/ipsec-secgw/ipsec.h                       |   2 +
>  examples/l2fwd-crypto/main.c                       |  66 ++++--
>  examples/vhost_crypto/main.c                       |  22 +-
>  lib/librte_cryptodev/Makefile                      |   1 +
>  lib/librte_cryptodev/meson.build                   |   1 +
>  lib/librte_cryptodev/rte_cryptodev.c               | 190 +++++++++++++---
>  lib/librte_cryptodev/rte_cryptodev.h               |  72 +++++-
>  lib/librte_cryptodev/rte_cryptodev_pmd.h           |  16 +-
>  lib/librte_cryptodev/rte_cryptodev_version.map     |   2 +
>  lib/librte_vhost/rte_vhost_crypto.h                |   9 +-
>  lib/librte_vhost/vhost_crypto.c                    |   8 +-
>  test/test/test_cryptodev.c                         | 253 ++++++++++++---------
>  test/test/test_cryptodev_asym.c                    |   8 +-
>  test/test/test_cryptodev_blockcipher.c             |   7 +-
>  test/test/test_cryptodev_blockcipher.h             |   1 +
>  test/test/test_event_crypto_adapter.c              |  35 ++-
>  87 files changed, 981 insertions(+), 382 deletions(-)
> 
> --

There are few checkpatch warnings.
Apart from that:
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>  

> 2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure
  2018-12-11 10:34   ` [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure Fan Zhang
@ 2018-12-17 19:31     ` Trahe, Fiona
  0 siblings, 0 replies; 61+ messages in thread
From: Trahe, Fiona @ 2018-12-17 19:31 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Ananyev, Konstantin, Trahe, Fiona



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Tuesday, December 11, 2018 3:34 AM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure
> 
> This patch changes the cryptodev queue pair configure structure
> to enable two mempool passed into cryptodev PMD simutaneously.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
For cryptodev lib changes, qat, null and test code changes:
Acked-by: Fiona Trahe <fiona.trahe@@intel.com>

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure
  2018-12-11 10:34   ` [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure Fan Zhang
@ 2018-12-17 20:29     ` Trahe, Fiona
  2018-12-18 16:25       ` Zhang, Roy Fan
  0 siblings, 1 reply; 61+ messages in thread
From: Trahe, Fiona @ 2018-12-17 20:29 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Ananyev, Konstantin, Trahe, Fiona

Hi Fan,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Tuesday, December 11, 2018 3:34 AM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure
> 
> This patch changes the symmetric session structure of cryptodev.
> The symmetric session now contains extra information for secure
> access purposes. The patch also includes the updates to the
> PMDs, test applications, and examples to fit the change.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---


> 
//snip////
>  int
>  rte_cryptodev_sym_session_init(uint8_t dev_id,
>  		struct rte_cryptodev_sym_session *sess,
> @@ -1160,12 +1206,15 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
>  		return -EINVAL;
> 
>  	index = dev->driver_id;
> +	if (index > sess->nb_drivers)
> +		return -EINVAL;
[Fiona] This should be <=


> -
>  unsigned int
>  rte_cryptodev_sym_get_header_session_size(void)
>  {
>  	/*
> -	 * Header contains pointers to the private data
> +	 * Header contains all dpointers to the private data
[Fiona] typo. And comment should be updated as it also 
now contains more than just a flag


>  	 * of all registered drivers, and a flag which
>  	 * indicates presence of user data
>  	 */
> -	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
> +	struct rte_cryptodev_sym_session s = {0};
> +	s.nb_drivers = nb_drivers;
> +	s.user_data_sz = 0;
[Fiona] Why is a get_header_session_size fn initialising fields in the session?
Doesn't seem right?

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure
  2018-12-17 20:29     ` Trahe, Fiona
@ 2018-12-18 16:25       ` Zhang, Roy Fan
  2018-12-18 16:32         ` Trahe, Fiona
  0 siblings, 1 reply; 61+ messages in thread
From: Zhang, Roy Fan @ 2018-12-18 16:25 UTC (permalink / raw)
  To: Trahe, Fiona, dev; +Cc: akhil.goyal, Ananyev, Konstantin

Hi Fiona,

Thanks for the review. Comments inline.

> -----Original Message-----
> From: Trahe, Fiona
> Sent: Monday, December 17, 2018 8:30 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session
> structure
> 
> Hi Fan,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> > Sent: Tuesday, December 11, 2018 3:34 AM
> > To: dev@dpdk.org
> > Cc: akhil.goyal@nxp.com; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>
> > Subject: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session
> > structure
> >
> > This patch changes the symmetric session structure of cryptodev.
> > The symmetric session now contains extra information for secure access
> > purposes. The patch also includes the updates to the PMDs, test
> > applications, and examples to fit the change.
> >
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > ---
> 
> 
> >
> //snip////
> >  int
> >  rte_cryptodev_sym_session_init(uint8_t dev_id,
> >  		struct rte_cryptodev_sym_session *sess, @@ -1160,12
> +1206,15 @@
> > rte_cryptodev_sym_session_init(uint8_t dev_id,
> >  		return -EINVAL;
> >
> >  	index = dev->driver_id;
> > +	if (index > sess->nb_drivers)
> > +		return -EINVAL;
> [Fiona] This should be <=
[Fan] I assume it is >= right?
> 
> 
> > -
> >  unsigned int
> >  rte_cryptodev_sym_get_header_session_size(void)
> >  {
> >  	/*
> > -	 * Header contains pointers to the private data
> > +	 * Header contains all dpointers to the private data
> [Fiona] typo. And comment should be updated as it also now contains more
> than just a flag
[Fan] Will change. Thanks for the catch.
> 
> 
> >  	 * of all registered drivers, and a flag which
> >  	 * indicates presence of user data
> >  	 */
> > -	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
> > +	struct rte_cryptodev_sym_session s = {0};
> > +	s.nb_drivers = nb_drivers;
> > +	s.user_data_sz = 0;
> [Fiona] Why is a get_header_session_size fn initialising fields in the session?
> Doesn't seem right?

[Fan] Header session includes the rte_cryptodev_sym_session structure plus the extended area to store session's driver specific private data. This function is used to obtain a "safe" session size (structure itself and the session private data pointers) with existing nb_drivers up-to-date exclude the user data size. A temporary sym session variable here is used to pass into rte_cryptodev_sym_session_data_size() function call so the data area size can be obtained.

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure
  2018-12-18 16:25       ` Zhang, Roy Fan
@ 2018-12-18 16:32         ` Trahe, Fiona
  0 siblings, 0 replies; 61+ messages in thread
From: Trahe, Fiona @ 2018-12-18 16:32 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Ananyev, Konstantin, Trahe, Fiona

Hi Fan,

> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Tuesday, December 18, 2018 9:25 AM
> To: Trahe, Fiona <fiona.trahe@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure
> 
> Hi Fiona,
> 
> Thanks for the review. Comments inline.
> 
> > -----Original Message-----
> > From: Trahe, Fiona
> > Sent: Monday, December 17, 2018 8:30 PM
> > To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> > Cc: akhil.goyal@nxp.com; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session
> > structure
> >
> > Hi Fan,
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> > > Sent: Tuesday, December 11, 2018 3:34 AM
> > > To: dev@dpdk.org
> > > Cc: akhil.goyal@nxp.com; Ananyev, Konstantin
> > > <konstantin.ananyev@intel.com>
> > > Subject: [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session
> > > structure
> > >
> > > This patch changes the symmetric session structure of cryptodev.
> > > The symmetric session now contains extra information for secure access
> > > purposes. The patch also includes the updates to the PMDs, test
> > > applications, and examples to fit the change.
> > >
> > > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > > ---
> >
> >
> > >
> > //snip////
> > >  int
> > >  rte_cryptodev_sym_session_init(uint8_t dev_id,
> > >  		struct rte_cryptodev_sym_session *sess, @@ -1160,12
> > +1206,15 @@
> > > rte_cryptodev_sym_session_init(uint8_t dev_id,
> > >  		return -EINVAL;
> > >
> > >  	index = dev->driver_id;
> > > +	if (index > sess->nb_drivers)
> > > +		return -EINVAL;
> > [Fiona] This should be <=
> [Fan] I assume it is >= right?
[Fiona] oops, yes.
> >
> >
> > > -
> > >  unsigned int
> > >  rte_cryptodev_sym_get_header_session_size(void)
> > >  {
> > >  	/*
> > > -	 * Header contains pointers to the private data
> > > +	 * Header contains all dpointers to the private data
> > [Fiona] typo. And comment should be updated as it also now contains more
> > than just a flag
> [Fan] Will change. Thanks for the catch.
> >
> >
> > >  	 * of all registered drivers, and a flag which
> > >  	 * indicates presence of user data
> > >  	 */
> > > -	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
> > > +	struct rte_cryptodev_sym_session s = {0};
> > > +	s.nb_drivers = nb_drivers;
> > > +	s.user_data_sz = 0;
> > [Fiona] Why is a get_header_session_size fn initialising fields in the session?
> > Doesn't seem right?
> 
> [Fan] Header session includes the rte_cryptodev_sym_session structure plus the extended area to
> store session's driver specific private data. This function is used to obtain a "safe" session size
> (structure itself and the session private data pointers) with existing nb_drivers up-to-date exclude the
> user data size. A temporary sym session variable here is used to pass into
> rte_cryptodev_sym_session_data_size() function call so the data area size can be obtained.
[Fiona] ok

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v3 0/2] cryptodev: change qp conf and sym session
  2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
                     ` (2 preceding siblings ...)
  2018-12-11 12:26   ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Ananyev, Konstantin
@ 2018-12-21 13:55   ` Fan Zhang
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
                       ` (2 more replies)
  3 siblings, 3 replies; 61+ messages in thread
From: Fan Zhang @ 2018-12-21 13:55 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patchset changes the queue pair configure structure and sym session
structure for cryptodev. An RFC patch http://patchwork.dpdk.org/patch/43883/
has been sent to state the change.

v3:
- Rebased.
- Fixed a few bugs.

v2:
- Removed incorrect config/common_base change
- Added new API for existing session size
- Changed element name of symmetric session

Fan Zhang (2):
  cryptodev: change queue pair configure structure
  cryptodev: change symmetric session structure

 app/test-crypto-perf/cperf.h                       |   1 +
 app/test-crypto-perf/cperf_ops.c                   |  11 +-
 app/test-crypto-perf/cperf_ops.h                   |   2 +-
 app/test-crypto-perf/cperf_test_latency.c          |   5 +-
 app/test-crypto-perf/cperf_test_latency.h          |   1 +
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c   |   5 +-
 app/test-crypto-perf/cperf_test_pmd_cyclecount.h   |   1 +
 app/test-crypto-perf/cperf_test_throughput.c       |   5 +-
 app/test-crypto-perf/cperf_test_throughput.h       |   1 +
 app/test-crypto-perf/cperf_test_verify.c           |   5 +-
 app/test-crypto-perf/cperf_test_verify.h           |   1 +
 app/test-crypto-perf/main.c                        | 105 ++++++---
 doc/guides/rel_notes/release_19_02.rst             |  19 ++
 drivers/crypto/aesni_gcm/Makefile                  |   1 +
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  10 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |   5 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |   2 +
 drivers/crypto/aesni_gcm/meson.build               |   1 +
 drivers/crypto/aesni_mb/Makefile                   |   1 +
 drivers/crypto/aesni_mb/meson.build                |   2 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  10 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |   5 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +
 drivers/crypto/armv8/Makefile                      |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c               |  10 +-
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |   5 +-
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |   2 +
 drivers/crypto/caam_jr/caam_jr.c                   |   3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |   5 +-
 drivers/crypto/ccp/ccp_pmd_private.h               |   2 +
 drivers/crypto/ccp/rte_ccp_pmd.c                   |   9 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |   3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |   3 +-
 drivers/crypto/kasumi/Makefile                     |   1 +
 drivers/crypto/kasumi/meson.build                  |   1 +
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  10 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |   5 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |   2 +
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |   5 +-
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |   3 +
 drivers/crypto/null/null_crypto_pmd.c              |   5 +-
 drivers/crypto/null/null_crypto_pmd_ops.c          |   5 +-
 drivers/crypto/null/null_crypto_pmd_private.h      |   2 +
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |   3 +-
 drivers/crypto/openssl/Makefile                    |   1 +
 drivers/crypto/openssl/meson.build                 |   1 +
 drivers/crypto/openssl/rte_openssl_pmd.c           |  10 +-
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |   5 +-
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |   2 +
 drivers/crypto/qat/qat_sym_pmd.c                   |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |   5 +-
 drivers/crypto/snow3g/Makefile                     |   1 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  10 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |   5 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |   2 +
 drivers/crypto/virtio/virtio_cryptodev.c           |   6 +-
 drivers/crypto/zuc/Makefile                        |   1 +
 drivers/crypto/zuc/meson.build                     |   1 +
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  10 +-
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |   5 +-
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |   2 +
 drivers/net/softnic/rte_eth_softnic_cli.c          |  52 +++-
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  52 +++-
 drivers/net/softnic/rte_eth_softnic_internals.h    |   3 +
 examples/fips_validation/main.c                    |  38 ++-
 examples/ip_pipeline/cli.c                         |  49 ++--
 examples/ip_pipeline/cryptodev.c                   |  51 +++-
 examples/ip_pipeline/cryptodev.h                   |   3 +
 examples/ip_pipeline/examples/flow_crypto.cli      |   9 +-
 examples/ipsec-secgw/ipsec-secgw.c                 |  51 ++--
 examples/ipsec-secgw/ipsec.c                       |   2 +-
 examples/ipsec-secgw/ipsec.h                       |   2 +
 examples/l2fwd-crypto/main.c                       |  66 ++++--
 examples/vhost_crypto/main.c                       |  22 +-
 lib/librte_cryptodev/Makefile                      |   1 +
 lib/librte_cryptodev/meson.build                   |   1 +
 lib/librte_cryptodev/rte_cryptodev.c               | 195 ++++++++++++---
 lib/librte_cryptodev/rte_cryptodev.h               |  72 +++++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  16 +-
 lib/librte_cryptodev/rte_cryptodev_version.map     |   2 +
 lib/librte_vhost/rte_vhost_crypto.h                |   9 +-
 lib/librte_vhost/vhost_crypto.c                    |   8 +-
 test/test/test_cryptodev.c                         | 262 ++++++++++++---------
 test/test/test_cryptodev_asym.c                    |   8 +-
 test/test/test_cryptodev_blockcipher.c             |   7 +-
 test/test/test_cryptodev_blockcipher.h             |   1 +
 test/test/test_event_crypto_adapter.c              |  35 ++-
 87 files changed, 992 insertions(+), 380 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure
  2018-12-21 13:55   ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
@ 2018-12-21 13:55     ` Fan Zhang
  2019-01-08 23:20       ` De Lara Guarch, Pablo
  2019-01-09 10:41       ` De Lara Guarch, Pablo
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure Fan Zhang
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
  2 siblings, 2 replies; 61+ messages in thread
From: Fan Zhang @ 2018-12-21 13:55 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch changes the cryptodev queue pair configure structure
to enable two mempool passed into cryptodev PMD simutaneously.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@@intel.com>
---
 app/test-crypto-perf/main.c                        |  6 ++--
 doc/guides/rel_notes/release_19_02.rst             |  5 +++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  7 ++--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |  5 +--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |  2 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  7 ++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  5 +--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |  2 ++
 drivers/crypto/armv8/rte_armv8_pmd.c               |  7 ++--
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |  5 +--
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |  2 ++
 drivers/crypto/caam_jr/caam_jr.c                   |  3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |  5 +--
 drivers/crypto/ccp/ccp_pmd_private.h               |  2 ++
 drivers/crypto/ccp/rte_ccp_pmd.c                   |  9 +++++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |  3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |  3 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  7 ++--
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |  5 +--
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |  2 ++
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |  5 +--
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |  3 ++
 drivers/crypto/null/null_crypto_pmd.c              |  5 +--
 drivers/crypto/null/null_crypto_pmd_ops.c          |  5 +--
 drivers/crypto/null/null_crypto_pmd_private.h      |  2 ++
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |  3 +-
 drivers/crypto/openssl/rte_openssl_pmd.c           |  7 ++--
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |  5 +--
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |  2 ++
 drivers/crypto/qat/qat_sym_pmd.c                   |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |  5 ++-
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  7 ++--
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |  5 +--
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |  2 ++
 drivers/crypto/virtio/virtio_cryptodev.c           |  6 ++--
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  7 ++--
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |  5 +--
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |  2 ++
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  2 +-
 examples/fips_validation/main.c                    |  4 +--
 examples/ip_pipeline/cryptodev.c                   |  2 +-
 examples/ipsec-secgw/ipsec-secgw.c                 |  7 ++--
 examples/l2fwd-crypto/main.c                       |  4 ++-
 examples/vhost_crypto/main.c                       |  9 ++++--
 lib/librte_cryptodev/rte_cryptodev.c               |  5 ++-
 lib/librte_cryptodev/rte_cryptodev.h               |  7 ++--
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  3 +-
 test/test/test_cryptodev.c                         | 37 +++++++++-------------
 test/test/test_cryptodev_asym.c                    |  8 ++---
 test/test/test_event_crypto_adapter.c              |  5 +--
 50 files changed, 156 insertions(+), 107 deletions(-)

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 953e058c9..38a2e429f 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -218,6 +218,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 			session_pool_socket[socket_id] = sess_mp;
 		}
 
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
+
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
 			printf("Failed to configure cryptodev %u", cdev_id);
@@ -226,8 +229,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 
 		for (j = 0; j < opts->nb_qps; j++) {
 			ret = rte_cryptodev_queue_pair_setup(cdev_id, j,
-				&qp_conf, socket_id,
-				session_pool_socket[socket_id]);
+				&qp_conf, socket_id);
 			if (ret < 0) {
 				printf("Failed to setup queue pair %u on "
 					"cryptodev %u",	j, cdev_id);
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 47768288a..4420c2441 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -130,6 +130,11 @@ API Changes
   ``rte_pdump_init()`` and enum ``rte_pdump_socktype`` were deprecated
   since 18.05 and are removed in this release.
 
+* cryptodev: as shown in the the 18.08 deprecation notice, the structure
+  ``rte_cryptodev_qp_conf`` has been added two parameters of symmetric session
+  mempool and symmetric session private data mempool, and the last parameter of
+  ``rte_cryptodev_queue_pair_setup()`` is removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index ebdf7c35a..abc7a6d5f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -151,7 +151,8 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_gcm_session *)_sess_private_data;
@@ -159,7 +160,7 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_gcm_set_session_parameters(qp->ops,
 				sess, sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -419,7 +420,7 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index c343a393f..2f70f2a1a 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -201,7 +201,7 @@ aesni_gcm_pmd_qp_create_processed_pkts_ring(struct aesni_gcm_qp *qp,
 static int
 aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_gcm_qp *qp = NULL;
 	struct aesni_gcm_private *internals = dev->data->dev_private;
@@ -229,7 +229,8 @@ aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_pkts == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
index 92b041354..903e7503d 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
@@ -48,6 +48,8 @@ struct aesni_gcm_qp {
 	/**< Queue pair statistics */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	uint16_t id;
 	/**< Queue Pair Identifier */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 83250e32c..b0f5c4d67 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -668,7 +668,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_mb_session *)_sess_private_data;
@@ -676,7 +677,7 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_mb_set_session_parameters(qp->op_fns,
 				sess, op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -951,7 +952,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index f3eff2685..af3021616 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -566,7 +566,7 @@ aesni_mb_pmd_qp_create_processed_ops_ring(struct aesni_mb_qp *qp,
 static int
 aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_mb_qp *qp = NULL;
 	struct aesni_mb_private *internals = dev->data->dev_private;
@@ -604,7 +604,8 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
index d8021cdaa..923403336 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
@@ -131,6 +131,8 @@ struct aesni_mb_qp {
        /**< Ring for placing operations ready for processing */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t digest_idx;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 9d15fee53..3b2d7fb2f 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -514,7 +514,8 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct armv8_crypto_session *)_sess_private_data;
@@ -522,7 +523,7 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(armv8_crypto_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -656,7 +657,7 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
 		rte_mempool_put(qp->sess_mp, sess);
-		rte_mempool_put(qp->sess_mp, op->sym->session);
+		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
 	}
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index ae03117ea..a4fee83a8 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -220,7 +220,7 @@ armv8_crypto_pmd_qp_create_processed_ops_ring(struct armv8_crypto_qp *qp,
 static int
 armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct armv8_crypto_qp *qp = NULL;
 
@@ -245,7 +245,8 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_private.h b/drivers/crypto/armv8/rte_armv8_pmd_private.h
index 7feb021db..0afd9c7c5 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_private.h
+++ b/drivers/crypto/armv8/rte_armv8_pmd_private.h
@@ -116,6 +116,8 @@ struct armv8_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+       /**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index f505adf6b..45b281331 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1540,8 +1540,7 @@ static int
 caam_jr_queue_pair_setup(
 		struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct sec_job_ring_t *internals;
 	struct caam_jr_qp *qp = NULL;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 6984913f1..d5041f0ec 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -685,7 +685,7 @@ ccp_pmd_qp_create_batch_info_ring(struct ccp_qp *qp,
 static int
 ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 const struct rte_cryptodev_qp_conf *qp_conf,
-		 int socket_id, struct rte_mempool *session_pool)
+		 int socket_id)
 {
 	struct ccp_private *internals = dev->data->dev_private;
 	struct ccp_qp *qp;
@@ -726,7 +726,8 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	/* mempool for batch info */
 	qp->batch_mp = rte_mempool_create(
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 79752f687..7f2979e89 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -76,6 +76,8 @@ struct ccp_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_mempool *batch_mp;
 	/**< Session Mempool for batch info */
 	struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 92d8a9559..b4bb5528f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -179,7 +179,7 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
 							internals) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -241,6 +241,13 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	for (i = 0; i < nb_dequeued; i++)
 		if (unlikely(ops[i]->sess_type ==
 			     RTE_CRYPTO_OP_SESSIONLESS)) {
+			struct ccp_session *sess = (struct ccp_session *)
+					get_sym_session_private_data(
+						ops[i]->sym->session,
+						ccp_cryptodev_driver_id);
+
+			rte_mempool_put(qp->sess_mp_priv,
+					sess);
 			rte_mempool_put(qp->sess_mp,
 					ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 6095c6021..82220ac4f 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1518,8 +1518,7 @@ dpaa2_sec_queue_pair_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 static int
 dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
 	struct dpaa2_sec_qp *qp;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index d83e74541..c95e43b7f 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -1661,8 +1661,7 @@ dpaa_sec_queue_pair_release(struct rte_cryptodev *dev,
 static int
 dpaa_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa_sec_dev_private *internals;
 	struct dpaa_sec_qp *qp = NULL;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 239a1cf44..6df645a23 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -145,7 +145,8 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct kasumi_session *)_sess_private_data;
@@ -153,7 +154,7 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(kasumi_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -325,7 +326,7 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index 9e4bf1b52..a4982f091 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -192,7 +192,7 @@ kasumi_pmd_qp_create_processed_ops_ring(struct kasumi_qp *qp,
 static int
 kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
 
@@ -217,7 +217,8 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
index 488777ca8..76f746c03 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
@@ -36,6 +36,8 @@ struct kasumi_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index 9956f051f..ef520356f 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -633,7 +633,7 @@ mrvl_crypto_pmd_close(struct rte_cryptodev *dev)
 static int
 mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct mrvl_crypto_qp *qp = NULL;
 	char match[RTE_CRYPTODEV_NAME_MAX_LEN];
@@ -690,7 +690,8 @@ mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		if (sam_cio_init(&qp->cio_params, &qp->cio) < 0)
 			break;
 
-		qp->sess_mp = session_pool;
+		qp->sess_mp = qp_conf->mp_session;
+		qp->sess_mp_priv = qp_conf->mp_session_private;
 
 		memset(&qp->stats, 0, sizeof(qp->stats));
 		dev->data->queue_pairs[qp_id] = qp;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
index 6f8cf5624..deb80c55d 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
@@ -51,6 +51,9 @@ struct mrvl_crypto_qp {
 	/** Session Mempool. */
 	struct rte_mempool *sess_mp;
 
+	/** Session Private Data Mempool. */
+	struct rte_mempool *sess_mp_priv;
+
 	/** Queue pair statistics. */
 	struct rte_cryptodev_stats stats;
 
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 6e29a21a6..d5e3064f2 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -87,7 +87,8 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct null_crypto_session *)_sess_private_data;
@@ -95,7 +96,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(null_crypto_set_session_parameters(sess,
 				sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 2bdcd019e..941d62bed 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -184,7 +184,7 @@ null_crypto_pmd_qp_create_processed_pkts_ring(struct null_crypto_qp *qp,
 static int
 null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct null_crypto_private *internals = dev->data->dev_private;
 	struct null_crypto_qp *qp;
@@ -228,7 +228,8 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index d5905afd8..d7bfd9cc8 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,6 +31,8 @@ struct null_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 } __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 90d0c14b8..6a0cf83f4 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -186,8 +186,7 @@ static int
 otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
 		       uint16_t que_pair_id,
 		       const struct rte_cryptodev_qp_conf *qp_conf,
-		       int socket_id __rte_unused,
-		       struct rte_mempool *session_pool __rte_unused)
+		       int socket_id __rte_unused)
 {
 	void *cptvf = dev->data->dev_private;
 	struct cpt_instance *instance = NULL;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index a0ccacb1e..a193af642 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -768,7 +768,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct openssl_session *)_sess_private_data;
@@ -776,7 +777,7 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(openssl_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -2020,7 +2021,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index bdaf937a3..5644f593a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -710,7 +710,7 @@ openssl_pmd_qp_create_processed_ops_ring(struct openssl_qp *qp,
 static int
 openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct openssl_qp *qp = NULL;
 
@@ -735,7 +735,8 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_private.h b/drivers/crypto/openssl/rte_openssl_pmd_private.h
index a8f2c8482..43ac3813d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_private.h
+++ b/drivers/crypto/openssl/rte_openssl_pmd_private.h
@@ -64,6 +64,8 @@ struct openssl_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index c3f700406..31ccab32e 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -127,7 +127,7 @@ static int qat_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 
 static int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	const struct rte_cryptodev_qp_conf *qp_conf,
-	int socket_id, struct rte_mempool *session_pool __rte_unused)
+	int socket_id)
 {
 	struct qat_qp *qp;
 	int ret = 0;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 939105aa8..cf70218b7 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -390,8 +390,7 @@ scheduler_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 /** Setup a queue pair */
 static int
 scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
-	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-	struct rte_mempool *session_pool)
+	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
 	struct scheduler_qp_ctx *qp_ctx;
@@ -419,7 +418,7 @@ scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 * must be big enough for all the drivers used.
 		 */
 		ret = rte_cryptodev_queue_pair_setup(slave_id, qp_id,
-				qp_conf, socket_id, session_pool);
+				qp_conf, socket_id);
 		if (ret < 0)
 			return ret;
 	}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index a17536b77..7d131f780 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -147,7 +147,8 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct snow3g_session *)_sess_private_data;
@@ -155,7 +156,7 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(snow3g_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -340,7 +341,7 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
index cfbc9522a..fad483c75 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
@@ -193,7 +193,7 @@ snow3g_pmd_qp_create_processed_ops_ring(struct snow3g_qp *qp,
 static int
 snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
 
@@ -218,7 +218,8 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
index b7807b621..df5c6092b 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
@@ -36,6 +36,8 @@ struct snow3g_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[SNOW3G_DIGEST_LENGTH];
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 568b5a406..4bae3b865 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -36,8 +36,7 @@ static void virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev);
 static int virtio_crypto_qp_setup(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool);
+		int socket_id);
 static int virtio_crypto_qp_release(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id);
 static void virtio_crypto_dev_free_mbufs(struct rte_cryptodev *dev);
@@ -585,8 +584,7 @@ virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev)
 static int
 virtio_crypto_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool __rte_unused)
+		int socket_id)
 {
 	int ret;
 	struct virtqueue *vq;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 313f4590b..997c2092f 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -144,7 +144,8 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct zuc_session *)_sess_private_data;
@@ -152,7 +153,7 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(zuc_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -327,7 +328,7 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, sessions[i]);
+			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
index 6da396542..7bd985fc1 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
@@ -193,7 +193,7 @@ zuc_pmd_qp_create_processed_ops_ring(struct zuc_qp *qp,
 static int
 zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
 
@@ -218,7 +218,8 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_private.h b/drivers/crypto/zuc/rte_zuc_pmd_private.h
index 5e5906ddb..aa73c0016 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_private.h
+++ b/drivers/crypto/zuc/rte_zuc_pmd_private.h
@@ -36,6 +36,8 @@ struct zuc_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[ZUC_DIGEST_LENGTH];
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index 1480f6dd5..f031d8803 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -101,7 +101,7 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e7559c633..384b7a240 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -39,7 +39,7 @@ static int
 cryptodev_fips_validate_app_int(void)
 {
 	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
-	struct rte_cryptodev_qp_conf qp_conf = {128};
+	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
 	int ret;
 
 	ret = rte_cryptodev_configure(env.dev_id, &conf);
@@ -52,7 +52,7 @@ cryptodev_fips_validate_app_int(void)
 		return ret;
 
 	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
-			rte_socket_id(), env.mpool);
+			rte_socket_id());
 	if (ret < 0)
 		return ret;
 
diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c
index c4ba72bec..b365810de 100644
--- a/examples/ip_pipeline/cryptodev.c
+++ b/examples/ip_pipeline/cryptodev.c
@@ -93,7 +93,7 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 1bc0b5b50..a0ff8f7f7 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1493,10 +1493,13 @@ cryptodevs_init(void)
 					cdev_id);
 
 		qp_conf.nb_descriptors = CDEV_QUEUE_DESC;
+		qp_conf.mp_session =
+				socket_ctx[dev_conf.socket_id].session_pool;
+		qp_conf.mp_session_private =
+				socket_ctx[dev_conf.socket_id].session_pool;
 		for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
 			if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
-					&qp_conf, dev_conf.socket_id,
-					socket_ctx[dev_conf.socket_id].session_pool))
+					&qp_conf, dev_conf.socket_id))
 				rte_panic("Failed to setup queue %u for "
 						"cdev_id %u\n",	0, cdev_id);
 
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index f12fd266e..1df7ba743 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2443,9 +2443,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
-				socket_id, session_pool_socket[socket_id]);
+				socket_id);
 		if (retval < 0) {
 			printf("Failed to setup queue pair %u on cryptodev %u",
 					0, cdev_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 3deb5263f..cb30f84c0 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -463,7 +463,7 @@ free_resource(void)
 int
 main(int argc, char *argv[])
 {
-	struct rte_cryptodev_qp_conf qp_conf = {NB_CRYPTO_DESCRIPTORS};
+	struct rte_cryptodev_qp_conf qp_conf;
 	struct rte_cryptodev_config config;
 	struct rte_cryptodev_info dev_info;
 	char name[128];
@@ -551,11 +551,14 @@ main(int argc, char *argv[])
 
 		options.infos[i] = info;
 
+		qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
+		qp_conf.mp_session = info->sess_pool;
+		qp_conf.mp_session_private = info->sess_pool;
+
 		for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
 			ret = rte_cryptodev_queue_pair_setup(info->cid, j,
 					&qp_conf, rte_lcore_to_socket_id(
-							lo->lcore_id),
-					info->sess_pool);
+							lo->lcore_id));
 			if (ret < 0) {
 				RTE_LOG(ERR, USER1, "Failed to configure qp\n");
 				goto error_exit;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a52eaaa45..11776b6ac 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -941,8 +941,7 @@ rte_cryptodev_close(uint8_t dev_id)
 
 int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool)
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 
 {
 	struct rte_cryptodev *dev;
@@ -967,7 +966,7 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
-			socket_id, session_pool);
+			socket_id);
 }
 
 
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 4099823f1..f9e7507da 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -495,6 +495,10 @@ enum rte_cryptodev_event_type {
 /** Crypto device queue pair configuration structure. */
 struct rte_cryptodev_qp_conf {
 	uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
+	struct rte_mempool *mp_session;
+	/**< The mempool for creating session in sessionless mode */
+	struct rte_mempool *mp_session_private;
+	/**< The mempool for creating sess private data in sessionless mode */
 };
 
 /**
@@ -689,8 +693,7 @@ rte_cryptodev_close(uint8_t dev_id);
  */
 extern int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool);
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
 
 /**
  * Get the number of queue pairs on a specific crypto device
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 1b6cafd17..f15c9af30 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -188,13 +188,12 @@ typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev,
  * @param	qp_id		Queue Pair Index
  * @param	qp_conf		Queue configuration structure
  * @param	socket_id	Socket Index
- * @param	session_pool	Pointer to device session mempool
  *
  * @return	Returns 0 on success.
  */
 typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev,
 		uint16_t qp_id,	const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool);
+		int socket_id);
 
 /**
  * Release memory resources allocated by given queue pair.
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 84065eb49..aac0b1f0b 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -461,12 +461,13 @@ testsuite_setup(void)
 			dev_id, ts_params->conf.nb_queue_pairs);
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, dev_id);
 	}
@@ -519,8 +520,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
@@ -709,13 +709,14 @@ test_queue_pair_descriptor_setup(void)
 	 * freed so are re-used if ring is released and re-created.
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
+	qp_conf.mp_session = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights "
 				"%u on qp %u on cryptodev %u",
@@ -729,8 +730,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -744,8 +744,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -760,8 +759,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -776,8 +774,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -791,8 +788,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -807,8 +803,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -824,8 +819,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
@@ -835,8 +829,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c
index a899f9973..0f6fc5767 100644
--- a/test/test/test_cryptodev_asym.c
+++ b/test/test/test_cryptodev_asym.c
@@ -383,11 +383,12 @@ testsuite_setup(void)
 
 	/* configure qp */
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u ASYM",
 			qp_id, dev_id);
 	}
@@ -449,8 +450,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index de258c346..54717870e 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -546,11 +546,12 @@ configure_cryptodev(void)
 			TEST_CDEV_ID, conf.nb_queue_pairs);
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	qp_conf.mp_session = params.session_mpool;
+	qp_conf.mp_session_private = params.session_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
-			rte_cryptodev_socket_id(TEST_CDEV_ID),
-			params.session_mpool),
+			rte_cryptodev_socket_id(TEST_CDEV_ID)),
 			"Failed to setup queue pair %u on cryptodev %u\n",
 			TEST_CDEV_QP_ID, TEST_CDEV_ID);
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure
  2018-12-21 13:55   ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
@ 2018-12-21 13:55     ` Fan Zhang
  2019-01-08 16:12       ` Trahe, Fiona
  2019-01-09 11:01       ` De Lara Guarch, Pablo
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
  2 siblings, 2 replies; 61+ messages in thread
From: Fan Zhang @ 2018-12-21 13:55 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch changes the symmetric session structure of cryptodev.
The symmetric session now contains extra information for secure
access purposes. The patch also includes the updates to the
PMDs, test applications, and examples to fit the change.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 app/test-crypto-perf/cperf.h                     |   1 +
 app/test-crypto-perf/cperf_ops.c                 |  11 +-
 app/test-crypto-perf/cperf_ops.h                 |   2 +-
 app/test-crypto-perf/cperf_test_latency.c        |   5 +-
 app/test-crypto-perf/cperf_test_latency.h        |   1 +
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c |   5 +-
 app/test-crypto-perf/cperf_test_pmd_cyclecount.h |   1 +
 app/test-crypto-perf/cperf_test_throughput.c     |   5 +-
 app/test-crypto-perf/cperf_test_throughput.h     |   1 +
 app/test-crypto-perf/cperf_test_verify.c         |   5 +-
 app/test-crypto-perf/cperf_test_verify.h         |   1 +
 app/test-crypto-perf/main.c                      | 103 ++++++----
 doc/guides/rel_notes/release_19_02.rst           |  14 ++
 drivers/crypto/aesni_gcm/Makefile                |   1 +
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c         |   3 +-
 drivers/crypto/aesni_gcm/meson.build             |   1 +
 drivers/crypto/aesni_mb/Makefile                 |   1 +
 drivers/crypto/aesni_mb/meson.build              |   2 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c       |   3 +-
 drivers/crypto/armv8/Makefile                    |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c             |   3 +-
 drivers/crypto/kasumi/Makefile                   |   1 +
 drivers/crypto/kasumi/meson.build                |   1 +
 drivers/crypto/kasumi/rte_kasumi_pmd.c           |   3 +-
 drivers/crypto/openssl/Makefile                  |   1 +
 drivers/crypto/openssl/meson.build               |   1 +
 drivers/crypto/openssl/rte_openssl_pmd.c         |   3 +-
 drivers/crypto/snow3g/Makefile                   |   1 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c           |   3 +-
 drivers/crypto/zuc/Makefile                      |   1 +
 drivers/crypto/zuc/meson.build                   |   1 +
 drivers/crypto/zuc/rte_zuc_pmd.c                 |   3 +-
 drivers/net/softnic/rte_eth_softnic_cli.c        |  52 ++++-
 drivers/net/softnic/rte_eth_softnic_cryptodev.c  |  50 ++++-
 drivers/net/softnic/rte_eth_softnic_internals.h  |   3 +
 examples/fips_validation/main.c                  |  34 +++-
 examples/ip_pipeline/cli.c                       |  49 +++--
 examples/ip_pipeline/cryptodev.c                 |  49 ++++-
 examples/ip_pipeline/cryptodev.h                 |   3 +
 examples/ip_pipeline/examples/flow_crypto.cli    |   9 +-
 examples/ipsec-secgw/ipsec-secgw.c               |  48 +++--
 examples/ipsec-secgw/ipsec.c                     |   2 +-
 examples/ipsec-secgw/ipsec.h                     |   2 +
 examples/l2fwd-crypto/main.c                     |  66 ++++---
 examples/vhost_crypto/main.c                     |  13 +-
 lib/librte_cryptodev/Makefile                    |   1 +
 lib/librte_cryptodev/meson.build                 |   1 +
 lib/librte_cryptodev/rte_cryptodev.c             | 190 +++++++++++++++----
 lib/librte_cryptodev/rte_cryptodev.h             |  65 ++++++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h         |  13 +-
 lib/librte_cryptodev/rte_cryptodev_version.map   |   2 +
 lib/librte_vhost/rte_vhost_crypto.h              |   9 +-
 lib/librte_vhost/vhost_crypto.c                  |   8 +-
 test/test/test_cryptodev.c                       | 229 ++++++++++++++---------
 test/test/test_cryptodev_blockcipher.c           |   7 +-
 test/test/test_cryptodev_blockcipher.h           |   1 +
 test/test/test_event_crypto_adapter.c            |  32 +++-
 57 files changed, 845 insertions(+), 282 deletions(-)

diff --git a/app/test-crypto-perf/cperf.h b/app/test-crypto-perf/cperf.h
index db58228dc..2b0aad095 100644
--- a/app/test-crypto-perf/cperf.h
+++ b/app/test-crypto-perf/cperf.h
@@ -15,6 +15,7 @@ struct cperf_op_fns;
 
 typedef void  *(*cperf_constructor_t)(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 44808f50a..f59568b80 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -469,6 +469,7 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
 
 static struct rte_cryptodev_sym_session *
 cperf_create_session(struct rte_mempool *sess_mp,
+	struct rte_mempool *priv_mp,
 	uint8_t dev_id,
 	const struct cperf_options *options,
 	const struct cperf_test_vector *test_vector,
@@ -505,7 +506,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 *  auth only
 	 */
@@ -533,7 +534,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 * cipher and auth
 	 */
@@ -592,12 +593,12 @@ cperf_create_session(struct rte_mempool *sess_mp,
 			cipher_xform.next = &auth_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &cipher_xform, sess_mp);
+					sess, &cipher_xform, priv_mp);
 		} else { /* auth then cipher */
 			auth_xform.next = &cipher_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &auth_xform, sess_mp);
+					sess, &auth_xform, priv_mp);
 		}
 	} else { /* options->op_type == CPERF_AEAD */
 		aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -618,7 +619,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 
 		/* Create crypto session */
 		rte_cryptodev_sym_session_init(dev_id,
-					sess, &aead_xform, sess_mp);
+					sess, &aead_xform, priv_mp);
 	}
 
 	return sess;
diff --git a/app/test-crypto-perf/cperf_ops.h b/app/test-crypto-perf/cperf_ops.h
index 29e109f2a..ff125d12c 100644
--- a/app/test-crypto-perf/cperf_ops.h
+++ b/app/test-crypto-perf/cperf_ops.h
@@ -13,7 +13,7 @@
 
 
 typedef struct rte_cryptodev_sym_session *(*cperf_sessions_create_t)(
-		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_mp, struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		uint16_t iv_offset);
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index c9c98dc50..0fc3a6680 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -62,6 +62,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx)
 
 void *
 cperf_latency_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -86,8 +87,8 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp,
 		sizeof(struct rte_crypto_sym_op) +
 		sizeof(struct cperf_op_result *);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-			iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_latency.h b/app/test-crypto-perf/cperf_test_latency.h
index d3fc3218d..ed5b0a07b 100644
--- a/app/test-crypto-perf/cperf_test_latency.h
+++ b/app/test-crypto-perf/cperf_test_latency.h
@@ -17,6 +17,7 @@
 void *
 cperf_latency_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index c8d16db6d..92af5ec90 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -80,6 +80,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
 
 void *
 cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -106,8 +107,8 @@ cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 			sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(
-			sess_mp, dev_id, options, test_vector, iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.h b/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
index beb441991..3084038a1 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
@@ -18,6 +18,7 @@
 void *
 cperf_pmd_cyclecount_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index 8766d6e9b..2767f4ea8 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -47,6 +47,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
 
 void *
 cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -69,8 +70,8 @@ cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 		sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-					iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_throughput.h b/app/test-crypto-perf/cperf_test_throughput.h
index 439ec8e55..91e1a4b70 100644
--- a/app/test-crypto-perf/cperf_test_throughput.h
+++ b/app/test-crypto-perf/cperf_test_throughput.h
@@ -18,6 +18,7 @@
 void *
 cperf_throughput_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 9134b921e..0497cf9a1 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -51,6 +51,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx)
 
 void *
 cperf_verify_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -73,8 +74,8 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 		sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-			iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_verify.h b/app/test-crypto-perf/cperf_test_verify.h
index 9f70ad87b..ac2192ba9 100644
--- a/app/test-crypto-perf/cperf_test_verify.h
+++ b/app/test-crypto-perf/cperf_test_verify.h
@@ -18,6 +18,7 @@
 void *
 cperf_verify_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 38a2e429f..175c639fb 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -21,6 +21,10 @@
 #include "cperf_test_verify.h"
 #include "cperf_test_pmd_cyclecount.h"
 
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 const char *cperf_test_type_strs[] = {
 	[CPERF_TEST_TYPE_THROUGHPUT] = "throughput",
@@ -61,8 +65,58 @@ const struct cperf_test cperf_testmap[] = {
 };
 
 static int
-cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
-			struct rte_mempool *session_pool_socket[])
+fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
+		uint32_t nb_sessions)
+{
+	char mp_name[RTE_MEMPOOL_NAMESIZE];
+	struct rte_mempool *sess_mp;
+
+	if (session_pool_socket[socket_id].priv_mp == NULL) {
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"priv_sess_mp_%u", socket_id);
+
+		sess_mp = rte_mempool_create(mp_name,
+					nb_sessions,
+					session_priv_size,
+					0, 0, NULL, NULL, NULL,
+					NULL, socket_id,
+					0);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].priv_mp = sess_mp;
+	}
+
+	if (session_pool_socket[socket_id].sess_mp == NULL) {
+
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"sess_mp_%u", socket_id);
+
+		sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
+					nb_sessions, 0, 0, 0, socket_id);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].sess_mp = sess_mp;
+	}
+
+	return 0;
+}
+
+static int
+cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 {
 	uint8_t enabled_cdev_count = 0, nb_lcores, cdev_id;
 	uint32_t sessions_needed = 0;
@@ -177,11 +231,11 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 				rte_cryptodev_scheduler_slaves_get(cdev_id,
 								NULL);
 
-			sessions_needed = 2 * enabled_cdev_count *
+			sessions_needed = enabled_cdev_count *
 				opts->nb_qps * nb_slaves;
 #endif
 		} else
-			sessions_needed = 2 * enabled_cdev_count *
+			sessions_needed = enabled_cdev_count *
 						opts->nb_qps;
 
 		/*
@@ -194,32 +248,15 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 				"%u sessions\n", opts->nb_qps);
 			return -ENOTSUP;
 		}
-		if (session_pool_socket[socket_id] == NULL) {
-			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
-
-			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
-			sess_mp = rte_mempool_create(mp_name,
-						sessions_needed,
-						max_sess_size,
-						0,
-						0, NULL, NULL, NULL,
-						NULL, socket_id,
-						0);
-
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
-					socket_id);
-				return -ENOMEM;
-			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
-		}
+		ret = fill_session_pool_socket(socket_id, max_sess_size,
+				sessions_needed);
+		if (ret < 0)
+			return ret;
 
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
@@ -453,10 +490,7 @@ main(int argc, char **argv)
 	struct cperf_options opts = {0};
 	struct cperf_test_vector *t_vec = NULL;
 	struct cperf_op_fns op_fns;
-
 	void *ctx[RTE_MAX_LCORE] = { };
-	struct rte_mempool *session_pool_socket[RTE_MAX_NUMA_NODES] = { 0 };
-
 	int nb_cryptodevs = 0;
 	uint16_t total_nb_qps = 0;
 	uint8_t cdev_id, i;
@@ -489,8 +523,7 @@ main(int argc, char **argv)
 		goto err;
 	}
 
-	nb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs,
-			session_pool_socket);
+	nb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs);
 
 	if (!opts.silent)
 		cperf_options_dump(&opts);
@@ -558,7 +591,9 @@ main(int argc, char **argv)
 		uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
 
 		ctx[i] = cperf_testmap[opts.test].constructor(
-				session_pool_socket[socket_id], cdev_id, qp_id,
+				session_pool_socket[socket_id].sess_mp,
+				session_pool_socket[socket_id].priv_mp,
+				cdev_id, qp_id,
 				&opts, t_vec, &op_fns);
 		if (ctx[i] == NULL) {
 			RTE_LOG(ERR, USER1, "Test run constructor failed\n");
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 4420c2441..7dbba15fe 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -135,6 +135,20 @@ API Changes
   mempool and symmetric session private data mempool, and the last parameter of
   ``rte_cryptodev_queue_pair_setup()`` is removed.
 
+* cryptodev: as shown in the the 18.08 deprecation notice, the structure
+  ``rte_cryptodev_sym_session`` has been updated to contain more information
+  to ensure safely accessing driver private data and user data area. The
+  creation of mempool for ``rte_cryptodev_sym_session`` objects is now enforced
+  to use new function ``rte_cryptodev_sym_session_pool_create()`` so that
+  the correct session information is set. Failed to do so will cause
+  ``rte_cryptodev_sym_session_create()`` function call failed. With the change
+  cryptodev does no longer enforce using the same mempool for symmetric session
+  header and the driver specific private data, and prevent the segmentation
+  faults caused by the incorrect access to both the session's private data and
+  user data. All cryptodev related applications (test applications and sample
+  applications) have been updated to demonstrate how to use this new
+  method.
+
 
 ABI Changes
 -----------
diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile
index 0a5c1a872..9241ad762 100644
--- a/drivers/crypto/aesni_gcm/Makefile
+++ b/drivers/crypto/aesni_gcm/Makefile
@@ -8,6 +8,7 @@ LIB = librte_pmd_aesni_gcm.a
 
 # build flags
 CFLAGS += -O3
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += $(WERROR_FLAGS)
 
 # library version
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index abc7a6d5f..948ff0763 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -419,7 +419,8 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/aesni_gcm/meson.build b/drivers/crypto/aesni_gcm/meson.build
index a02da1ef5..70f57ad73 100644
--- a/drivers/crypto/aesni_gcm/meson.build
+++ b/drivers/crypto/aesni_gcm/meson.build
@@ -8,5 +8,6 @@ else
 	ext_deps += lib
 endif
 
+allow_experimental_apis = true
 sources = files('aesni_gcm_pmd.c', 'aesni_gcm_pmd_ops.c')
 deps += ['bus_vdev']
diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile
index 806a95eb8..a6fa071ec 100644
--- a/drivers/crypto/aesni_mb/Makefile
+++ b/drivers/crypto/aesni_mb/Makefile
@@ -9,6 +9,7 @@ LIB = librte_pmd_aesni_mb.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/aesni_mb/meson.build b/drivers/crypto/aesni_mb/meson.build
index aae0995e5..145c3d984 100644
--- a/drivers/crypto/aesni_mb/meson.build
+++ b/drivers/crypto/aesni_mb/meson.build
@@ -9,4 +9,6 @@ else
 endif
 
 sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+allow_experimental_apis = true
+
 deps += ['bus_vdev']
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b0f5c4d67..f3b270d09 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -951,7 +951,8 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile
index e862af72e..f71f6b14a 100644
--- a/drivers/crypto/armv8/Makefile
+++ b/drivers/crypto/armv8/Makefile
@@ -28,6 +28,7 @@ EXPORT_MAP := rte_pmd_armv8_version.map
 # external library dependencies
 CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)
 CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)/asm/include
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 3b2d7fb2f..0d4649adc 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -655,7 +655,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct armv8_crypto_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp, sess);
 		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile
index cafe94986..3de2f97ed 100644
--- a/drivers/crypto/kasumi/Makefile
+++ b/drivers/crypto/kasumi/Makefile
@@ -15,6 +15,7 @@ LIB = librte_pmd_kasumi.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/kasumi/meson.build b/drivers/crypto/kasumi/meson.build
index a09b0e251..80f13cd24 100644
--- a/drivers/crypto/kasumi/meson.build
+++ b/drivers/crypto/kasumi/meson.build
@@ -8,5 +8,6 @@ else
 	ext_deps += lib
 endif
 
+allow_experimental_apis = true
 sources = files('rte_kasumi_pmd.c', 'rte_kasumi_pmd_ops.c')
 deps += ['bus_vdev']
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 6df645a23..3abdb01a9 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -325,7 +325,8 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index 8fe086b90..ae6c3bcac 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -9,6 +9,7 @@ LIB = librte_pmd_openssl.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index c2a0dd8ba..77a6596d7 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -5,6 +5,7 @@ dep = dependency('libcrypto', required: false)
 if not dep.found()
 	build = false
 endif
+allow_experimental_apis = true
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index a193af642..ea5aac69e 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -2020,7 +2020,8 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		openssl_reset_session(sess);
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile
index ee5027d0c..37f77dbf8 100644
--- a/drivers/crypto/snow3g/Makefile
+++ b/drivers/crypto/snow3g/Makefile
@@ -15,6 +15,7 @@ LIB = librte_pmd_snow3g.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 7d131f780..5fd94b686 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -340,7 +340,8 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile
index 68d84eebc..8d625aa01 100644
--- a/drivers/crypto/zuc/Makefile
+++ b/drivers/crypto/zuc/Makefile
@@ -15,6 +15,7 @@ LIB = librte_pmd_zuc.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/zuc/meson.build b/drivers/crypto/zuc/meson.build
index b8ca7107e..63f2a5298 100644
--- a/drivers/crypto/zuc/meson.build
+++ b/drivers/crypto/zuc/meson.build
@@ -8,5 +8,6 @@ else
 	ext_deps += lib
 endif
 
+allow_experimental_apis = true
 sources = files('rte_zuc_pmd.c', 'rte_zuc_pmd_ops.c')
 deps += ['bus_vdev']
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 997c2092f..637994dfd 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -327,7 +327,8 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 57b623377..76136c2e2 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1092,7 +1092,7 @@ cmd_tap(struct pmd_internals *softnic,
 
 /**
  * cryptodev <tap_name> dev <device_name> | dev_id <device_id>
- * queue <n_queues> <queue_size>
+ * queue <n_queues> <queue_size> max_sessions <n_sessions>
  **/
 
 static void
@@ -1106,7 +1106,7 @@ cmd_cryptodev(struct pmd_internals *softnic,
 	char *name;
 
 	memset(&params, 0, sizeof(params));
-	if (n_tokens != 7) {
+	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
 	}
@@ -1145,6 +1145,19 @@ cmd_cryptodev(struct pmd_internals *softnic,
 		return;
 	}
 
+	if (strcmp(tokens[7], "max_sessions")) {
+		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
+			"4");
+		return;
+	}
+
+	if (softnic_parser_read_uint32(&params.session_pool_size, tokens[8])
+			< 0) {
+		snprintf(out, out_size,	MSG_ARG_INVALID,
+			"q");
+		return;
+	}
+
 	if (softnic_cryptodev_create(softnic, name, &params) == NULL) {
 		snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
 		return;
@@ -1739,6 +1752,41 @@ cmd_table_action_profile(struct pmd_internals *softnic,
 		t0 += 1;
 	} /* decap */
 
+	if (t0 < n_tokens && (strcmp(tokens[t0], "sym_crypto") == 0)) {
+		struct softnic_cryptodev *cryptodev;
+
+		if (n_tokens < t0 + 5 ||
+				strcmp(tokens[t0 + 1], "dev") ||
+				strcmp(tokens[t0 + 3], "offset")) {
+			snprintf(out, out_size, MSG_ARG_MISMATCH,
+				"table action profile sym_crypto");
+			return;
+		}
+
+		cryptodev = softnic_cryptodev_find(softnic, tokens[t0 + 2]);
+		if (cryptodev == NULL) {
+			snprintf(out, out_size, MSG_ARG_INVALID,
+				"table action profile sym_crypto");
+			return;
+		}
+
+		p.sym_crypto.cryptodev_id = cryptodev->dev_id;
+
+		if (softnic_parser_read_uint32(&p.sym_crypto.op_offset,
+				tokens[t0 + 4]) != 0) {
+			snprintf(out, out_size, MSG_ARG_INVALID,
+					"table action profile sym_crypto");
+			return;
+		}
+
+		p.sym_crypto.mp_create = cryptodev->mp_create;
+		p.sym_crypto.mp_init = cryptodev->mp_init;
+
+		p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO;
+
+		t0 += 5;
+	} /* sym_crypto */
+
 	if (t0 < n_tokens) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index f031d8803..18a52ed05 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -11,6 +11,8 @@
 
 #include "rte_eth_softnic_internals.h"
 
+#define SOFTNIC_CRYPTO_SESSION_CACHE_SIZE 128
+
 int
 softnic_cryptodev_init(struct pmd_internals *p)
 {
@@ -61,13 +63,16 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	struct softnic_cryptodev *cryptodev;
 	uint32_t dev_id, i;
 	uint32_t socket_id;
+	uint32_t cache_size;
+	char mp_name[NAME_SIZE];
 	int status;
 
 	/* Check input params */
 	if ((name == NULL) ||
 		softnic_cryptodev_find(p, name) ||
 		(params->n_queues == 0) ||
-		(params->queue_size == 0))
+		(params->queue_size == 0) ||
+		(params->session_pool_size == 0))
 		return NULL;
 
 	if (params->dev_name) {
@@ -83,6 +88,12 @@ softnic_cryptodev_create(struct pmd_internals *p,
 		dev_id = params->dev_id;
 	}
 
+	cache_size = (params->session_pool_size / 2 <
+			SOFTNIC_CRYPTO_SESSION_CACHE_SIZE) ?
+					(params->session_pool_size / 2) :
+					SOFTNIC_CRYPTO_SESSION_CACHE_SIZE;
+
+
 	socket_id = rte_cryptodev_socket_id(dev_id);
 	rte_cryptodev_info_get(dev_id, &dev_info);
 
@@ -119,7 +130,44 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	cryptodev->dev_id = dev_id;
 	cryptodev->n_queues = params->n_queues;
 
+	snprintf(mp_name, NAME_SIZE, "%s_mp%u", name, dev_id);
+	cryptodev->mp_create = rte_cryptodev_sym_session_pool_create(
+			mp_name,
+			params->session_pool_size,
+			0,
+			cache_size,
+			0,
+			socket_id);
+	if (!cryptodev->mp_create)
+		goto error_exit;
+
+	snprintf(mp_name, NAME_SIZE, "%s_priv_mp%u", name, dev_id);
+	cryptodev->mp_init = rte_mempool_create(
+			mp_name,
+			params->session_pool_size,
+			rte_cryptodev_sym_get_private_session_size(dev_id),
+			cache_size,
+			0,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			socket_id,
+			0);
+	if (!cryptodev->mp_init)
+		goto error_exit;
+
 	TAILQ_INSERT_TAIL(&p->cryptodev_list, cryptodev, node);
 
 	return cryptodev;
+
+error_exit:
+	if (cryptodev->mp_create)
+		rte_mempool_free(cryptodev->mp_create);
+	if (cryptodev->mp_init)
+		rte_mempool_free(cryptodev->mp_init);
+
+	free(cryptodev);
+
+	return NULL;
 }
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h
index 31698b9f0..685058be6 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -286,6 +286,7 @@ struct softnic_cryptodev_params {
 	uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */
 	uint32_t n_queues;
 	uint32_t queue_size;
+	uint32_t session_pool_size;
 };
 
 struct softnic_cryptodev {
@@ -293,6 +294,8 @@ struct softnic_cryptodev {
 	char name[NAME_SIZE];
 	uint16_t dev_id;
 	uint32_t n_queues;
+	struct rte_mempool *mp_create;
+	struct rte_mempool *mp_init;
 };
 
 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 384b7a240..bd9aa9018 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -29,6 +29,8 @@ struct cryptodev_fips_validate_env {
 	uint32_t is_path_folder;
 	uint32_t dev_id;
 	struct rte_mempool *mpool;
+	struct rte_mempool *sess_mpool;
+	struct rte_mempool *sess_priv_mpool;
 	struct rte_mempool *op_pool;
 	struct rte_mbuf *mbuf;
 	struct rte_crypto_op *op;
@@ -40,6 +42,8 @@ cryptodev_fips_validate_app_int(void)
 {
 	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
 	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+	uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
+			env.dev_id);
 	int ret;
 
 	ret = rte_cryptodev_configure(env.dev_id, &conf);
@@ -58,6 +62,17 @@ cryptodev_fips_validate_app_int(void)
 
 	ret = -ENOMEM;
 
+	env.sess_mpool = rte_cryptodev_sym_session_pool_create(
+			"FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+	if (!env.sess_mpool)
+		goto error_exit;
+
+	env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
+			16, sess_sz, 0, 0, NULL, NULL, NULL,
+			NULL, rte_socket_id(), 0);
+	if (!env.sess_priv_mpool)
+		goto error_exit;
+
 	env.op_pool = rte_crypto_op_pool_create(
 			"FIPS_OP_POOL",
 			RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -75,10 +90,23 @@ cryptodev_fips_validate_app_int(void)
 	if (!env.op)
 		goto error_exit;
 
+	qp_conf.mp_session = env.sess_mpool;
+	qp_conf.mp_session_private = env.sess_priv_mpool;
+
+	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
+			rte_socket_id());
+	if (ret < 0)
+		goto error_exit;
+
 	return 0;
 
 error_exit:
+
 	rte_mempool_free(env.mpool);
+	if (env.sess_mpool)
+		rte_mempool_free(env.sess_mpool);
+	if (env.sess_priv_mpool)
+		rte_mempool_free(env.sess_priv_mpool);
 	if (env.op_pool)
 		rte_mempool_free(env.op_pool);
 
@@ -93,6 +121,8 @@ cryptodev_fips_validate_app_uninit(void)
 	rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
 	rte_cryptodev_sym_session_free(env.sess);
 	rte_mempool_free(env.mpool);
+	rte_mempool_free(env.sess_mpool);
+	rte_mempool_free(env.sess_priv_mpool);
 	rte_mempool_free(env.op_pool);
 }
 
@@ -797,12 +827,12 @@ fips_run_test(void)
 	if (ret < 0)
 		return ret;
 
-	env.sess = rte_cryptodev_sym_session_create(env.mpool);
+	env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
 	if (!env.sess)
 		return -ENOMEM;
 
 	ret = rte_cryptodev_sym_session_init(env.dev_id,
-			env.sess, &xform, env.mpool);
+			env.sess, &xform, env.sess_priv_mpool);
 	if (ret < 0) {
 		RTE_LOG(ERR, USER1, "Error %i: Init session\n",
 				ret);
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..a92467e63 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -790,7 +790,8 @@ cmd_kni(char **tokens,
 static const char cmd_cryptodev_help[] =
 "cryptodev <cryptodev_name>\n"
 "   dev <device_name> | dev_id <device_id>\n"
-"   queue <n_queues> <queue_size>\n";
+"   queue <n_queues> <queue_size>\n"
+"   max_sessions <n_sessions>";
 
 static void
 cmd_cryptodev(char **tokens,
@@ -802,7 +803,7 @@ cmd_cryptodev(char **tokens,
 	char *name;
 
 	memset(&params, 0, sizeof(params));
-	if (n_tokens != 7) {
+	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
 	}
@@ -825,7 +826,7 @@ cmd_cryptodev(char **tokens,
 
 	if (strcmp(tokens[4], "queue")) {
 		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
-			"4");
+			"queue");
 		return;
 	}
 
@@ -841,6 +842,18 @@ cmd_cryptodev(char **tokens,
 		return;
 	}
 
+	if (strcmp(tokens[7], "max_sessions")) {
+		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
+			"max_sessions");
+		return;
+	}
+
+	if (parser_read_uint32(&params.session_pool_size, tokens[8]) < 0) {
+		snprintf(out, out_size,	MSG_ARG_INVALID,
+			"queue_size");
+		return;
+	}
+
 	if (cryptodev_create(name, &params) == NULL) {
 		snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
 		return;
@@ -1030,9 +1043,7 @@ static const char cmd_table_action_profile_help[] =
 "       stats none | pkts]\n"
 "   [stats pkts | bytes | both]\n"
 "   [time]\n"
-"   [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset> "
-"       mempool_create <mempool_name>\n"
-"       mempool_init <mempool_name>]\n"
+"   [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset>]\n"
 "   [tag]\n"
 "   [decap]\n";
 
@@ -1404,13 +1415,10 @@ cmd_table_action_profile(char **tokens,
 
 	if ((t0 < n_tokens) && (strcmp(tokens[t0], "sym_crypto") == 0)) {
 		struct cryptodev *cryptodev;
-		struct mempool *mempool;
 
-		if (n_tokens < t0 + 9 ||
+		if (n_tokens < t0 + 5 ||
 				strcmp(tokens[t0 + 1], "dev") ||
-				strcmp(tokens[t0 + 3], "offset") ||
-				strcmp(tokens[t0 + 5], "mempool_create") ||
-				strcmp(tokens[t0 + 7], "mempool_init")) {
+				strcmp(tokens[t0 + 3], "offset")) {
 			snprintf(out, out_size, MSG_ARG_MISMATCH,
 				"table action profile sym_crypto");
 			return;
@@ -1432,25 +1440,12 @@ cmd_table_action_profile(char **tokens,
 			return;
 		}
 
-		mempool = mempool_find(tokens[t0 + 6]);
-		if (mempool == NULL) {
-			snprintf(out, out_size, MSG_ARG_INVALID,
-				"table action profile sym_crypto");
-			return;
-		}
-		p.sym_crypto.mp_create = mempool->m;
-
-		mempool = mempool_find(tokens[t0 + 8]);
-		if (mempool == NULL) {
-			snprintf(out, out_size, MSG_ARG_INVALID,
-				"table action profile sym_crypto");
-			return;
-		}
-		p.sym_crypto.mp_init = mempool->m;
+		p.sym_crypto.mp_create = cryptodev->mp_create;
+		p.sym_crypto.mp_init = cryptodev->mp_init;
 
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO;
 
-		t0 += 9;
+		t0 += 5;
 	} /* sym_crypto */
 
 	if ((t0 < n_tokens) && (strcmp(tokens[t0], "tag") == 0)) {
diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c
index b365810de..ac1e38d6a 100644
--- a/examples/ip_pipeline/cryptodev.c
+++ b/examples/ip_pipeline/cryptodev.c
@@ -11,6 +11,8 @@
 
 #include "cryptodev.h"
 
+#define PIPELINE_CRYPTO_SESSION_CACHE_SIZE	128
+
 static struct cryptodev_list cryptodev_list;
 
 int
@@ -53,13 +55,16 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	struct cryptodev *cryptodev;
 	uint32_t dev_id, i;
 	uint32_t socket_id;
+	uint32_t cache_size;
+	char mp_name[NAME_SIZE];
 	int status;
 
 	/* Check input params */
 	if ((name == NULL) ||
 		cryptodev_find(name) ||
 		(params->n_queues == 0) ||
-		(params->queue_size == 0))
+		(params->queue_size == 0) ||
+		(params->session_pool_size == 0))
 		return NULL;
 
 	if (params->dev_name) {
@@ -75,6 +80,11 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 		dev_id = params->dev_id;
 	}
 
+	cache_size = (params->session_pool_size / 2 <
+			PIPELINE_CRYPTO_SESSION_CACHE_SIZE) ?
+					(params->session_pool_size / 2) :
+					PIPELINE_CRYPTO_SESSION_CACHE_SIZE;
+
 	socket_id = rte_cryptodev_socket_id(dev_id);
 	rte_cryptodev_info_get(dev_id, &dev_info);
 
@@ -111,7 +121,44 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	cryptodev->dev_id = dev_id;
 	cryptodev->n_queues = params->n_queues;
 
+	snprintf(mp_name, NAME_SIZE, "%s_mp%u", name, dev_id);
+	cryptodev->mp_create = rte_cryptodev_sym_session_pool_create(
+			mp_name,
+			params->session_pool_size,
+			0,
+			cache_size,
+			0,
+			socket_id);
+	if (!cryptodev->mp_create)
+		goto error_exit;
+
+	snprintf(mp_name, NAME_SIZE, "%s_mp_priv%u", name, dev_id);
+	cryptodev->mp_init = rte_mempool_create(
+			NULL,
+			params->session_pool_size,
+			rte_cryptodev_sym_get_private_session_size(dev_id),
+			cache_size,
+			0,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			socket_id,
+			0);
+	if (!cryptodev->mp_init)
+		goto error_exit;
+
 	TAILQ_INSERT_TAIL(&cryptodev_list, cryptodev, node);
 
 	return cryptodev;
+
+error_exit:
+	if (cryptodev->mp_create)
+		rte_mempool_free(cryptodev->mp_create);
+	if (cryptodev->mp_init)
+		rte_mempool_free(cryptodev->mp_init);
+
+	free(cryptodev);
+
+	return NULL;
 }
diff --git a/examples/ip_pipeline/cryptodev.h b/examples/ip_pipeline/cryptodev.h
index d06b3f2f1..d00434379 100644
--- a/examples/ip_pipeline/cryptodev.h
+++ b/examples/ip_pipeline/cryptodev.h
@@ -17,6 +17,8 @@ struct cryptodev {
 	char name[NAME_SIZE];
 	uint16_t dev_id;
 	uint32_t n_queues;
+	struct rte_mempool *mp_create;
+	struct rte_mempool *mp_init;
 };
 
 TAILQ_HEAD(cryptodev_list, cryptodev);
@@ -35,6 +37,7 @@ struct cryptodev_params {
 	uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */
 	uint32_t n_queues;
 	uint32_t queue_size;
+	uint32_t session_pool_size;
 };
 
 struct cryptodev *
diff --git a/examples/ip_pipeline/examples/flow_crypto.cli b/examples/ip_pipeline/examples/flow_crypto.cli
index 9b639deb7..849f9d5fe 100644
--- a/examples/ip_pipeline/examples/flow_crypto.cli
+++ b/examples/ip_pipeline/examples/flow_crypto.cli
@@ -21,14 +21,13 @@
 ; 5   Crypto Operation 1792             160
 
 mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 1
-mempool MEMPOOL_SESSION0 buffer 1024 pool 1024 cache 128 cpu 1
 
-link LINK0 dev 0000:81:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on
+link LINK0 dev 81:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on
 
 #Cryptodev
-cryptodev CRYPTO0 dev crypto_aesni_gcm0 queue 1 1024
+cryptodev CRYPTO0 dev crypto_aesni_gcm0 queue 1 1024 max_sessions 512
 
-table action profile AP0 ipv4 offset 270 fwd sym_crypto dev CRYPTO0 offset 1792 mempool_create MEMPOOL_SESSION0 mempool_init MEMPOOL_SESSION0
+table action profile AP0 ipv4 offset 270 fwd sym_crypto dev CRYPTO0 offset 1792
 table action profile AP1 ipv4 offset 270 fwd
 
 pipeline PIPELINE0 period 10 offset_port_id 0 cpu 1
@@ -46,7 +45,7 @@ pipeline PIPELINE0 table match stub action AP1
 pipeline PIPELINE0 port in 0 table 0
 pipeline PIPELINE0 port in 1 table 1
 
-thread 24 pipeline PIPELINE0 enable
+thread 2 pipeline PIPELINE0 enable
 
 pipeline PIPELINE0 table 0 rule add match default action fwd port 2
 
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a0ff8f7f7..fc102a396 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -55,7 +55,7 @@
 
 #define CDEV_QUEUE_DESC 2048
 #define CDEV_MAP_ENTRIES 16384
-#define CDEV_MP_NB_OBJS 2048
+#define CDEV_MP_NB_OBJS 1024
 #define CDEV_MP_CACHE_SZ 64
 #define MAX_QUEUE_PAIRS 1
 
@@ -820,11 +820,15 @@ main_loop(__attribute__((unused)) void *dummy)
 	qconf->inbound.sa_ctx = socket_ctx[socket_id].sa_in;
 	qconf->inbound.cdev_map = cdev_map_in;
 	qconf->inbound.session_pool = socket_ctx[socket_id].session_pool;
+	qconf->inbound.session_priv_pool =
+			socket_ctx[socket_id].session_priv_pool;
 	qconf->outbound.sp4_ctx = socket_ctx[socket_id].sp_ip4_out;
 	qconf->outbound.sp6_ctx = socket_ctx[socket_id].sp_ip6_out;
 	qconf->outbound.sa_ctx = socket_ctx[socket_id].sa_out;
 	qconf->outbound.cdev_map = cdev_map_out;
 	qconf->outbound.session_pool = socket_ctx[socket_id].session_pool;
+	qconf->outbound.session_priv_pool =
+			socket_ctx[socket_id].session_priv_pool;
 
 	if (qconf->nb_rx_queue == 0) {
 		RTE_LOG(INFO, IPSEC, "lcore %u has nothing to do\n", lcore_id);
@@ -1460,10 +1464,10 @@ cryptodevs_init(void)
 		dev_conf.nb_queue_pairs = qp;
 
 		uint32_t dev_max_sess = cdev_info.sym.max_nb_sessions;
-		if (dev_max_sess != 0 && dev_max_sess < (CDEV_MP_NB_OBJS / 2))
+		if (dev_max_sess != 0 && dev_max_sess < CDEV_MP_NB_OBJS)
 			rte_exit(EXIT_FAILURE,
 				"Device does not support at least %u "
-				"sessions", CDEV_MP_NB_OBJS / 2);
+				"sessions", CDEV_MP_NB_OBJS);
 
 		if (!socket_ctx[dev_conf.socket_id].session_pool) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
@@ -1471,6 +1475,19 @@ cryptodevs_init(void)
 
 			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
 					"sess_mp_%u", dev_conf.socket_id);
+			sess_mp = rte_cryptodev_sym_session_pool_create(
+					mp_name, CDEV_MP_NB_OBJS,
+					0, CDEV_MP_CACHE_SZ, 0,
+					dev_conf.socket_id);
+			socket_ctx[dev_conf.socket_id].session_pool = sess_mp;
+		}
+
+		if (!socket_ctx[dev_conf.socket_id].session_priv_pool) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			struct rte_mempool *sess_mp;
+
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+					"sess_mp_priv_%u", dev_conf.socket_id);
 			sess_mp = rte_mempool_create(mp_name,
 					CDEV_MP_NB_OBJS,
 					max_sess_sz,
@@ -1478,25 +1495,28 @@ cryptodevs_init(void)
 					0, NULL, NULL, NULL,
 					NULL, dev_conf.socket_id,
 					0);
-			if (sess_mp == NULL)
-				rte_exit(EXIT_FAILURE,
-					"Cannot create session pool on socket %d\n",
-					dev_conf.socket_id);
-			else
-				printf("Allocated session pool on socket %d\n",
-					dev_conf.socket_id);
-			socket_ctx[dev_conf.socket_id].session_pool = sess_mp;
+			socket_ctx[dev_conf.socket_id].session_priv_pool =
+					sess_mp;
 		}
 
+		if (!socket_ctx[dev_conf.socket_id].session_priv_pool ||
+				!socket_ctx[dev_conf.socket_id].session_pool)
+			rte_exit(EXIT_FAILURE,
+				"Cannot create session pool on socket %d\n",
+				dev_conf.socket_id);
+		else
+			printf("Allocated session pool on socket %d\n",
+					dev_conf.socket_id);
+
 		if (rte_cryptodev_configure(cdev_id, &dev_conf))
 			rte_panic("Failed to initialize cryptodev %u\n",
 					cdev_id);
 
 		qp_conf.nb_descriptors = CDEV_QUEUE_DESC;
 		qp_conf.mp_session =
-				socket_ctx[dev_conf.socket_id].session_pool;
+			socket_ctx[dev_conf.socket_id].session_pool;
 		qp_conf.mp_session_private =
-				socket_ctx[dev_conf.socket_id].session_pool;
+			socket_ctx[dev_conf.socket_id].session_priv_pool;
 		for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
 			if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
 					&qp_conf, dev_conf.socket_id))
@@ -1521,7 +1541,7 @@ cryptodevs_init(void)
 				snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
 						"sess_mp_%u", socket_id);
 				sess_mp = rte_mempool_create(mp_name,
-						CDEV_MP_NB_OBJS,
+						(CDEV_MP_NB_OBJS * 2),
 						max_sess_sz,
 						CDEV_MP_CACHE_SZ,
 						0, NULL, NULL, NULL,
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 3d415f1af..9dc6e173c 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -323,7 +323,7 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 				ipsec_ctx->session_pool);
 		rte_cryptodev_sym_session_init(ipsec_ctx->tbl[cdev_id_qp].id,
 				sa->crypto_session, sa->xforms,
-				ipsec_ctx->session_pool);
+				ipsec_ctx->session_priv_pool);
 
 		rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id,
 				&cdev_info);
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index c998c8076..f35552857 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -144,6 +144,7 @@ struct ipsec_ctx {
 	uint16_t last_qp;
 	struct cdev_qp tbl[MAX_QP_PER_LCORE];
 	struct rte_mempool *session_pool;
+	struct rte_mempool *session_priv_pool;
 	struct rte_mbuf *ol_pkts[MAX_PKT_BURST] __rte_aligned(sizeof(void *));
 	uint16_t ol_pkts_cnt;
 };
@@ -166,6 +167,7 @@ struct socket_ctx {
 	struct rt_ctx *rt_ip6;
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *session_pool;
+	struct rte_mempool *session_priv_pool;
 };
 
 struct cnt_blk {
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 1df7ba743..9982f07e9 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -221,7 +221,10 @@ static struct rte_eth_conf port_conf = {
 
 struct rte_mempool *l2fwd_pktmbuf_pool;
 struct rte_mempool *l2fwd_crypto_op_pool;
-struct rte_mempool *session_pool_socket[RTE_MAX_NUMA_NODES] = { 0 };
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 /* Per-port statistics struct */
 struct l2fwd_port_statistics {
@@ -645,7 +648,6 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		return NULL;
 
 	uint8_t socket_id = (uint8_t) retval;
-	struct rte_mempool *sess_mp = session_pool_socket[socket_id];
 
 	if (options->xform_chain == L2FWD_CRYPTO_AEAD) {
 		first_xform = &options->aead_xform;
@@ -661,13 +663,14 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		first_xform = &options->auth_xform;
 	}
 
-	session = rte_cryptodev_sym_session_create(sess_mp);
-
+	session = rte_cryptodev_sym_session_create(
+			session_pool_socket[socket_id].sess_mp);
 	if (session == NULL)
 		return NULL;
 
 	if (rte_cryptodev_sym_session_init(cdev_id, session,
-				first_xform, sess_mp) < 0)
+				first_xform,
+				session_pool_socket[socket_id].priv_mp) < 0)
 		return NULL;
 
 	return session;
@@ -2267,38 +2270,54 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 				rte_cryptodev_scheduler_slaves_get(cdev_id,
 								NULL);
 
-			sessions_needed = 2 * enabled_cdev_count * nb_slaves;
+			sessions_needed = enabled_cdev_count * nb_slaves;
 #endif
 		} else
-			sessions_needed = 2 * enabled_cdev_count;
+			sessions_needed = enabled_cdev_count;
 
-		if (session_pool_socket[socket_id] == NULL) {
+		if (session_pool_socket[socket_id].priv_mp == NULL) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
 
 			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
+				"priv_sess_mp_%u", socket_id);
 
-			/*
-			 * Create enough objects for session headers and
-			 * device private data
-			 */
-			sess_mp = rte_mempool_create(mp_name,
+			session_pool_socket[socket_id].priv_mp =
+					rte_mempool_create(mp_name,
 						sessions_needed,
 						max_sess_sz,
-						SESSION_POOL_CACHE_SIZE,
-						0, NULL, NULL, NULL,
+						0, 0, NULL, NULL, NULL,
 						NULL, socket_id,
 						0);
 
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
+			if (session_pool_socket[socket_id].priv_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
+					socket_id);
+				return -ENOMEM;
+			}
+
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+		}
+
+		if (session_pool_socket[socket_id].sess_mp == NULL) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+				"sess_mp_%u", socket_id);
+
+			session_pool_socket[socket_id].sess_mp =
+					rte_cryptodev_sym_session_pool_create(
+							mp_name,
+							sessions_needed,
+							0, 0, 0, socket_id);
+
+			if (session_pool_socket[socket_id].sess_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
 					socket_id);
 				return -ENOMEM;
 			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
 		}
 
 		/* Set AEAD parameters */
@@ -2443,8 +2462,9 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
 				socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index cb30f84c0..8bdcb3a9c 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,6 +46,7 @@ struct vhost_crypto_info {
 	int vids[MAX_NB_SOCKETS];
 	uint32_t nb_vids;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *cop_pool;
 	uint8_t cid;
 	uint32_t qid;
@@ -289,6 +290,7 @@ new_device(int vid)
 	}
 
 	ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
+			info->sess_priv_pool,
 			rte_lcore_to_socket_id(options.los[i].lcore_id));
 	if (ret) {
 		RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -448,6 +450,7 @@ free_resource(void)
 
 		rte_mempool_free(info->cop_pool);
 		rte_mempool_free(info->sess_pool);
+		rte_mempool_free(info->sess_priv_pool);
 
 		for (j = 0; j < lo->nb_sockets; j++) {
 			rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -528,11 +531,17 @@ main(int argc, char *argv[])
 		}
 
 		snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
-		info->sess_pool = rte_mempool_create(name, SESSION_MAP_ENTRIES,
+		info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
+				SESSION_MAP_ENTRIES, 0, 0, 0,
+				rte_lcore_to_socket_id(lo->lcore_id));
+
+		snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
+		info->sess_priv_pool = rte_mempool_create(name,
+				SESSION_MAP_ENTRIES,
 				rte_cryptodev_sym_get_private_session_size(
 				info->cid), 64, 0, NULL, NULL, NULL, NULL,
 				rte_lcore_to_socket_id(lo->lcore_id), 0);
-		if (!info->sess_pool) {
+		if (!info->sess_priv_pool || info->sess_pool) {
 			RTE_LOG(ERR, USER1, "Failed to create mempool");
 			goto error_exit;
 		}
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index a8f94c097..ade108b90 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -12,6 +12,7 @@ LIBABIVER := 5
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf
 LDLIBS += -lrte_kvargs
 
diff --git a/lib/librte_cryptodev/meson.build b/lib/librte_cryptodev/meson.build
index 990dd3d44..40ccce37a 100644
--- a/lib/librte_cryptodev/meson.build
+++ b/lib/librte_cryptodev/meson.build
@@ -2,6 +2,7 @@
 # Copyright(c) 2017 Intel Corporation
 
 version = 5
+allow_experimental_apis = true
 sources = files('rte_cryptodev.c', 'rte_cryptodev_pmd.c')
 headers = files('rte_cryptodev.h',
 	'rte_cryptodev_pmd.h',
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 11776b6ac..e5e60f7e2 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -189,6 +189,16 @@ const char *rte_crypto_asym_op_strings[] = {
 	[RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE] = "sharedsecret_compute",
 };
 
+/**
+ * The private data structure stored in the session mempool private data.
+ */
+struct rte_cryptodev_sym_session_pool_private_data {
+	uint16_t nb_drivers;
+	/**< number of elements in sess_data array */
+	uint16_t user_data_sz;
+	/**< session user data will be placed after sess_data */
+};
+
 int
 rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum,
 		const char *algo_string)
@@ -951,7 +961,45 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EINVAL;
 	}
 
+	if (!qp_conf) {
+		CDEV_LOG_ERR("qp_conf cannot be NULL\n");
+		return -EINVAL;
+	}
+
+	if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
+			(!qp_conf->mp_session && qp_conf->mp_session_private)) {
+		CDEV_LOG_ERR("Invalid mempools\n");
+		return -EINVAL;
+	}
+
 	dev = &rte_crypto_devices[dev_id];
+
+	if (qp_conf->mp_session) {
+		struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+		uint32_t obj_size = qp_conf->mp_session->elt_size;
+		uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
+		struct rte_cryptodev_sym_session s = {0};
+
+		pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
+		if (!pool_priv || qp_conf->mp_session->private_data_size <
+				sizeof(*pool_priv)) {
+			CDEV_LOG_ERR("Invalid mempool\n");
+			return -EINVAL;
+		}
+
+		s.nb_drivers = pool_priv->nb_drivers;
+		s.user_data_sz = pool_priv->user_data_sz;
+
+		if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
+			obj_size) || (s.nb_drivers <= dev->driver_id) ||
+			rte_cryptodev_sym_get_private_session_size(dev_id) >
+				obj_priv_size) {
+			CDEV_LOG_ERR("Invalid mempool\n");
+			return -EINVAL;
+		}
+
+	}
+
 	if (queue_pair_id >= dev->data->nb_queue_pairs) {
 		CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id);
 		return -EINVAL;
@@ -969,7 +1017,6 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 			socket_id);
 }
 
-
 int
 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
 {
@@ -1143,7 +1190,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
 	rte_spinlock_unlock(&rte_cryptodev_cb_lock);
 }
 
-
 int
 rte_cryptodev_sym_session_init(uint8_t dev_id,
 		struct rte_cryptodev_sym_session *sess,
@@ -1160,12 +1206,15 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 		return -EINVAL;
 
 	index = dev->driver_id;
+	if (index >= sess->nb_drivers)
+		return -EINVAL;
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
 
-	if (sess->sess_private_data[index] == NULL) {
+	if (sess->sess_data[index].refcnt == 0) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
-							sess, mp);
+			sess, mp);
+
 		if (ret < 0) {
 			CDEV_LOG_ERR(
 				"dev_id %d failed to configure session details",
@@ -1174,6 +1223,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 		}
 	}
 
+	sess->sess_data[index].refcnt++;
 	return 0;
 }
 
@@ -1212,10 +1262,70 @@ rte_cryptodev_asym_session_init(uint8_t dev_id,
 	return 0;
 }
 
+struct rte_mempool *__rte_experimental
+rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
+	uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
+	int socket_id)
+{
+	struct rte_mempool *mp;
+	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+	uint32_t obj_sz;
+
+	obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
+	if (obj_sz > elt_size)
+		CDEV_LOG_INFO("elt_size %u is expanded to %u\n", elt_size,
+				obj_sz);
+	else
+		obj_sz = elt_size;
+
+	mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
+			(uint32_t)(sizeof(*pool_priv)),
+			NULL, NULL, NULL, NULL,
+			socket_id, 0);
+	if (mp == NULL) {
+		CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d\n",
+			__func__, name, rte_errno);
+		return NULL;
+	}
+
+	pool_priv = rte_mempool_get_priv(mp);
+	if (!pool_priv) {
+		CDEV_LOG_ERR("%s(name=%s) failed to get private data\n",
+			__func__, name);
+		rte_mempool_free(mp);
+		return NULL;
+	}
+
+	pool_priv->nb_drivers = nb_drivers;
+	pool_priv->user_data_sz = user_data_size;
+
+	return mp;
+}
+
+static unsigned int
+rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
+{
+	return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
+			sess->user_data_sz;
+}
+
 struct rte_cryptodev_sym_session *
 rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 {
 	struct rte_cryptodev_sym_session *sess;
+	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+	if (!mp) {
+		CDEV_LOG_ERR("Invalid mempool\n");
+		return NULL;
+	}
+
+	pool_priv = rte_mempool_get_priv(mp);
+
+	if (!pool_priv || mp->private_data_size < sizeof(*pool_priv)) {
+		CDEV_LOG_ERR("Invalid mempool\n");
+		return NULL;
+	}
 
 	/* Allocate a session structure from the session pool */
 	if (rte_mempool_get(mp, (void **)&sess)) {
@@ -1226,7 +1336,12 @@ rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 	/* Clear device session pointer.
 	 * Include the flag indicating presence of user data
 	 */
-	memset(sess, 0, (sizeof(void *) * nb_drivers) + sizeof(uint8_t));
+	sess->nb_drivers = pool_priv->nb_drivers;
+	sess->user_data_sz = pool_priv->user_data_sz;
+	sess->opaque_data = 0;
+
+	memset(sess->sess_data, 0,
+			rte_cryptodev_sym_session_data_size(sess));
 
 	return sess;
 }
@@ -1255,12 +1370,17 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
 		struct rte_cryptodev_sym_session *sess)
 {
 	struct rte_cryptodev *dev;
+	uint8_t driver_id;
 
 	dev = rte_cryptodev_pmd_get_dev(dev_id);
 
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
+	driver_id = dev->driver_id;
+	if (--sess->sess_data[driver_id].refcnt != 0)
+		return -EBUSY;
+
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
 
 	dev->dev_ops->sym_session_clear(dev, sess);
@@ -1290,16 +1410,15 @@ int
 rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
 {
 	uint8_t i;
-	void *sess_priv;
 	struct rte_mempool *sess_mp;
 
 	if (sess == NULL)
 		return -EINVAL;
 
 	/* Check that all device private data has been freed */
-	for (i = 0; i < nb_drivers; i++) {
-		sess_priv = get_sym_session_private_data(sess, i);
-		if (sess_priv != NULL)
+	/* Check that all device private data has been freed */
+	for (i = 0; i < sess->nb_drivers; i++) {
+		if (sess->sess_data[i].refcnt != 0)
 			return -EBUSY;
 	}
 
@@ -1334,16 +1453,32 @@ rte_cryptodev_asym_session_free(struct rte_cryptodev_asym_session *sess)
 	return 0;
 }
 
-
 unsigned int
 rte_cryptodev_sym_get_header_session_size(void)
 {
 	/*
-	 * Header contains pointers to the private data
-	 * of all registered drivers, and a flag which
-	 * indicates presence of user data
+	 * Header contains all pointers to the private data
+	 * of all registered drivers with a reference count, and the
+	 * information of maximum number of drivers in the system and the user
+	 * data size.
 	 */
-	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
+	struct rte_cryptodev_sym_session s = {0};
+	s.nb_drivers = nb_drivers;
+	s.user_data_sz = 0;
+
+	return (unsigned int)(sizeof(s) +
+			rte_cryptodev_sym_session_data_size(&s));
+}
+
+unsigned int __rte_experimental
+rte_cryptodev_sym_get_existing_header_session_size(
+		struct rte_cryptodev_sym_session *sess)
+{
+	if (!sess)
+		return 0;
+	else
+		return (unsigned int)(sizeof(*sess) +
+				rte_cryptodev_sym_session_data_size(sess));
 }
 
 unsigned int __rte_experimental
@@ -1361,7 +1496,6 @@ unsigned int
 rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
 {
 	struct rte_cryptodev *dev;
-	unsigned int header_size = sizeof(void *) * nb_drivers;
 	unsigned int priv_sess_size;
 
 	if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
@@ -1374,14 +1508,6 @@ rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
 
 	priv_sess_size = (*dev->dev_ops->sym_session_get_size)(dev);
 
-	/*
-	 * If size is less than session header size,
-	 * return the latter, as this guarantees that
-	 * sessionless operations will work
-	 */
-	if (priv_sess_size < header_size)
-		return header_size;
-
 	return priv_sess_size;
 
 }
@@ -1415,15 +1541,13 @@ rte_cryptodev_sym_session_set_user_data(
 					void *data,
 					uint16_t size)
 {
-	uint16_t off_set = sizeof(void *) * nb_drivers;
-	uint8_t *user_data_present = (uint8_t *)sess + off_set;
-
 	if (sess == NULL)
 		return -EINVAL;
 
-	*user_data_present = 1;
-	off_set += sizeof(uint8_t);
-	rte_memcpy((uint8_t *)sess + off_set, data, size);
+	if (sess->user_data_sz < size)
+		return -ENOMEM;
+
+	rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
 	return 0;
 }
 
@@ -1431,14 +1555,10 @@ void * __rte_experimental
 rte_cryptodev_sym_session_get_user_data(
 					struct rte_cryptodev_sym_session *sess)
 {
-	uint16_t off_set = sizeof(void *) * nb_drivers;
-	uint8_t *user_data_present = (uint8_t *)sess + off_set;
-
-	if (sess == NULL || !*user_data_present)
+	if (sess == NULL || sess->user_data_sz == 0)
 		return NULL;
 
-	off_set += sizeof(uint8_t);
-	return (uint8_t *)sess + off_set;
+	return (void *)(sess->sess_data + sess->nb_drivers);
 }
 
 /** Initialise rte_crypto_op mempool element */
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index f9e7507da..698a859f3 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -951,14 +951,22 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 			dev->data->queue_pairs[qp_id], ops, nb_ops);
 }
 
-
 /** Cryptodev symmetric crypto session
  * Each session is derived from a fixed xform chain. Therefore each session
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	__extension__ void *sess_private_data[0];
-	/**< Private symmetric session material */
+	uint64_t opaque_data;
+	/**< Can be used for external metadata */
+	uint16_t nb_drivers;
+	/**< number of elements in sess_data array */
+	uint16_t user_data_sz;
+	/**< session user data will be placed after sess_data */
+	__extension__ struct {
+		void *data;
+		uint16_t refcnt;
+	} sess_data[0];
+	/**< Driver specific session material, variable size */
 };
 
 /** Cryptodev asymmetric crypto session */
@@ -968,6 +976,37 @@ struct rte_cryptodev_asym_session {
 };
 
 /**
+ * Create a symmetric session mempool.
+ *
+ * @param name
+ *   The unique mempool name.
+ * @param nb_elts
+ *   The number of elements in the mempool.
+ * @param elt_size
+ *   The size of the element. This value will be ignored if it is smaller than
+ *   the minimum session header size required for the system. For the user who
+ *   want to use the same mempool for sym session and session private data it
+ *   can be the maximum value of all existing devices' private data and session
+ *   header sizes.
+ * @param cache_size
+ *   The number of per-lcore cache elements
+ * @param priv_size
+ *   The private data size of each session.
+ * @param socket_id
+ *   The *socket_id* argument is the socket identifier in the case of
+ *   NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA
+ *   constraint for the reserved zone.
+ *
+ * @return
+ *  - On success return size of the session
+ *  - On failure returns 0
+ */
+struct rte_mempool * __rte_experimental
+rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
+	uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
+	int socket_id);
+
+/**
  * Create symmetric crypto session header (generic with no private data)
  *
  * @param   mempool    Symmetric session mempool to allocate session
@@ -1097,15 +1136,31 @@ rte_cryptodev_asym_session_clear(uint8_t dev_id,
 			struct rte_cryptodev_asym_session *sess);
 
 /**
- * Get the size of the header session, for all registered drivers.
+ * Get the size of the header session, for all registered drivers excluding
+ * the user data size.
  *
  * @return
- *   Size of the symmetric eader session.
+ *   Size of the symmetric header session.
  */
 unsigned int
 rte_cryptodev_sym_get_header_session_size(void);
 
 /**
+ * Get the size of the header session from created session.
+ *
+ * @param sess
+ *   The sym cryptodev session pointer
+ *
+ * @return
+ *   - If sess is not NULL, return the size of the header session including
+ *   the private data size defined within sess.
+ *   - If sess is NULL, return 0.
+ */
+unsigned int __rte_experimental
+rte_cryptodev_sym_get_existing_header_session_size(
+		struct rte_cryptodev_sym_session *sess);
+
+/**
  * Get the size of the asymmetric session header, for all registered drivers.
  *
  * @return
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index f15c9af30..defe05ea0 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -475,14 +475,23 @@ RTE_INIT(init_ ##driver_id)\
 static inline void *
 get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
 		uint8_t driver_id) {
-	return sess->sess_private_data[driver_id];
+	if (unlikely(sess->nb_drivers <= driver_id))
+		return NULL;
+
+	return sess->sess_data[driver_id].data;
 }
 
 static inline void
 set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
 		uint8_t driver_id, void *private_data)
 {
-	sess->sess_private_data[driver_id] = private_data;
+	if (unlikely(sess->nb_drivers <= driver_id)) {
+		CDEV_LOG_ERR("Set private data for driver %u not allowed\n",
+				driver_id);
+		return;
+	}
+
+	sess->sess_data[driver_id].data = private_data;
 }
 
 static inline void *
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a695b61dc..0d0f3bc28 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -105,4 +105,6 @@ EXPERIMENTAL {
 	rte_cryptodev_sym_session_set_user_data;
 	rte_crypto_asym_op_strings;
 	rte_crypto_asym_xform_strings;
+	rte_cryptodev_sym_session_pool_create;
+	rte_cryptodev_sym_get_existing_header_session_size;
 };
diff --git a/lib/librte_vhost/rte_vhost_crypto.h b/lib/librte_vhost/rte_vhost_crypto.h
index f9fbc0548..d08e0ffab 100644
--- a/lib/librte_vhost/rte_vhost_crypto.h
+++ b/lib/librte_vhost/rte_vhost_crypto.h
@@ -26,8 +26,9 @@ enum rte_vhost_crypto_zero_copy {
  *  The identifier of DPDK Cryptodev, the same cryptodev_id can be assigned to
  *  multiple Vhost-crypto devices.
  * @param sess_pool
- *  The pointer to the created cryptodev session pool with the private data size
- *  matches the target DPDK Cryptodev.
+ *  The pointer to the created cryptodev session pool.
+ * @param sess_priv_pool
+ *  The pointer to the created cryptodev session private data mempool.
  * @param socket_id
  *  NUMA Socket ID to allocate resources on. *
  * @return
@@ -36,7 +37,9 @@ enum rte_vhost_crypto_zero_copy {
  */
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id);
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id);
 
 /**
  *  Free the Vhost-crypto instance
diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index dd01afc08..598196fb7 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -198,6 +198,7 @@ struct vhost_crypto {
 	struct rte_hash *session_map;
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *wb_pool;
 
 	/** DPDK cryptodev ID */
@@ -369,7 +370,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
 	}
 
 	if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
-			vcrypto->sess_pool) < 0) {
+			vcrypto->sess_priv_pool) < 0) {
 		VC_LOG_ERR("Failed to initialize session");
 		sess_param->session_id = -VIRTIO_CRYPTO_ERR;
 		return;
@@ -1293,7 +1294,9 @@ vhost_crypto_complete_one_vm_requests(struct rte_crypto_op **ops,
 
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id)
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id)
 {
 	struct virtio_net *dev = get_device(vid);
 	struct rte_hash_parameters params = {0};
@@ -1321,6 +1324,7 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
 	}
 
 	vcrypto->sess_pool = sess_pool;
+	vcrypto->sess_priv_pool = sess_priv_pool;
 	vcrypto->cid = cryptodev_id;
 	vcrypto->cache_session_id = UINT64_MAX;
 	vcrypto->last_session_id = 1;
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index aac0b1f0b..238b7dd34 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -48,6 +48,7 @@ struct crypto_testsuite_params {
 	struct rte_mempool *large_mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config conf;
 	struct rte_cryptodev_qp_conf qp_conf;
 
@@ -444,17 +445,24 @@ testsuite_setup(void)
 		return TEST_FAILED;
 	}
 
-	ts_params->session_mpool = rte_mempool_create(
-				"test_sess_mp",
-				MAX_NB_SESSIONS * 2,
-				session_size,
-				0, 0, NULL, NULL, NULL,
-				NULL, SOCKET_ID_ANY,
-				0);
-
+	ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
+			"test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+			SOCKET_ID_ANY);
 	TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
 			"session mempool allocation failed");
 
+	ts_params->session_priv_mpool = rte_mempool_create(
+			"test_sess_mp_priv",
+			MAX_NB_SESSIONS,
+			session_size,
+			0, 0, NULL, NULL, NULL,
+			NULL, SOCKET_ID_ANY,
+			0);
+	TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
+			"session mempool allocation failed");
+
+
+
 	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
 			&ts_params->conf),
 			"Failed to configure cryptodev %u with %u qps",
@@ -462,7 +470,7 @@ testsuite_setup(void)
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	ts_params->qp_conf.mp_session = ts_params->session_mpool;
-	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -491,6 +499,11 @@ testsuite_teardown(void)
 	}
 
 	/* Free session mempools */
+	if (ts_params->session_priv_mpool != NULL) {
+		rte_mempool_free(ts_params->session_priv_mpool);
+		ts_params->session_priv_mpool = NULL;
+	}
+
 	if (ts_params->session_mpool != NULL) {
 		rte_mempool_free(ts_params->session_mpool);
 		ts_params->session_mpool = NULL;
@@ -510,6 +523,9 @@ ut_setup(void)
 
 	/* Reconfigure device to default parameters */
 	ts_params->conf.socket_id = SOCKET_ID_ANY;
+	ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
 			&ts_params->conf),
@@ -710,7 +726,7 @@ test_queue_pair_descriptor_setup(void)
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
 	qp_conf.mp_session = ts_params->session_mpool;
-	qp_conf.mp_session_private = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -1337,7 +1353,7 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
 	/* Create crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate crypto op data structure */
@@ -1551,7 +1567,7 @@ test_AES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1570,7 +1586,7 @@ test_AES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1589,7 +1605,7 @@ test_AES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1608,7 +1624,7 @@ test_DES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1627,7 +1643,7 @@ test_authonly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1646,7 +1662,7 @@ test_authonly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1664,7 +1680,7 @@ test_AES_chain_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1685,7 +1701,7 @@ test_AES_cipheronly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1704,7 +1720,7 @@ test_AES_chain_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1723,7 +1739,7 @@ test_authonly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1744,7 +1760,7 @@ test_AES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1763,7 +1779,7 @@ test_AES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1782,7 +1798,7 @@ test_AES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1801,7 +1817,7 @@ test_AES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1820,7 +1836,7 @@ test_AES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1839,7 +1855,7 @@ test_AES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1858,7 +1874,7 @@ test_AES_cipheronly_virtio_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)),
@@ -1877,7 +1893,7 @@ test_AES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1896,7 +1912,7 @@ test_AES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1915,7 +1931,7 @@ test_authonly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1935,7 +1951,7 @@ test_AES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1954,7 +1970,7 @@ test_AES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1973,7 +1989,7 @@ test_authonly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1992,7 +2008,7 @@ test_AES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2011,7 +2027,7 @@ test_AES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2030,7 +2046,7 @@ test_authonly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2049,7 +2065,7 @@ test_authonly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -2068,7 +2084,7 @@ test_authonly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -2087,7 +2103,7 @@ test_AES_chain_armv8_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)),
@@ -2106,7 +2122,7 @@ test_AES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2125,7 +2141,7 @@ test_AES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2144,7 +2160,7 @@ test_authonly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2163,7 +2179,7 @@ test_3DES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2182,7 +2198,7 @@ test_3DES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2201,6 +2217,7 @@ test_AES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2219,6 +2236,7 @@ test_AES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2237,6 +2255,7 @@ test_3DES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2255,6 +2274,7 @@ test_3DES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2273,6 +2293,7 @@ test_authonly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2315,7 +2336,8 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2352,7 +2374,8 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2468,7 +2491,8 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2527,7 +2551,8 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2589,7 +2614,8 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -5075,7 +5101,7 @@ test_3DES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5094,7 +5120,7 @@ test_DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5113,7 +5139,7 @@ test_DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5132,7 +5158,7 @@ test_DES_docsis_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5151,7 +5177,7 @@ test_DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5169,7 +5195,7 @@ test_3DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5188,7 +5214,7 @@ test_DES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5207,7 +5233,7 @@ test_3DES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5226,7 +5252,7 @@ test_3DES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5245,7 +5271,7 @@ test_3DES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5264,7 +5290,7 @@ test_3DES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5283,7 +5309,7 @@ test_3DES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5302,7 +5328,7 @@ test_3DES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5321,7 +5347,7 @@ test_3DES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5340,7 +5366,7 @@ test_3DES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5359,7 +5385,7 @@ test_3DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5378,7 +5404,7 @@ test_3DES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5397,7 +5423,7 @@ test_3DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5443,7 +5469,8 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->aead_xform, ts_params->session_mpool);
+			&ut_params->aead_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -6547,7 +6574,7 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
 
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 
 	if (ut_params->sess == NULL)
 		return TEST_FAILED;
@@ -6728,7 +6755,7 @@ test_multi_session(void)
 
 		rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				sessions[i], &ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
 				i);
@@ -6766,7 +6793,7 @@ test_multi_session(void)
 	/* Next session create should fail */
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			sessions[i], &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NULL(sessions[i],
 			"Session creation succeeded unexpectedly!");
 
@@ -6847,7 +6874,7 @@ test_multi_session_random_usage(void)
 				ts_params->valid_devs[0],
 				sessions[i],
 				&ut_paramz[i].ut_params.auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
@@ -6925,7 +6952,7 @@ test_null_cipher_only_operation(void)
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				ut_params->sess,
 				&ut_params->cipher_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6998,7 +7025,7 @@ test_null_auth_only_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7077,7 +7104,7 @@ test_null_cipher_auth_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7165,7 +7192,7 @@ test_null_auth_cipher_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7235,7 +7262,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7253,7 +7280,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7294,7 +7321,7 @@ test_null_burst_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
@@ -7429,7 +7456,7 @@ static int create_gmac_session(uint8_t dev_id,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7809,7 +7836,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7862,7 +7889,7 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -8740,12 +8767,14 @@ test_scheduler_attach_slave_op(void)
 	for (i = 0; i < rte_cryptodev_count() && nb_devs_attached < 2;
 			i++) {
 		struct rte_cryptodev_info info;
+		unsigned int session_size;
 
 		rte_cryptodev_info_get(i, &info);
 		if (info.driver_id != rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
 			continue;
 
+		session_size = rte_cryptodev_sym_get_private_session_size(i);
 		/*
 		 * Create the session mempool again, since now there are new devices
 		 * to use the mempool.
@@ -8754,8 +8783,10 @@ test_scheduler_attach_slave_op(void)
 			rte_mempool_free(ts_params->session_mpool);
 			ts_params->session_mpool = NULL;
 		}
-		unsigned int session_size =
-			rte_cryptodev_sym_get_private_session_size(i);
+		if (ts_params->session_priv_mpool) {
+			rte_mempool_free(ts_params->session_priv_mpool);
+			ts_params->session_priv_mpool = NULL;
+		}
 
 		if (info.sym.max_nb_sessions != 0 &&
 				info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
@@ -8766,22 +8797,40 @@ test_scheduler_attach_slave_op(void)
 			return TEST_FAILED;
 		}
 		/*
-		 * Create mempool with maximum number of sessions * 2,
+		 * Create mempool with maximum number of sessions,
 		 * to include the session headers
 		 */
 		if (ts_params->session_mpool == NULL) {
-			ts_params->session_mpool = rte_mempool_create(
-					"test_sess_mp",
-					MAX_NB_SESSIONS * 2,
+			ts_params->session_mpool =
+				rte_cryptodev_sym_session_pool_create(
+						"test_sess_mp",
+						MAX_NB_SESSIONS, 0, 0, 0,
+						SOCKET_ID_ANY);
+			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+					"session mempool allocation failed");
+		}
+
+		/*
+		 * Create mempool with maximum number of sessions,
+		 * to include device specific session private data
+		 */
+		if (ts_params->session_priv_mpool == NULL) {
+			ts_params->session_priv_mpool = rte_mempool_create(
+					"test_sess_mp_priv",
+					MAX_NB_SESSIONS,
 					session_size,
 					0, 0, NULL, NULL, NULL,
 					NULL, SOCKET_ID_ANY,
 					0);
 
-			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+			TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
 					"session mempool allocation failed");
 		}
 
+		ts_params->qp_conf.mp_session = ts_params->session_mpool;
+		ts_params->qp_conf.mp_session_private =
+				ts_params->session_priv_mpool;
+
 		ret = rte_cryptodev_scheduler_slave_attach(sched_id,
 				(uint8_t)i);
 
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 1c3f29f6b..4d6f46a6e 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -25,6 +25,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 	struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	char *test_msg)
@@ -347,7 +348,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 		sess = rte_cryptodev_sym_session_create(sess_mpool);
 
 		rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
-				sess_mpool);
+				sess_priv_mpool);
 		if (!sess) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
@@ -615,6 +616,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type)
@@ -730,7 +732,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			continue;
 
 		status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
-			sess_mpool, dev_id, driver_id, test_msg);
+			sess_mpool, sess_priv_mpool, dev_id, driver_id,
+			test_msg);
 
 		printf("  %u) TestCase %s %s\n", test_index ++,
 			tc->test_descr, test_msg);
diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h
index f8bd85838..5c22d5da6 100644
--- a/test/test/test_cryptodev_blockcipher.h
+++ b/test/test/test_cryptodev_blockcipher.h
@@ -104,6 +104,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type);
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index 54717870e..f750ce3d8 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -61,6 +61,7 @@ struct event_crypto_adapter_test_params {
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config *config;
 	uint8_t crypto_event_port_id;
 };
@@ -193,12 +194,13 @@ test_op_forward_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		/* Create Crypto session*/
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
 							evdev, &cap);
@@ -381,7 +383,8 @@ test_op_new_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
@@ -396,7 +399,7 @@ test_op_new_mode(uint8_t session_less)
 						&m_data, sizeof(m_data));
 		}
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 		rte_crypto_op_attach_sym_session(op, sess);
 	} else {
 		struct rte_crypto_sym_xform *first_xform;
@@ -526,15 +529,20 @@ configure_cryptodev(void)
 	session_size = rte_cryptodev_sym_get_private_session_size(TEST_CDEV_ID);
 	session_size += sizeof(union rte_event_crypto_metadata);
 
-	params.session_mpool = rte_mempool_create(
-				"CRYPTO_ADAPTER_SESSION_MP",
-				MAX_NB_SESSIONS * 2,
+	params.session_mpool = rte_cryptodev_sym_session_pool_create(
+			"CRYPTO_ADAPTER_SESSION_MP",
+			MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+	TEST_ASSERT_NOT_NULL(params.session_mpool,
+			"session mempool allocation failed\n");
+
+	params.session_priv_mpool = rte_mempool_create(
+				"CRYPTO_ADAPTER_SESSION_MP_PRIV",
+				MAX_NB_SESSIONS,
 				session_size,
 				0, 0, NULL, NULL, NULL,
 				NULL, SOCKET_ID_ANY,
 				0);
-
-	TEST_ASSERT_NOT_NULL(params.session_mpool,
+	TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
 			"session mempool allocation failed\n");
 
 	rte_cryptodev_info_get(TEST_CDEV_ID, &info);
@@ -547,7 +555,7 @@ configure_cryptodev(void)
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	qp_conf.mp_session = params.session_mpool;
-	qp_conf.mp_session_private = params.session_mpool;
+	qp_conf.mp_session_private = params.session_priv_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -859,6 +867,10 @@ crypto_teardown(void)
 		rte_mempool_free(params.session_mpool);
 		params.session_mpool = NULL;
 	}
+	if (params.session_priv_mpool != NULL) {
+		rte_mempool_free(params.session_priv_mpool);
+		params.session_priv_mpool = NULL;
+	}
 
 	/* Free ops mempool */
 	if (params.op_mpool != NULL) {
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure Fan Zhang
@ 2019-01-08 16:12       ` Trahe, Fiona
  2019-01-09 11:01       ` De Lara Guarch, Pablo
  1 sibling, 0 replies; 61+ messages in thread
From: Trahe, Fiona @ 2019-01-08 16:12 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, De Lara Guarch, Pablo, Trahe, Fiona



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Friday, December 21, 2018 1:56 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Trahe, Fiona
> <fiona.trahe@intel.com>
> Subject: [PATCH v3 2/2] cryptodev: change symmetric session structure
> 
> This patch changes the symmetric session structure of cryptodev.
> The symmetric session now contains extra information for secure
> access purposes. The patch also includes the updates to the
> PMDs, test applications, and examples to fit the change.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
@ 2019-01-08 23:20       ` De Lara Guarch, Pablo
  2019-01-09 11:30         ` Zhang, Roy Fan
  2019-01-09 10:41       ` De Lara Guarch, Pablo
  1 sibling, 1 reply; 61+ messages in thread
From: De Lara Guarch, Pablo @ 2019-01-08 23:20 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Trahe, Fiona



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Friday, December 21, 2018 1:56 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: [PATCH v3 1/2] cryptodev: change queue pair configure structure
> 
> This patch changes the cryptodev queue pair configure structure
> to enable two mempool passed into cryptodev PMD simutaneously.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Fiona Trahe <fiona.trahe@@intel.com>

...

> diff --git a/doc/guides/rel_notes/release_19_02.rst
> b/doc/guides/rel_notes/release_19_02.rst
> index 47768288a..4420c2441 100644
> --- a/doc/guides/rel_notes/release_19_02.rst
> +++ b/doc/guides/rel_notes/release_19_02.rst
> @@ -130,6 +130,11 @@ API Changes
>    ``rte_pdump_init()`` and enum ``rte_pdump_socktype`` were deprecated
>    since 18.05 and are removed in this release.
> 
> +* cryptodev: as shown in the the 18.08 deprecation notice, the structure

Typo. "the 18.11" deprecation notice.

> +  ``rte_cryptodev_qp_conf`` has been added two parameters of symmetric
> session
> +  mempool and symmetric session private data mempool, and the last
> parameter of
> +  ``rte_cryptodev_queue_pair_setup()`` is removed.
> +
> 
>  ABI Changes
>  -----------

I think we need to bump the ABI version of cryptodev due to this, in release notes.
Also, the deprecation notice added for this change, should be removed in this patch.

> diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> index ebdf7c35a..abc7a6d5f 100644

...

> --- a/examples/fips_validation/main.c
> +++ b/examples/fips_validation/main.c
> @@ -39,7 +39,7 @@ static int
>  cryptodev_fips_validate_app_int(void)
>  {
>  	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
> -	struct rte_cryptodev_qp_conf qp_conf = {128};
> +	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};

Is this OK? Below, it looks like a mempool was passes (env.mpool), but now it is NULL here.

>  	int ret;
> 
>  	ret = rte_cryptodev_configure(env.dev_id, &conf);
> @@ -52,7 +52,7 @@ cryptodev_fips_validate_app_int(void)
>  		return ret;
> 
>  	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
> -			rte_socket_id(), env.mpool);
> +			rte_socket_id());
>  	if (ret < 0)
>  		return ret;
> 

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
  2019-01-08 23:20       ` De Lara Guarch, Pablo
@ 2019-01-09 10:41       ` De Lara Guarch, Pablo
  1 sibling, 0 replies; 61+ messages in thread
From: De Lara Guarch, Pablo @ 2019-01-09 10:41 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Trahe, Fiona

Hi,

> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Friday, December 21, 2018 1:56 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: [PATCH v3 1/2] cryptodev: change queue pair configure structure
> 
> This patch changes the cryptodev queue pair configure structure
> to enable two mempool passed into cryptodev PMD simutaneously.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Fiona Trahe <fiona.trahe@@intel.com>
> ---
>  app/test-crypto-perf/main.c                        |  6 ++--
>  doc/guides/rel_notes/release_19_02.rst             |  5 +++

One last thing. Could you update the programmer's guide with the changes made in "rte_cryptodev_qp_conf"?
In section 14.2.4 and the sample code 14.6.

Thanks,
Pablo

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure Fan Zhang
  2019-01-08 16:12       ` Trahe, Fiona
@ 2019-01-09 11:01       ` De Lara Guarch, Pablo
  2019-01-09 11:10         ` Zhang, Roy Fan
  1 sibling, 1 reply; 61+ messages in thread
From: De Lara Guarch, Pablo @ 2019-01-09 11:01 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Trahe, Fiona

Hi Fan,

> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Friday, December 21, 2018 1:56 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: [PATCH v3 2/2] cryptodev: change symmetric session structure
> 
> This patch changes the symmetric session structure of cryptodev.
> The symmetric session now contains extra information for secure
> access purposes. The patch also includes the updates to the
> PMDs, test applications, and examples to fit the change.
> 

Programmer's guide needs to be updated to reflect these changes.

> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>

...

> diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
> index a8f94c097..ade108b90 100644
> --- a/lib/librte_cryptodev/Makefile
> +++ b/lib/librte_cryptodev/Makefile
> @@ -12,6 +12,7 @@ LIBABIVER := 5

This needs to be bumped to 6 (here and in meson.build),
probably in the previous patch.

>  # build flags
>  CFLAGS += -O3
>  CFLAGS += $(WERROR_FLAGS)
> +CFLAGS += -DALLOW_EXPERIMENTAL_API
>  LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf
>  LDLIBS += -lrte_kvargs
> 

...

> +++ b/lib/librte_cryptodev/rte_cryptodev.c

...

> +struct rte_mempool *__rte_experimental
> +rte_cryptodev_sym_session_pool_create(const char *name, uint32_t
> nb_elts,
> +	uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
> +	int socket_id)

Is elt_size a required parameter? This mempool is created specifically for crypto sessions,
so the size of it is known and can be transparent to the user (plus, I see that in all apps, this is always 0).

> +		CDEV_LOG_INFO("elt_size %u is expanded to %u\n", elt_size,
> +				obj_sz);

...

> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -105,4 +105,6 @@ EXPERIMENTAL {
>  	rte_cryptodev_sym_session_set_user_data;
>  	rte_crypto_asym_op_strings;
>  	rte_crypto_asym_xform_strings;
> +	rte_cryptodev_sym_session_pool_create;
> +	rte_cryptodev_sym_get_existing_header_session_size;

As far as I know, this new API is mandatory to be used, and therefore,
I think this should not be marked as experimental,
as the crypto library is a stable library.

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure
  2019-01-09 11:01       ` De Lara Guarch, Pablo
@ 2019-01-09 11:10         ` Zhang, Roy Fan
  0 siblings, 0 replies; 61+ messages in thread
From: Zhang, Roy Fan @ 2019-01-09 11:10 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev; +Cc: akhil.goyal, Trahe, Fiona

Hi Pablo,

Thanks for the review. Comments inline.

Regards,
Fan

> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Wednesday, January 9, 2019 11:01 AM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: RE: [PATCH v3 2/2] cryptodev: change symmetric session structure
> 
> Hi Fan,
> 
> > -----Original Message-----
> > From: Zhang, Roy Fan
> > Sent: Friday, December 21, 2018 1:56 PM
> > To: dev@dpdk.org
> > Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> > Subject: [PATCH v3 2/2] cryptodev: change symmetric session structure
> >
> > This patch changes the symmetric session structure of cryptodev.
> > The symmetric session now contains extra information for secure access
> > purposes. The patch also includes the updates to the PMDs, test
> > applications, and examples to fit the change.
> >
> 
> Programmer's guide needs to be updated to reflect these changes.
> 
[Fan: Will do]
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> 
> ...
> 
> > diff --git a/lib/librte_cryptodev/Makefile
> > b/lib/librte_cryptodev/Makefile index a8f94c097..ade108b90 100644
> > --- a/lib/librte_cryptodev/Makefile
> > +++ b/lib/librte_cryptodev/Makefile
> > @@ -12,6 +12,7 @@ LIBABIVER := 5
> 
> This needs to be bumped to 6 (here and in meson.build), probably in the
> previous patch.
> 
[Fan: No problem]
> >  # build flags
> >  CFLAGS += -O3
> >  CFLAGS += $(WERROR_FLAGS)
> > +CFLAGS += -DALLOW_EXPERIMENTAL_API
> >  LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf  LDLIBS +=
> > -lrte_kvargs
> >
> 
> ...
> 
> > +++ b/lib/librte_cryptodev/rte_cryptodev.c
> 
> ...
> 
> > +struct rte_mempool *__rte_experimental
> > +rte_cryptodev_sym_session_pool_create(const char *name, uint32_t
> > nb_elts,
> > +	uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
> > +	int socket_id)
> 
> Is elt_size a required parameter? This mempool is created specifically for
> crypto sessions, so the size of it is known and can be transparent to the user
> (plus, I see that in all apps, this is always 0).
> 
[Fan: Yes. If the user wants to use the same mempool for both session header and private data, this elt size can be used to pass the private session data's size, so the library can create a mempool with big enough elt size. The API comments of the header file has described that and I will add it to the programmer's guide] 
> > +		CDEV_LOG_INFO("elt_size %u is expanded to %u\n",
> elt_size,
> > +				obj_sz);
> 
> ...
> 
> > +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> > @@ -105,4 +105,6 @@ EXPERIMENTAL {
> >  	rte_cryptodev_sym_session_set_user_data;
> >  	rte_crypto_asym_op_strings;
> >  	rte_crypto_asym_xform_strings;
> > +	rte_cryptodev_sym_session_pool_create;
> > +	rte_cryptodev_sym_get_existing_header_session_size;
> 
> As far as I know, this new API is mandatory to be used, and therefore, I think
> this should not be marked as experimental, as the crypto library is a stable
> library.
[Fan: Will do.] 

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure
  2019-01-08 23:20       ` De Lara Guarch, Pablo
@ 2019-01-09 11:30         ` Zhang, Roy Fan
  0 siblings, 0 replies; 61+ messages in thread
From: Zhang, Roy Fan @ 2019-01-09 11:30 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev; +Cc: akhil.goyal, Trahe, Fiona

Hi Pablo,

Thanks for the review.
Comments inline.

> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Tuesday, January 8, 2019 11:21 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: RE: [PATCH v3 1/2] cryptodev: change queue pair configure
> structure
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Roy Fan
> > Sent: Friday, December 21, 2018 1:56 PM
> > To: dev@dpdk.org
> > Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> > Subject: [PATCH v3 1/2] cryptodev: change queue pair configure
> > structure
> >
> > This patch changes the cryptodev queue pair configure structure to
> > enable two mempool passed into cryptodev PMD simutaneously.
> >
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > Acked-by: Fiona Trahe <fiona.trahe@@intel.com>
> 
> ...
> 
> > diff --git a/doc/guides/rel_notes/release_19_02.rst
> > b/doc/guides/rel_notes/release_19_02.rst
> > index 47768288a..4420c2441 100644
> > --- a/doc/guides/rel_notes/release_19_02.rst
> > +++ b/doc/guides/rel_notes/release_19_02.rst
> > @@ -130,6 +130,11 @@ API Changes
> >    ``rte_pdump_init()`` and enum ``rte_pdump_socktype`` were deprecated
> >    since 18.05 and are removed in this release.
> >
> > +* cryptodev: as shown in the the 18.08 deprecation notice, the
> > +structure
> 
> Typo. "the 18.11" deprecation notice.
[Fan: Will change] 
> 
> > +  ``rte_cryptodev_qp_conf`` has been added two parameters of
> > + symmetric
> > session
> > +  mempool and symmetric session private data mempool, and the last
> > parameter of
> > +  ``rte_cryptodev_queue_pair_setup()`` is removed.
> > +
> >
> >  ABI Changes
> >  -----------
> 
> I think we need to bump the ABI version of cryptodev due to this, in release
> notes.
> Also, the deprecation notice added for this change, should be removed in
> this patch.

[Fan: Will do] 
> 
> > diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > index ebdf7c35a..abc7a6d5f 100644
> 
> ...
> 
> > --- a/examples/fips_validation/main.c
> > +++ b/examples/fips_validation/main.c
> > @@ -39,7 +39,7 @@ static int
> >  cryptodev_fips_validate_app_int(void)
> >  {
> >  	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
> > -	struct rte_cryptodev_qp_conf qp_conf = {128};
> > +	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
> 
> Is this OK? Below, it looks like a mempool was passes (env.mpool), but now it
> is NULL here.
[Fan: we do not need a mempool here as none of the session-less scheme will be tested] 
> 
> >  	int ret;
> >
> >  	ret = rte_cryptodev_configure(env.dev_id, &conf); @@ -52,7 +52,7
> @@
> > cryptodev_fips_validate_app_int(void)
> >  		return ret;
> >
> >  	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
> > -			rte_socket_id(), env.mpool);
> > +			rte_socket_id());
> >  	if (ret < 0)
> >  		return ret;
> >

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session
  2018-12-21 13:55   ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
  2018-12-21 13:55     ` [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure Fan Zhang
@ 2019-01-09 22:55     ` Fan Zhang
  2019-01-09 22:55       ` [dpdk-dev] [PATCH v4 01/12] cryptodev: change queue pair configure structure Fan Zhang
                         ` (12 more replies)
  2 siblings, 13 replies; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:55 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patchset changes the queue pair configure structure and sym session
structure for cryptodev. An RFC patch http://patchwork.dpdk.org/patch/43883/
has been sent to state the change.

The patchset also includes two added APIs for creating symmetric session mempool
and getting the session header data for existing session. 

v4:
- Fixed some issue.
- Patch splitted.

v3:
- Rebased.
- Fixed a few bugs.

v2:
- Removed incorrect config/common_base change
- Added new API for existing session size
- Changed element name of symmetric session

Fan Zhang (12):
  cryptodev: change queue pair configure structure
  cryptodev: add sym session mempool create
  app/test-crypto-perf: use separate session mempools
  net/softnic: use separate session mempools
  examples: use separate session mempools
  vhost/crypto: use separate session mempools
  test/crypto: use separate session mempools
  cryptodev: add sym session header size API
  cryptodev: update symmetric session structure
  cryptodev: add user data size to symmetric session
  cryptodev: add reference count to session private data
  cryptodev: add opaque data field to symmetric session

 app/test-crypto-perf/cperf.h                       |   1 +
 app/test-crypto-perf/cperf_ops.c                   |  11 +-
 app/test-crypto-perf/cperf_ops.h                   |   2 +-
 app/test-crypto-perf/cperf_test_latency.c          |   5 +-
 app/test-crypto-perf/cperf_test_latency.h          |   1 +
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c   |   5 +-
 app/test-crypto-perf/cperf_test_pmd_cyclecount.h   |   1 +
 app/test-crypto-perf/cperf_test_throughput.c       |   5 +-
 app/test-crypto-perf/cperf_test_throughput.h       |   1 +
 app/test-crypto-perf/cperf_test_verify.c           |   5 +-
 app/test-crypto-perf/cperf_test_verify.h           |   1 +
 app/test-crypto-perf/main.c                        | 105 ++-
 doc/guides/prog_guide/cryptodev_lib.rst            |  43 +-
 doc/guides/prog_guide/img/cryptodev_sym_sess.svg   | 725 +++++++++++----------
 doc/guides/rel_notes/release_19_02.rst             |  30 +
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  10 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |   5 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |   2 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  10 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |   5 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +
 drivers/crypto/armv8/rte_armv8_pmd.c               |  10 +-
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |   5 +-
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |   2 +
 drivers/crypto/caam_jr/caam_jr.c                   |   3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |   5 +-
 drivers/crypto/ccp/ccp_pmd_private.h               |   2 +
 drivers/crypto/ccp/rte_ccp_pmd.c                   |   9 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |   3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |   3 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  10 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |   5 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |   2 +
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |   5 +-
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |   3 +
 drivers/crypto/null/null_crypto_pmd.c              |   5 +-
 drivers/crypto/null/null_crypto_pmd_ops.c          |   5 +-
 drivers/crypto/null/null_crypto_pmd_private.h      |   2 +
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |   3 +-
 drivers/crypto/openssl/rte_openssl_pmd.c           |  10 +-
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |   5 +-
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |   2 +
 drivers/crypto/qat/qat_sym_pmd.c                   |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |   5 +-
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  10 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |   5 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |   2 +
 drivers/crypto/virtio/virtio_cryptodev.c           |   6 +-
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  10 +-
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |   5 +-
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |   2 +
 drivers/net/softnic/rte_eth_softnic_cli.c          |  52 +-
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  52 +-
 drivers/net/softnic/rte_eth_softnic_internals.h    |   3 +
 examples/fips_validation/main.c                    |  38 +-
 examples/ip_pipeline/cli.c                         |  49 +-
 examples/ip_pipeline/cryptodev.c                   |  51 +-
 examples/ip_pipeline/cryptodev.h                   |   3 +
 examples/ip_pipeline/examples/flow_crypto.cli      |   9 +-
 examples/ipsec-secgw/ipsec-secgw.c                 |  51 +-
 examples/ipsec-secgw/ipsec.c                       |   2 +-
 examples/ipsec-secgw/ipsec.h                       |   2 +
 examples/l2fwd-crypto/main.c                       |  66 +-
 examples/vhost_crypto/main.c                       |  22 +-
 lib/librte_cryptodev/Makefile                      |   4 +-
 lib/librte_cryptodev/rte_cryptodev.c               | 192 +++++-
 lib/librte_cryptodev/rte_cryptodev.h               |  69 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  16 +-
 lib/librte_cryptodev/rte_cryptodev_version.map     |   8 +
 lib/librte_vhost/rte_vhost_crypto.h                |   9 +-
 lib/librte_vhost/vhost_crypto.c                    |   8 +-
 test/test/test_cryptodev.c                         | 262 ++++----
 test/test/test_cryptodev_asym.c                    |   8 +-
 test/test/test_cryptodev_blockcipher.c             |   7 +-
 test/test/test_cryptodev_blockcipher.h             |   1 +
 test/test/test_event_crypto_adapter.c              |  35 +-
 76 files changed, 1401 insertions(+), 739 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 01/12] cryptodev: change queue pair configure structure
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
@ 2019-01-09 22:55       ` Fan Zhang
  2019-01-10  9:47         ` De Lara Guarch, Pablo
  2019-01-09 22:55       ` [dpdk-dev] [PATCH v4 02/12] cryptodev: add sym session mempool create Fan Zhang
                         ` (11 subsequent siblings)
  12 siblings, 1 reply; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:55 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch changes the cryptodev queue pair configure structure
to enable two mempool passed into cryptodev PMD simutaneously.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@@intel.com>
---
 app/test-crypto-perf/main.c                        |  6 ++--
 doc/guides/prog_guide/cryptodev_lib.rst            | 12 ++++++-
 doc/guides/rel_notes/release_19_02.rst             |  7 ++++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  7 ++--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |  5 +--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   |  2 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  7 ++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  5 +--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |  2 ++
 drivers/crypto/armv8/rte_armv8_pmd.c               |  7 ++--
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |  5 +--
 drivers/crypto/armv8/rte_armv8_pmd_private.h       |  2 ++
 drivers/crypto/caam_jr/caam_jr.c                   |  3 +-
 drivers/crypto/ccp/ccp_pmd_ops.c                   |  5 +--
 drivers/crypto/ccp/ccp_pmd_private.h               |  2 ++
 drivers/crypto/ccp/rte_ccp_pmd.c                   |  9 +++++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |  3 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                 |  3 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  7 ++--
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |  5 +--
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h     |  2 ++
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c            |  5 +--
 drivers/crypto/mvsam/rte_mrvl_pmd_private.h        |  3 ++
 drivers/crypto/null/null_crypto_pmd.c              |  5 +--
 drivers/crypto/null/null_crypto_pmd_ops.c          |  5 +--
 drivers/crypto/null/null_crypto_pmd_private.h      |  2 ++
 drivers/crypto/octeontx/otx_cryptodev_ops.c        |  3 +-
 drivers/crypto/openssl/rte_openssl_pmd.c           |  7 ++--
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |  5 +--
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |  2 ++
 drivers/crypto/qat/qat_sym_pmd.c                   |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |  5 ++-
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  7 ++--
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |  5 +--
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h     |  2 ++
 drivers/crypto/virtio/virtio_cryptodev.c           |  6 ++--
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  7 ++--
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |  5 +--
 drivers/crypto/zuc/rte_zuc_pmd_private.h           |  2 ++
 drivers/net/softnic/rte_eth_softnic_cryptodev.c    |  2 +-
 examples/fips_validation/main.c                    |  4 +--
 examples/ip_pipeline/cryptodev.c                   |  2 +-
 examples/ipsec-secgw/ipsec-secgw.c                 |  7 ++--
 examples/l2fwd-crypto/main.c                       |  4 ++-
 examples/vhost_crypto/main.c                       |  9 ++++--
 lib/librte_cryptodev/Makefile                      |  4 +--
 lib/librte_cryptodev/rte_cryptodev.c               | 16 ++++++++--
 lib/librte_cryptodev/rte_cryptodev.h               |  7 ++--
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  3 +-
 test/test/test_cryptodev.c                         | 37 +++++++++-------------
 test/test/test_cryptodev_asym.c                    |  8 ++---
 test/test/test_event_crypto_adapter.c              |  5 +--
 52 files changed, 182 insertions(+), 110 deletions(-)

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 953e058c9..38a2e429f 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -218,6 +218,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 			session_pool_socket[socket_id] = sess_mp;
 		}
 
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
+
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
 			printf("Failed to configure cryptodev %u", cdev_id);
@@ -226,8 +229,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 
 		for (j = 0; j < opts->nb_qps; j++) {
 			ret = rte_cryptodev_queue_pair_setup(cdev_id, j,
-				&qp_conf, socket_id,
-				session_pool_socket[socket_id]);
+				&qp_conf, socket_id);
 			if (ret < 0) {
 				printf("Failed to setup queue pair %u on "
 					"cryptodev %u",	j, cdev_id);
diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst
index 8ee33c875..050a58dc4 100644
--- a/doc/guides/prog_guide/cryptodev_lib.rst
+++ b/doc/guides/prog_guide/cryptodev_lib.rst
@@ -121,11 +121,21 @@ Each queue pairs resources may be allocated on a specified socket.
                 const struct rte_cryptodev_qp_conf *qp_conf,
                 int socket_id)
 
-    struct rte_cryptodev_qp_conf {
+   struct rte_cryptodev_qp_conf {
         uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
+        struct rte_mempool *mp_session;
+        /**< The mempool for creating session in sessionless mode */
+        struct rte_mempool *mp_session_private;
+        /**< The mempool for creating sess private data in sessionless mode */
     };
 
 
+The fields ``mp_session`` and ``mp_session_private`` are used for creating
+temporary session to process the crypto operations in the session-less mode.
+They can be the same other different mempools. Please note not all Cryptodev
+PMDs supports session-less mode.
+
+
 Logical Cores, Memory and Queues Pair Relationships
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index e3b2055d0..75128f8f2 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -164,6 +164,9 @@ API Changes
   ``rte_pdump_init()`` and enum ``rte_pdump_socktype`` were deprecated
   since 18.05 and are removed in this release.
 
+* cryptodev: as shown in the the 18.11 deprecation notice, the last parameter
+  of ``rte_cryptodev_queue_pair_setup()``, ``session_pool``, is removed.
+
 
 ABI Changes
 -----------
@@ -183,6 +186,10 @@ ABI Changes
 * mbuf: The format of the sched field of ``rte_mbuf`` has been changed
   to include the following fields: ``queue ID``, ``traffic class``, ``color``.
 
+* cryptodev: as shown in the the 18.11 deprecation notice, the structure
+  ``rte_cryptodev_qp_conf`` has been added two parameters of symmetric session
+  mempool and symmetric session private data mempool.
+
 
 Shared Library Versions
 -----------------------
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index ebdf7c35a..abc7a6d5f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -151,7 +151,8 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_gcm_session *)_sess_private_data;
@@ -159,7 +160,7 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_gcm_set_session_parameters(qp->ops,
 				sess, sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -419,7 +420,7 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index cd15245bd..bf69dde54 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -206,7 +206,7 @@ aesni_gcm_pmd_qp_create_processed_pkts_ring(struct aesni_gcm_qp *qp,
 static int
 aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_gcm_qp *qp = NULL;
 	struct aesni_gcm_private *internals = dev->data->dev_private;
@@ -234,7 +234,8 @@ aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_pkts == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
index 92b041354..903e7503d 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
@@ -48,6 +48,8 @@ struct aesni_gcm_qp {
 	/**< Queue pair statistics */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	uint16_t id;
 	/**< Queue Pair Identifier */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 83250e32c..b0f5c4d67 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -668,7 +668,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct aesni_mb_session *)_sess_private_data;
@@ -676,7 +677,7 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(aesni_mb_set_session_parameters(qp->op_fns,
 				sess, op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -951,7 +952,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index f3eff2685..af3021616 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -566,7 +566,7 @@ aesni_mb_pmd_qp_create_processed_ops_ring(struct aesni_mb_qp *qp,
 static int
 aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct aesni_mb_qp *qp = NULL;
 	struct aesni_mb_private *internals = dev->data->dev_private;
@@ -604,7 +604,8 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
index d8021cdaa..923403336 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
@@ -131,6 +131,8 @@ struct aesni_mb_qp {
        /**< Ring for placing operations ready for processing */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t digest_idx;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 9d15fee53..3b2d7fb2f 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -514,7 +514,8 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct armv8_crypto_session *)_sess_private_data;
@@ -522,7 +523,7 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(armv8_crypto_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -656,7 +657,7 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
 		rte_mempool_put(qp->sess_mp, sess);
-		rte_mempool_put(qp->sess_mp, op->sym->session);
+		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
 	}
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index ae03117ea..a4fee83a8 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -220,7 +220,7 @@ armv8_crypto_pmd_qp_create_processed_ops_ring(struct armv8_crypto_qp *qp,
 static int
 armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct armv8_crypto_qp *qp = NULL;
 
@@ -245,7 +245,8 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_private.h b/drivers/crypto/armv8/rte_armv8_pmd_private.h
index 7feb021db..0afd9c7c5 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_private.h
+++ b/drivers/crypto/armv8/rte_armv8_pmd_private.h
@@ -116,6 +116,8 @@ struct armv8_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+       /**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index f505adf6b..45b281331 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1540,8 +1540,7 @@ static int
 caam_jr_queue_pair_setup(
 		struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct sec_job_ring_t *internals;
 	struct caam_jr_qp *qp = NULL;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 6984913f1..d5041f0ec 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -685,7 +685,7 @@ ccp_pmd_qp_create_batch_info_ring(struct ccp_qp *qp,
 static int
 ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 const struct rte_cryptodev_qp_conf *qp_conf,
-		 int socket_id, struct rte_mempool *session_pool)
+		 int socket_id)
 {
 	struct ccp_private *internals = dev->data->dev_private;
 	struct ccp_qp *qp;
@@ -726,7 +726,8 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	/* mempool for batch info */
 	qp->batch_mp = rte_mempool_create(
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 79752f687..7f2979e89 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -76,6 +76,8 @@ struct ccp_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_mempool *batch_mp;
 	/**< Session Mempool for batch info */
 	struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 92d8a9559..b4bb5528f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -179,7 +179,7 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
 							internals) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -241,6 +241,13 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	for (i = 0; i < nb_dequeued; i++)
 		if (unlikely(ops[i]->sess_type ==
 			     RTE_CRYPTO_OP_SESSIONLESS)) {
+			struct ccp_session *sess = (struct ccp_session *)
+					get_sym_session_private_data(
+						ops[i]->sym->session,
+						ccp_cryptodev_driver_id);
+
+			rte_mempool_put(qp->sess_mp_priv,
+					sess);
 			rte_mempool_put(qp->sess_mp,
 					ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 6095c6021..82220ac4f 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1518,8 +1518,7 @@ dpaa2_sec_queue_pair_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 static int
 dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
 	struct dpaa2_sec_qp *qp;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index d83e74541..c95e43b7f 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -1661,8 +1661,7 @@ dpaa_sec_queue_pair_release(struct rte_cryptodev *dev,
 static int
 dpaa_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		__rte_unused const struct rte_cryptodev_qp_conf *qp_conf,
-		__rte_unused int socket_id,
-		__rte_unused struct rte_mempool *session_pool)
+		__rte_unused int socket_id)
 {
 	struct dpaa_sec_dev_private *internals;
 	struct dpaa_sec_qp *qp = NULL;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 239a1cf44..6df645a23 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -145,7 +145,8 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct kasumi_session *)_sess_private_data;
@@ -153,7 +154,7 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(kasumi_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -325,7 +326,7 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index 9e4bf1b52..a4982f091 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -192,7 +192,7 @@ kasumi_pmd_qp_create_processed_ops_ring(struct kasumi_qp *qp,
 static int
 kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
 
@@ -217,7 +217,8 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
index 488777ca8..76f746c03 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
@@ -36,6 +36,8 @@ struct kasumi_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index 9956f051f..ef520356f 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -633,7 +633,7 @@ mrvl_crypto_pmd_close(struct rte_cryptodev *dev)
 static int
 mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct mrvl_crypto_qp *qp = NULL;
 	char match[RTE_CRYPTODEV_NAME_MAX_LEN];
@@ -690,7 +690,8 @@ mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		if (sam_cio_init(&qp->cio_params, &qp->cio) < 0)
 			break;
 
-		qp->sess_mp = session_pool;
+		qp->sess_mp = qp_conf->mp_session;
+		qp->sess_mp_priv = qp_conf->mp_session_private;
 
 		memset(&qp->stats, 0, sizeof(qp->stats));
 		dev->data->queue_pairs[qp_id] = qp;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
index 6f8cf5624..deb80c55d 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h
@@ -51,6 +51,9 @@ struct mrvl_crypto_qp {
 	/** Session Mempool. */
 	struct rte_mempool *sess_mp;
 
+	/** Session Private Data Mempool. */
+	struct rte_mempool *sess_mp_priv;
+
 	/** Queue pair statistics. */
 	struct rte_cryptodev_stats stats;
 
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 6e29a21a6..d5e3064f2 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -87,7 +87,8 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct null_crypto_session *)_sess_private_data;
@@ -95,7 +96,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(null_crypto_set_session_parameters(sess,
 				sym_op->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 2bdcd019e..941d62bed 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -184,7 +184,7 @@ null_crypto_pmd_qp_create_processed_pkts_ring(struct null_crypto_qp *qp,
 static int
 null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct null_crypto_private *internals = dev->data->dev_private;
 	struct null_crypto_qp *qp;
@@ -228,7 +228,8 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 	}
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index d5905afd8..d7bfd9cc8 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,6 +31,8 @@ struct null_crypto_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 } __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 90d0c14b8..6a0cf83f4 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -186,8 +186,7 @@ static int
 otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
 		       uint16_t que_pair_id,
 		       const struct rte_cryptodev_qp_conf *qp_conf,
-		       int socket_id __rte_unused,
-		       struct rte_mempool *session_pool __rte_unused)
+		       int socket_id __rte_unused)
 {
 	void *cptvf = dev->data->dev_private;
 	struct cpt_instance *instance = NULL;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index a0ccacb1e..a193af642 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -768,7 +768,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct openssl_session *)_sess_private_data;
@@ -776,7 +777,7 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(openssl_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -2020,7 +2021,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
 				rte_cryptodev_sym_get_header_session_size());
-		rte_mempool_put(qp->sess_mp, sess);
+		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index d382476a6..40217cf0d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -715,7 +715,7 @@ openssl_pmd_qp_create_processed_ops_ring(struct openssl_qp *qp,
 static int
 openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct openssl_qp *qp = NULL;
 
@@ -740,7 +740,8 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->stats, 0, sizeof(qp->stats));
 
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_private.h b/drivers/crypto/openssl/rte_openssl_pmd_private.h
index a8f2c8482..43ac3813d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_private.h
+++ b/drivers/crypto/openssl/rte_openssl_pmd_private.h
@@ -64,6 +64,8 @@ struct openssl_qp {
 	/**< Ring for placing process packets */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index c3f700406..31ccab32e 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -127,7 +127,7 @@ static int qat_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 
 static int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	const struct rte_cryptodev_qp_conf *qp_conf,
-	int socket_id, struct rte_mempool *session_pool __rte_unused)
+	int socket_id)
 {
 	struct qat_qp *qp;
 	int ret = 0;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 939105aa8..cf70218b7 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -390,8 +390,7 @@ scheduler_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 /** Setup a queue pair */
 static int
 scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
-	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-	struct rte_mempool *session_pool)
+	const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
 	struct scheduler_qp_ctx *qp_ctx;
@@ -419,7 +418,7 @@ scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		 * must be big enough for all the drivers used.
 		 */
 		ret = rte_cryptodev_queue_pair_setup(slave_id, qp_id,
-				qp_conf, socket_id, session_pool);
+				qp_conf, socket_id);
 		if (ret < 0)
 			return ret;
 	}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index a17536b77..7d131f780 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -147,7 +147,8 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct snow3g_session *)_sess_private_data;
@@ -155,7 +156,7 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(snow3g_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -340,7 +341,7 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, session);
+			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
index a367ee9a0..d2125233f 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
@@ -198,7 +198,7 @@ snow3g_pmd_qp_create_processed_ops_ring(struct snow3g_qp *qp,
 static int
 snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
 
@@ -223,7 +223,8 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
index b7807b621..df5c6092b 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h
@@ -36,6 +36,8 @@ struct snow3g_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[SNOW3G_DIGEST_LENGTH];
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 568b5a406..4bae3b865 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -36,8 +36,7 @@ static void virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev);
 static int virtio_crypto_qp_setup(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool);
+		int socket_id);
 static int virtio_crypto_qp_release(struct rte_cryptodev *dev,
 		uint16_t queue_pair_id);
 static void virtio_crypto_dev_free_mbufs(struct rte_cryptodev *dev);
@@ -585,8 +584,7 @@ virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev)
 static int
 virtio_crypto_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id,
-		struct rte_mempool *session_pool __rte_unused)
+		int socket_id)
 {
 	int ret;
 	struct virtqueue *vq;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 313f4590b..997c2092f 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -144,7 +144,8 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+		if (rte_mempool_get(qp->sess_mp_priv,
+				(void **)&_sess_private_data))
 			return NULL;
 
 		sess = (struct zuc_session *)_sess_private_data;
@@ -152,7 +153,7 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 		if (unlikely(zuc_set_session_parameters(sess,
 				op->sym->xform) != 0)) {
 			rte_mempool_put(qp->sess_mp, _sess);
-			rte_mempool_put(qp->sess_mp, _sess_private_data);
+			rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
@@ -327,7 +328,7 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
 					rte_cryptodev_sym_get_header_session_size());
-			rte_mempool_put(qp->sess_mp, sessions[i]);
+			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
 		}
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
index 04d45e449..1b88947eb 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
@@ -198,7 +198,7 @@ zuc_pmd_qp_create_processed_ops_ring(struct zuc_qp *qp,
 static int
 zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool)
+		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
 
@@ -223,7 +223,8 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
-	qp->sess_mp = session_pool;
+	qp->sess_mp = qp_conf->mp_session;
+	qp->sess_mp_priv = qp_conf->mp_session_private;
 
 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
 
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_private.h b/drivers/crypto/zuc/rte_zuc_pmd_private.h
index 5e5906ddb..aa73c0016 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_private.h
+++ b/drivers/crypto/zuc/rte_zuc_pmd_private.h
@@ -36,6 +36,8 @@ struct zuc_qp {
 	/**< Ring for placing processed ops */
 	struct rte_mempool *sess_mp;
 	/**< Session Mempool */
+	struct rte_mempool *sess_mp_priv;
+	/**< Session Private Data Mempool */
 	struct rte_cryptodev_stats qp_stats;
 	/**< Queue pair statistics */
 	uint8_t temp_digest[ZUC_DIGEST_LENGTH];
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index 1480f6dd5..f031d8803 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -101,7 +101,7 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e7559c633..384b7a240 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -39,7 +39,7 @@ static int
 cryptodev_fips_validate_app_int(void)
 {
 	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
-	struct rte_cryptodev_qp_conf qp_conf = {128};
+	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
 	int ret;
 
 	ret = rte_cryptodev_configure(env.dev_id, &conf);
@@ -52,7 +52,7 @@ cryptodev_fips_validate_app_int(void)
 		return ret;
 
 	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
-			rte_socket_id(), env.mpool);
+			rte_socket_id());
 	if (ret < 0)
 		return ret;
 
diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c
index c4ba72bec..b365810de 100644
--- a/examples/ip_pipeline/cryptodev.c
+++ b/examples/ip_pipeline/cryptodev.c
@@ -93,7 +93,7 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	queue_conf.nb_descriptors = params->queue_size;
 	for (i = 0; i < params->n_queues; i++) {
 		status = rte_cryptodev_queue_pair_setup(dev_id, i,
-				&queue_conf, socket_id, NULL);
+				&queue_conf, socket_id);
 		if (status < 0)
 			return NULL;
 	}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 1bc0b5b50..a0ff8f7f7 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1493,10 +1493,13 @@ cryptodevs_init(void)
 					cdev_id);
 
 		qp_conf.nb_descriptors = CDEV_QUEUE_DESC;
+		qp_conf.mp_session =
+				socket_ctx[dev_conf.socket_id].session_pool;
+		qp_conf.mp_session_private =
+				socket_ctx[dev_conf.socket_id].session_pool;
 		for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
 			if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
-					&qp_conf, dev_conf.socket_id,
-					socket_ctx[dev_conf.socket_id].session_pool))
+					&qp_conf, dev_conf.socket_id))
 				rte_panic("Failed to setup queue %u for "
 						"cdev_id %u\n",	0, cdev_id);
 
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index f12fd266e..1df7ba743 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2443,9 +2443,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
+		qp_conf.mp_session = session_pool_socket[socket_id];
+		qp_conf.mp_session_private = session_pool_socket[socket_id];
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
-				socket_id, session_pool_socket[socket_id]);
+				socket_id);
 		if (retval < 0) {
 			printf("Failed to setup queue pair %u on cryptodev %u",
 					0, cdev_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 3deb5263f..cb30f84c0 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -463,7 +463,7 @@ free_resource(void)
 int
 main(int argc, char *argv[])
 {
-	struct rte_cryptodev_qp_conf qp_conf = {NB_CRYPTO_DESCRIPTORS};
+	struct rte_cryptodev_qp_conf qp_conf;
 	struct rte_cryptodev_config config;
 	struct rte_cryptodev_info dev_info;
 	char name[128];
@@ -551,11 +551,14 @@ main(int argc, char *argv[])
 
 		options.infos[i] = info;
 
+		qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
+		qp_conf.mp_session = info->sess_pool;
+		qp_conf.mp_session_private = info->sess_pool;
+
 		for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
 			ret = rte_cryptodev_queue_pair_setup(info->cid, j,
 					&qp_conf, rte_lcore_to_socket_id(
-							lo->lcore_id),
-					info->sess_pool);
+							lo->lcore_id));
 			if (ret < 0) {
 				RTE_LOG(ERR, USER1, "Failed to configure qp\n");
 				goto error_exit;
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index a8f94c097..b734d144a 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2015 Intel Corporation
+# Copyright(c) 2015-2018 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
@@ -7,7 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_cryptodev.a
 
 # library version
-LIBABIVER := 5
+LIBABIVER := 6
 
 # build flags
 CFLAGS += -O3
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a52eaaa45..4929d0451 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -941,8 +941,7 @@ rte_cryptodev_close(uint8_t dev_id)
 
 int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool)
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 
 {
 	struct rte_cryptodev *dev;
@@ -958,6 +957,17 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EINVAL;
 	}
 
+	if (!qp_conf) {
+		CDEV_LOG_ERR("qp_conf cannot be NULL\n");
+		return -EINVAL;
+	}
+
+	if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
+			(!qp_conf->mp_session && qp_conf->mp_session_private)) {
+		CDEV_LOG_ERR("Invalid mempools\n");
+		return -EINVAL;
+	}
+
 	if (dev->data->dev_started) {
 		CDEV_LOG_ERR(
 		    "device %d must be stopped to allow configuration", dev_id);
@@ -967,7 +977,7 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
-			socket_id, session_pool);
+			socket_id);
 }
 
 
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 4099823f1..f9e7507da 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -495,6 +495,10 @@ enum rte_cryptodev_event_type {
 /** Crypto device queue pair configuration structure. */
 struct rte_cryptodev_qp_conf {
 	uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
+	struct rte_mempool *mp_session;
+	/**< The mempool for creating session in sessionless mode */
+	struct rte_mempool *mp_session_private;
+	/**< The mempool for creating sess private data in sessionless mode */
 };
 
 /**
@@ -689,8 +693,7 @@ rte_cryptodev_close(uint8_t dev_id);
  */
 extern int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
-		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
-		struct rte_mempool *session_pool);
+		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
 
 /**
  * Get the number of queue pairs on a specific crypto device
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 1b6cafd17..f15c9af30 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -188,13 +188,12 @@ typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev,
  * @param	qp_id		Queue Pair Index
  * @param	qp_conf		Queue configuration structure
  * @param	socket_id	Socket Index
- * @param	session_pool	Pointer to device session mempool
  *
  * @return	Returns 0 on success.
  */
 typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev,
 		uint16_t qp_id,	const struct rte_cryptodev_qp_conf *qp_conf,
-		int socket_id, struct rte_mempool *session_pool);
+		int socket_id);
 
 /**
  * Release memory resources allocated by given queue pair.
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 84065eb49..aac0b1f0b 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -461,12 +461,13 @@ testsuite_setup(void)
 			dev_id, ts_params->conf.nb_queue_pairs);
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, dev_id);
 	}
@@ -519,8 +520,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
@@ -709,13 +709,14 @@ test_queue_pair_descriptor_setup(void)
 	 * freed so are re-used if ring is released and re-created.
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
+	qp_conf.mp_session = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights "
 				"%u on qp %u on cryptodev %u",
@@ -729,8 +730,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -744,8 +744,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for "
 				"rte_cryptodev_queue_pair_setup: num_inflights"
 				" %u on qp %u on cryptodev %u",
@@ -760,8 +759,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -776,8 +774,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -791,8 +788,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Failed test for"
 				" rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -807,8 +803,7 @@ test_queue_pair_descriptor_setup(void)
 		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 				ts_params->valid_devs[0], qp_id, &qp_conf,
 				rte_cryptodev_socket_id(
-						ts_params->valid_devs[0]),
-				ts_params->session_mpool),
+						ts_params->valid_devs[0])),
 				"Unexpectedly passed test for "
 				"rte_cryptodev_queue_pair_setup:"
 				"num_inflights %u on qp %u on cryptodev %u",
@@ -824,8 +819,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
@@ -835,8 +829,7 @@ test_queue_pair_descriptor_setup(void)
 	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0],
 			qp_id, &qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed test for rte_cryptodev_queue_pair_setup:"
 			"invalid qp %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c
index a899f9973..0f6fc5767 100644
--- a/test/test/test_cryptodev_asym.c
+++ b/test/test/test_cryptodev_asym.c
@@ -383,11 +383,12 @@ testsuite_setup(void)
 
 	/* configure qp */
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			dev_id, qp_id, &ts_params->qp_conf,
-			rte_cryptodev_socket_id(dev_id),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(dev_id)),
 			"Failed to setup queue pair %u on cryptodev %u ASYM",
 			qp_id, dev_id);
 	}
@@ -449,8 +450,7 @@ ut_setup(void)
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
-			rte_cryptodev_socket_id(ts_params->valid_devs[0]),
-			ts_params->session_mpool),
+			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
 			"Failed to setup queue pair %u on cryptodev %u",
 			qp_id, ts_params->valid_devs[0]);
 	}
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index de258c346..54717870e 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -546,11 +546,12 @@ configure_cryptodev(void)
 			TEST_CDEV_ID, conf.nb_queue_pairs);
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+	qp_conf.mp_session = params.session_mpool;
+	qp_conf.mp_session_private = params.session_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
-			rte_cryptodev_socket_id(TEST_CDEV_ID),
-			params.session_mpool),
+			rte_cryptodev_socket_id(TEST_CDEV_ID)),
 			"Failed to setup queue pair %u on cryptodev %u\n",
 			TEST_CDEV_QP_ID, TEST_CDEV_ID);
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 02/12] cryptodev: add sym session mempool create
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
  2019-01-09 22:55       ` [dpdk-dev] [PATCH v4 01/12] cryptodev: change queue pair configure structure Fan Zhang
@ 2019-01-09 22:55       ` Fan Zhang
  2019-01-10 11:22         ` De Lara Guarch, Pablo
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
                         ` (10 subsequent siblings)
  12 siblings, 1 reply; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:55 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch adds a new API "rte_cryptodev_sym_session_pool_create()" to
cryptodev library. All applications are required to use this API to
create sym session mempool as it adds private data and nb_drivers
information to the mempool private data.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 doc/guides/prog_guide/cryptodev_lib.rst        | 28 ++++++++++-----
 doc/guides/rel_notes/release_19_02.rst         |  5 +++
 lib/librte_cryptodev/rte_cryptodev.c           | 50 ++++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev.h           | 31 ++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev_version.map |  7 ++++
 5 files changed, 112 insertions(+), 9 deletions(-)

diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst
index 050a58dc4..366508618 100644
--- a/doc/guides/prog_guide/cryptodev_lib.rst
+++ b/doc/guides/prog_guide/cryptodev_lib.rst
@@ -455,13 +455,15 @@ Crypto workloads.
 
 .. figure:: img/cryptodev_sym_sess.*
 
-The Crypto device framework provides APIs to allocate and initialize sessions
-for crypto devices, where sessions are mempool objects.
+The Crypto device framework provides APIs to create session mempool and allocate
+and initialize sessions for crypto devices, where sessions are mempool objects.
 It is the application's responsibility to create and manage the session mempools.
 This approach allows for different scenarios such as having a single session
 mempool for all crypto devices (where the mempool object size is big
 enough to hold the private session of any crypto device), as well as having
-multiple session mempools of different sizes for better memory usage.
+multiple session mempools of different sizes for better memory usage. However,
+the application is required to use ``rte_cryptodev_sym_session_pool_create()``
+to create symmetric session mempool.
 
 An application can use ``rte_cryptodev_sym_get_private_session_size()`` to
 get the private session size of given crypto device. This function would allow
@@ -623,7 +625,8 @@ using one of the crypto PMDs available in DPDK.
     #define IV_OFFSET            (sizeof(struct rte_crypto_op) + \
                                  sizeof(struct rte_crypto_sym_op))
 
-    struct rte_mempool *mbuf_pool, *crypto_op_pool, *session_pool;
+    struct rte_mempool *mbuf_pool, *crypto_op_pool;
+    struct *session_pool, *session_priv_pool;
     unsigned int session_size;
     int ret;
 
@@ -673,13 +676,20 @@ using one of the crypto PMDs available in DPDK.
     /* Get private session data size. */
     session_size = rte_cryptodev_sym_get_private_session_size(cdev_id);
 
+    /* Create session mempool for the session header. */
+    session_pool = rte_cryptodev_sym_session_pool_create("session_pool",
+                                    MAX_SESSIONS,
+                                    0,
+                                    POOL_CACHE_SIZE,
+                                    0,
+                                    socket_id);
+
     /*
-     * Create session mempool, with two objects per session,
-     * one for the session header and another one for the
+     * Create session private data mempool for the
      * private session data for the crypto device.
      */
-    session_pool = rte_mempool_create("session_pool",
-                                    MAX_SESSIONS * 2,
+    session_priv_pool = rte_mempool_create("session_pool",
+                                    MAX_SESSIONS,
                                     session_size,
                                     POOL_CACHE_SIZE,
                                     0, NULL, NULL, NULL,
@@ -731,7 +741,7 @@ using one of the crypto PMDs available in DPDK.
         rte_exit(EXIT_FAILURE, "Session could not be created\n");
 
     if (rte_cryptodev_sym_session_init(cdev_id, session,
-                    &cipher_xform, session_pool) < 0)
+                    &cipher_xform, session_priv_pool) < 0)
         rte_exit(EXIT_FAILURE, "Session could not be initialized "
                     "for the crypto device\n");
 
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 75128f8f2..0b3c30c80 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -167,6 +167,11 @@ API Changes
 * cryptodev: as shown in the the 18.11 deprecation notice, the last parameter
   of ``rte_cryptodev_queue_pair_setup()`` is removed.
 
+* cryptodev: a new function ``rte_cryptodev_sym_session_pool_create()`` is
+  introduced. This function is used to create symmetric session mempool safely
+  and all crypto applications are required to use this function to create
+  symmetric session mempool from now on.
+
 
 ABI Changes
 -----------
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 4929d0451..5b1449d14 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -189,6 +189,16 @@ const char *rte_crypto_asym_op_strings[] = {
 	[RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE] = "sharedsecret_compute",
 };
 
+/**
+ * The private data structure stored in the session mempool private data.
+ */
+struct rte_cryptodev_sym_session_pool_private_data {
+	uint16_t nb_drivers;
+	/**< number of elements in sess_data array */
+	uint16_t user_data_sz;
+	/**< session user data will be placed after sess_data */
+};
+
 int
 rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum,
 		const char *algo_string)
@@ -1223,6 +1233,46 @@ rte_cryptodev_asym_session_init(uint8_t dev_id,
 	return 0;
 }
 
+struct rte_mempool *
+rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
+	uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
+	int socket_id)
+{
+	struct rte_mempool *mp;
+	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+	uint32_t obj_sz;
+
+	obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
+	if (obj_sz > elt_size)
+		CDEV_LOG_INFO("elt_size %u is expanded to %u\n", elt_size,
+				obj_sz);
+	else
+		obj_sz = elt_size;
+
+	mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
+			(uint32_t)(sizeof(*pool_priv)),
+			NULL, NULL, NULL, NULL,
+			socket_id, 0);
+	if (mp == NULL) {
+		CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d\n",
+			__func__, name, rte_errno);
+		return NULL;
+	}
+
+	pool_priv = rte_mempool_get_priv(mp);
+	if (!pool_priv) {
+		CDEV_LOG_ERR("%s(name=%s) failed to get private data\n",
+			__func__, name);
+		rte_mempool_free(mp);
+		return NULL;
+	}
+
+	pool_priv->nb_drivers = nb_drivers;
+	pool_priv->user_data_sz = user_data_size;
+
+	return mp;
+}
+
 struct rte_cryptodev_sym_session *
 rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 {
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index f9e7507da..265f02cbe 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -968,6 +968,37 @@ struct rte_cryptodev_asym_session {
 };
 
 /**
+ * Create a symmetric session mempool.
+ *
+ * @param name
+ *   The unique mempool name.
+ * @param nb_elts
+ *   The number of elements in the mempool.
+ * @param elt_size
+ *   The size of the element. This value will be ignored if it is smaller than
+ *   the minimum session header size required for the system. For the user who
+ *   want to use the same mempool for sym session and session private data it
+ *   can be the maximum value of all existing devices' private data and session
+ *   header sizes.
+ * @param cache_size
+ *   The number of per-lcore cache elements
+ * @param priv_size
+ *   The private data size of each session.
+ * @param socket_id
+ *   The *socket_id* argument is the socket identifier in the case of
+ *   NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA
+ *   constraint for the reserved zone.
+ *
+ * @return
+ *  - On success return size of the session
+ *  - On failure returns 0
+ */
+struct rte_mempool *
+rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
+	uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
+	int socket_id);
+
+/**
  * Create symmetric crypto session header (generic with no private data)
  *
  * @param   mempool    Symmetric session mempool to allocate session
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a695b61dc..5b6b679f5 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -88,6 +88,13 @@ DPDK_18.05 {
 
 } DPDK_17.11;
 
+DPDK_19.02 {
+	global:
+
+	rte_cryptodev_sym_session_pool_create;
+
+} DPDK_18.05;
+
 EXPERIMENTAL {
 	global:
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 03/12] app/test-crypto-perf: use separate session mempools
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
  2019-01-09 22:55       ` [dpdk-dev] [PATCH v4 01/12] cryptodev: change queue pair configure structure Fan Zhang
  2019-01-09 22:55       ` [dpdk-dev] [PATCH v4 02/12] cryptodev: add sym session mempool create Fan Zhang
@ 2019-01-09 22:56       ` Fan Zhang
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 04/12] net/softnic: " Fan Zhang
                         ` (9 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:56 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch uses the two session mempool approach to crypto perf
application. One mempool is for session header objects, and the other
is for session private data.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 app/test-crypto-perf/cperf.h                     |   1 +
 app/test-crypto-perf/cperf_ops.c                 |  11 +--
 app/test-crypto-perf/cperf_ops.h                 |   2 +-
 app/test-crypto-perf/cperf_test_latency.c        |   5 +-
 app/test-crypto-perf/cperf_test_latency.h        |   1 +
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c |   5 +-
 app/test-crypto-perf/cperf_test_pmd_cyclecount.h |   1 +
 app/test-crypto-perf/cperf_test_throughput.c     |   5 +-
 app/test-crypto-perf/cperf_test_throughput.h     |   1 +
 app/test-crypto-perf/cperf_test_verify.c         |   5 +-
 app/test-crypto-perf/cperf_test_verify.h         |   1 +
 app/test-crypto-perf/main.c                      | 103 +++++++++++++++--------
 12 files changed, 93 insertions(+), 48 deletions(-)

diff --git a/app/test-crypto-perf/cperf.h b/app/test-crypto-perf/cperf.h
index db58228dc..2b0aad095 100644
--- a/app/test-crypto-perf/cperf.h
+++ b/app/test-crypto-perf/cperf.h
@@ -15,6 +15,7 @@ struct cperf_op_fns;
 
 typedef void  *(*cperf_constructor_t)(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 44808f50a..f59568b80 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -469,6 +469,7 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
 
 static struct rte_cryptodev_sym_session *
 cperf_create_session(struct rte_mempool *sess_mp,
+	struct rte_mempool *priv_mp,
 	uint8_t dev_id,
 	const struct cperf_options *options,
 	const struct cperf_test_vector *test_vector,
@@ -505,7 +506,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 *  auth only
 	 */
@@ -533,7 +534,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		/* create crypto session */
 		rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
-				sess_mp);
+				priv_mp);
 	/*
 	 * cipher and auth
 	 */
@@ -592,12 +593,12 @@ cperf_create_session(struct rte_mempool *sess_mp,
 			cipher_xform.next = &auth_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &cipher_xform, sess_mp);
+					sess, &cipher_xform, priv_mp);
 		} else { /* auth then cipher */
 			auth_xform.next = &cipher_xform;
 			/* create crypto session */
 			rte_cryptodev_sym_session_init(dev_id,
-					sess, &auth_xform, sess_mp);
+					sess, &auth_xform, priv_mp);
 		}
 	} else { /* options->op_type == CPERF_AEAD */
 		aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -618,7 +619,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 
 		/* Create crypto session */
 		rte_cryptodev_sym_session_init(dev_id,
-					sess, &aead_xform, sess_mp);
+					sess, &aead_xform, priv_mp);
 	}
 
 	return sess;
diff --git a/app/test-crypto-perf/cperf_ops.h b/app/test-crypto-perf/cperf_ops.h
index 29e109f2a..ff125d12c 100644
--- a/app/test-crypto-perf/cperf_ops.h
+++ b/app/test-crypto-perf/cperf_ops.h
@@ -13,7 +13,7 @@
 
 
 typedef struct rte_cryptodev_sym_session *(*cperf_sessions_create_t)(
-		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_mp, struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		uint16_t iv_offset);
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index c9c98dc50..0fc3a6680 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -62,6 +62,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx)
 
 void *
 cperf_latency_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -86,8 +87,8 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp,
 		sizeof(struct rte_crypto_sym_op) +
 		sizeof(struct cperf_op_result *);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-			iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_latency.h b/app/test-crypto-perf/cperf_test_latency.h
index d3fc3218d..ed5b0a07b 100644
--- a/app/test-crypto-perf/cperf_test_latency.h
+++ b/app/test-crypto-perf/cperf_test_latency.h
@@ -17,6 +17,7 @@
 void *
 cperf_latency_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index c8d16db6d..92af5ec90 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -80,6 +80,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
 
 void *
 cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -106,8 +107,8 @@ cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 			sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(
-			sess_mp, dev_id, options, test_vector, iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.h b/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
index beb441991..3084038a1 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.h
@@ -18,6 +18,7 @@
 void *
 cperf_pmd_cyclecount_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index 8766d6e9b..2767f4ea8 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -47,6 +47,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
 
 void *
 cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -69,8 +70,8 @@ cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 		sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-					iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_throughput.h b/app/test-crypto-perf/cperf_test_throughput.h
index 439ec8e55..91e1a4b70 100644
--- a/app/test-crypto-perf/cperf_test_throughput.h
+++ b/app/test-crypto-perf/cperf_test_throughput.h
@@ -18,6 +18,7 @@
 void *
 cperf_throughput_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 9134b921e..0497cf9a1 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -51,6 +51,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx)
 
 void *
 cperf_verify_test_constructor(struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
@@ -73,8 +74,8 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,
 	uint16_t iv_offset = sizeof(struct rte_crypto_op) +
 		sizeof(struct rte_crypto_sym_op);
 
-	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector,
-			iv_offset);
+	ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,
+			test_vector, iv_offset);
 	if (ctx->sess == NULL)
 		goto err;
 
diff --git a/app/test-crypto-perf/cperf_test_verify.h b/app/test-crypto-perf/cperf_test_verify.h
index 9f70ad87b..ac2192ba9 100644
--- a/app/test-crypto-perf/cperf_test_verify.h
+++ b/app/test-crypto-perf/cperf_test_verify.h
@@ -18,6 +18,7 @@
 void *
 cperf_verify_test_constructor(
 		struct rte_mempool *sess_mp,
+		struct rte_mempool *sess_priv_mp,
 		uint8_t dev_id,
 		uint16_t qp_id,
 		const struct cperf_options *options,
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 38a2e429f..175c639fb 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -21,6 +21,10 @@
 #include "cperf_test_verify.h"
 #include "cperf_test_pmd_cyclecount.h"
 
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 const char *cperf_test_type_strs[] = {
 	[CPERF_TEST_TYPE_THROUGHPUT] = "throughput",
@@ -61,8 +65,58 @@ const struct cperf_test cperf_testmap[] = {
 };
 
 static int
-cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
-			struct rte_mempool *session_pool_socket[])
+fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
+		uint32_t nb_sessions)
+{
+	char mp_name[RTE_MEMPOOL_NAMESIZE];
+	struct rte_mempool *sess_mp;
+
+	if (session_pool_socket[socket_id].priv_mp == NULL) {
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"priv_sess_mp_%u", socket_id);
+
+		sess_mp = rte_mempool_create(mp_name,
+					nb_sessions,
+					session_priv_size,
+					0, 0, NULL, NULL, NULL,
+					NULL, socket_id,
+					0);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].priv_mp = sess_mp;
+	}
+
+	if (session_pool_socket[socket_id].sess_mp == NULL) {
+
+		snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+			"sess_mp_%u", socket_id);
+
+		sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
+					nb_sessions, 0, 0, 0, socket_id);
+
+		if (sess_mp == NULL) {
+			printf("Cannot create pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+			return -ENOMEM;
+		}
+
+		printf("Allocated pool \"%s\" on socket %d\n",
+			mp_name, socket_id);
+		session_pool_socket[socket_id].sess_mp = sess_mp;
+	}
+
+	return 0;
+}
+
+static int
+cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 {
 	uint8_t enabled_cdev_count = 0, nb_lcores, cdev_id;
 	uint32_t sessions_needed = 0;
@@ -177,11 +231,11 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 				rte_cryptodev_scheduler_slaves_get(cdev_id,
 								NULL);
 
-			sessions_needed = 2 * enabled_cdev_count *
+			sessions_needed = enabled_cdev_count *
 				opts->nb_qps * nb_slaves;
 #endif
 		} else
-			sessions_needed = 2 * enabled_cdev_count *
+			sessions_needed = enabled_cdev_count *
 						opts->nb_qps;
 
 		/*
@@ -194,32 +248,15 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
 				"%u sessions\n", opts->nb_qps);
 			return -ENOTSUP;
 		}
-		if (session_pool_socket[socket_id] == NULL) {
-			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
-
-			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
-			sess_mp = rte_mempool_create(mp_name,
-						sessions_needed,
-						max_sess_size,
-						0,
-						0, NULL, NULL, NULL,
-						NULL, socket_id,
-						0);
-
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
-					socket_id);
-				return -ENOMEM;
-			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
-		}
+		ret = fill_session_pool_socket(socket_id, max_sess_size,
+				sessions_needed);
+		if (ret < 0)
+			return ret;
 
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
@@ -453,10 +490,7 @@ main(int argc, char **argv)
 	struct cperf_options opts = {0};
 	struct cperf_test_vector *t_vec = NULL;
 	struct cperf_op_fns op_fns;
-
 	void *ctx[RTE_MAX_LCORE] = { };
-	struct rte_mempool *session_pool_socket[RTE_MAX_NUMA_NODES] = { 0 };
-
 	int nb_cryptodevs = 0;
 	uint16_t total_nb_qps = 0;
 	uint8_t cdev_id, i;
@@ -489,8 +523,7 @@ main(int argc, char **argv)
 		goto err;
 	}
 
-	nb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs,
-			session_pool_socket);
+	nb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs);
 
 	if (!opts.silent)
 		cperf_options_dump(&opts);
@@ -558,7 +591,9 @@ main(int argc, char **argv)
 		uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
 
 		ctx[i] = cperf_testmap[opts.test].constructor(
-				session_pool_socket[socket_id], cdev_id, qp_id,
+				session_pool_socket[socket_id].sess_mp,
+				session_pool_socket[socket_id].priv_mp,
+				cdev_id, qp_id,
 				&opts, t_vec, &op_fns);
 		if (ctx[i] == NULL) {
 			RTE_LOG(ERR, USER1, "Test run constructor failed\n");
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 04/12] net/softnic: use separate session mempools
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
                         ` (2 preceding siblings ...)
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
@ 2019-01-09 22:56       ` Fan Zhang
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 05/12] examples: " Fan Zhang
                         ` (8 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:56 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch uses the two session mempool approach to softnic PMD.
One mempool is for session header objects, and the other is for
session private data.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_cli.c       | 52 ++++++++++++++++++++++++-
 drivers/net/softnic/rte_eth_softnic_cryptodev.c | 50 +++++++++++++++++++++++-
 drivers/net/softnic/rte_eth_softnic_internals.h |  3 ++
 3 files changed, 102 insertions(+), 3 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 57b623377..76136c2e2 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1092,7 +1092,7 @@ cmd_tap(struct pmd_internals *softnic,
 
 /**
  * cryptodev <tap_name> dev <device_name> | dev_id <device_id>
- * queue <n_queues> <queue_size>
+ * queue <n_queues> <queue_size> max_sessions <n_sessions>
  **/
 
 static void
@@ -1106,7 +1106,7 @@ cmd_cryptodev(struct pmd_internals *softnic,
 	char *name;
 
 	memset(&params, 0, sizeof(params));
-	if (n_tokens != 7) {
+	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
 	}
@@ -1145,6 +1145,19 @@ cmd_cryptodev(struct pmd_internals *softnic,
 		return;
 	}
 
+	if (strcmp(tokens[7], "max_sessions")) {
+		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
+			"4");
+		return;
+	}
+
+	if (softnic_parser_read_uint32(&params.session_pool_size, tokens[8])
+			< 0) {
+		snprintf(out, out_size,	MSG_ARG_INVALID,
+			"q");
+		return;
+	}
+
 	if (softnic_cryptodev_create(softnic, name, &params) == NULL) {
 		snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
 		return;
@@ -1739,6 +1752,41 @@ cmd_table_action_profile(struct pmd_internals *softnic,
 		t0 += 1;
 	} /* decap */
 
+	if (t0 < n_tokens && (strcmp(tokens[t0], "sym_crypto") == 0)) {
+		struct softnic_cryptodev *cryptodev;
+
+		if (n_tokens < t0 + 5 ||
+				strcmp(tokens[t0 + 1], "dev") ||
+				strcmp(tokens[t0 + 3], "offset")) {
+			snprintf(out, out_size, MSG_ARG_MISMATCH,
+				"table action profile sym_crypto");
+			return;
+		}
+
+		cryptodev = softnic_cryptodev_find(softnic, tokens[t0 + 2]);
+		if (cryptodev == NULL) {
+			snprintf(out, out_size, MSG_ARG_INVALID,
+				"table action profile sym_crypto");
+			return;
+		}
+
+		p.sym_crypto.cryptodev_id = cryptodev->dev_id;
+
+		if (softnic_parser_read_uint32(&p.sym_crypto.op_offset,
+				tokens[t0 + 4]) != 0) {
+			snprintf(out, out_size, MSG_ARG_INVALID,
+					"table action profile sym_crypto");
+			return;
+		}
+
+		p.sym_crypto.mp_create = cryptodev->mp_create;
+		p.sym_crypto.mp_init = cryptodev->mp_init;
+
+		p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO;
+
+		t0 += 5;
+	} /* sym_crypto */
+
 	if (t0 < n_tokens) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index f031d8803..18a52ed05 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -11,6 +11,8 @@
 
 #include "rte_eth_softnic_internals.h"
 
+#define SOFTNIC_CRYPTO_SESSION_CACHE_SIZE 128
+
 int
 softnic_cryptodev_init(struct pmd_internals *p)
 {
@@ -61,13 +63,16 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	struct softnic_cryptodev *cryptodev;
 	uint32_t dev_id, i;
 	uint32_t socket_id;
+	uint32_t cache_size;
+	char mp_name[NAME_SIZE];
 	int status;
 
 	/* Check input params */
 	if ((name == NULL) ||
 		softnic_cryptodev_find(p, name) ||
 		(params->n_queues == 0) ||
-		(params->queue_size == 0))
+		(params->queue_size == 0) ||
+		(params->session_pool_size == 0))
 		return NULL;
 
 	if (params->dev_name) {
@@ -83,6 +88,12 @@ softnic_cryptodev_create(struct pmd_internals *p,
 		dev_id = params->dev_id;
 	}
 
+	cache_size = (params->session_pool_size / 2 <
+			SOFTNIC_CRYPTO_SESSION_CACHE_SIZE) ?
+					(params->session_pool_size / 2) :
+					SOFTNIC_CRYPTO_SESSION_CACHE_SIZE;
+
+
 	socket_id = rte_cryptodev_socket_id(dev_id);
 	rte_cryptodev_info_get(dev_id, &dev_info);
 
@@ -119,7 +130,44 @@ softnic_cryptodev_create(struct pmd_internals *p,
 	cryptodev->dev_id = dev_id;
 	cryptodev->n_queues = params->n_queues;
 
+	snprintf(mp_name, NAME_SIZE, "%s_mp%u", name, dev_id);
+	cryptodev->mp_create = rte_cryptodev_sym_session_pool_create(
+			mp_name,
+			params->session_pool_size,
+			0,
+			cache_size,
+			0,
+			socket_id);
+	if (!cryptodev->mp_create)
+		goto error_exit;
+
+	snprintf(mp_name, NAME_SIZE, "%s_priv_mp%u", name, dev_id);
+	cryptodev->mp_init = rte_mempool_create(
+			mp_name,
+			params->session_pool_size,
+			rte_cryptodev_sym_get_private_session_size(dev_id),
+			cache_size,
+			0,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			socket_id,
+			0);
+	if (!cryptodev->mp_init)
+		goto error_exit;
+
 	TAILQ_INSERT_TAIL(&p->cryptodev_list, cryptodev, node);
 
 	return cryptodev;
+
+error_exit:
+	if (cryptodev->mp_create)
+		rte_mempool_free(cryptodev->mp_create);
+	if (cryptodev->mp_init)
+		rte_mempool_free(cryptodev->mp_init);
+
+	free(cryptodev);
+
+	return NULL;
 }
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h
index 31698b9f0..685058be6 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -286,6 +286,7 @@ struct softnic_cryptodev_params {
 	uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */
 	uint32_t n_queues;
 	uint32_t queue_size;
+	uint32_t session_pool_size;
 };
 
 struct softnic_cryptodev {
@@ -293,6 +294,8 @@ struct softnic_cryptodev {
 	char name[NAME_SIZE];
 	uint16_t dev_id;
 	uint32_t n_queues;
+	struct rte_mempool *mp_create;
+	struct rte_mempool *mp_init;
 };
 
 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 05/12] examples: use separate session mempools
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
                         ` (3 preceding siblings ...)
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 04/12] net/softnic: " Fan Zhang
@ 2019-01-09 22:56       ` Fan Zhang
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 06/12] vhost/crypto: " Fan Zhang
                         ` (7 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:56 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch uses the two session mempool approach to all cryptodev
sample applications. One mempool is for session header objects, and
the other is for session private data.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 examples/fips_validation/main.c               | 34 +++++++++++++-
 examples/ip_pipeline/cli.c                    | 49 +++++++++-----------
 examples/ip_pipeline/cryptodev.c              | 49 +++++++++++++++++++-
 examples/ip_pipeline/cryptodev.h              |  3 ++
 examples/ip_pipeline/examples/flow_crypto.cli |  9 ++--
 examples/ipsec-secgw/ipsec-secgw.c            | 48 +++++++++++++------
 examples/ipsec-secgw/ipsec.c                  |  2 +-
 examples/ipsec-secgw/ipsec.h                  |  2 +
 examples/l2fwd-crypto/main.c                  | 66 +++++++++++++++++----------
 examples/vhost_crypto/main.c                  | 13 +++++-
 10 files changed, 200 insertions(+), 75 deletions(-)

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 384b7a240..bd9aa9018 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -29,6 +29,8 @@ struct cryptodev_fips_validate_env {
 	uint32_t is_path_folder;
 	uint32_t dev_id;
 	struct rte_mempool *mpool;
+	struct rte_mempool *sess_mpool;
+	struct rte_mempool *sess_priv_mpool;
 	struct rte_mempool *op_pool;
 	struct rte_mbuf *mbuf;
 	struct rte_crypto_op *op;
@@ -40,6 +42,8 @@ cryptodev_fips_validate_app_int(void)
 {
 	struct rte_cryptodev_config conf = {rte_socket_id(), 1};
 	struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+	uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
+			env.dev_id);
 	int ret;
 
 	ret = rte_cryptodev_configure(env.dev_id, &conf);
@@ -58,6 +62,17 @@ cryptodev_fips_validate_app_int(void)
 
 	ret = -ENOMEM;
 
+	env.sess_mpool = rte_cryptodev_sym_session_pool_create(
+			"FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+	if (!env.sess_mpool)
+		goto error_exit;
+
+	env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
+			16, sess_sz, 0, 0, NULL, NULL, NULL,
+			NULL, rte_socket_id(), 0);
+	if (!env.sess_priv_mpool)
+		goto error_exit;
+
 	env.op_pool = rte_crypto_op_pool_create(
 			"FIPS_OP_POOL",
 			RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -75,10 +90,23 @@ cryptodev_fips_validate_app_int(void)
 	if (!env.op)
 		goto error_exit;
 
+	qp_conf.mp_session = env.sess_mpool;
+	qp_conf.mp_session_private = env.sess_priv_mpool;
+
+	ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
+			rte_socket_id());
+	if (ret < 0)
+		goto error_exit;
+
 	return 0;
 
 error_exit:
+
 	rte_mempool_free(env.mpool);
+	if (env.sess_mpool)
+		rte_mempool_free(env.sess_mpool);
+	if (env.sess_priv_mpool)
+		rte_mempool_free(env.sess_priv_mpool);
 	if (env.op_pool)
 		rte_mempool_free(env.op_pool);
 
@@ -93,6 +121,8 @@ cryptodev_fips_validate_app_uninit(void)
 	rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
 	rte_cryptodev_sym_session_free(env.sess);
 	rte_mempool_free(env.mpool);
+	rte_mempool_free(env.sess_mpool);
+	rte_mempool_free(env.sess_priv_mpool);
 	rte_mempool_free(env.op_pool);
 }
 
@@ -797,12 +827,12 @@ fips_run_test(void)
 	if (ret < 0)
 		return ret;
 
-	env.sess = rte_cryptodev_sym_session_create(env.mpool);
+	env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
 	if (!env.sess)
 		return -ENOMEM;
 
 	ret = rte_cryptodev_sym_session_init(env.dev_id,
-			env.sess, &xform, env.mpool);
+			env.sess, &xform, env.sess_priv_mpool);
 	if (ret < 0) {
 		RTE_LOG(ERR, USER1, "Error %i: Init session\n",
 				ret);
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..a92467e63 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -790,7 +790,8 @@ cmd_kni(char **tokens,
 static const char cmd_cryptodev_help[] =
 "cryptodev <cryptodev_name>\n"
 "   dev <device_name> | dev_id <device_id>\n"
-"   queue <n_queues> <queue_size>\n";
+"   queue <n_queues> <queue_size>\n"
+"   max_sessions <n_sessions>";
 
 static void
 cmd_cryptodev(char **tokens,
@@ -802,7 +803,7 @@ cmd_cryptodev(char **tokens,
 	char *name;
 
 	memset(&params, 0, sizeof(params));
-	if (n_tokens != 7) {
+	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
 	}
@@ -825,7 +826,7 @@ cmd_cryptodev(char **tokens,
 
 	if (strcmp(tokens[4], "queue")) {
 		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
-			"4");
+			"queue");
 		return;
 	}
 
@@ -841,6 +842,18 @@ cmd_cryptodev(char **tokens,
 		return;
 	}
 
+	if (strcmp(tokens[7], "max_sessions")) {
+		snprintf(out, out_size,	MSG_ARG_NOT_FOUND,
+			"max_sessions");
+		return;
+	}
+
+	if (parser_read_uint32(&params.session_pool_size, tokens[8]) < 0) {
+		snprintf(out, out_size,	MSG_ARG_INVALID,
+			"queue_size");
+		return;
+	}
+
 	if (cryptodev_create(name, &params) == NULL) {
 		snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
 		return;
@@ -1030,9 +1043,7 @@ static const char cmd_table_action_profile_help[] =
 "       stats none | pkts]\n"
 "   [stats pkts | bytes | both]\n"
 "   [time]\n"
-"   [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset> "
-"       mempool_create <mempool_name>\n"
-"       mempool_init <mempool_name>]\n"
+"   [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset>]\n"
 "   [tag]\n"
 "   [decap]\n";
 
@@ -1404,13 +1415,10 @@ cmd_table_action_profile(char **tokens,
 
 	if ((t0 < n_tokens) && (strcmp(tokens[t0], "sym_crypto") == 0)) {
 		struct cryptodev *cryptodev;
-		struct mempool *mempool;
 
-		if (n_tokens < t0 + 9 ||
+		if (n_tokens < t0 + 5 ||
 				strcmp(tokens[t0 + 1], "dev") ||
-				strcmp(tokens[t0 + 3], "offset") ||
-				strcmp(tokens[t0 + 5], "mempool_create") ||
-				strcmp(tokens[t0 + 7], "mempool_init")) {
+				strcmp(tokens[t0 + 3], "offset")) {
 			snprintf(out, out_size, MSG_ARG_MISMATCH,
 				"table action profile sym_crypto");
 			return;
@@ -1432,25 +1440,12 @@ cmd_table_action_profile(char **tokens,
 			return;
 		}
 
-		mempool = mempool_find(tokens[t0 + 6]);
-		if (mempool == NULL) {
-			snprintf(out, out_size, MSG_ARG_INVALID,
-				"table action profile sym_crypto");
-			return;
-		}
-		p.sym_crypto.mp_create = mempool->m;
-
-		mempool = mempool_find(tokens[t0 + 8]);
-		if (mempool == NULL) {
-			snprintf(out, out_size, MSG_ARG_INVALID,
-				"table action profile sym_crypto");
-			return;
-		}
-		p.sym_crypto.mp_init = mempool->m;
+		p.sym_crypto.mp_create = cryptodev->mp_create;
+		p.sym_crypto.mp_init = cryptodev->mp_init;
 
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO;
 
-		t0 += 9;
+		t0 += 5;
 	} /* sym_crypto */
 
 	if ((t0 < n_tokens) && (strcmp(tokens[t0], "tag") == 0)) {
diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c
index b365810de..ac1e38d6a 100644
--- a/examples/ip_pipeline/cryptodev.c
+++ b/examples/ip_pipeline/cryptodev.c
@@ -11,6 +11,8 @@
 
 #include "cryptodev.h"
 
+#define PIPELINE_CRYPTO_SESSION_CACHE_SIZE	128
+
 static struct cryptodev_list cryptodev_list;
 
 int
@@ -53,13 +55,16 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	struct cryptodev *cryptodev;
 	uint32_t dev_id, i;
 	uint32_t socket_id;
+	uint32_t cache_size;
+	char mp_name[NAME_SIZE];
 	int status;
 
 	/* Check input params */
 	if ((name == NULL) ||
 		cryptodev_find(name) ||
 		(params->n_queues == 0) ||
-		(params->queue_size == 0))
+		(params->queue_size == 0) ||
+		(params->session_pool_size == 0))
 		return NULL;
 
 	if (params->dev_name) {
@@ -75,6 +80,11 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 		dev_id = params->dev_id;
 	}
 
+	cache_size = (params->session_pool_size / 2 <
+			PIPELINE_CRYPTO_SESSION_CACHE_SIZE) ?
+					(params->session_pool_size / 2) :
+					PIPELINE_CRYPTO_SESSION_CACHE_SIZE;
+
 	socket_id = rte_cryptodev_socket_id(dev_id);
 	rte_cryptodev_info_get(dev_id, &dev_info);
 
@@ -111,7 +121,44 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 	cryptodev->dev_id = dev_id;
 	cryptodev->n_queues = params->n_queues;
 
+	snprintf(mp_name, NAME_SIZE, "%s_mp%u", name, dev_id);
+	cryptodev->mp_create = rte_cryptodev_sym_session_pool_create(
+			mp_name,
+			params->session_pool_size,
+			0,
+			cache_size,
+			0,
+			socket_id);
+	if (!cryptodev->mp_create)
+		goto error_exit;
+
+	snprintf(mp_name, NAME_SIZE, "%s_mp_priv%u", name, dev_id);
+	cryptodev->mp_init = rte_mempool_create(
+			NULL,
+			params->session_pool_size,
+			rte_cryptodev_sym_get_private_session_size(dev_id),
+			cache_size,
+			0,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			socket_id,
+			0);
+	if (!cryptodev->mp_init)
+		goto error_exit;
+
 	TAILQ_INSERT_TAIL(&cryptodev_list, cryptodev, node);
 
 	return cryptodev;
+
+error_exit:
+	if (cryptodev->mp_create)
+		rte_mempool_free(cryptodev->mp_create);
+	if (cryptodev->mp_init)
+		rte_mempool_free(cryptodev->mp_init);
+
+	free(cryptodev);
+
+	return NULL;
 }
diff --git a/examples/ip_pipeline/cryptodev.h b/examples/ip_pipeline/cryptodev.h
index d06b3f2f1..d00434379 100644
--- a/examples/ip_pipeline/cryptodev.h
+++ b/examples/ip_pipeline/cryptodev.h
@@ -17,6 +17,8 @@ struct cryptodev {
 	char name[NAME_SIZE];
 	uint16_t dev_id;
 	uint32_t n_queues;
+	struct rte_mempool *mp_create;
+	struct rte_mempool *mp_init;
 };
 
 TAILQ_HEAD(cryptodev_list, cryptodev);
@@ -35,6 +37,7 @@ struct cryptodev_params {
 	uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */
 	uint32_t n_queues;
 	uint32_t queue_size;
+	uint32_t session_pool_size;
 };
 
 struct cryptodev *
diff --git a/examples/ip_pipeline/examples/flow_crypto.cli b/examples/ip_pipeline/examples/flow_crypto.cli
index 9b639deb7..849f9d5fe 100644
--- a/examples/ip_pipeline/examples/flow_crypto.cli
+++ b/examples/ip_pipeline/examples/flow_crypto.cli
@@ -21,14 +21,13 @@
 ; 5   Crypto Operation 1792             160
 
 mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 1
-mempool MEMPOOL_SESSION0 buffer 1024 pool 1024 cache 128 cpu 1
 
-link LINK0 dev 0000:81:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on
+link LINK0 dev 81:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on
 
 #Cryptodev
-cryptodev CRYPTO0 dev crypto_aesni_gcm0 queue 1 1024
+cryptodev CRYPTO0 dev crypto_aesni_gcm0 queue 1 1024 max_sessions 512
 
-table action profile AP0 ipv4 offset 270 fwd sym_crypto dev CRYPTO0 offset 1792 mempool_create MEMPOOL_SESSION0 mempool_init MEMPOOL_SESSION0
+table action profile AP0 ipv4 offset 270 fwd sym_crypto dev CRYPTO0 offset 1792
 table action profile AP1 ipv4 offset 270 fwd
 
 pipeline PIPELINE0 period 10 offset_port_id 0 cpu 1
@@ -46,7 +45,7 @@ pipeline PIPELINE0 table match stub action AP1
 pipeline PIPELINE0 port in 0 table 0
 pipeline PIPELINE0 port in 1 table 1
 
-thread 24 pipeline PIPELINE0 enable
+thread 2 pipeline PIPELINE0 enable
 
 pipeline PIPELINE0 table 0 rule add match default action fwd port 2
 
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a0ff8f7f7..fc102a396 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -55,7 +55,7 @@
 
 #define CDEV_QUEUE_DESC 2048
 #define CDEV_MAP_ENTRIES 16384
-#define CDEV_MP_NB_OBJS 2048
+#define CDEV_MP_NB_OBJS 1024
 #define CDEV_MP_CACHE_SZ 64
 #define MAX_QUEUE_PAIRS 1
 
@@ -820,11 +820,15 @@ main_loop(__attribute__((unused)) void *dummy)
 	qconf->inbound.sa_ctx = socket_ctx[socket_id].sa_in;
 	qconf->inbound.cdev_map = cdev_map_in;
 	qconf->inbound.session_pool = socket_ctx[socket_id].session_pool;
+	qconf->inbound.session_priv_pool =
+			socket_ctx[socket_id].session_priv_pool;
 	qconf->outbound.sp4_ctx = socket_ctx[socket_id].sp_ip4_out;
 	qconf->outbound.sp6_ctx = socket_ctx[socket_id].sp_ip6_out;
 	qconf->outbound.sa_ctx = socket_ctx[socket_id].sa_out;
 	qconf->outbound.cdev_map = cdev_map_out;
 	qconf->outbound.session_pool = socket_ctx[socket_id].session_pool;
+	qconf->outbound.session_priv_pool =
+			socket_ctx[socket_id].session_priv_pool;
 
 	if (qconf->nb_rx_queue == 0) {
 		RTE_LOG(INFO, IPSEC, "lcore %u has nothing to do\n", lcore_id);
@@ -1460,10 +1464,10 @@ cryptodevs_init(void)
 		dev_conf.nb_queue_pairs = qp;
 
 		uint32_t dev_max_sess = cdev_info.sym.max_nb_sessions;
-		if (dev_max_sess != 0 && dev_max_sess < (CDEV_MP_NB_OBJS / 2))
+		if (dev_max_sess != 0 && dev_max_sess < CDEV_MP_NB_OBJS)
 			rte_exit(EXIT_FAILURE,
 				"Device does not support at least %u "
-				"sessions", CDEV_MP_NB_OBJS / 2);
+				"sessions", CDEV_MP_NB_OBJS);
 
 		if (!socket_ctx[dev_conf.socket_id].session_pool) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
@@ -1471,6 +1475,19 @@ cryptodevs_init(void)
 
 			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
 					"sess_mp_%u", dev_conf.socket_id);
+			sess_mp = rte_cryptodev_sym_session_pool_create(
+					mp_name, CDEV_MP_NB_OBJS,
+					0, CDEV_MP_CACHE_SZ, 0,
+					dev_conf.socket_id);
+			socket_ctx[dev_conf.socket_id].session_pool = sess_mp;
+		}
+
+		if (!socket_ctx[dev_conf.socket_id].session_priv_pool) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			struct rte_mempool *sess_mp;
+
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+					"sess_mp_priv_%u", dev_conf.socket_id);
 			sess_mp = rte_mempool_create(mp_name,
 					CDEV_MP_NB_OBJS,
 					max_sess_sz,
@@ -1478,25 +1495,28 @@ cryptodevs_init(void)
 					0, NULL, NULL, NULL,
 					NULL, dev_conf.socket_id,
 					0);
-			if (sess_mp == NULL)
-				rte_exit(EXIT_FAILURE,
-					"Cannot create session pool on socket %d\n",
-					dev_conf.socket_id);
-			else
-				printf("Allocated session pool on socket %d\n",
-					dev_conf.socket_id);
-			socket_ctx[dev_conf.socket_id].session_pool = sess_mp;
+			socket_ctx[dev_conf.socket_id].session_priv_pool =
+					sess_mp;
 		}
 
+		if (!socket_ctx[dev_conf.socket_id].session_priv_pool ||
+				!socket_ctx[dev_conf.socket_id].session_pool)
+			rte_exit(EXIT_FAILURE,
+				"Cannot create session pool on socket %d\n",
+				dev_conf.socket_id);
+		else
+			printf("Allocated session pool on socket %d\n",
+					dev_conf.socket_id);
+
 		if (rte_cryptodev_configure(cdev_id, &dev_conf))
 			rte_panic("Failed to initialize cryptodev %u\n",
 					cdev_id);
 
 		qp_conf.nb_descriptors = CDEV_QUEUE_DESC;
 		qp_conf.mp_session =
-				socket_ctx[dev_conf.socket_id].session_pool;
+			socket_ctx[dev_conf.socket_id].session_pool;
 		qp_conf.mp_session_private =
-				socket_ctx[dev_conf.socket_id].session_pool;
+			socket_ctx[dev_conf.socket_id].session_priv_pool;
 		for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
 			if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
 					&qp_conf, dev_conf.socket_id))
@@ -1521,7 +1541,7 @@ cryptodevs_init(void)
 				snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
 						"sess_mp_%u", socket_id);
 				sess_mp = rte_mempool_create(mp_name,
-						CDEV_MP_NB_OBJS,
+						(CDEV_MP_NB_OBJS * 2),
 						max_sess_sz,
 						CDEV_MP_CACHE_SZ,
 						0, NULL, NULL, NULL,
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 3d415f1af..9dc6e173c 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -323,7 +323,7 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 				ipsec_ctx->session_pool);
 		rte_cryptodev_sym_session_init(ipsec_ctx->tbl[cdev_id_qp].id,
 				sa->crypto_session, sa->xforms,
-				ipsec_ctx->session_pool);
+				ipsec_ctx->session_priv_pool);
 
 		rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id,
 				&cdev_info);
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index c998c8076..f35552857 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -144,6 +144,7 @@ struct ipsec_ctx {
 	uint16_t last_qp;
 	struct cdev_qp tbl[MAX_QP_PER_LCORE];
 	struct rte_mempool *session_pool;
+	struct rte_mempool *session_priv_pool;
 	struct rte_mbuf *ol_pkts[MAX_PKT_BURST] __rte_aligned(sizeof(void *));
 	uint16_t ol_pkts_cnt;
 };
@@ -166,6 +167,7 @@ struct socket_ctx {
 	struct rt_ctx *rt_ip6;
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *session_pool;
+	struct rte_mempool *session_priv_pool;
 };
 
 struct cnt_blk {
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 1df7ba743..9982f07e9 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -221,7 +221,10 @@ static struct rte_eth_conf port_conf = {
 
 struct rte_mempool *l2fwd_pktmbuf_pool;
 struct rte_mempool *l2fwd_crypto_op_pool;
-struct rte_mempool *session_pool_socket[RTE_MAX_NUMA_NODES] = { 0 };
+static struct {
+	struct rte_mempool *sess_mp;
+	struct rte_mempool *priv_mp;
+} session_pool_socket[RTE_MAX_NUMA_NODES];
 
 /* Per-port statistics struct */
 struct l2fwd_port_statistics {
@@ -645,7 +648,6 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		return NULL;
 
 	uint8_t socket_id = (uint8_t) retval;
-	struct rte_mempool *sess_mp = session_pool_socket[socket_id];
 
 	if (options->xform_chain == L2FWD_CRYPTO_AEAD) {
 		first_xform = &options->aead_xform;
@@ -661,13 +663,14 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 		first_xform = &options->auth_xform;
 	}
 
-	session = rte_cryptodev_sym_session_create(sess_mp);
-
+	session = rte_cryptodev_sym_session_create(
+			session_pool_socket[socket_id].sess_mp);
 	if (session == NULL)
 		return NULL;
 
 	if (rte_cryptodev_sym_session_init(cdev_id, session,
-				first_xform, sess_mp) < 0)
+				first_xform,
+				session_pool_socket[socket_id].priv_mp) < 0)
 		return NULL;
 
 	return session;
@@ -2267,38 +2270,54 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 				rte_cryptodev_scheduler_slaves_get(cdev_id,
 								NULL);
 
-			sessions_needed = 2 * enabled_cdev_count * nb_slaves;
+			sessions_needed = enabled_cdev_count * nb_slaves;
 #endif
 		} else
-			sessions_needed = 2 * enabled_cdev_count;
+			sessions_needed = enabled_cdev_count;
 
-		if (session_pool_socket[socket_id] == NULL) {
+		if (session_pool_socket[socket_id].priv_mp == NULL) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
-			struct rte_mempool *sess_mp;
 
 			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
-				"sess_mp_%u", socket_id);
+				"priv_sess_mp_%u", socket_id);
 
-			/*
-			 * Create enough objects for session headers and
-			 * device private data
-			 */
-			sess_mp = rte_mempool_create(mp_name,
+			session_pool_socket[socket_id].priv_mp =
+					rte_mempool_create(mp_name,
 						sessions_needed,
 						max_sess_sz,
-						SESSION_POOL_CACHE_SIZE,
-						0, NULL, NULL, NULL,
+						0, 0, NULL, NULL, NULL,
 						NULL, socket_id,
 						0);
 
-			if (sess_mp == NULL) {
-				printf("Cannot create session pool on socket %d\n",
+			if (session_pool_socket[socket_id].priv_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
+					socket_id);
+				return -ENOMEM;
+			}
+
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
+		}
+
+		if (session_pool_socket[socket_id].sess_mp == NULL) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+				"sess_mp_%u", socket_id);
+
+			session_pool_socket[socket_id].sess_mp =
+					rte_cryptodev_sym_session_pool_create(
+							mp_name,
+							sessions_needed,
+							0, 0, 0, socket_id);
+
+			if (session_pool_socket[socket_id].sess_mp == NULL) {
+				printf("Cannot create pool on socket %d\n",
 					socket_id);
 				return -ENOMEM;
 			}
 
-			printf("Allocated session pool on socket %d\n", socket_id);
-			session_pool_socket[socket_id] = sess_mp;
+			printf("Allocated pool \"%s\" on socket %d\n",
+				mp_name, socket_id);
 		}
 
 		/* Set AEAD parameters */
@@ -2443,8 +2462,9 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		}
 
 		qp_conf.nb_descriptors = 2048;
-		qp_conf.mp_session = session_pool_socket[socket_id];
-		qp_conf.mp_session_private = session_pool_socket[socket_id];
+		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
+		qp_conf.mp_session_private =
+				session_pool_socket[socket_id].priv_mp;
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
 				socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index cb30f84c0..8bdcb3a9c 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,6 +46,7 @@ struct vhost_crypto_info {
 	int vids[MAX_NB_SOCKETS];
 	uint32_t nb_vids;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *cop_pool;
 	uint8_t cid;
 	uint32_t qid;
@@ -289,6 +290,7 @@ new_device(int vid)
 	}
 
 	ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
+			info->sess_priv_pool,
 			rte_lcore_to_socket_id(options.los[i].lcore_id));
 	if (ret) {
 		RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -448,6 +450,7 @@ free_resource(void)
 
 		rte_mempool_free(info->cop_pool);
 		rte_mempool_free(info->sess_pool);
+		rte_mempool_free(info->sess_priv_pool);
 
 		for (j = 0; j < lo->nb_sockets; j++) {
 			rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -528,11 +531,17 @@ main(int argc, char *argv[])
 		}
 
 		snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
-		info->sess_pool = rte_mempool_create(name, SESSION_MAP_ENTRIES,
+		info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
+				SESSION_MAP_ENTRIES, 0, 0, 0,
+				rte_lcore_to_socket_id(lo->lcore_id));
+
+		snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
+		info->sess_priv_pool = rte_mempool_create(name,
+				SESSION_MAP_ENTRIES,
 				rte_cryptodev_sym_get_private_session_size(
 				info->cid), 64, 0, NULL, NULL, NULL, NULL,
 				rte_lcore_to_socket_id(lo->lcore_id), 0);
-		if (!info->sess_pool) {
+		if (!info->sess_priv_pool || info->sess_pool) {
 			RTE_LOG(ERR, USER1, "Failed to create mempool");
 			goto error_exit;
 		}
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 06/12] vhost/crypto: use separate session mempools
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
                         ` (4 preceding siblings ...)
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 05/12] examples: " Fan Zhang
@ 2019-01-09 22:56       ` Fan Zhang
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 07/12] test/crypto: " Fan Zhang
                         ` (6 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:56 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch uses the two session mempool approach to vhost crypto.
One mempool is for session header objects, and the other is for
session private data.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 lib/librte_vhost/rte_vhost_crypto.h | 9 ++++++---
 lib/librte_vhost/vhost_crypto.c     | 8 ++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/librte_vhost/rte_vhost_crypto.h b/lib/librte_vhost/rte_vhost_crypto.h
index f9fbc0548..d08e0ffab 100644
--- a/lib/librte_vhost/rte_vhost_crypto.h
+++ b/lib/librte_vhost/rte_vhost_crypto.h
@@ -26,8 +26,9 @@ enum rte_vhost_crypto_zero_copy {
  *  The identifier of DPDK Cryptodev, the same cryptodev_id can be assigned to
  *  multiple Vhost-crypto devices.
  * @param sess_pool
- *  The pointer to the created cryptodev session pool with the private data size
- *  matches the target DPDK Cryptodev.
+ *  The pointer to the created cryptodev session pool.
+ * @param sess_priv_pool
+ *  The pointer to the created cryptodev session private data mempool.
  * @param socket_id
  *  NUMA Socket ID to allocate resources on. *
  * @return
@@ -36,7 +37,9 @@ enum rte_vhost_crypto_zero_copy {
  */
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id);
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id);
 
 /**
  *  Free the Vhost-crypto instance
diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index dd01afc08..598196fb7 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -198,6 +198,7 @@ struct vhost_crypto {
 	struct rte_hash *session_map;
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *sess_pool;
+	struct rte_mempool *sess_priv_pool;
 	struct rte_mempool *wb_pool;
 
 	/** DPDK cryptodev ID */
@@ -369,7 +370,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
 	}
 
 	if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
-			vcrypto->sess_pool) < 0) {
+			vcrypto->sess_priv_pool) < 0) {
 		VC_LOG_ERR("Failed to initialize session");
 		sess_param->session_id = -VIRTIO_CRYPTO_ERR;
 		return;
@@ -1293,7 +1294,9 @@ vhost_crypto_complete_one_vm_requests(struct rte_crypto_op **ops,
 
 int __rte_experimental
 rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
-		struct rte_mempool *sess_pool, int socket_id)
+		struct rte_mempool *sess_pool,
+		struct rte_mempool *sess_priv_pool,
+		int socket_id)
 {
 	struct virtio_net *dev = get_device(vid);
 	struct rte_hash_parameters params = {0};
@@ -1321,6 +1324,7 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
 	}
 
 	vcrypto->sess_pool = sess_pool;
+	vcrypto->sess_priv_pool = sess_priv_pool;
 	vcrypto->cid = cryptodev_id;
 	vcrypto->cache_session_id = UINT64_MAX;
 	vcrypto->last_session_id = 1;
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 07/12] test/crypto: use separate session mempools
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
                         ` (5 preceding siblings ...)
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 06/12] vhost/crypto: " Fan Zhang
@ 2019-01-09 22:56       ` Fan Zhang
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 08/12] cryptodev: add sym session header size API Fan Zhang
                         ` (5 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:56 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch uses the two session mempool approach to crypto unit
test. One mempool is for session header objects, and the other is
for session private data.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 test/test/test_cryptodev.c             | 229 ++++++++++++++++++++-------------
 test/test/test_cryptodev_blockcipher.c |   7 +-
 test/test/test_cryptodev_blockcipher.h |   1 +
 test/test/test_event_crypto_adapter.c  |  32 +++--
 4 files changed, 167 insertions(+), 102 deletions(-)

diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index aac0b1f0b..238b7dd34 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -48,6 +48,7 @@ struct crypto_testsuite_params {
 	struct rte_mempool *large_mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config conf;
 	struct rte_cryptodev_qp_conf qp_conf;
 
@@ -444,17 +445,24 @@ testsuite_setup(void)
 		return TEST_FAILED;
 	}
 
-	ts_params->session_mpool = rte_mempool_create(
-				"test_sess_mp",
-				MAX_NB_SESSIONS * 2,
-				session_size,
-				0, 0, NULL, NULL, NULL,
-				NULL, SOCKET_ID_ANY,
-				0);
-
+	ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
+			"test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+			SOCKET_ID_ANY);
 	TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
 			"session mempool allocation failed");
 
+	ts_params->session_priv_mpool = rte_mempool_create(
+			"test_sess_mp_priv",
+			MAX_NB_SESSIONS,
+			session_size,
+			0, 0, NULL, NULL, NULL,
+			NULL, SOCKET_ID_ANY,
+			0);
+	TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
+			"session mempool allocation failed");
+
+
+
 	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
 			&ts_params->conf),
 			"Failed to configure cryptodev %u with %u qps",
@@ -462,7 +470,7 @@ testsuite_setup(void)
 
 	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	ts_params->qp_conf.mp_session = ts_params->session_mpool;
-	ts_params->qp_conf.mp_session_private = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -491,6 +499,11 @@ testsuite_teardown(void)
 	}
 
 	/* Free session mempools */
+	if (ts_params->session_priv_mpool != NULL) {
+		rte_mempool_free(ts_params->session_priv_mpool);
+		ts_params->session_priv_mpool = NULL;
+	}
+
 	if (ts_params->session_mpool != NULL) {
 		rte_mempool_free(ts_params->session_mpool);
 		ts_params->session_mpool = NULL;
@@ -510,6 +523,9 @@ ut_setup(void)
 
 	/* Reconfigure device to default parameters */
 	ts_params->conf.socket_id = SOCKET_ID_ANY;
+	ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
+	ts_params->qp_conf.mp_session = ts_params->session_mpool;
+	ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
 			&ts_params->conf),
@@ -710,7 +726,7 @@ test_queue_pair_descriptor_setup(void)
 	 */
 	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
 	qp_conf.mp_session = ts_params->session_mpool;
-	qp_conf.mp_session_private = ts_params->session_mpool;
+	qp_conf.mp_session_private = ts_params->session_priv_mpool;
 
 	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -1337,7 +1353,7 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
 	/* Create crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate crypto op data structure */
@@ -1551,7 +1567,7 @@ test_AES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1570,7 +1586,7 @@ test_AES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1589,7 +1605,7 @@ test_AES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1608,7 +1624,7 @@ test_DES_docsis_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1627,7 +1643,7 @@ test_authonly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1646,7 +1662,7 @@ test_authonly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1664,7 +1680,7 @@ test_AES_chain_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -1685,7 +1701,7 @@ test_AES_cipheronly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1704,7 +1720,7 @@ test_AES_chain_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1723,7 +1739,7 @@ test_authonly_scheduler_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
@@ -1744,7 +1760,7 @@ test_AES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1763,7 +1779,7 @@ test_AES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -1782,7 +1798,7 @@ test_AES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1801,7 +1817,7 @@ test_AES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -1820,7 +1836,7 @@ test_AES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1839,7 +1855,7 @@ test_AES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -1858,7 +1874,7 @@ test_AES_cipheronly_virtio_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)),
@@ -1877,7 +1893,7 @@ test_AES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1896,7 +1912,7 @@ test_AES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1915,7 +1931,7 @@ test_authonly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -1935,7 +1951,7 @@ test_AES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1954,7 +1970,7 @@ test_AES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1973,7 +1989,7 @@ test_authonly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -1992,7 +2008,7 @@ test_AES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2011,7 +2027,7 @@ test_AES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2030,7 +2046,7 @@ test_authonly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -2049,7 +2065,7 @@ test_authonly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -2068,7 +2084,7 @@ test_authonly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -2087,7 +2103,7 @@ test_AES_chain_armv8_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)),
@@ -2106,7 +2122,7 @@ test_AES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2125,7 +2141,7 @@ test_AES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2144,7 +2160,7 @@ test_authonly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2163,7 +2179,7 @@ test_3DES_chain_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2182,7 +2198,7 @@ test_3DES_cipheronly_mrvl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
@@ -2201,6 +2217,7 @@ test_AES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2219,6 +2236,7 @@ test_AES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2237,6 +2255,7 @@ test_3DES_chain_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2255,6 +2274,7 @@ test_3DES_cipheronly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2273,6 +2293,7 @@ test_authonly_octeontx_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool, ts_params->session_mpool,
+		ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
@@ -2315,7 +2336,8 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2352,7 +2374,8 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2468,7 +2491,8 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2527,7 +2551,8 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->cipher_xform, ts_params->session_mpool);
+			&ut_params->cipher_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2589,7 +2614,8 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->auth_xform, ts_params->session_mpool);
+			&ut_params->auth_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -5075,7 +5101,7 @@ test_3DES_chain_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5094,7 +5120,7 @@ test_DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5113,7 +5139,7 @@ test_DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5132,7 +5158,7 @@ test_DES_docsis_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5151,7 +5177,7 @@ test_DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5169,7 +5195,7 @@ test_3DES_cipheronly_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5188,7 +5214,7 @@ test_DES_docsis_mb_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
@@ -5207,7 +5233,7 @@ test_3DES_chain_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5226,7 +5252,7 @@ test_3DES_cipheronly_caam_jr_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD)),
@@ -5245,7 +5271,7 @@ test_3DES_chain_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5264,7 +5290,7 @@ test_3DES_cipheronly_dpaa_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
@@ -5283,7 +5309,7 @@ test_3DES_chain_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5302,7 +5328,7 @@ test_3DES_cipheronly_dpaa2_sec_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
@@ -5321,7 +5347,7 @@ test_3DES_chain_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5340,7 +5366,7 @@ test_3DES_cipheronly_ccp_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
@@ -5359,7 +5385,7 @@ test_3DES_cipheronly_qat_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
@@ -5378,7 +5404,7 @@ test_3DES_chain_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5397,7 +5423,7 @@ test_3DES_cipheronly_openssl_all(void)
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
 		ts_params->op_mpool,
-		ts_params->session_mpool,
+		ts_params->session_mpool, ts_params->session_priv_mpool,
 		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
@@ -5443,7 +5469,8 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
 			ts_params->session_mpool);
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
-			&ut_params->aead_xform, ts_params->session_mpool);
+			&ut_params->aead_xform,
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -6547,7 +6574,7 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
 
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 
 	if (ut_params->sess == NULL)
 		return TEST_FAILED;
@@ -6728,7 +6755,7 @@ test_multi_session(void)
 
 		rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				sessions[i], &ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
 				i);
@@ -6766,7 +6793,7 @@ test_multi_session(void)
 	/* Next session create should fail */
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			sessions[i], &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NULL(sessions[i],
 			"Session creation succeeded unexpectedly!");
 
@@ -6847,7 +6874,7 @@ test_multi_session_random_usage(void)
 				ts_params->valid_devs[0],
 				sessions[i],
 				&ut_paramz[i].ut_params.auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
@@ -6925,7 +6952,7 @@ test_null_cipher_only_operation(void)
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 				ut_params->sess,
 				&ut_params->cipher_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6998,7 +7025,7 @@ test_null_auth_only_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7077,7 +7104,7 @@ test_null_cipher_auth_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7165,7 +7192,7 @@ test_null_auth_cipher_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -7235,7 +7262,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7253,7 +7280,7 @@ test_null_invalid_operation(void)
 	/* Create Crypto session*/
 	ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT(ret < 0,
 			"Session creation succeeded unexpectedly");
 
@@ -7294,7 +7321,7 @@ test_null_burst_operation(void)
 	/* Create Crypto session*/
 	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
 			ut_params->sess, &ut_params->cipher_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
@@ -7429,7 +7456,7 @@ static int create_gmac_session(uint8_t dev_id,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->auth_xform,
-			ts_params->session_mpool);
+			ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7809,7 +7836,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7862,7 +7889,7 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
 
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 				&ut_params->auth_xform,
-				ts_params->session_mpool);
+				ts_params->session_priv_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -8740,12 +8767,14 @@ test_scheduler_attach_slave_op(void)
 	for (i = 0; i < rte_cryptodev_count() && nb_devs_attached < 2;
 			i++) {
 		struct rte_cryptodev_info info;
+		unsigned int session_size;
 
 		rte_cryptodev_info_get(i, &info);
 		if (info.driver_id != rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
 			continue;
 
+		session_size = rte_cryptodev_sym_get_private_session_size(i);
 		/*
 		 * Create the session mempool again, since now there are new devices
 		 * to use the mempool.
@@ -8754,8 +8783,10 @@ test_scheduler_attach_slave_op(void)
 			rte_mempool_free(ts_params->session_mpool);
 			ts_params->session_mpool = NULL;
 		}
-		unsigned int session_size =
-			rte_cryptodev_sym_get_private_session_size(i);
+		if (ts_params->session_priv_mpool) {
+			rte_mempool_free(ts_params->session_priv_mpool);
+			ts_params->session_priv_mpool = NULL;
+		}
 
 		if (info.sym.max_nb_sessions != 0 &&
 				info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
@@ -8766,22 +8797,40 @@ test_scheduler_attach_slave_op(void)
 			return TEST_FAILED;
 		}
 		/*
-		 * Create mempool with maximum number of sessions * 2,
+		 * Create mempool with maximum number of sessions,
 		 * to include the session headers
 		 */
 		if (ts_params->session_mpool == NULL) {
-			ts_params->session_mpool = rte_mempool_create(
-					"test_sess_mp",
-					MAX_NB_SESSIONS * 2,
+			ts_params->session_mpool =
+				rte_cryptodev_sym_session_pool_create(
+						"test_sess_mp",
+						MAX_NB_SESSIONS, 0, 0, 0,
+						SOCKET_ID_ANY);
+			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+					"session mempool allocation failed");
+		}
+
+		/*
+		 * Create mempool with maximum number of sessions,
+		 * to include device specific session private data
+		 */
+		if (ts_params->session_priv_mpool == NULL) {
+			ts_params->session_priv_mpool = rte_mempool_create(
+					"test_sess_mp_priv",
+					MAX_NB_SESSIONS,
 					session_size,
 					0, 0, NULL, NULL, NULL,
 					NULL, SOCKET_ID_ANY,
 					0);
 
-			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+			TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
 					"session mempool allocation failed");
 		}
 
+		ts_params->qp_conf.mp_session = ts_params->session_mpool;
+		ts_params->qp_conf.mp_session_private =
+				ts_params->session_priv_mpool;
+
 		ret = rte_cryptodev_scheduler_slave_attach(sched_id,
 				(uint8_t)i);
 
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 1c3f29f6b..4d6f46a6e 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -25,6 +25,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 	struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	char *test_msg)
@@ -347,7 +348,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 		sess = rte_cryptodev_sym_session_create(sess_mpool);
 
 		rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
-				sess_mpool);
+				sess_priv_mpool);
 		if (!sess) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
@@ -615,6 +616,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type)
@@ -730,7 +732,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			continue;
 
 		status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
-			sess_mpool, dev_id, driver_id, test_msg);
+			sess_mpool, sess_priv_mpool, dev_id, driver_id,
+			test_msg);
 
 		printf("  %u) TestCase %s %s\n", test_index ++,
 			tc->test_descr, test_msg);
diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h
index f8bd85838..5c22d5da6 100644
--- a/test/test/test_cryptodev_blockcipher.h
+++ b/test/test/test_cryptodev_blockcipher.h
@@ -104,6 +104,7 @@ int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
 	struct rte_mempool *sess_mpool,
+	struct rte_mempool *sess_priv_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type);
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
index 54717870e..f750ce3d8 100644
--- a/test/test/test_event_crypto_adapter.c
+++ b/test/test/test_event_crypto_adapter.c
@@ -61,6 +61,7 @@ struct event_crypto_adapter_test_params {
 	struct rte_mempool *mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config *config;
 	uint8_t crypto_event_port_id;
 };
@@ -193,12 +194,13 @@ test_op_forward_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		/* Create Crypto session*/
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
 							evdev, &cap);
@@ -381,7 +383,8 @@ test_op_new_mode(uint8_t session_less)
 	sym_op = op->sym;
 
 	if (!session_less) {
-		sess = rte_cryptodev_sym_session_create(params.session_mpool);
+		sess = rte_cryptodev_sym_session_create(
+				params.session_mpool);
 		TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
 
 		ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID,
@@ -396,7 +399,7 @@ test_op_new_mode(uint8_t session_less)
 						&m_data, sizeof(m_data));
 		}
 		rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
-				&cipher_xform, params.session_mpool);
+				&cipher_xform, params.session_priv_mpool);
 		rte_crypto_op_attach_sym_session(op, sess);
 	} else {
 		struct rte_crypto_sym_xform *first_xform;
@@ -526,15 +529,20 @@ configure_cryptodev(void)
 	session_size = rte_cryptodev_sym_get_private_session_size(TEST_CDEV_ID);
 	session_size += sizeof(union rte_event_crypto_metadata);
 
-	params.session_mpool = rte_mempool_create(
-				"CRYPTO_ADAPTER_SESSION_MP",
-				MAX_NB_SESSIONS * 2,
+	params.session_mpool = rte_cryptodev_sym_session_pool_create(
+			"CRYPTO_ADAPTER_SESSION_MP",
+			MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+	TEST_ASSERT_NOT_NULL(params.session_mpool,
+			"session mempool allocation failed\n");
+
+	params.session_priv_mpool = rte_mempool_create(
+				"CRYPTO_ADAPTER_SESSION_MP_PRIV",
+				MAX_NB_SESSIONS,
 				session_size,
 				0, 0, NULL, NULL, NULL,
 				NULL, SOCKET_ID_ANY,
 				0);
-
-	TEST_ASSERT_NOT_NULL(params.session_mpool,
+	TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
 			"session mempool allocation failed\n");
 
 	rte_cryptodev_info_get(TEST_CDEV_ID, &info);
@@ -547,7 +555,7 @@ configure_cryptodev(void)
 
 	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 	qp_conf.mp_session = params.session_mpool;
-	qp_conf.mp_session_private = params.session_mpool;
+	qp_conf.mp_session_private = params.session_priv_mpool;
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -859,6 +867,10 @@ crypto_teardown(void)
 		rte_mempool_free(params.session_mpool);
 		params.session_mpool = NULL;
 	}
+	if (params.session_priv_mpool != NULL) {
+		rte_mempool_free(params.session_priv_mpool);
+		params.session_priv_mpool = NULL;
+	}
 
 	/* Free ops mempool */
 	if (params.op_mpool != NULL) {
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 08/12] cryptodev: add sym session header size API
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
                         ` (6 preceding siblings ...)
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 07/12] test/crypto: " Fan Zhang
@ 2019-01-09 22:56       ` Fan Zhang
  2019-01-10 13:28         ` De Lara Guarch, Pablo
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 09/12] cryptodev: update symmetric session structure Fan Zhang
                         ` (4 subsequent siblings)
  12 siblings, 1 reply; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:56 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch adds a new API in Cryptodev Framework. The API is used
to get the header size for the created symmetric Cryptodev session.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 doc/guides/prog_guide/cryptodev_lib.rst        |  3 ++-
 doc/guides/rel_notes/release_19_02.rst         |  7 +++++++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c       |  3 ++-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     |  3 ++-
 drivers/crypto/armv8/rte_armv8_pmd.c           |  3 ++-
 drivers/crypto/kasumi/rte_kasumi_pmd.c         |  3 ++-
 drivers/crypto/openssl/rte_openssl_pmd.c       |  3 ++-
 drivers/crypto/snow3g/rte_snow3g_pmd.c         |  3 ++-
 drivers/crypto/zuc/rte_zuc_pmd.c               |  3 ++-
 lib/librte_cryptodev/rte_cryptodev.c           | 10 ++++++++++
 lib/librte_cryptodev/rte_cryptodev.h           | 15 +++++++++++++++
 lib/librte_cryptodev/rte_cryptodev_version.map |  1 +
 12 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst
index 366508618..9dc2d2aa4 100644
--- a/doc/guides/prog_guide/cryptodev_lib.rst
+++ b/doc/guides/prog_guide/cryptodev_lib.rst
@@ -471,7 +471,8 @@ an application to calculate the max device session size of all crypto devices
 to create a single session mempool.
 If instead an application creates multiple session mempools, the Crypto device
 framework also provides ``rte_cryptodev_sym_get_header_session_size`` to get
-the size of an uninitialized session.
+the size of an uninitialized session. For the initialized session, the function
+``rte_cryptodev_sym_get_existing_header_session_size`` should be used instead.
 
 Once the session mempools have been created, ``rte_cryptodev_sym_session_create()``
 is used to allocate an uninitialized session from the given mempool.
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 0b3c30c80..445d6a809 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -172,6 +172,13 @@ API Changes
   and all crypto applications are required to use this function to create
   symmetric session mempool from now on.
 
+* cryptodev: introduced a new function
+  ``rte_cryptodev_sym_get_existing_header_session_size()``. The function is
+  used to get the session header size from existing symmetric session. Since
+  different sessions may be created from the mempools with different elt size,
+  using this function help pinpoint the exact header data for the session
+  header.
+
 
 ABI Changes
 -----------
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index abc7a6d5f..948ff0763 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -419,7 +419,8 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_gcm_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b0f5c4d67..f3b270d09 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -951,7 +951,8 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct aesni_mb_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 3b2d7fb2f..0d4649adc 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -655,7 +655,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
 	if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 		memset(sess, 0, sizeof(struct armv8_crypto_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp, sess);
 		rte_mempool_put(qp->sess_mp_priv, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 6df645a23..3abdb01a9 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -325,7 +325,8 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct kasumi_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index a193af642..ea5aac69e 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -2020,7 +2020,8 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 		openssl_reset_session(sess);
 		memset(sess, 0, sizeof(struct openssl_session));
 		memset(op->sym->session, 0,
-				rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+				op->sym->session));
 		rte_mempool_put(qp->sess_mp_priv, sess);
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 7d131f780..5fd94b686 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -340,7 +340,8 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(session, 0, sizeof(struct snow3g_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, session);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 997c2092f..637994dfd 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -327,7 +327,8 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
 		if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
 			memset(sessions[i], 0, sizeof(struct zuc_session));
 			memset(ops[i]->sym->session, 0,
-					rte_cryptodev_sym_get_header_session_size());
+			rte_cryptodev_sym_get_existing_header_session_size(
+					ops[i]->sym->session));
 			rte_mempool_put(qp->sess_mp_priv, sessions[i]);
 			rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
 			ops[i]->sym->session = NULL;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 5b1449d14..f4f1cf598 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1407,6 +1407,16 @@ rte_cryptodev_sym_get_header_session_size(void)
 	return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
 }
 
+unsigned int
+rte_cryptodev_sym_get_existing_header_session_size(
+		struct rte_cryptodev_sym_session *sess)
+{
+	if (!sess)
+		return 0;
+	else
+		return rte_cryptodev_sym_get_header_session_size();
+}
+
 unsigned int __rte_experimental
 rte_cryptodev_asym_get_header_session_size(void)
 {
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 265f02cbe..c4db3aa0b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -1137,6 +1137,21 @@ unsigned int
 rte_cryptodev_sym_get_header_session_size(void);
 
 /**
+ * Get the size of the header session from created session.
+ *
+ * @param sess
+ *   The sym cryptodev session pointer
+ *
+ * @return
+ *   - If sess is not NULL, return the size of the header session including
+ *   the private data size defined within sess.
+ *   - If sess is NULL, return 0.
+ */
+unsigned int
+rte_cryptodev_sym_get_existing_header_session_size(
+		struct rte_cryptodev_sym_session *sess);
+
+/**
  * Get the size of the asymmetric session header, for all registered drivers.
  *
  * @return
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 5b6b679f5..0c8d67223 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -91,6 +91,7 @@ DPDK_18.05 {
 DPDK_19.02 {
 	global:
 
+	rte_cryptodev_sym_get_existing_header_session_size;
 	rte_cryptodev_sym_session_pool_create;
 
 } DPDK_18.05;
-- 
2.13.6

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [dpdk-dev] [PATCH v4 09/12] cryptodev: update symmetric session structure
  2019-01-09 22:55     ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
                         ` (7 preceding siblings ...)
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 08/12] cryptodev: add sym session header size API Fan Zhang
@ 2019-01-09 22:56       ` Fan Zhang
  2019-01-10 13:06         ` De Lara Guarch, Pablo
  2019-01-09 22:56       ` [dpdk-dev] [PATCH v4 10/12] cryptodev: add user data size to symmetric session Fan Zhang
                         ` (3 subsequent siblings)
  12 siblings, 1 reply; 61+ messages in thread
From: Fan Zhang @ 2019-01-09 22:56 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, fiona.trahe

This patch updates the rte_cryptodev_sym_session structure for
cryptodev library. The updates include a changed session private
data array and an added nb_drivers field. They are used to
calculate the correct session header size and ensure safe access
of the session private data.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 doc/guides/prog_guide/img/cryptodev_sym_sess.svg | 701 ++++++++++++-----------
 doc/guides/rel_notes/release_19_02.rst           |   7 +-
 lib/librte_cryptodev/rte_cryptodev.c             | 100 +++-
 lib/librte_cryptodev/rte_cryptodev.h             |   8 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.h         |  13 +-
 5 files changed, 444 insertions(+), 385 deletions(-)

diff --git a/doc/guides/prog_guide/img/cryptodev_sym_sess.svg b/doc/guides/prog_guide/img/cryptodev_sym_sess.svg
index a807cebac..5c843f736 100644
--- a/doc/guides/prog_guide/img/cryptodev_sym_sess.svg
+++ b/doc/guides/prog_guide/img/cryptodev_sym_sess.svg
@@ -19,33 +19,31 @@
    id="svg70"
    sodipodi:docname="cryptodev_sym_sess.svg"
    style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-rule:evenodd;stroke-linecap:square;stroke-miterlimit:3"
-   inkscape:version="0.92.1 r15371"><metadata
-   id="metadata74"><rdf:RDF><cc:Work
-       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
-         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
-   pagecolor="#ffffff"
-   bordercolor="#666666"
-   borderopacity="1"
-   objecttolerance="10"
-   gridtolerance="10"
-   guidetolerance="10"
-   inkscape:pageopacity="0"
-   inkscape:pageshadow="2"
-   inkscape:window-width="1920"
-   inkscape:window-height="1051"
-   id="namedview72"
-   showgrid="false"
-   inkscape:zoom="1.7495789"
-   inkscape:cx="208.74719"
-   inkscape:cy="216.52777"
-   inkscape:window-x="-9"
-   inkscape:window-y="-9"
-   inkscape:window-maximized="0"
-   inkscape:current-layer="g68-0" />
-	<style
-   type="text/css"
-   id="style2">
-	<![CDATA[
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"><metadata
+     id="metadata74"><rdf:RDF><cc:Work
+         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="956"
+     id="namedview72"
+     showgrid="false"
+     inkscape:zoom="1.7495789"
+     inkscape:cx="208.74719"
+     inkscape:cy="216.52777"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="shape18-1-4" /><style
+     type="text/css"
+     id="style2"><![CDATA[
 		.st1 {fill:url(#grad0-4);stroke:#386288;stroke-width:0.75}
 		.st2 {fill:#386288;font-family:Calibri;font-size:0.833336em}
 		.st3 {visibility:visible}
@@ -56,337 +54,340 @@
 		.st8 {font-size:0.799995em}
 		.st9 {font-size:0.799995em;font-weight:bold}
 		.st10 {fill:none;fill-rule:evenodd;font-size:12px;overflow:visible;stroke-linecap:square;stroke-miterlimit:3}
-	]]>
-	</style>
-
-	<defs
-   id="Patterns_And_Gradients"><marker
-   inkscape:isstock="true"
-   style="overflow:visible"
-   id="marker5421"
-   refX="0"
-   refY="0"
-   orient="auto"
-   inkscape:stockid="Arrow2Lend"><path
-     transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
-     d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
-     style="fill:#41719c;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
-     id="path5419"
-     inkscape:connector-curvature="0" /></marker><marker
-   inkscape:stockid="Arrow2Lend"
-   orient="auto"
-   refY="0"
-   refX="0"
-   id="Arrow2Lend"
-   style="overflow:visible"
-   inkscape:isstock="true"><path
-     id="path5004"
-     style="fill:#41719c;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
-     d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
-     transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
-     inkscape:connector-curvature="0" /></marker><marker
-   inkscape:stockid="Arrow1Lend"
-   orient="auto"
-   refY="0"
-   refX="0"
-   id="Arrow1Lend"
-   style="overflow:visible"
-   inkscape:isstock="true"><path
-     id="path4986"
-     d="M 0,0 5,-5 -12.5,0 5,5 Z"
-     style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
-     transform="matrix(-0.8,0,0,-0.8,-10,0)"
-     inkscape:connector-curvature="0" /></marker>
-		<linearGradient
-   id="grad0-4"
-   x1="0"
-   y1="0"
-   x2="1"
-   y2="0"
-   gradientTransform="rotate(60,0.5,0.5)">
-			<stop
-   offset="0"
-   stop-color="#e8ebef"
-   stop-opacity="1"
-   id="stop4" />
-			<stop
-   offset="0.24"
-   stop-color="#f4f5f7"
-   stop-opacity="1"
-   id="stop6" />
-			<stop
-   offset="0.54"
-   stop-color="#feffff"
-   stop-opacity="1"
-   id="stop8" />
-		</linearGradient>
-	<filter
-   id="filter_2-4"><feGaussianBlur
-     stdDeviation="2"
-     id="feGaussianBlur12-0" /></filter><linearGradient
-   inkscape:collect="always"
-   xlink:href="#grad0-4"
-   id="linearGradient189"
-   gradientTransform="scale(0.8787489,1.1379815)"
-   x1="-0.42674366"
-   y1="0.98859203"
-   x2="176.71146"
-   y2="0.98859203"
-   gradientUnits="userSpaceOnUse" /><filter
-   id="filter_2-5"><feGaussianBlur
-     stdDeviation="2"
-     id="feGaussianBlur12-8" /></filter><filter
-   id="filter_2-3"><feGaussianBlur
-     stdDeviation="2"
-     id="feGaussianBlur12-2" /></filter><linearGradient
-   inkscape:collect="always"
-   xlink:href="#grad0-4"
-   id="linearGradient189-7"
-   gradientTransform="scale(0.8787489,1.1379815)"
-   x1="-0.42674366"
-   y1="0.98859203"
-   x2="176.71146"
-   y2="0.98859203"
-   gradientUnits="userSpaceOnUse" /><linearGradient
-   inkscape:collect="always"
-   xlink:href="#grad0-4"
-   id="linearGradient500"
-   gradientTransform="matrix(0.8787489,0,0,1.1379815,12.431599,21.739241)"
-   x1="-0.42674366"
-   y1="0.98859203"
-   x2="176.71146"
-   y2="0.98859203"
-   gradientUnits="userSpaceOnUse" /></defs>
-	<defs
-   id="Filters">
-		<filter
-   id="filter_2">
-			<feGaussianBlur
-   stdDeviation="2"
-   id="feGaussianBlur12" />
-		</filter>
-	</defs>
-	<g
-   id="g68"
-   transform="matrix(1,0,0,0.41409874,-12.807629,-5.4621159)">
-		<title
-   id="title16">Page-1</title>
-		<g
-   id="shape18-1"
-   transform="translate(0.749889,-0.75)">
-			<title
-   id="title18">Rounded Rectangle.12</title>
-			<desc
-   id="desc20">Crypto Symmetric Session</desc>
-			<path
-   d="M 19.211599,224.06924 H 160.5716 a 6.77735,6.77735 0 0 0 6.77,-6.77 V 30.019241 a 6.77735,6.77735 0 0 0 -6.77,-6.78 H 19.211599 a 6.77735,6.77735 0 0 0 -6.78,6.78 V 217.29924 a 6.77735,6.77735 0 0 0 6.78,6.77 z"
-   class="st1"
-   id="path22"
-   style="fill:url(#linearGradient500);stroke:#386288;stroke-width:0.75"
-   inkscape:connector-curvature="0" />
-			<text
-   x="63.123039"
-   y="28.531481"
-   class="st2"
-   id="text24"
-   style="font-size:16.97244835px;font-family:Calibri;fill:#386288;stroke-width:1.69723928"
-   transform="scale(0.58919214,1.6972392)">Crypto Symmetric Session</text>
-
-		</g>
-		<g
-   id="shape19-6"
-   transform="translate(10.6711,-9.82087)">
-			<title
-   id="title27">Rounded Rectangle.13</title>
-			<desc
-   id="desc29">Private Session Data</desc>
-		</g>
-		<g
-   id="shape20-12"
-   transform="matrix(1,0,0,2.5278193,23.531375,-309.78186)">
-			<title
-   id="title39">Rounded Rectangle.15</title>
-			<desc
-   id="desc41">void *sess_private_data[]</desc>
-			<path
-   d="m 5.91,202.33 h 123.25 a 5.90925,5.90925 -180 0 0 5.91,-5.9 v -36.37 a 5.90925,5.90925 -180 0 0 -5.91,-5.91 H 5.91 A 5.90925,5.90925 -180 0 0 0,160.06 v 36.37 a 5.90925,5.90925 -180 0 0 5.91,5.9 z"
-   class="st7"
-   id="path43"
-   inkscape:connector-curvature="0"
-   style="fill:#ffffff;stroke:#41719c;stroke-width:0.75" />
-			<text
-   x="14.072042"
-   y="159.1931"
-   class="st6"
-   id="text65"
-   style="font-size:11.41061592px;font-family:Calibri;fill:#41719c;stroke-width:1.14105785"
-   transform="scale(0.92359087,1.0827305)">void *sess_private_data[] <tspan
-   x="-3.5230706"
-   class="st9"
-   id="tspan47"
-   style="font-weight:bold;font-size:9.12843513px;stroke-width:1.14105785" /></text>
-
-		<rect
-   style="fill:none;fill-opacity:1;stroke:#41719c;stroke-width:0.73305672;stroke-opacity:1"
-   id="rect4604"
-   width="15.968175"
-   height="14.230948"
-   x="13.494645"
-   y="181.68814" /><rect
-   style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.73305672;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
-   id="rect4604-7"
-   width="15.968174"
-   height="14.230948"
-   x="29.46282"
-   y="181.68814" /><rect
-   style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.73305672;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
-   id="rect4604-7-6"
-   width="15.968174"
-   height="14.230948"
-   x="45.430992"
-   y="181.68814" /><rect
-   style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.73305672;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
-   id="rect4604-7-6-9"
-   width="15.968174"
-   height="14.230948"
-   x="61.399166"
-   y="181.68814" /><rect
-   style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.73305672;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
-   id="rect4604-7-6-9-8"
-   width="15.968174"
-   height="14.230948"
-   x="77.36734"
-   y="181.68814" /><rect
-   style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.73305672;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
-   id="rect4604-7-6-9-8-9"
-   width="15.968174"
-   height="14.230948"
-   x="93.33551"
-   y="181.68814" /><rect
-   style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.73305672;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
-   id="rect4604-7-6-9-8-9-6"
-   width="15.968174"
-   height="14.230948"
-   x="109.30369"
-   y="181.68814" /><path
-   style="fill:none;fill-opacity:1;stroke:#41719c;stroke-width:0.72427988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
-   d="m 117.64885,196.01764 0.22164,18.77485 44.6966,-0.0725 -0.22163,-20.00716 16.84434,0.43494"
-   id="path5030"
-   inkscape:connector-curvature="0" /></g>
-	</g>
-<g
-   transform="translate(190.70887,-0.53319281)"
-   id="g68-0"><title
-     id="title16-2">Page-1</title><g
-     id="shape18-1-4"
-     transform="matrix(1,0,0,0.57815109,0.749889,-0.11722686)"><title
-   id="title18-4">Rounded Rectangle.12</title><desc
-   id="desc20-6">Crypto Symmetric Session</desc><path
-   inkscape:connector-curvature="0"
-   d="m 6.78,202.33 h 141.36 a 6.77735,6.77735 -180 0 0 6.77,-6.77 V 8.28 A 6.77735,6.77735 -180 0 0 148.14,1.5 H 6.78 A 6.77735,6.77735 -180 0 0 0,8.28 v 187.28 a 6.77735,6.77735 -180 0 0 6.78,6.77 z"
-   class="st1"
-   id="path22-0"
-   style="fill:url(#linearGradient189);stroke:#386288;stroke-width:0.75" /><text
-   x="26.317923"
-   y="17.335487"
-   class="st2"
-   id="text24-5"
-   style="font-size:14.02988338px;font-family:Calibri;fill:#386288;stroke-width:1.40298378"
-   transform="scale(0.71276665,1.4029837)">Crypto Driver Private Session</text>
-
-</g><g
-     id="shape19-6-5"
-     transform="matrix(1.022976,0,0,0.71529071,9.1114734,-39.403506)"><title
-   id="title27-2">Rounded Rectangle.13</title><desc
-   id="desc29-0">Private Session Data</desc><g
-   id="shadow19-7-1"
-   transform="translate(0.345598,1.97279)"
-   class="st3"
-   style="visibility:visible"><path
+	]]></style><defs
+     id="Patterns_And_Gradients"><marker
+       inkscape:isstock="true"
+       style="overflow:visible"
+       id="marker5421"
+       refX="0"
+       refY="0"
+       orient="auto"
+       inkscape:stockid="Arrow2Lend"><path
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         style="fill:#41719c;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+         id="path5419"
+         inkscape:connector-curvature="0" /></marker><marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend"
+       style="overflow:visible"
+       inkscape:isstock="true"><path
+         id="path5004"
+         style="fill:#41719c;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" /></marker><marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Lend"
+       style="overflow:visible"
+       inkscape:isstock="true"><path
+         id="path4986"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" /></marker><linearGradient
+       id="grad0-4"
+       x1="0"
+       y1="0"
+       x2="1"
+       y2="0"
+       gradientTransform="rotate(60,0.5,0.5)"><stop
+         offset="0"
+         stop-color="#e8ebef"
+         stop-opacity="1"
+         id="stop4" /><stop
+         offset="0.24"
+         stop-color="#f4f5f7"
+         stop-opacity="1"
+         id="stop6" /><stop
+         offset="0.54"
+         stop-color="#feffff"
+         stop-opacity="1"
+         id="stop8" /></linearGradient><filter
+       id="filter_2-4"><feGaussianBlur
+         stdDeviation="2"
+         id="feGaussianBlur12-0" /></filter><linearGradient
+       inkscape:collect="always"
+       xlink:href="#grad0-4"
+       id="linearGradient189"
+       gradientTransform="scale(0.8787489,1.1379815)"
+       x1="-0.42674366"
+       y1="0.98859203"
+       x2="176.71146"
+       y2="0.98859203"
+       gradientUnits="userSpaceOnUse" /><filter
+       id="filter_2-5"><feGaussianBlur
+         stdDeviation="2"
+         id="feGaussianBlur12-8" /></filter><filter
+       id="filter_2-3"><feGaussianBlur
+         stdDeviation="2"
+         id="feGaussianBlur12-2" /></filter><linearGradient
+       inkscape:collect="always"
+       xlink:href="#grad0-4"
+       id="linearGradient189-7"
+       gradientTransform="scale(0.8787489,1.1379815)"
+       x1="-0.42674366"
+       y1="0.98859203"
+       x2="176.71146"
+       y2="0.98859203"
+       gradientUnits="userSpaceOnUse" /><linearGradient
+       inkscape:collect="always"
+       xlink:href="#grad0-4"
+       id="linearGradient500"
+       gradientTransform="matrix(0.87785006,0,0,2.0116303,15.940232,20.619826)"
+       x1="-0.42674366"
+       y1="0.98859203"
+       x2="176.71146"
+       y2="0.98859203"
+       gradientUnits="userSpaceOnUse" /></defs><defs
+     id="Filters"><filter
+       id="filter_2"><feGaussianBlur
+         stdDeviation="2"
+         id="feGaussianBlur12" /></filter></defs><g
+     transform="matrix(1,0,0,0.41409874,-12.05774,-5.77269)"
+     id="shape18-1"><title
+       id="title18">Rounded Rectangle.12</title><desc
+       id="desc20">Crypto Symmetric Session</desc><path
+       inkscape:connector-curvature="0"
+       style="fill:url(#linearGradient500);stroke:#386288;stroke-width:0.99665654"
+       id="path22"
+       class="st1"
+       d="M 22.713297,378.28219 H 163.92871 a 6.7704177,11.980443 0 0 0 6.76307,-11.96745 V 35.256532 A 6.7704177,11.980443 0 0 0 163.92871,23.271405 H 22.713297 A 6.7704177,11.980443 0 0 0 15.940232,35.256532 V 366.31474 a 6.7704177,11.980443 0 0 0 6.773065,11.96745 z" /></g><g
+     transform="matrix(1,0,0,0.41409874,-2.136529,-9.5289258)"
+     id="shape19-6"><title
+       id="title27">Rounded Rectangle.13</title><desc
+       id="desc29">Private Session Data</desc></g><g
+     id="g4079"
+     transform="matrix(0.9997031,0,0,1.070998,206.15511,-5.6465883)"><path
+       style="fill:#ffffff;stroke:#41719c;stroke-width:1.15444767"
+       inkscape:connector-curvature="0"
+       id="path43"
+       class="st7"
+       d="m -189.55935,139.62776 h 123.25 a 5.90925,14.000977 0 0 0 5.91,-13.97905 V 39.476089 a 5.90925,14.000977 0 0 0 -5.91,-14.002757 h -123.25 a 5.90925,14.000977 0 0 0 -5.91,14.002757 v 86.172621 a 5.90925,14.000977 0 0 0 5.91,13.97905 z" /><rect
+       y="118.60072"
+       x="-181.11736"
+       height="14.896484"
+       width="15.968175"
+       id="rect4604"
+       style="fill:none;fill-opacity:1;stroke:#41719c;stroke-width:0.75000221;stroke-opacity:1" /><rect
+       y="118.60072"
+       x="-165.14919"
+       height="14.896484"
+       width="15.968174"
+       id="rect4604-7"
+       style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
+       y="118.60072"
+       x="-149.181"
+       height="14.896484"
+       width="15.968174"
+       id="rect4604-7-6"
+       style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
+       y="118.60072"
+       x="-133.21283"
+       height="14.896484"
+       width="15.968174"
+       id="rect4604-7-6-9"
+       style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
+       y="118.60072"
+       x="-117.24466"
+       height="14.896484"
+       width="15.968174"
+       id="rect4604-7-6-9-8"
+       style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
+       y="118.60072"
+       x="-101.27649"
+       height="14.896484"
+       width="15.968174"
+       id="rect4604-7-6-9-8-9"
+       style="font-size:12