[dpdk-dev] [PATCH v2 09/11] cryptodev: support device independent sessions

Pablo de Lara pablo.de.lara.guarch at intel.com
Fri Jun 30 19:09:31 CEST 2017


From: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>

Change crypto device's session management to make it device independent
and simplify architecture when session is intended to be used on more than
one device.

Sessions private data is agnostic to underlying device by adding an
indirection in the sessions private data using the crypto driver identifier.
A single session can contain indirections to multiple device types.

New function rte_cryptodev_sym_session_init has been created,
to initialize the private data per driver to be used on
a same session.

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
---
 app/test-crypto-perf/cperf.h                       |   5 +-
 app/test-crypto-perf/cperf_ops.c                   |  30 +-
 app/test-crypto-perf/cperf_ops.h                   |   1 +
 app/test-crypto-perf/cperf_test_latency.c          |   7 +-
 app/test-crypto-perf/cperf_test_latency.h          |   5 +-
 app/test-crypto-perf/cperf_test_throughput.c       |   7 +-
 app/test-crypto-perf/cperf_test_throughput.h       |   5 +-
 app/test-crypto-perf/cperf_test_verify.c           |   7 +-
 app/test-crypto-perf/cperf_test_verify.h           |   5 +-
 app/test-crypto-perf/main.c                        |  50 +--
 doc/guides/rel_notes/release_17_08.rst             |   6 +-
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c           |  54 ++--
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c       |  28 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  29 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  27 +-
 drivers/crypto/armv8/rte_armv8_pmd.c               |  11 +-
 drivers/crypto/armv8/rte_armv8_pmd_ops.c           |  31 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c        |  53 +++-
 drivers/crypto/kasumi/rte_kasumi_pmd.c             |  16 +-
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c         |  28 +-
 drivers/crypto/null/null_crypto_pmd.c              |  14 +-
 drivers/crypto/null/null_crypto_pmd_ops.c          |  31 +-
 drivers/crypto/openssl/rte_openssl_pmd.c           |  10 +-
 drivers/crypto/openssl/rte_openssl_pmd_ops.c       |  28 +-
 drivers/crypto/qat/qat_crypto.c                    |  68 ++--
 drivers/crypto/qat/qat_crypto.h                    |  12 +-
 drivers/crypto/qat/rte_qat_cryptodev.c             |   1 -
 drivers/crypto/scheduler/scheduler_failover.c      |  45 +--
 .../crypto/scheduler/scheduler_pkt_size_distr.c    |  18 --
 drivers/crypto/scheduler/scheduler_pmd_ops.c       |  87 +++---
 drivers/crypto/scheduler/scheduler_pmd_private.h   |   4 -
 drivers/crypto/scheduler/scheduler_roundrobin.c    |  41 ---
 drivers/crypto/snow3g/rte_snow3g_pmd.c             |  16 +-
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c         |  28 +-
 drivers/crypto/zuc/rte_zuc_pmd.c                   |  15 +-
 drivers/crypto/zuc/rte_zuc_pmd_ops.c               |  28 +-
 examples/ipsec-secgw/ipsec-secgw.c                 |  41 ++-
 examples/ipsec-secgw/ipsec.c                       |   7 +-
 examples/ipsec-secgw/ipsec.h                       |   2 +
 examples/l2fwd-crypto/main.c                       |  74 +++--
 lib/librte_cryptodev/rte_cryptodev.c               | 128 ++++----
 lib/librte_cryptodev/rte_cryptodev.h               |  65 ++--
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  24 +-
 lib/librte_cryptodev/rte_cryptodev_version.map     |   2 +
 test/test/test_cryptodev.c                         | 346 ++++++++++++++-------
 test/test/test_cryptodev_blockcipher.c             |  15 +-
 test/test/test_cryptodev_blockcipher.h             |   1 +
 test/test/test_cryptodev_perf.c                    | 187 +++++++----
 48 files changed, 1071 insertions(+), 672 deletions(-)

diff --git a/app/test-crypto-perf/cperf.h b/app/test-crypto-perf/cperf.h
index 293ba94..c9f7f81 100644
--- a/app/test-crypto-perf/cperf.h
+++ b/app/test-crypto-perf/cperf.h
@@ -41,7 +41,10 @@ struct cperf_options;
 struct cperf_test_vector;
 struct cperf_op_fns;
 
-typedef void  *(*cperf_constructor_t)(uint8_t dev_id, uint16_t qp_id,
+typedef void  *(*cperf_constructor_t)(
+		struct rte_mempool *sess_mp,
+		uint8_t dev_id,
+		uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *t_vec,
 		const struct cperf_op_fns *op_fns);
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index c2c3db5..23bdd70 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -334,14 +334,16 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
 }
 
 static struct rte_cryptodev_sym_session *
-cperf_create_session(uint8_t dev_id,
+cperf_create_session(struct rte_mempool *sess_mp,
+	uint8_t dev_id,
 	const struct cperf_options *options,
 	const struct cperf_test_vector *test_vector)
 {
 	struct rte_crypto_sym_xform cipher_xform;
 	struct rte_crypto_sym_xform auth_xform;
-	struct rte_cryptodev_sym_session *sess = NULL;
+	struct rte_cryptodev_sym_session *sess;
 
+	sess = rte_cryptodev_sym_session_create(sess_mp);
 	/*
 	 * cipher only
 	 */
@@ -362,7 +364,8 @@ cperf_create_session(uint8_t dev_id,
 			cipher_xform.cipher.key.length = 0;
 		}
 		/* create crypto session */
-		sess = rte_cryptodev_sym_session_create(dev_id,	&cipher_xform);
+		rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
+				sess_mp);
 	/*
 	 *  auth only
 	 */
@@ -388,7 +391,8 @@ cperf_create_session(uint8_t dev_id,
 			auth_xform.auth.key.data = NULL;
 		}
 		/* create crypto session */
-		sess =  rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+		rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
+				sess_mp);
 	/*
 	 * cipher and auth
 	 */
@@ -452,29 +456,31 @@ cperf_create_session(uint8_t dev_id,
 					RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
 				cipher_xform.next = &auth_xform;
 				/* create crypto session */
-				sess = rte_cryptodev_sym_session_create(dev_id,
-					&cipher_xform);
+				rte_cryptodev_sym_session_init(dev_id,
+						sess, &cipher_xform, sess_mp);
+
 			} else { /* decrypt */
 				auth_xform.next = &cipher_xform;
 				/* create crypto session */
-				sess = rte_cryptodev_sym_session_create(dev_id,
-					&auth_xform);
+				rte_cryptodev_sym_session_init(dev_id,
+						sess, &auth_xform, sess_mp);
 			}
 		} else { /* create crypto session for other */
 			/* cipher then auth */
 			if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
 				cipher_xform.next = &auth_xform;
 				/* create crypto session */
-				sess = rte_cryptodev_sym_session_create(dev_id,
-						&cipher_xform);
+				rte_cryptodev_sym_session_init(dev_id,
+						sess, &cipher_xform, sess_mp);
 			} else { /* auth then cipher */
 				auth_xform.next = &cipher_xform;
 				/* create crypto session */
-				sess = rte_cryptodev_sym_session_create(dev_id,
-						&auth_xform);
+				rte_cryptodev_sym_session_init(dev_id,
+						sess, &auth_xform, sess_mp);
 			}
 		}
 	}
+
 	return sess;
 }
 
diff --git a/app/test-crypto-perf/cperf_ops.h b/app/test-crypto-perf/cperf_ops.h
index 1b748da..36daf9d 100644
--- a/app/test-crypto-perf/cperf_ops.h
+++ b/app/test-crypto-perf/cperf_ops.h
@@ -41,6 +41,7 @@
 
 
 typedef struct rte_cryptodev_sym_session *(*cperf_sessions_create_t)(
+		struct rte_mempool *sess_mp,
 		uint8_t dev_id, const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector);
 
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index e61ac97..546a960 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -76,7 +76,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx, uint32_t mbuf_nb)
 
 	if (ctx) {
 		if (ctx->sess)
-			rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
+			rte_cryptodev_sym_session_free(ctx->sess);
 
 		if (ctx->mbufs_in) {
 			for (i = 0; i < mbuf_nb; i++)
@@ -187,7 +187,8 @@ cperf_mbuf_create(struct rte_mempool *mempool,
 }
 
 void *
-cperf_latency_test_constructor(uint8_t dev_id, uint16_t qp_id,
+cperf_latency_test_constructor(struct rte_mempool *sess_mp,
+		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		const struct cperf_op_fns *op_fns)
@@ -207,7 +208,7 @@ cperf_latency_test_constructor(uint8_t dev_id, uint16_t qp_id,
 	ctx->options = options;
 	ctx->test_vector = test_vector;
 
-	ctx->sess = op_fns->sess_create(dev_id, options, test_vector);
+	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector);
 	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 6a2cf61..1bbedb4 100644
--- a/app/test-crypto-perf/cperf_test_latency.h
+++ b/app/test-crypto-perf/cperf_test_latency.h
@@ -43,7 +43,10 @@
 #include "cperf_test_vectors.h"
 
 void *
-cperf_latency_test_constructor(uint8_t dev_id, uint16_t qp_id,
+cperf_latency_test_constructor(
+		struct rte_mempool *sess_mp,
+		uint8_t dev_id,
+		uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		const struct cperf_op_fns *ops_fn);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index 61b27ea..df85c67 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -65,7 +65,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx, uint32_t mbuf_nb)
 
 	if (ctx) {
 		if (ctx->sess)
-			rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
+			rte_cryptodev_sym_session_free(ctx->sess);
 
 		if (ctx->mbufs_in) {
 			for (i = 0; i < mbuf_nb; i++)
@@ -175,7 +175,8 @@ cperf_mbuf_create(struct rte_mempool *mempool,
 }
 
 void *
-cperf_throughput_test_constructor(uint8_t dev_id, uint16_t qp_id,
+cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
+		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		const struct cperf_op_fns *op_fns)
@@ -195,7 +196,7 @@ cperf_throughput_test_constructor(uint8_t dev_id, uint16_t qp_id,
 	ctx->options = options;
 	ctx->test_vector = test_vector;
 
-	ctx->sess = op_fns->sess_create(dev_id, options, test_vector);
+	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector);
 	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 f1b5766..987d0c3 100644
--- a/app/test-crypto-perf/cperf_test_throughput.h
+++ b/app/test-crypto-perf/cperf_test_throughput.h
@@ -44,7 +44,10 @@
 
 
 void *
-cperf_throughput_test_constructor(uint8_t dev_id, uint16_t qp_id,
+cperf_throughput_test_constructor(
+		struct rte_mempool *sess_mp,
+		uint8_t dev_id,
+		uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		const struct cperf_op_fns *ops_fn);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 454221e..3c2700f 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -69,7 +69,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx, uint32_t mbuf_nb)
 
 	if (ctx) {
 		if (ctx->sess)
-			rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
+			rte_cryptodev_sym_session_free(ctx->sess);
 
 		if (ctx->mbufs_in) {
 			for (i = 0; i < mbuf_nb; i++)
@@ -179,7 +179,8 @@ cperf_mbuf_create(struct rte_mempool *mempool,
 }
 
 void *
-cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+cperf_verify_test_constructor(struct rte_mempool *sess_mp,
+		uint8_t dev_id, uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		const struct cperf_op_fns *op_fns)
@@ -199,7 +200,7 @@ cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
 	ctx->options = options;
 	ctx->test_vector = test_vector;
 
-	ctx->sess = op_fns->sess_create(dev_id, options, test_vector);
+	ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector);
 	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 3fa78ee..e67b48d 100644
--- a/app/test-crypto-perf/cperf_test_verify.h
+++ b/app/test-crypto-perf/cperf_test_verify.h
@@ -44,7 +44,10 @@
 
 
 void *
-cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+cperf_verify_test_constructor(
+		struct rte_mempool *sess_mp,
+		uint8_t dev_id,
+		uint16_t qp_id,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector,
 		const struct cperf_op_fns *ops_fn);
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 9a22925..9f5c6be 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -46,6 +46,8 @@ const struct cperf_test cperf_testmap[] = {
 		}
 };
 
+static struct rte_mempool *cperf_mempool;
+
 static int
 cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 {
@@ -69,6 +71,30 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 		return -EINVAL;
 	}
 
+	/* Create a mempool shared by all the devices */
+	uint32_t max_sess_size = 0, sess_size;
+
+	for (cdev_id = 0; cdev_id < enabled_cdev_count &&
+			cdev_id < RTE_CRYPTO_MAX_DEVS; cdev_id++) {
+		uint8_t enabled_id = enabled_cdevs[cdev_id];
+		sess_size = rte_cryptodev_get_private_session_size(enabled_id);
+		if (sess_size > max_sess_size)
+			max_sess_size = sess_size;
+	}
+
+	cperf_mempool = rte_mempool_create("sess_mp",
+				NUM_SESSIONS,
+				max_sess_size,
+				SESS_MEMPOOL_CACHE_SIZE,
+				0, NULL, NULL, NULL,
+				NULL, SOCKET_ID_ANY,
+				0);
+
+	if (cperf_mempool == NULL) {
+		printf("Failed to create device session mempool\n");
+		return -ENOMEM;
+	}
+
 	for (cdev_id = 0; cdev_id < enabled_cdev_count &&
 			cdev_id < RTE_CRYPTO_MAX_DEVS; cdev_id++) {
 
@@ -81,28 +107,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 				.nb_descriptors = 2048
 		};
 
-		unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
-			rte_cryptodev_get_private_session_size(enabled_cdevs[cdev_id]);
-
-		char mp_name[RTE_MEMPOOL_NAMESIZE];
-		struct rte_mempool *sess_mp;
-
-		snprintf(mp_name, sizeof(mp_name), "sess_mp_%u", cdev_id);
-		sess_mp = rte_mempool_create(mp_name,
-					NUM_SESSIONS,
-					session_size,
-					SESS_MEMPOOL_CACHE_SIZE,
-					0, NULL, NULL, NULL,
-					NULL, SOCKET_ID_ANY,
-					0);
-
-		if (sess_mp == NULL) {
-			printf("Failed to create device session mempool\n");
-			return -ENOMEM;
-		}
 
 		ret = rte_cryptodev_configure(enabled_cdevs[cdev_id], &conf,
-							sess_mp);
+							cperf_mempool);
 		if (ret < 0) {
 			printf("Failed to configure cryptodev %u",
 					enabled_cdevs[cdev_id]);
@@ -388,7 +395,8 @@ main(int argc, char **argv)
 
 		cdev_id = enabled_cdevs[i];
 
-		ctx[cdev_id] = cperf_testmap[opts.test].constructor(cdev_id, 0,
+		ctx[cdev_id] = cperf_testmap[opts.test].constructor(
+				cperf_mempool, cdev_id, 0,
 				&opts, t_vec, &op_fns);
 		if (ctx[cdev_id] == NULL) {
 			RTE_LOG(ERR, USER1, "Test run constructor failed\n");
diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst
index 6215584..ad1f269 100644
--- a/doc/guides/rel_notes/release_17_08.rst
+++ b/doc/guides/rel_notes/release_17_08.rst
@@ -77,7 +77,9 @@ New Features
 
 * **Updated cryptodev library.**
 
-  Added helper functions for crypto device driver identification.
+  * Added helper functions for crypto device driver identification.
+  * Added support for multi-device sessions, so a single session can be
+    used in multiple drivers.
 
 
 Resolved Issues
@@ -163,6 +165,8 @@ API Changes
   * ``dev_id`` field has been removed from ``rte_cryptodev_sym_session`` structure.
   * ``driver_id`` field has been removed from ``rte_cryptodev_sym_session`` structure.
   * Mempool pointer ``mp`` has been removed from ``rte_cryptodev_sym_session`` structure.
+  * Replaced ``private`` marker with array of pointers to private data sessions
+    ``sess_private_data`` in ``rte_cryptodev_sym_session``
 
 
 ABI Changes
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 2774b4e..2438b55 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -141,27 +141,35 @@ aesni_gcm_set_session_parameters(struct aesni_gcm_session *sess,
 
 /** Get gcm session */
 static struct aesni_gcm_session *
-aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_sym_op *op)
+aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
 {
 	struct aesni_gcm_session *sess = NULL;
 
-	if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
-		sess = (struct aesni_gcm_session *)op->session->_private;
-	} else  {
-		void *_sess;
-
-		if (rte_mempool_get(qp->sess_mp, &_sess))
-			return sess;
+	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
+		if (likely(op->sym->session != NULL)) {
+			sess = (struct aesni_gcm_session *)
+					get_session_private_data(
+					op->sym->session,
+					cryptodev_driver_id);
+		}
+	} else {
+		/* provide internal session */
+		void *_sess = NULL;
 
-		sess = (struct aesni_gcm_session *)
-			((struct rte_cryptodev_sym_session *)_sess)->_private;
+		if (!rte_mempool_get(qp->sess_mp, (void **)&_sess)) {
+			sess = (struct aesni_gcm_session *)_sess;
 
-		if (unlikely(aesni_gcm_set_session_parameters(sess,
-				op->xform) != 0)) {
-			rte_mempool_put(qp->sess_mp, _sess);
-			sess = NULL;
+			if (unlikely(aesni_gcm_set_session_parameters(
+					sess, op->sym->xform) != 0)) {
+				rte_mempool_put(qp->sess_mp, _sess);
+				sess = NULL;
+			}
 		}
 	}
+
+	if (sess == NULL)
+		op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+
 	return sess;
 }
 
@@ -323,17 +331,16 @@ process_gcm_crypto_op(struct rte_crypto_sym_op *op,
  * - Returns NULL on invalid job
  */
 static void
-post_process_gcm_crypto_op(struct rte_crypto_op *op)
+post_process_gcm_crypto_op(struct rte_crypto_op *op,
+		struct aesni_gcm_session *sess)
 {
 	struct rte_mbuf *m = op->sym->m_dst ? op->sym->m_dst : op->sym->m_src;
 
-	struct aesni_gcm_session *session =
-		(struct aesni_gcm_session *)op->sym->session->_private;
-
 	op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
 
+
 	/* Verify digest if required */
-	if (session->op == AESNI_GCM_OP_AUTHENTICATED_DECRYPTION) {
+	if (sess->op == AESNI_GCM_OP_AUTHENTICATED_DECRYPTION) {
 
 		uint8_t *tag = rte_pktmbuf_mtod_offset(m, uint8_t *,
 				m->data_len - op->sym->auth.digest.length);
@@ -365,12 +372,13 @@ post_process_gcm_crypto_op(struct rte_crypto_op *op)
  */
 static void
 handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
-		struct rte_crypto_op *op)
+		struct rte_crypto_op *op, struct aesni_gcm_session *sess)
 {
-	post_process_gcm_crypto_op(op);
+	post_process_gcm_crypto_op(op, sess);
 
 	/* Free session if a session-less crypto op */
 	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) {
+		memset(op->sym->session, 0, sizeof(struct aesni_gcm_session));
 		rte_mempool_put(qp->sess_mp, op->sym->session);
 		op->sym->session = NULL;
 	}
@@ -391,7 +399,7 @@ aesni_gcm_pmd_dequeue_burst(void *queue_pair,
 
 	for (i = 0; i < nb_dequeued; i++) {
 
-		sess = aesni_gcm_get_session(qp, ops[i]->sym);
+		sess = aesni_gcm_get_session(qp, ops[i]);
 		if (unlikely(sess == NULL)) {
 			ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
 			qp->qp_stats.dequeue_err_count++;
@@ -405,7 +413,7 @@ aesni_gcm_pmd_dequeue_burst(void *queue_pair,
 			break;
 		}
 
-		handle_completed_gcm_crypto_op(qp, ops[i]);
+		handle_completed_gcm_crypto_op(qp, ops[i], sess);
 	}
 
 	qp->qp_stats.dequeued_count += i;
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index 721dbda..0b063fd 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -313,21 +313,37 @@ aesni_gcm_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure a aesni gcm session from a crypto xform chain */
-static void *
+static int
 aesni_gcm_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
-		struct rte_crypto_sym_xform *xform,	void *sess)
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
 {
+	void *sess_private_data;
+
 	if (unlikely(sess == NULL)) {
 		GCM_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
 
-	if (aesni_gcm_set_session_parameters(sess, xform) != 0) {
+	if (aesni_gcm_set_session_parameters(sess_private_data, xform) != 0) {
 		GCM_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+			sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index ec348ab..c8ec112 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -348,22 +348,33 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 	struct aesni_mb_session *sess = NULL;
 
 	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
-		sess = (struct aesni_mb_session *)op->sym->session->_private;
-	} else  {
+		if (likely(op->sym->session != NULL))
+			sess = (struct aesni_mb_session *)
+					get_session_private_data(
+					op->sym->session,
+					cryptodev_driver_id);
+	} else {
 		void *_sess = NULL;
+		void *_sess_private_data = NULL;
 
 		if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
 			return NULL;
 
-		sess = (struct aesni_mb_session *)
-			((struct rte_cryptodev_sym_session *)_sess)->_private;
+		if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+			return NULL;
+
+		sess = (struct aesni_mb_session *)_sess_private_data;
 
 		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);
 			sess = NULL;
 		}
 		op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
+		set_session_private_data(op->sym->session, cryptodev_driver_id,
+			_sess_private_data);
+
 	}
 
 	return sess;
@@ -512,7 +523,7 @@ verify_digest(JOB_AES_HMAC *job, struct rte_crypto_op *op) {
  * - Returns NULL on invalid job
  */
 static inline struct rte_crypto_op *
-post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
+post_process_mb_job(JOB_AES_HMAC *job)
 {
 	struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data;
 
@@ -525,7 +536,9 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 
 			if (job->hash_alg != NULL_HASH) {
 				sess = (struct aesni_mb_session *)
-						op->sym->session->_private;
+						get_session_private_data(
+						op->sym->session,
+						cryptodev_driver_id);
 
 				if (sess->auth.operation ==
 						RTE_CRYPTO_AUTH_OP_VERIFY)
@@ -539,7 +552,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
 
 	/* Free session if a session-less crypto op */
 	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) {
-		rte_mempool_put(qp->sess_mp, op->sym->session);
+		rte_cryptodev_sym_session_free(op->sym->session);
 		op->sym->session = NULL;
 	}
 
@@ -564,7 +577,7 @@ handle_completed_jobs(struct aesni_mb_qp *qp, JOB_AES_HMAC *job,
 	unsigned processed_jobs = 0;
 
 	while (job != NULL && processed_jobs < nb_ops) {
-		op = post_process_mb_job(qp, job);
+		op = post_process_mb_job(job);
 
 		if (op) {
 			ops[processed_jobs++] = op;
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 3a2683b..fda8296 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -472,24 +472,39 @@ aesni_mb_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure a aesni multi-buffer session from a crypto xform chain */
-static void *
+static int
 aesni_mb_pmd_session_configure(struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform,	void *sess)
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
 {
+	void *sess_private_data;
 	struct aesni_mb_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		MB_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
 
 	if (aesni_mb_set_session_parameters(&job_ops[internals->vector_mode],
-			sess, xform) != 0) {
+			sess_private_data, xform) != 0) {
 		MB_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+			sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 1ddf6a2..775280a 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -549,18 +549,17 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 
 	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
 		/* get existing session */
-		if (likely(op->sym->session != NULL)) {
+		if (likely(op->sym->session != NULL))
 			sess = (struct armv8_crypto_session *)
-				op->sym->session->_private;
-		}
+					get_session_private_data(
+					op->sym->session,
+					cryptodev_driver_id);
 	} else {
 		/* provide internal session */
 		void *_sess = NULL;
 
 		if (!rte_mempool_get(qp->sess_mp, (void **)&_sess)) {
-			sess = (struct armv8_crypto_session *)
-				((struct rte_cryptodev_sym_session *)_sess)
-				->_private;
+			sess = (struct armv8_crypto_session *)_sess;
 
 			if (unlikely(armv8_crypto_set_session_parameters(
 					sess, op->sym->xform) != 0)) {
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index 2911417..3db420b 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -316,22 +316,37 @@ armv8_crypto_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure the session from a crypto xform chain */
-static void *
-armv8_crypto_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
-		struct rte_crypto_sym_xform *xform, void *sess)
+static int
+armv8_crypto_pmd_session_configure(struct rte_cryptodev *dev,
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
 {
+	void *sess_private_data;
+
 	if (unlikely(sess == NULL)) {
 		ARMV8_CRYPTO_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
 
-	if (armv8_crypto_set_session_parameters(
-			sess, xform) != 0) {
+	if (armv8_crypto_set_session_parameters(sess_private_data, xform) != 0) {
 		ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+			sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 70ad07a..c71b0c7 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -465,7 +465,9 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 			/*Clear the unused FD fields before sending*/
 			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
 			sess = (dpaa2_sec_session *)
-				(*ops)->sym->session->_private;
+					get_session_private_data(
+					(*ops)->sym->session,
+					cryptodev_driver_id);
 			mb_pool = (*ops)->sym->m_src->pool;
 			bpid = mempool_to_bpid(mb_pool);
 			ret = build_sec_fd(sess, *ops, &fd_arr[loop], bpid);
@@ -749,13 +751,6 @@ dpaa2_sec_session_get_size(struct rte_cryptodev *dev __rte_unused)
 	return sizeof(dpaa2_sec_session);
 }
 
-static void
-dpaa2_sec_session_initialize(struct rte_mempool *mp __rte_unused,
-			     void *sess __rte_unused)
-{
-	PMD_INIT_FUNC_TRACE();
-}
-
 static int
 dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
 		      struct rte_crypto_sym_xform *xform,
@@ -1202,18 +1197,14 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
 	return -1;
 }
 
-static void *
-dpaa2_sec_session_configure(struct rte_cryptodev *dev,
+static int
+dpaa2_sec_set_session_parameters(struct rte_cryptodev *dev,
 			    struct rte_crypto_sym_xform *xform,	void *sess)
 {
 	dpaa2_sec_session *session = sess;
 
 	PMD_INIT_FUNC_TRACE();
 
-	if (unlikely(sess == NULL)) {
-		RTE_LOG(ERR, PMD, "invalid session struct");
-		return NULL;
-	}
 	/* Cipher Only */
 	if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER && xform->next == NULL) {
 		session->ctxt_type = DPAA2_SEC_CIPHER;
@@ -1238,10 +1229,39 @@ dpaa2_sec_session_configure(struct rte_cryptodev *dev,
 		dpaa2_sec_aead_init(dev, xform, session);
 	} else {
 		RTE_LOG(ERR, PMD, "Invalid crypto type");
-		return NULL;
+		return -1;
 	}
 
-	return session;
+	return 0;
+}
+
+static int
+dpaa2_sec_session_configure(struct rte_cryptodev *dev,
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
+{
+	void *sess_private_data;
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
+	}
+
+	if (dpaa2_sec_set_session_parameters(dev, xform, sess_private_data) != 0) {
+		PMD_DRV_LOG(ERR, "DPAA2 PMD: failed to configure "
+				"session parameters");
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
+	}
+
+	set_session_private_data(sess, dev->driver_id,
+		sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
@@ -1477,7 +1497,6 @@ static struct rte_cryptodev_ops crypto_ops = {
 	.queue_pair_stop      = dpaa2_sec_queue_pair_stop,
 	.queue_pair_count     = dpaa2_sec_queue_pair_count,
 	.session_get_size     = dpaa2_sec_session_get_size,
-	.session_initialize   = dpaa2_sec_session_initialize,
 	.session_configure    = dpaa2_sec_session_configure,
 	.session_clear        = dpaa2_sec_session_clear,
 };
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 67f0b06..a114542 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -143,17 +143,21 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
 static struct kasumi_session *
 kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
 {
-	struct kasumi_session *sess;
+	struct kasumi_session *sess = NULL;
 
 	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
-		sess = (struct kasumi_session *)op->sym->session->_private;
-	} else  {
-		struct rte_cryptodev_sym_session *c_sess = NULL;
+		if (likely(op->sym->session != NULL))
+			sess = (struct kasumi_session *)
+					get_session_private_data(
+					op->sym->session,
+					cryptodev_driver_id);
+	} else {
+		void *c_sess = NULL;
 
 		if (rte_mempool_get(qp->sess_mp, (void **)&c_sess))
 			return NULL;
 
-		sess = (struct kasumi_session *)c_sess->_private;
+		sess = (struct kasumi_session *)c_sess;
 
 		if (unlikely(kasumi_set_session_parameters(sess,
 				op->sym->xform) != 0))
@@ -297,7 +301,7 @@ process_kasumi_hash_op(struct rte_crypto_op **ops,
 			/* Trim area used for digest from mbuf. */
 			rte_pktmbuf_trim(ops[i]->sym->m_src,
 					ops[i]->sym->auth.digest.length);
-		} else  {
+		} else {
 			dst = ops[i]->sym->auth.digest.data;
 
 			sso_kasumi_f9_1_buffer_user(&session->pKeySched_hash,
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index 343c9b3..d590b91 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -291,21 +291,37 @@ kasumi_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure a KASUMI session from a crypto xform chain */
-static void *
+static int
 kasumi_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
-		struct rte_crypto_sym_xform *xform,	void *sess)
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
 {
+	void *sess_private_data;
+
 	if (unlikely(sess == NULL)) {
 		KASUMI_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
 
-	if (kasumi_set_session_parameters(sess, xform) != 0) {
+	if (kasumi_set_session_parameters(sess_private_data, xform) != 0) {
 		KASUMI_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+		sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9323874..448bbcf 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -94,20 +94,20 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op,
 static struct null_crypto_session *
 get_session(struct null_crypto_qp *qp, struct rte_crypto_sym_op *op)
 {
-	struct null_crypto_session *sess;
+	struct null_crypto_session *sess = NULL;
 
 	if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
-		if (unlikely(op->session == NULL))
-			return NULL;
-
-		sess = (struct null_crypto_session *)op->session->_private;
-	} else  {
+		if (likely(op->session != NULL))
+			sess = (struct null_crypto_session *)
+					get_session_private_data(
+					op->session, cryptodev_driver_id);
+	} else {
 		struct rte_cryptodev_sym_session *c_sess = NULL;
 
 		if (rte_mempool_get(qp->sess_mp, (void **)&c_sess))
 			return NULL;
 
-		sess = (struct null_crypto_session *)c_sess->_private;
+		sess = (struct null_crypto_session *)c_sess;
 
 		if (null_crypto_set_session_parameters(sess, op->xform)	!= 0)
 			return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index a7c891e..04147fe 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -302,24 +302,37 @@ null_crypto_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure a null crypto session from a crypto xform chain */
-static void *
+static int
 null_crypto_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
-		struct rte_crypto_sym_xform *xform, void *sess)
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mp)
 {
-	int retval;
+	void *sess_private_data;
 
 	if (unlikely(sess == NULL)) {
 		NULL_CRYPTO_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mp, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
-	retval = null_crypto_set_session_parameters(
-			(struct null_crypto_session *)sess, xform);
-	if (retval != 0) {
+
+	if (null_crypto_set_session_parameters(sess_private_data, xform) != 0) {
 		NULL_CRYPTO_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mp, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+		sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 3232455..d34cf16 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -452,15 +452,15 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 		/* get existing session */
 		if (likely(op->sym->session != NULL))
 			sess = (struct openssl_session *)
-				op->sym->session->_private;
-	} else  {
+					get_session_private_data(
+					op->sym->session,
+					cryptodev_driver_id);
+	} else {
 		/* provide internal session */
 		void *_sess = NULL;
 
 		if (!rte_mempool_get(qp->sess_mp, (void **)&_sess)) {
-			sess = (struct openssl_session *)
-				((struct rte_cryptodev_sym_session *)_sess)
-				->_private;
+			sess = (struct openssl_session *)_sess;
 
 			if (unlikely(openssl_set_session_parameters(
 					sess, op->sym->xform) != 0)) {
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index f65de53..005855b 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -671,22 +671,38 @@ openssl_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure the session from a crypto xform chain */
-static void *
+static int
 openssl_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
-		struct rte_crypto_sym_xform *xform,	void *sess)
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
 {
+	void *sess_private_data;
+
 	if (unlikely(sess == NULL)) {
 		OPENSSL_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
 
 	if (openssl_set_session_parameters(
-			sess, xform) != 0) {
+			sess_private_data, xform) != 0) {
 		OPENSSL_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+			sess_private_data);
+
+	return 0;
 }
 
 
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 13bd0b5..6e028bb 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -220,7 +220,6 @@ void qat_crypto_sym_clear_session(struct rte_cryptodev *dev,
 		void *session)
 {
 	struct qat_session *sess = session;
-	phys_addr_t cd_paddr;
 
 	PMD_INIT_FUNC_TRACE();
 	if (sess) {
@@ -228,9 +227,7 @@ void qat_crypto_sym_clear_session(struct rte_cryptodev *dev,
 			bpi_cipher_ctx_free(sess->bpi_ctx);
 			sess->bpi_ctx = NULL;
 		}
-		cd_paddr = sess->cd_paddr;
 		memset(sess, 0, qat_crypto_sym_get_session_private_size(dev));
-		sess->cd_paddr = cd_paddr;
 	} else
 		PMD_DRV_LOG(ERR, "NULL session");
 }
@@ -448,9 +445,37 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
 	return NULL;
 }
 
-
-void *
+int
 qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
+{
+	void *sess_private_data;
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
+	}
+
+	if (qat_crypto_set_session_parameters(dev, xform, sess_private_data) != 0) {
+		PMD_DRV_LOG(ERR, "Crypto QAT PMD: failed to configure "
+				"session parameters");
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
+	}
+
+	set_session_private_data(sess, dev->driver_id,
+		sess_private_data);
+
+	return 0;
+}
+
+int
+qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform, void *session_private)
 {
 	struct qat_session *session = session_private;
@@ -458,6 +483,10 @@ qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
 	int qat_cmd_id;
 	PMD_INIT_FUNC_TRACE();
 
+	session->cd_paddr = rte_mempool_virt2phy(NULL, session) +
+			offsetof(struct qat_session, cd);
+
+
 	/* Get requested QAT command id */
 	qat_cmd_id = qat_get_cmd_id(xform);
 	if (qat_cmd_id < 0 || qat_cmd_id >= ICP_QAT_FW_LA_CMD_DELIMITER) {
@@ -498,10 +527,10 @@ qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
 		goto error_out;
 	}
 
-	return session;
+	return 0;
 
 error_out:
-	return NULL;
+	return -1;
 }
 
 struct qat_session *
@@ -809,7 +838,10 @@ qat_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops,
 			rx_op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
 		} else {
 			struct qat_session *sess = (struct qat_session *)
-						(rx_op->sym->session->_private);
+					get_session_private_data(
+					rx_op->sym->session,
+					cryptodev_qat_driver_id);
+
 			if (sess->bpi_ctx)
 				qat_bpicipher_postprocess(sess, rx_op);
 			rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
@@ -914,7 +946,14 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
 		return -EINVAL;
 	}
 
-	ctx = (struct qat_session *)op->sym->session->_private;
+	ctx = (struct qat_session *)get_session_private_data(
+			op->sym->session, cryptodev_qat_driver_id);
+
+	if (unlikely(ctx == NULL)) {
+		PMD_DRV_LOG(ERR, "Session was not created for this device");
+		return -EINVAL;
+	}
+
 	qat_req = (struct icp_qat_fw_la_bulk_req *)out_msg;
 	rte_mov128((uint8_t *)qat_req, (const uint8_t *)&(ctx->fw_req));
 	qat_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op;
@@ -1192,17 +1231,6 @@ static inline uint32_t adf_modulo(uint32_t data, uint32_t shift)
 	return data - mult;
 }
 
-void qat_crypto_sym_session_init(struct rte_mempool *mp, void *sym_sess)
-{
-	struct rte_cryptodev_sym_session *sess = sym_sess;
-	struct qat_session *s = (void *)sess->_private;
-
-	PMD_INIT_FUNC_TRACE();
-	s->cd_paddr = rte_mempool_virt2phy(mp, sess) +
-		offsetof(struct qat_session, cd) +
-		offsetof(struct rte_cryptodev_sym_session, _private);
-}
-
 int qat_dev_config(__rte_unused struct rte_cryptodev *dev,
 		__rte_unused struct rte_cryptodev_config *config)
 {
diff --git a/drivers/crypto/qat/qat_crypto.h b/drivers/crypto/qat/qat_crypto.h
index ed27e3b..d5466c2 100644
--- a/drivers/crypto/qat/qat_crypto.h
+++ b/drivers/crypto/qat/qat_crypto.h
@@ -114,11 +114,15 @@ qat_pmd_session_mempool_create(struct rte_cryptodev *dev,
 extern unsigned
 qat_crypto_sym_get_session_private_size(struct rte_cryptodev *dev);
 
-extern void
-qat_crypto_sym_session_init(struct rte_mempool *mempool, void *priv_sess);
-
-extern void *
+extern int
 qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool);
+
+
+int
+qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform, void *session_private);
 
 struct qat_session *
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1c5ff77..9a710e6 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -73,7 +73,6 @@ static struct rte_cryptodev_ops crypto_qat_ops = {
 		/* Crypto related operations */
 		.session_get_size	= qat_crypto_sym_get_session_private_size,
 		.session_configure	= qat_crypto_sym_configure_session,
-		.session_initialize	= qat_crypto_sym_session_init,
 		.session_clear		= qat_crypto_sym_clear_session
 };
 
diff --git a/drivers/crypto/scheduler/scheduler_failover.c b/drivers/crypto/scheduler/scheduler_failover.c
index 162a29b..2aa13f8 100644
--- a/drivers/crypto/scheduler/scheduler_failover.c
+++ b/drivers/crypto/scheduler/scheduler_failover.c
@@ -49,57 +49,18 @@ struct fo_scheduler_qp_ctx {
 };
 
 static __rte_always_inline uint16_t
-failover_slave_enqueue(struct scheduler_slave *slave, uint8_t slave_idx,
+failover_slave_enqueue(struct scheduler_slave *slave,
 		struct rte_crypto_op **ops, uint16_t nb_ops)
 {
 	uint16_t i, processed_ops;
-	struct rte_cryptodev_sym_session *sessions[nb_ops];
-	struct scheduler_session *sess0, *sess1, *sess2, *sess3;
 
 	for (i = 0; i < nb_ops && i < 4; i++)
 		rte_prefetch0(ops[i]->sym->session);
 
-	for (i = 0; (i < (nb_ops - 8)) && (nb_ops > 8); i += 4) {
-		rte_prefetch0(ops[i + 4]->sym->session);
-		rte_prefetch0(ops[i + 5]->sym->session);
-		rte_prefetch0(ops[i + 6]->sym->session);
-		rte_prefetch0(ops[i + 7]->sym->session);
-
-		sess0 = (struct scheduler_session *)
-				ops[i]->sym->session->_private;
-		sess1 = (struct scheduler_session *)
-				ops[i+1]->sym->session->_private;
-		sess2 = (struct scheduler_session *)
-				ops[i+2]->sym->session->_private;
-		sess3 = (struct scheduler_session *)
-				ops[i+3]->sym->session->_private;
-
-		sessions[i] = ops[i]->sym->session;
-		sessions[i + 1] = ops[i + 1]->sym->session;
-		sessions[i + 2] = ops[i + 2]->sym->session;
-		sessions[i + 3] = ops[i + 3]->sym->session;
-
-		ops[i]->sym->session = sess0->sessions[slave_idx];
-		ops[i + 1]->sym->session = sess1->sessions[slave_idx];
-		ops[i + 2]->sym->session = sess2->sessions[slave_idx];
-		ops[i + 3]->sym->session = sess3->sessions[slave_idx];
-	}
-
-	for (; i < nb_ops; i++) {
-		sess0 = (struct scheduler_session *)
-				ops[i]->sym->session->_private;
-		sessions[i] = ops[i]->sym->session;
-		ops[i]->sym->session = sess0->sessions[slave_idx];
-	}
-
 	processed_ops = rte_cryptodev_enqueue_burst(slave->dev_id,
 			slave->qp_id, ops, nb_ops);
 	slave->nb_inflight_cops += processed_ops;
 
-	if (unlikely(processed_ops < nb_ops))
-		for (i = processed_ops; i < nb_ops; i++)
-			ops[i]->sym->session = sessions[i];
-
 	return processed_ops;
 }
 
@@ -114,11 +75,11 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 		return 0;
 
 	enqueued_ops = failover_slave_enqueue(&qp_ctx->primary_slave,
-			PRIMARY_SLAVE_IDX, ops, nb_ops);
+			ops, nb_ops);
 
 	if (enqueued_ops < nb_ops)
 		enqueued_ops += failover_slave_enqueue(&qp_ctx->secondary_slave,
-				SECONDARY_SLAVE_IDX, &ops[enqueued_ops],
+				&ops[enqueued_ops],
 				nb_ops - enqueued_ops);
 
 	return enqueued_ops;
diff --git a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
index 6b628df..1dd1bc3 100644
--- a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
+++ b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
@@ -67,7 +67,6 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 	struct scheduler_qp_ctx *qp_ctx = qp;
 	struct psd_scheduler_qp_ctx *psd_qp_ctx = qp_ctx->private_qp_ctx;
 	struct rte_crypto_op *sched_ops[NB_PKT_SIZE_SLAVES][nb_ops];
-	struct scheduler_session *sess;
 	uint32_t in_flight_ops[NB_PKT_SIZE_SLAVES] = {
 			psd_qp_ctx->primary_slave.nb_inflight_cops,
 			psd_qp_ctx->secondary_slave.nb_inflight_cops
@@ -97,8 +96,6 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 		rte_prefetch0(ops[i + 7]->sym);
 		rte_prefetch0(ops[i + 7]->sym->session);
 
-		sess = (struct scheduler_session *)
-				ops[i]->sym->session->_private;
 		/* job_len is initialized as cipher data length, once
 		 * it is 0, equals to auth data length
 		 */
@@ -118,11 +115,8 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 		}
 
 		sched_ops[p_enq_op->slave_idx][p_enq_op->pos] = ops[i];
-		ops[i]->sym->session = sess->sessions[p_enq_op->slave_idx];
 		p_enq_op->pos++;
 
-		sess = (struct scheduler_session *)
-				ops[i+1]->sym->session->_private;
 		job_len = ops[i+1]->sym->cipher.data.length;
 		job_len += (ops[i+1]->sym->cipher.data.length == 0) *
 				ops[i+1]->sym->auth.data.length;
@@ -135,11 +129,8 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 		}
 
 		sched_ops[p_enq_op->slave_idx][p_enq_op->pos] = ops[i+1];
-		ops[i+1]->sym->session = sess->sessions[p_enq_op->slave_idx];
 		p_enq_op->pos++;
 
-		sess = (struct scheduler_session *)
-				ops[i+2]->sym->session->_private;
 		job_len = ops[i+2]->sym->cipher.data.length;
 		job_len += (ops[i+2]->sym->cipher.data.length == 0) *
 				ops[i+2]->sym->auth.data.length;
@@ -152,12 +143,8 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 		}
 
 		sched_ops[p_enq_op->slave_idx][p_enq_op->pos] = ops[i+2];
-		ops[i+2]->sym->session = sess->sessions[p_enq_op->slave_idx];
 		p_enq_op->pos++;
 
-		sess = (struct scheduler_session *)
-				ops[i+3]->sym->session->_private;
-
 		job_len = ops[i+3]->sym->cipher.data.length;
 		job_len += (ops[i+3]->sym->cipher.data.length == 0) *
 				ops[i+3]->sym->auth.data.length;
@@ -170,14 +157,10 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 		}
 
 		sched_ops[p_enq_op->slave_idx][p_enq_op->pos] = ops[i+3];
-		ops[i+3]->sym->session = sess->sessions[p_enq_op->slave_idx];
 		p_enq_op->pos++;
 	}
 
 	for (; i < nb_ops; i++) {
-		sess = (struct scheduler_session *)
-				ops[i]->sym->session->_private;
-
 		job_len = ops[i]->sym->cipher.data.length;
 		job_len += (ops[i]->sym->cipher.data.length == 0) *
 				ops[i]->sym->auth.data.length;
@@ -190,7 +173,6 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 		}
 
 		sched_ops[p_enq_op->slave_idx][p_enq_op->pos] = ops[i];
-		ops[i]->sym->session = sess->sessions[p_enq_op->slave_idx];
 		p_enq_op->pos++;
 	}
 
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index b9d8973..6e37efc 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -85,8 +85,10 @@ scheduler_attach_init_slave(struct rte_cryptodev *dev)
 /** Configure device */
 static int
 scheduler_pmd_config(struct rte_cryptodev *dev,
-		struct rte_cryptodev_config *config __rte_unused)
+		struct rte_cryptodev_config *config)
 {
+	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
+	uint32_t i;
 	int ret;
 
 	/* although scheduler_attach_init_slave presents multiple times,
@@ -96,6 +98,15 @@ scheduler_pmd_config(struct rte_cryptodev *dev,
 	if (ret < 0)
 		return ret;
 
+	for (i = 0; i < sched_ctx->nb_slaves; i++) {
+		uint8_t slave_dev_id = sched_ctx->slaves[i].dev_id;
+
+		ret = rte_cryptodev_configure(slave_dev_id, config,
+				dev->data->session_pool);
+		if (ret < 0)
+			break;
+	}
+
 	return ret;
 }
 
@@ -474,67 +485,43 @@ scheduler_pmd_qp_count(struct rte_cryptodev *dev)
 static uint32_t
 scheduler_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 {
-	return sizeof(struct scheduler_session);
-}
-
-static int
-config_slave_sess(struct scheduler_ctx *sched_ctx,
-		struct rte_crypto_sym_xform *xform,
-		struct scheduler_session *sess,
-		uint32_t create)
-{
-	uint32_t i;
+	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
+	uint8_t i = 0;
+	uint32_t max_priv_sess_size = 0;
 
+	/* Check what is the maximum private session size for all slaves */
 	for (i = 0; i < sched_ctx->nb_slaves; i++) {
-		struct scheduler_slave *slave = &sched_ctx->slaves[i];
+		uint8_t slave_dev_id = sched_ctx->slaves[i].dev_id;
+		struct rte_cryptodev *dev = &rte_cryptodevs[slave_dev_id];
+		uint32_t priv_sess_size = (*dev->dev_ops->session_get_size)(dev);
 
-		if (sess->sessions[i]) {
-			if (create)
-				continue;
-			/* !create */
-			sess->sessions[i] = rte_cryptodev_sym_session_free(
-					slave->dev_id, sess->sessions[i]);
-		} else {
-			if (!create)
-				continue;
-			/* create */
-			sess->sessions[i] =
-					rte_cryptodev_sym_session_create(
-							slave->dev_id, xform);
-			if (!sess->sessions[i]) {
-				config_slave_sess(sched_ctx, NULL, sess, 0);
-				return -1;
-			}
-		}
+		if (max_priv_sess_size < priv_sess_size)
+			max_priv_sess_size = priv_sess_size;
 	}
 
-	return 0;
-}
-
-/** Clear the memory of session so it doesn't leave key material behind */
-static void
-scheduler_pmd_session_clear(struct rte_cryptodev *dev,
-	void *sess)
-{
-	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
-
-	config_slave_sess(sched_ctx, NULL, sess, 0);
-
-	memset(sess, 0, sizeof(struct scheduler_session));
+	return max_priv_sess_size;
 }
 
-static void *
+static int
 scheduler_pmd_session_configure(struct rte_cryptodev *dev,
-	struct rte_crypto_sym_xform *xform, void *sess)
+	struct rte_crypto_sym_xform *xform,
+	struct rte_cryptodev_sym_session *sess,
+	struct rte_mempool *mempool)
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
+	uint32_t i;
+
+	for (i = 0; i < sched_ctx->nb_slaves; i++) {
+		struct scheduler_slave *slave = &sched_ctx->slaves[i];
 
-	if (config_slave_sess(sched_ctx, xform, sess, 1) < 0) {
-		CS_LOG_ERR("unabled to config sym session");
-		return NULL;
+		if (rte_cryptodev_sym_session_init(slave->dev_id, sess,
+					xform, mempool) < 0) {
+			CS_LOG_ERR("unabled to config sym session");
+			return -1;
+		}
 	}
 
-	return sess;
+	return 0;
 }
 
 struct rte_cryptodev_ops scheduler_pmd_ops = {
@@ -556,7 +543,7 @@ struct rte_cryptodev_ops scheduler_pmd_ops = {
 
 		.session_get_size	= scheduler_pmd_session_get_size,
 		.session_configure	= scheduler_pmd_session_configure,
-		.session_clear		= scheduler_pmd_session_clear,
+		.session_clear		= NULL,
 };
 
 struct rte_cryptodev_ops *rte_crypto_scheduler_pmd_ops = &scheduler_pmd_ops;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_private.h b/drivers/crypto/scheduler/scheduler_pmd_private.h
index e313a89..639d75a 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_private.h
+++ b/drivers/crypto/scheduler/scheduler_pmd_private.h
@@ -103,10 +103,6 @@ struct scheduler_qp_ctx {
 	uint32_t seqn;
 } __rte_cache_aligned;
 
-struct scheduler_session {
-	struct rte_cryptodev_sym_session *sessions[
-			RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES];
-};
 
 extern uint8_t cryptodev_driver_id;
 
diff --git a/drivers/crypto/scheduler/scheduler_roundrobin.c b/drivers/crypto/scheduler/scheduler_roundrobin.c
index 0116276..4a84728 100644
--- a/drivers/crypto/scheduler/scheduler_roundrobin.c
+++ b/drivers/crypto/scheduler/scheduler_roundrobin.c
@@ -52,8 +52,6 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 	uint32_t slave_idx = rr_qp_ctx->last_enq_slave_idx;
 	struct scheduler_slave *slave = &rr_qp_ctx->slaves[slave_idx];
 	uint16_t i, processed_ops;
-	struct rte_cryptodev_sym_session *sessions[nb_ops];
-	struct scheduler_session *sess0, *sess1, *sess2, *sess3;
 
 	if (unlikely(nb_ops == 0))
 		return 0;
@@ -61,39 +59,6 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 	for (i = 0; i < nb_ops && i < 4; i++)
 		rte_prefetch0(ops[i]->sym->session);
 
-	for (i = 0; (i < (nb_ops - 8)) && (nb_ops > 8); i += 4) {
-		sess0 = (struct scheduler_session *)
-				ops[i]->sym->session->_private;
-		sess1 = (struct scheduler_session *)
-				ops[i+1]->sym->session->_private;
-		sess2 = (struct scheduler_session *)
-				ops[i+2]->sym->session->_private;
-		sess3 = (struct scheduler_session *)
-				ops[i+3]->sym->session->_private;
-
-		sessions[i] = ops[i]->sym->session;
-		sessions[i + 1] = ops[i + 1]->sym->session;
-		sessions[i + 2] = ops[i + 2]->sym->session;
-		sessions[i + 3] = ops[i + 3]->sym->session;
-
-		ops[i]->sym->session = sess0->sessions[slave_idx];
-		ops[i + 1]->sym->session = sess1->sessions[slave_idx];
-		ops[i + 2]->sym->session = sess2->sessions[slave_idx];
-		ops[i + 3]->sym->session = sess3->sessions[slave_idx];
-
-		rte_prefetch0(ops[i + 4]->sym->session);
-		rte_prefetch0(ops[i + 5]->sym->session);
-		rte_prefetch0(ops[i + 6]->sym->session);
-		rte_prefetch0(ops[i + 7]->sym->session);
-	}
-
-	for (; i < nb_ops; i++) {
-		sess0 = (struct scheduler_session *)
-				ops[i]->sym->session->_private;
-		sessions[i] = ops[i]->sym->session;
-		ops[i]->sym->session = sess0->sessions[slave_idx];
-	}
-
 	processed_ops = rte_cryptodev_enqueue_burst(slave->dev_id,
 			slave->qp_id, ops, nb_ops);
 
@@ -102,12 +67,6 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
 	rr_qp_ctx->last_enq_slave_idx += 1;
 	rr_qp_ctx->last_enq_slave_idx %= rr_qp_ctx->nb_slaves;
 
-	/* recover session if enqueue is failed */
-	if (unlikely(processed_ops < nb_ops)) {
-		for (i = processed_ops; i < nb_ops; i++)
-			ops[i]->sym->session = sessions[i];
-	}
-
 	return processed_ops;
 }
 
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 677849d..e1771bb 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -143,17 +143,21 @@ snow3g_set_session_parameters(struct snow3g_session *sess,
 static struct snow3g_session *
 snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
 {
-	struct snow3g_session *sess;
+	struct snow3g_session *sess = NULL;
 
 	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
-		sess = (struct snow3g_session *)op->sym->session->_private;
-	} else  {
-		struct rte_cryptodev_sym_session *c_sess = NULL;
+		if (likely(op->sym->session != NULL))
+			sess = (struct snow3g_session *)
+					get_session_private_data(
+					op->sym->session,
+					cryptodev_driver_id);
+	} else {
+		void *c_sess = NULL;
 
 		if (rte_mempool_get(qp->sess_mp, (void **)&c_sess))
 			return NULL;
 
-		sess = (struct snow3g_session *)c_sess->_private;
+		sess = (struct snow3g_session *)c_sess;
 
 		if (unlikely(snow3g_set_session_parameters(sess,
 				op->sym->xform) != 0))
@@ -286,7 +290,7 @@ process_snow3g_hash_op(struct rte_crypto_op **ops,
 			/* Trim area used for digest from mbuf. */
 			rte_pktmbuf_trim(ops[i]->sym->m_src,
 					ops[i]->sym->auth.digest.length);
-		} else  {
+		} else {
 			dst = ops[i]->sym->auth.digest.data;
 
 			sso_snow3g_f9_1_buffer(&session->pKeySched_hash,
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
index 26cc3e9..1967409 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
@@ -289,21 +289,37 @@ snow3g_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure a SNOW 3G session from a crypto xform chain */
-static void *
+static int
 snow3g_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
-		struct rte_crypto_sym_xform *xform,	void *sess)
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
 {
+	void *sess_private_data;
+
 	if (unlikely(sess == NULL)) {
 		SNOW3G_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
 
-	if (snow3g_set_session_parameters(sess, xform) != 0) {
+	if (snow3g_set_session_parameters(sess_private_data, xform) != 0) {
 		SNOW3G_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+		sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 385e4e5..af90f90 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -142,17 +142,20 @@ zuc_set_session_parameters(struct zuc_session *sess,
 static struct zuc_session *
 zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
 {
-	struct zuc_session *sess;
+	struct zuc_session *sess = NULL;
 
 	if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) {
-		sess = (struct zuc_session *)op->sym->session->_private;
-	} else  {
-		struct rte_cryptodev_sym_session *c_sess = NULL;
+		if (likely(op->sym->session != NULL))
+			sess = (struct zuc_session *)get_session_private_data(
+					op->sym->session,
+					cryptodev_driver_id);
+	} else {
+		void *c_sess = NULL;
 
 		if (rte_mempool_get(qp->sess_mp, (void **)&c_sess))
 			return NULL;
 
-		sess = (struct zuc_session *)c_sess->_private;
+		sess = (struct zuc_session *)c_sess;
 
 		if (unlikely(zuc_set_session_parameters(sess,
 				op->sym->xform) != 0))
@@ -277,7 +280,7 @@ process_zuc_hash_op(struct rte_crypto_op **ops,
 			/* Trim area used for digest from mbuf. */
 			rte_pktmbuf_trim(ops[i]->sym->m_src,
 					ops[i]->sym->auth.digest.length);
-		} else  {
+		} else {
 			dst = (uint32_t *)ops[i]->sym->auth.digest.data;
 
 			sso_zuc_eia3_1_buffer(session->pKey_hash,
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
index 645b80c..cdc783f 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
@@ -289,21 +289,37 @@ zuc_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
 }
 
 /** Configure a ZUC session from a crypto xform chain */
-static void *
+static int
 zuc_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
-		struct rte_crypto_sym_xform *xform,	void *sess)
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_mempool *mempool)
 {
+	void *sess_private_data;
+
 	if (unlikely(sess == NULL)) {
 		ZUC_LOG_ERR("invalid session struct");
-		return NULL;
+		return -1;
+	}
+
+	if (rte_mempool_get(mempool, &sess_private_data)) {
+		CDEV_LOG_ERR(
+			"Couldn't get object from session mempool");
+		return -1;
 	}
 
-	if (zuc_set_session_parameters(sess, xform) != 0) {
+	if (zuc_set_session_parameters(sess_private_data, xform) != 0) {
 		ZUC_LOG_ERR("failed configure session parameters");
-		return NULL;
+
+		/* Return session to mempool */
+		rte_mempool_put(mempool, sess_private_data);
+		return -1;
 	}
 
-	return sess;
+	set_session_private_data(sess, dev->driver_id,
+		sess_private_data);
+
+	return 0;
 }
 
 /** Clear the memory of session so it doesn't leave key material behind */
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a2286fd..708eadd 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -710,10 +710,12 @@ main_loop(__attribute__((unused)) void *dummy)
 	qconf->inbound.sp6_ctx = socket_ctx[socket_id].sp_ip6_in;
 	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->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;
 
 	if (qconf->nb_rx_queue == 0) {
 		RTE_LOG(INFO, IPSEC, "lcore %u has nothing to do\n", lcore_id);
@@ -1238,6 +1240,13 @@ cryptodevs_init(void)
 
 	printf("lcore/cryptodev/qp mappings:\n");
 
+	uint32_t max_sess_sz = 0, sess_sz;
+	for (cdev_id = 0; cdev_id < rte_cryptodev_count(); cdev_id++) {
+		sess_sz = rte_cryptodev_get_private_session_size(cdev_id);
+		if (sess_sz > max_sess_sz)
+			max_sess_sz = sess_sz;
+	}
+
 	idx = 0;
 	/* Start from last cdev id to give HW priority */
 	for (cdev_id = rte_cryptodev_count() - 1; cdev_id >= 0; cdev_id--) {
@@ -1267,27 +1276,31 @@ cryptodevs_init(void)
 		dev_conf.socket_id = rte_cryptodev_socket_id(cdev_id);
 		dev_conf.nb_queue_pairs = qp;
 
-		char mp_name[RTE_MEMPOOL_NAMESIZE];
-		struct rte_mempool *sess_mp;
-
-		unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
-			rte_cryptodev_get_private_session_size(cdev_id);
+		if (!socket_ctx[dev_conf.socket_id].session_pool) {
+			char mp_name[RTE_MEMPOOL_NAMESIZE];
+			struct rte_mempool *sess_mp;
 
-		snprintf(mp_name, sizeof(mp_name), "sess_mp_%u", cdev_id);
-		sess_mp = rte_mempool_create(mp_name,
+			snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+					"sess_mp_%u", dev_conf.socket_id);
+			sess_mp = rte_mempool_create(mp_name,
 					CDEV_MP_NB_OBJS,
-					session_size,
+					max_sess_sz,
 					CDEV_MP_CACHE_SZ,
 					0, NULL, NULL, NULL,
 					NULL, dev_conf.socket_id,
 					0);
-
-		if (sess_mp == NULL) {
-			printf("Failed to create device session mempool\n");
-			return -ENOMEM;
+			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;
 		}
 
-		if (rte_cryptodev_configure(cdev_id, &dev_conf, sess_mp))
+		if (rte_cryptodev_configure(cdev_id, &dev_conf,
+				socket_ctx[dev_conf.socket_id].session_pool))
 			rte_panic("Failed to initialize cryptodev %u\n",
 					cdev_id);
 
@@ -1451,7 +1464,7 @@ main(int32_t argc, char **argv)
 
 	nb_lcores = rte_lcore_count();
 
-	/* Replicate each contex per socket */
+	/* Replicate each context per socket */
 	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
 		if (rte_lcore_is_enabled(lcore_id) == 0)
 			continue;
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 048e441..c927344 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -45,7 +45,7 @@
 #include "esp.h"
 
 static inline int
-create_session(struct ipsec_ctx *ipsec_ctx __rte_unused, struct ipsec_sa *sa)
+create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 {
 	struct rte_cryptodev_info cdev_info;
 	unsigned long cdev_id_qp = 0;
@@ -72,7 +72,10 @@ create_session(struct ipsec_ctx *ipsec_ctx __rte_unused, struct ipsec_sa *sa)
 			ipsec_ctx->tbl[cdev_id_qp].qp);
 
 	sa->crypto_session = rte_cryptodev_sym_session_create(
-			ipsec_ctx->tbl[cdev_id_qp].id, sa->xforms);
+			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);
 
 	rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id, &cdev_info);
 	if (cdev_info.sym.max_nb_sessions_per_qp > 0) {
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 1d63161..593b0a2 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -139,6 +139,7 @@ struct ipsec_ctx {
 	uint16_t nb_qps;
 	uint16_t last_qp;
 	struct cdev_qp tbl[MAX_QP_PER_LCORE];
+	struct rte_mempool *session_pool;
 };
 
 struct cdev_key {
@@ -157,6 +158,7 @@ struct socket_ctx {
 	struct rt_ctx *rt_ip4;
 	struct rt_ctx *rt_ip6;
 	struct rte_mempool *mbuf_pool;
+	struct rte_mempool *session_pool;
 };
 
 struct cnt_blk {
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index c3c6f45..20f28d5 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -88,9 +88,8 @@ enum cdev_type {
 #define MAX_KEY_SIZE 128
 #define MAX_PKT_BURST 32
 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
-
-#define NUM_SESSIONS 2048
-#define SESS_MEMPOOL_CACHE_SIZE 64
+#define MAX_SESSIONS 32
+#define SESSION_POOL_CACHE_SIZE 0
 
 /*
  * Configurable number of RX/TX ring descriptors
@@ -226,6 +225,7 @@ static const struct rte_eth_conf port_conf = {
 
 struct rte_mempool *l2fwd_pktmbuf_pool;
 struct rte_mempool *l2fwd_crypto_op_pool;
+struct rte_mempool *l2fwd_session_pool;
 
 /* Per-port statistics struct */
 struct l2fwd_port_statistics {
@@ -589,9 +589,9 @@ generate_random_key(uint8_t *key, unsigned length)
 		rte_exit(EXIT_FAILURE, "Failed to generate random key\n");
 }
 
-static struct rte_cryptodev_sym_session *
+static int
 initialize_crypto_session(struct l2fwd_crypto_options *options,
-		uint8_t cdev_id)
+		uint8_t cdev_id, struct rte_cryptodev_sym_session *sess)
 {
 	struct rte_crypto_sym_xform *first_xform;
 
@@ -608,12 +608,14 @@ initialize_crypto_session(struct l2fwd_crypto_options *options,
 	}
 
 	/* Setup Cipher Parameters */
-	return rte_cryptodev_sym_session_create(cdev_id, first_xform);
+	return rte_cryptodev_sym_session_init(cdev_id, sess, first_xform,
+			l2fwd_session_pool);
 }
 
 static void
 l2fwd_crypto_options_print(struct l2fwd_crypto_options *options);
 
+
 /* main processing loop */
 static void
 l2fwd_main_loop(struct l2fwd_crypto_options *options)
@@ -629,6 +631,7 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
 			US_PER_S * BURST_TX_DRAIN_US;
 	struct l2fwd_crypto_params *cparams;
 	struct l2fwd_crypto_params port_cparams[qconf->nb_crypto_devs];
+	struct rte_cryptodev_sym_session *session;
 
 	if (qconf->nb_rx_ports == 0) {
 		RTE_LOG(INFO, L2FWD, "lcore %u has nothing to do\n", lcore_id);
@@ -644,6 +647,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
 			portid);
 	}
 
+	session = rte_cryptodev_sym_session_create(l2fwd_session_pool);
+
 	for (i = 0; i < qconf->nb_crypto_devs; i++) {
 		port_cparams[i].do_cipher = 0;
 		port_cparams[i].do_hash = 0;
@@ -701,11 +706,12 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
 			port_cparams[i].cipher_algo = options->cipher_xform.cipher.algo;
 		}
 
-		port_cparams[i].session = initialize_crypto_session(options,
-				port_cparams[i].dev_id);
+		port_cparams[i].session = session;
 
-		if (port_cparams[i].session == NULL)
+		if (initialize_crypto_session(options, port_cparams[i].dev_id,
+				port_cparams[i].session) < 0)
 			return;
+
 		RTE_LOG(INFO, L2FWD, " -- lcoreid=%u cryptoid=%u\n", lcore_id,
 				port_cparams[i].dev_id);
 	}
@@ -1554,6 +1560,8 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 	enum rte_crypto_cipher_algorithm cap_cipher_algo;
 	enum rte_crypto_cipher_algorithm opt_cipher_algo;
 	int retval;
+	uint32_t max_sess_sz = 0, sess_sz;
+	char mp_name[RTE_MEMPOOL_NAMESIZE];
 
 	cdev_count = rte_cryptodev_count();
 	if (cdev_count == 0) {
@@ -1561,6 +1569,29 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		return -1;
 	}
 
+	for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
+		sess_sz = rte_cryptodev_get_private_session_size(cdev_id);
+		if (sess_sz > max_sess_sz)
+			max_sess_sz = sess_sz;
+	}
+
+	snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "sess_mp_%u", rte_socket_id());
+	l2fwd_session_pool = rte_mempool_create(mp_name,
+				MAX_SESSIONS * cdev_count,
+				max_sess_sz,
+				SESSION_POOL_CACHE_SIZE,
+				0, NULL, NULL, NULL,
+				NULL, rte_socket_id(),
+				0);
+
+	if (l2fwd_session_pool == NULL) {
+		printf("Failed to create session mempool on socket %u\n",
+				rte_socket_id());
+		return -ENOMEM;
+	}
+
+	printf("Allocated session mempool on socket %u\n", rte_socket_id());
+
 	for (cdev_id = 0; cdev_id < cdev_count && enabled_cdev_count < nb_ports;
 			cdev_id++) {
 		struct rte_cryptodev_qp_conf qp_conf;
@@ -1796,27 +1827,8 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 						cap->sym.auth.digest_size.min;
 		}
 
-		unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
-			rte_cryptodev_get_private_session_size(enabled_cdevs[cdev_id]);
-
-		char mp_name[RTE_MEMPOOL_NAMESIZE];
-		struct rte_mempool *sess_mp;
-
-		snprintf(mp_name, sizeof(mp_name), "sess_mp_%u", cdev_id);
-		sess_mp = rte_mempool_create(mp_name,
-					NUM_SESSIONS,
-					session_size,
-					SESS_MEMPOOL_CACHE_SIZE,
-					0, NULL, NULL, NULL,
-					NULL, SOCKET_ID_ANY,
-					0);
-
-		if (sess_mp == NULL) {
-			printf("Failed to create device session mempool\n");
-			return -ENOMEM;
-		}
-
-		retval = rte_cryptodev_configure(cdev_id, &conf, sess_mp);
+		retval = rte_cryptodev_configure(cdev_id, &conf,
+				l2fwd_session_pool);
 		if (retval < 0) {
 			printf("Failed to configure cryptodev %u", cdev_id);
 			return -1;
@@ -1825,7 +1837,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 		qp_conf.nb_descriptors = 2048;
 
 		retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
-				SOCKET_ID_ANY);
+				rte_socket_id());
 		if (retval < 0) {
 			printf("Failed to setup queue pair %u on cryptodev %u",
 					0, cdev_id);
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index cc42c25..f5a72de 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -69,6 +69,8 @@
 #include "rte_cryptodev.h"
 #include "rte_cryptodev_pmd.h"
 
+static uint8_t nb_drivers;
+
 struct rte_cryptodev rte_crypto_devices[RTE_CRYPTO_MAX_DEVS];
 
 struct rte_cryptodev *rte_cryptodevs = &rte_crypto_devices[0];
@@ -1018,54 +1020,47 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
 	rte_spinlock_unlock(&rte_cryptodev_cb_lock);
 }
 
-
-static void
-rte_cryptodev_sym_session_init(struct rte_mempool *mp,
-		struct rte_cryptodev *dev,
-		struct rte_cryptodev_sym_session *sess)
+int
+rte_cryptodev_sym_session_init(uint8_t dev_id,
+		struct rte_cryptodev_sym_session *sess,
+		struct rte_crypto_sym_xform *xforms,
+		struct rte_mempool *mp)
 {
-	memset(sess, 0, mp->elt_size);
+	struct rte_cryptodev *dev;
+	uint8_t index;
 
-	if (dev->dev_ops->session_initialize)
-		(*dev->dev_ops->session_initialize)(mp, sess);
-}
+	dev = rte_cryptodev_pmd_get_dev(dev_id);
 
+	if (sess == NULL || xforms == NULL || dev == NULL)
+		return -1;
 
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(uint8_t dev_id,
-		struct rte_crypto_sym_xform *xform)
-{
-	struct rte_cryptodev *dev;
-	struct rte_cryptodev_sym_session *sess;
-	void *_sess;
+	index = dev->driver_id;
 
-	if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
-		CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
-		return NULL;
+	if (sess->sess_private_data[index] == NULL) {
+		if (dev->dev_ops->session_configure(dev, xforms, sess, mp) < 0) {
+			CDEV_LOG_ERR(
+				"dev_id %d failed to configure session details",
+				dev_id);
+			return -1;
+		}
 	}
 
-	dev = &rte_crypto_devices[dev_id];
+	return 0;
+}
+
+struct rte_cryptodev_sym_session *
+rte_cryptodev_sym_session_create(struct rte_mempool *mp)
+{
+	struct rte_cryptodev_sym_session *sess;
 
 	/* Allocate a session structure from the session pool */
-	if (rte_mempool_get(dev->data->session_pool, &_sess)) {
-		CDEV_LOG_ERR("Couldn't get object from session mempool");
+	if (rte_mempool_get(mp, (void *)&sess)) {
+		CDEV_LOG_ERR("couldn't get object from session mempool");
 		return NULL;
 	}
 
-	sess = _sess;
-
-	rte_cryptodev_sym_session_init(dev->data->session_pool, dev,
-					sess);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->session_configure, NULL);
-	if (dev->dev_ops->session_configure(dev, xform, sess->_private) ==
-			NULL) {
-		CDEV_LOG_ERR("dev_id %d failed to configure session details",
-				dev_id);
-
-		/* Return session to mempool */
-		rte_mempool_put(dev->data->session_pool, _sess);
-		return NULL;
-	}
+	/* Clear device session pointer */
+	memset(sess, 0, (sizeof(void *) * nb_drivers));
 
 	return sess;
 }
@@ -1085,7 +1080,10 @@ rte_cryptodev_queue_pair_attach_sym_session(uint8_t dev_id, uint16_t qp_id,
 
 	/* The API is optional, not returning error if driver do not suuport */
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_attach_session, 0);
-	if (dev->dev_ops->qp_attach_session(dev, qp_id, sess->_private)) {
+
+	void *sess_priv = get_session_private_data(sess, dev->driver_id);
+
+	if (dev->dev_ops->qp_attach_session(dev, qp_id, sess_priv)) {
 		CDEV_LOG_ERR("dev_id %d failed to attach qp: %d with session",
 				dev_id, qp_id);
 		return -EPERM;
@@ -1109,7 +1107,10 @@ rte_cryptodev_queue_pair_detach_sym_session(uint8_t dev_id, uint16_t qp_id,
 
 	/* The API is optional, not returning error if driver do not suuport */
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_detach_session, 0);
-	if (dev->dev_ops->qp_detach_session(dev, qp_id, sess->_private)) {
+
+	void *sess_priv = get_session_private_data(sess, dev->driver_id);
+
+	if (dev->dev_ops->qp_detach_session(dev, qp_id, sess_priv)) {
 		CDEV_LOG_ERR("dev_id %d failed to detach qp: %d from session",
 				dev_id, qp_id);
 		return -EPERM;
@@ -1117,34 +1118,45 @@ rte_cryptodev_queue_pair_detach_sym_session(uint8_t dev_id, uint16_t qp_id,
 
 	return 0;
 }
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_free(uint8_t dev_id,
-		struct rte_cryptodev_sym_session *sess)
+void
+rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
 {
-	struct rte_cryptodev *dev;
+	uint8_t i;
+	struct rte_mempool *sess_mp;
 
-	if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
-		CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
-		return sess;
-	}
+	if (sess == NULL)
+		return;
 
-	dev = &rte_crypto_devices[dev_id];
+	void *sess_priv;
 
-	/* Let device implementation clear session material */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->session_clear, sess);
-	dev->dev_ops->session_clear(dev, (void *)sess->_private);
+	for (i = 0; i < nb_drivers; i++) {
+		if (sess->sess_private_data[i] != NULL) {
+			sess_priv = get_session_private_data(sess, i);
+			sess_mp = rte_mempool_from_obj(sess_priv);
+			rte_mempool_put(sess_mp, sess_priv);
+		}
+	}
 
 	/* Return session to mempool */
-	struct rte_mempool *mp = rte_mempool_from_obj(sess);
-	rte_mempool_put(mp, (void *)sess);
+	sess_mp = rte_mempool_from_obj(sess);
+	rte_mempool_put(sess_mp, sess);
+}
 
-	return NULL;
+unsigned int
+rte_cryptodev_get_header_session_size(void)
+{
+	/*
+	 * Header contains pointers to the private data
+	 * of all registered drivers
+	 */
+	return (sizeof(void *) * nb_drivers);
 }
 
 unsigned int
 rte_cryptodev_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))
@@ -1157,6 +1169,14 @@ rte_cryptodev_get_private_session_size(uint8_t dev_id)
 
 	priv_sess_size = (*dev->dev_ops->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;
 
 }
@@ -1272,8 +1292,6 @@ struct cryptodev_driver {
 	uint8_t id;
 };
 
-static uint8_t nb_drivers;
-
 int
 rte_cryptodev_driver_id_get(const char *name)
 {
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 044a4aa..2204982 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -797,50 +797,59 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 /** Cryptodev symmetric crypto session */
 struct rte_cryptodev_sym_session {
 	RTE_STD_C11
-	__extension__ char _private[0];
+	__extension__ void *sess_private_data[0];
 	/**< Private session material */
 };
 
 
 /**
- * Initialise a session for symmetric cryptographic operations.
+ * Create symmetric crypto session (generic with no private data)
  *
- * This function is used by the client to initialize immutable
- * parameters of symmetric cryptographic operation.
- * To perform the operation the rte_cryptodev_enqueue_burst function is
- * used.  Each mbuf should contain a reference to the session
- * pointer returned from this function contained within it's crypto_op if a
- * session-based operation is being provisioned. Memory to contain the session
- * information is allocated from within mempool managed by the cryptodev.
- *
- * The rte_cryptodev_session_free must be called to free allocated
- * memory when the session is no longer required.
+ * @param   mempool    Symmetric session mempool to allocate session
+ *                     objects from
+ * @return
+ *  - On success return pointer to sym-session
+ *  - On failure returns NULL
+ */
+struct rte_cryptodev_sym_session *
+rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
+
+/**
+ * Frees symmetric crypto session and all related device type specific
+ * private data objects associated with session
  *
- * @param	dev_id		The device identifier.
- * @param	xform		Crypto transform chain.
+ * @param   session  Session where the private data will be attached to
+ */
+void
+rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *session);
 
+/**
+ * Fill out private data for the device id, based on its device type
+ *
+ * @param   dev_id   ID of device that we want the session to be used on
+ * @param   sess     Session where the private data will be attached to
+ * @param   xforms   Symmetric crypto transform operations to apply on flow
+ *                   processed with this session
+ * @param   mempool  Mempool where the private data is allocated.
  *
  * @return
- *  Pointer to the created session or NULL
+ *  - On success, zero.
+ *  - On failure, a negative value.
  */
-extern struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(uint8_t dev_id,
-		struct rte_crypto_sym_xform *xform);
+int
+rte_cryptodev_sym_session_init(uint8_t dev_id,
+			struct rte_cryptodev_sym_session *sess,
+			struct rte_crypto_sym_xform *xforms,
+			struct rte_mempool *mempool);
 
 /**
- * Free the memory associated with a previously allocated session.
- *
- * @param	dev_id		The device identifier.
- * @param	session		Session pointer previously allocated by
- *				*rte_cryptodev_sym_session_create*.
+ * Get the size of the header session, for all registered drivers.
  *
  * @return
- *   NULL on successful freeing of session.
- *   Session pointer on failure to free session.
+ *   Size of the header session.
  */
-extern struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_free(uint8_t dev_id,
-		struct rte_cryptodev_sym_session *session);
+unsigned int
+rte_cryptodev_get_header_session_size(void);
 
 /**
  * Get the size of the private session data for a device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 5911b83..959a8ae 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -285,13 +285,16 @@ typedef void (*cryptodev_sym_initialize_session_t)(struct rte_mempool *mempool,
  * @param	dev		Crypto device pointer
  * @param	xform		Single or chain of crypto xforms
  * @param	priv_sess	Pointer to cryptodev's private session structure
+ * @param	mp		Mempool where the private session is allocated
  *
  * @return
- *  - Returns private session structure on success.
- *  - Returns NULL on failure.
+ *  - Returns 0 if private session structure have been created successfully.
+ *  - Returns -1 on failure.
  */
-typedef void * (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform, void *session_private);
+typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
+		struct rte_crypto_sym_xform *xform,
+		struct rte_cryptodev_sym_session *session,
+		struct rte_mempool *mp);
 
 /**
  * Free Crypto session.
@@ -413,6 +416,19 @@ void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
 int
 rte_cryptodev_pmd_create_dev_name(char *name, const char *dev_name_prefix);
 
+static inline void *
+get_session_private_data(struct rte_cryptodev_sym_session *sess,
+		uint8_t driver_id) {
+	return sess->sess_private_data[driver_id];
+}
+
+static inline void
+set_session_private_data(struct rte_cryptodev_sym_session *sess,
+		uint8_t driver_id, void *private_data)
+{
+	sess->sess_private_data[driver_id] = private_data;
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 8855a34..c117c4f 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -65,9 +65,11 @@ DPDK_17.08 {
 	rte_cryptodev_device_count_by_driver;
 	rte_cryptodev_driver_id_get;
 	rte_cryptodev_driver_name_get;
+	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
 	rte_cryptodev_pci_generic_probe;
 	rte_cryptodev_pci_generic_remove;
+	rte_cryptodev_sym_session_init;
 	rte_cryptodev_vdev_parse_init_params;
 	rte_cryptodev_vdev_pmd_init;
 
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 3979145..9d08eb8 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -67,7 +67,6 @@ struct crypto_testsuite_params {
 	struct rte_mempool *large_mbuf_pool;
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
-	struct rte_mempool *slave_session_mpool;
 	struct rte_cryptodev_config conf;
 	struct rte_cryptodev_qp_conf qp_conf;
 
@@ -384,12 +383,15 @@ testsuite_setup(void)
 	ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
 	ts_params->conf.socket_id = SOCKET_ID_ANY;
 
-	unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
-		rte_cryptodev_get_private_session_size(dev_id);
+	unsigned int session_size = rte_cryptodev_get_private_session_size(dev_id);
 
+	/*
+	 * Create mempool with maximum number of sessions * 2,
+	 * to include the session headers
+	 */
 	ts_params->session_mpool = rte_mempool_create(
 				"test_sess_mp",
-				info.sym.max_nb_sessions,
+				info.sym.max_nb_sessions * 2,
 				session_size,
 				0, 0, NULL, NULL, NULL,
 				NULL, SOCKET_ID_ANY,
@@ -432,11 +434,10 @@ testsuite_teardown(void)
 	}
 
 	/* Free session mempools */
-	if (ts_params->session_mpool != NULL)
+	if (ts_params->session_mpool != NULL) {
 		rte_mempool_free(ts_params->session_mpool);
-
-	if (ts_params->slave_session_mpool != NULL)
-		rte_mempool_free(ts_params->slave_session_mpool);
+		ts_params->session_mpool = NULL;
+	}
 }
 
 static int
@@ -487,8 +488,7 @@ ut_teardown(void)
 
 	/* free crypto session structure */
 	if (ut_params->sess) {
-		rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
-				ut_params->sess);
+		rte_cryptodev_sym_session_free(ut_params->sess);
 		ut_params->sess = NULL;
 	}
 
@@ -1271,10 +1271,13 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
 	ut_params->auth_xform.auth.key.data = hmac_sha1_key;
 	ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
 
-	/* Create crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0],
-			&ut_params->cipher_xform);
+			ts_params->session_mpool);
+
+	/* Create crypto session*/
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+			ut_params->sess, &ut_params->cipher_xform,
+			ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate crypto op data structure */
@@ -1496,7 +1499,9 @@ test_AES_cipheronly_mb_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
 		BLKCIPHER_AES_CIPHERONLY_TYPE);
@@ -1513,7 +1518,9 @@ test_AES_docsis_mb_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
 		BLKCIPHER_AES_DOCSIS_TYPE);
@@ -1530,7 +1537,9 @@ test_AES_docsis_qat_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
 		BLKCIPHER_AES_DOCSIS_TYPE);
@@ -1547,7 +1556,9 @@ test_DES_docsis_qat_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
 		BLKCIPHER_DES_DOCSIS_TYPE);
@@ -1564,7 +1575,9 @@ test_authonly_mb_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
 		BLKCIPHER_AUTHONLY_TYPE);
@@ -1581,7 +1594,9 @@ test_AES_chain_mb_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
 		BLKCIPHER_AES_CHAIN_TYPE);
@@ -1600,7 +1615,9 @@ test_AES_cipheronly_scheduler_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
 		BLKCIPHER_AES_CIPHERONLY_TYPE);
@@ -1617,7 +1634,9 @@ test_AES_chain_scheduler_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
 		BLKCIPHER_AES_CHAIN_TYPE);
@@ -1634,7 +1653,9 @@ test_authonly_scheduler_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
 		BLKCIPHER_AUTHONLY_TYPE);
@@ -1653,7 +1674,9 @@ test_AES_chain_openssl_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
 		BLKCIPHER_AES_CHAIN_TYPE);
@@ -1670,7 +1693,9 @@ test_AES_cipheronly_openssl_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
 		BLKCIPHER_AES_CIPHERONLY_TYPE);
@@ -1687,7 +1712,9 @@ test_AES_chain_qat_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
 		BLKCIPHER_AES_CHAIN_TYPE);
@@ -1704,7 +1731,9 @@ test_AES_cipheronly_qat_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
 		BLKCIPHER_AES_CIPHERONLY_TYPE);
@@ -1721,7 +1750,9 @@ test_AES_chain_dpaa2_sec_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
 		BLKCIPHER_AES_CHAIN_TYPE);
@@ -1738,7 +1769,9 @@ test_AES_cipheronly_dpaa2_sec_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
 		BLKCIPHER_AES_CIPHERONLY_TYPE);
@@ -1755,7 +1788,9 @@ test_authonly_openssl_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
 		BLKCIPHER_AUTHONLY_TYPE);
@@ -1772,7 +1807,9 @@ test_AES_chain_armv8_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)),
 		BLKCIPHER_AES_CHAIN_TYPE);
@@ -1792,6 +1829,7 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 {
 	uint8_t hash_key[key_len];
 
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
 	memcpy(hash_key, key, key_len);
@@ -1808,8 +1846,12 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 	ut_params->auth_xform.auth.key.data = hash_key;
 	ut_params->auth_xform.auth.digest_length = auth_len;
 	ut_params->auth_xform.auth.add_auth_data_length = aad_len;
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->auth_xform);
+
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
+	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+			&ut_params->auth_xform, ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -1822,6 +1864,7 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 {
 	uint8_t cipher_key[key_len];
 
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
 	memcpy(cipher_key, key, key_len);
@@ -1835,12 +1878,14 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 	ut_params->cipher_xform.cipher.key.data = cipher_key;
 	ut_params->cipher_xform.cipher.key.length = key_len;
 
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
 	TEST_HEXDUMP(stdout, "key:", key, key_len);
 
 	/* Create Crypto session */
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-						&ut_params->
-						cipher_xform);
+	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+			&ut_params->cipher_xform, ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -1951,6 +1996,7 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 {
 	uint8_t cipher_auth_key[key_len];
 
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
 	memcpy(cipher_auth_key, key, key_len);
@@ -1976,11 +2022,14 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 	ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
 	ut_params->cipher_xform.cipher.key.length = key_len;
 
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
 	TEST_HEXDUMP(stdout, "key:", key, key_len);
 
 	/* Create Crypto session*/
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->cipher_xform);
+	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+				&ut_params->cipher_xform, ts_params->session_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -1998,6 +2047,7 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 	uint8_t cipher_auth_key[key_len];
 
 	struct crypto_unittest_params *ut_params = &unittest_params;
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	const uint8_t *key = tdata->key.data;
 	const uint8_t aad_len = tdata->aad.len;
 	const uint8_t auth_len = tdata->digest.len;
@@ -2025,11 +2075,14 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 	ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
 	ut_params->cipher_xform.cipher.key.length = key_len;
 
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
 	TEST_HEXDUMP(stdout, "key:", key, key_len);
 
 	/* Create Crypto session*/
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->cipher_xform);
+	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+				&ut_params->cipher_xform, ts_params->session_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
@@ -2056,6 +2109,7 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 {
 	uint8_t auth_cipher_key[key_len];
 
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
 	memcpy(auth_cipher_key, key, key_len);
@@ -2078,11 +2132,14 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 	ut_params->cipher_xform.cipher.key.data = auth_cipher_key;
 	ut_params->cipher_xform.cipher.key.length = key_len;
 
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
 	TEST_HEXDUMP(stdout, "key:", key, key_len);
 
 	/* Create Crypto session*/
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->auth_xform);
+	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+				&ut_params->auth_xform, ts_params->session_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -4696,7 +4753,9 @@ test_3DES_chain_qat_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
 		BLKCIPHER_3DES_CHAIN_TYPE);
@@ -4713,7 +4772,9 @@ test_DES_cipheronly_qat_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
 		BLKCIPHER_DES_CIPHERONLY_TYPE);
@@ -4730,7 +4791,9 @@ test_DES_docsis_openssl_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
 		BLKCIPHER_DES_DOCSIS_TYPE);
@@ -4747,7 +4810,9 @@ test_3DES_chain_dpaa2_sec_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
 		BLKCIPHER_3DES_CHAIN_TYPE);
@@ -4764,7 +4829,9 @@ test_3DES_cipheronly_dpaa2_sec_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
 		BLKCIPHER_3DES_CIPHERONLY_TYPE);
@@ -4781,7 +4848,9 @@ test_3DES_cipheronly_qat_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
 		BLKCIPHER_3DES_CIPHERONLY_TYPE);
@@ -4798,7 +4867,9 @@ test_3DES_chain_openssl_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
 		BLKCIPHER_3DES_CHAIN_TYPE);
@@ -4815,7 +4886,9 @@ test_3DES_cipheronly_openssl_all(void)
 	int status;
 
 	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool, ts_params->valid_devs[0],
+		ts_params->op_mpool,
+		ts_params->session_mpool,
+		ts_params->valid_devs[0],
 		rte_cryptodev_driver_id_get(
 		RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
 		BLKCIPHER_3DES_CIPHERONLY_TYPE);
@@ -4835,6 +4908,7 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
 {
 	uint8_t cipher_key[key_len];
 
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
 	memcpy(cipher_key, key, key_len);
@@ -4862,16 +4936,19 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
 	ut_params->auth_xform.auth.key.length = 0;
 	ut_params->auth_xform.auth.key.data = NULL;
 
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
 	if (op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
 		ut_params->cipher_xform.next = &ut_params->auth_xform;
 
 		/* Create Crypto session*/
-		ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->cipher_xform);
+		rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+				&ut_params->cipher_xform, ts_params->session_mpool);
 	} else {/* Create Crypto session*/
 		ut_params->auth_xform.next = &ut_params->cipher_xform;
-		ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->auth_xform);
+		rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+				&ut_params->auth_xform, ts_params->session_mpool);
 	}
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
@@ -5769,7 +5846,11 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
 	ut_params->auth_xform.auth.key.data = key;
 
 	ut_params->sess = rte_cryptodev_sym_session_create(
-		ts_params->valid_devs[0], &ut_params->auth_xform);
+			ts_params->session_mpool);
+
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+			ut_params->sess, &ut_params->auth_xform,
+			ts_params->session_mpool);
 
 	if (ut_params->sess == NULL)
 		return TEST_FAILED;
@@ -5945,9 +6026,13 @@ test_multi_session(void)
 
 	/* Create multiple crypto sessions*/
 	for (i = 0; i < dev_info.sym.max_nb_sessions; i++) {
+
 		sessions[i] = rte_cryptodev_sym_session_create(
-				ts_params->valid_devs[0],
-			&ut_params->auth_xform);
+				ts_params->session_mpool);
+
+		rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+				sessions[i], &ut_params->auth_xform,
+				ts_params->session_mpool);
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
 				i);
@@ -5983,14 +6068,14 @@ test_multi_session(void)
 	}
 
 	/* Next session create should fail */
-	sessions[i] = rte_cryptodev_sym_session_create(ts_params->valid_devs[0],
-			&ut_params->auth_xform);
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+			sessions[i], &ut_params->auth_xform,
+			ts_params->session_mpool);
 	TEST_ASSERT_NULL(sessions[i],
 			"Session creation succeeded unexpectedly!");
 
 	for (i = 0; i < dev_info.sym.max_nb_sessions; i++)
-		rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
-				sessions[i]);
+		rte_cryptodev_sym_session_free(sessions[i]);
 
 	rte_free(sessions);
 
@@ -6048,6 +6133,9 @@ test_multi_session_random_usage(void)
 					* dev_info.sym.max_nb_sessions) + 1, 0);
 
 	for (i = 0; i < MB_SESSION_NUMBER; i++) {
+		sessions[i] = rte_cryptodev_sym_session_create(
+				ts_params->session_mpool);
+
 		rte_memcpy(&ut_paramz[i].ut_params, &testsuite_params,
 				sizeof(struct crypto_unittest_params));
 
@@ -6056,9 +6144,11 @@ test_multi_session_random_usage(void)
 				ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
 
 		/* Create multiple crypto sessions*/
-		sessions[i] = rte_cryptodev_sym_session_create(
+		rte_cryptodev_sym_session_init(
 				ts_params->valid_devs[0],
-				&ut_paramz[i].ut_params.auth_xform);
+				sessions[i],
+				&ut_paramz[i].ut_params.auth_xform,
+				ts_params->session_mpool);
 
 		TEST_ASSERT_NOT_NULL(sessions[i],
 				"Session creation failed at session number %u",
@@ -6102,8 +6192,7 @@ test_multi_session_random_usage(void)
 	}
 
 	for (i = 0; i < MB_SESSION_NUMBER; i++)
-		rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
-				sessions[i]);
+		rte_cryptodev_sym_session_free(sessions[i]);
 
 	rte_free(sessions);
 
@@ -6127,9 +6216,14 @@ test_null_cipher_only_operation(void)
 	ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
 	ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 
-	/* Create Crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0], &ut_params->cipher_xform);
+			ts_params->session_mpool);
+
+	/* Create Crypto session*/
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+				ut_params->sess,
+				&ut_params->cipher_xform,
+				ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6184,9 +6278,13 @@ test_null_auth_only_operation(void)
 	ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
 	ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
 
-	/* Create Crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0], &ut_params->auth_xform);
+			ts_params->session_mpool);
+
+	/* Create Crypto session*/
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+			ut_params->sess, &ut_params->auth_xform,
+			ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6240,9 +6338,13 @@ test_null_cipher_auth_operation(void)
 	ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
 	ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
 
-	/* Create Crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0], &ut_params->cipher_xform);
+			ts_params->session_mpool);
+
+	/* Create Crypto session*/
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+			ut_params->sess, &ut_params->cipher_xform,
+			ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6306,9 +6408,13 @@ test_null_auth_cipher_operation(void)
 	ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
 	ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
 
-	/* Create Crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0], &ut_params->cipher_xform);
+			ts_params->session_mpool);
+
+	/* Create Crypto session*/
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+			ut_params->sess, &ut_params->cipher_xform,
+			ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	/* Generate Crypto op data structure */
@@ -6354,6 +6460,7 @@ test_null_invalid_operation(void)
 {
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
+	int ret;
 
 	/* Setup Cipher Parameters */
 	ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -6362,10 +6469,14 @@ test_null_invalid_operation(void)
 	ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
 	ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 
-	/* Create Crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0], &ut_params->cipher_xform);
-	TEST_ASSERT_NULL(ut_params->sess,
+			ts_params->session_mpool);
+
+	/* 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);
+	TEST_ASSERT(ret == -1,
 			"Session creation succeeded unexpectedly");
 
 
@@ -6376,10 +6487,14 @@ test_null_invalid_operation(void)
 	ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
 	ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
 
-	/* Create Crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0], &ut_params->auth_xform);
-	TEST_ASSERT_NULL(ut_params->sess,
+			ts_params->session_mpool);
+
+	/* 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);
+	TEST_ASSERT(ret == -1,
 			"Session creation succeeded unexpectedly");
 
 	return TEST_SUCCESS;
@@ -6413,9 +6528,13 @@ test_null_burst_operation(void)
 	ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
 	ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
 
-	/* Create Crypto session*/
 	ut_params->sess = rte_cryptodev_sym_session_create(
-			ts_params->valid_devs[0], &ut_params->cipher_xform);
+			ts_params->session_mpool);
+
+	/* Create Crypto session*/
+	rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+			ut_params->sess, &ut_params->cipher_xform,
+			ts_params->session_mpool);
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
@@ -6556,6 +6675,7 @@ static int create_gmac_session(uint8_t dev_id,
 {
 	uint8_t cipher_key[tdata->key.len];
 
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
 	memcpy(cipher_key, tdata->key.data, tdata->key.len);
@@ -6580,8 +6700,12 @@ static int create_gmac_session(uint8_t dev_id,
 
 	ut_params->cipher_xform.next = &ut_params->auth_xform;
 
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-			&ut_params->cipher_xform);
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
+	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+			&ut_params->cipher_xform,
+			ts_params->session_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -6911,6 +7035,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
 		const struct test_crypto_vector *reference,
 		enum rte_crypto_auth_operation auth_op)
 {
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	uint8_t auth_key[reference->auth_key.len + 1];
 
 	memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -6925,9 +7050,13 @@ create_auth_session(struct crypto_unittest_params *ut_params,
 	ut_params->auth_xform.auth.digest_length = reference->digest.len;
 	ut_params->auth_xform.auth.add_auth_data_length = reference->aad.len;
 
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
 	/* Create Crypto session*/
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->auth_xform);
+	 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+				&ut_params->auth_xform,
+				ts_params->session_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -6941,6 +7070,7 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
 		enum rte_crypto_auth_operation auth_op,
 		enum rte_crypto_cipher_operation cipher_op)
 {
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	uint8_t cipher_key[reference->cipher_key.len + 1];
 	uint8_t auth_key[reference->auth_key.len + 1];
 
@@ -6966,9 +7096,13 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
 	ut_params->cipher_xform.cipher.key.data = cipher_key;
 	ut_params->cipher_xform.cipher.key.length = reference->cipher_key.len;
 
+	ut_params->sess = rte_cryptodev_sym_session_create(
+			ts_params->session_mpool);
+
 	/* Create Crypto session*/
-	ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
-				&ut_params->auth_xform);
+	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+				&ut_params->auth_xform,
+				ts_params->session_mpool);
 
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
@@ -7860,30 +7994,32 @@ test_scheduler_attach_slave_op(void)
 			continue;
 
 		/*
-		 * Create a separate mempool for the slaves, as they need different
-		 * session size and then configure them to store the pointer
-		 * to this mempool
+		 * Create the session mempool again, since now there are new devices
+		 * to use the mempool.
 		 */
-		unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
-			rte_cryptodev_get_private_session_size(i);
-
-		if (ts_params->slave_session_mpool == NULL) {
-			ts_params->slave_session_mpool = rte_mempool_create(
-				"test_slave_sess_mp",
-				info.sym.max_nb_sessions,
-				session_size,
-				0, 0, NULL, NULL, NULL, NULL,
-				SOCKET_ID_ANY, 0);
+		if (ts_params->session_mpool) {
+			rte_mempool_free(ts_params->session_mpool);
+			ts_params->session_mpool = NULL;
+		}
+		unsigned int session_size = rte_cryptodev_get_private_session_size(i);
 
-			TEST_ASSERT_NOT_NULL(ts_params->slave_session_mpool,
+		/*
+		 * Create mempool with maximum number of sessions * 2,
+		 * to include the session headers
+		 */
+		if (ts_params->session_mpool == NULL) {
+			ts_params->session_mpool = rte_mempool_create(
+					"test_sess_mp",
+					info.sym.max_nb_sessions * 2,
+					session_size,
+					0, 0, NULL, NULL, NULL,
+					NULL, SOCKET_ID_ANY,
+					0);
+
+			TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
 					"session mempool allocation failed");
 		}
 
-		TEST_ASSERT_SUCCESS(rte_cryptodev_configure(i,
-				&ts_params->conf, ts_params->slave_session_mpool),
-				"Failed to configure cryptodev %u with %u qps",
-				i, ts_params->conf.nb_queue_pairs);
-
 		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 4bc370d..b2e600f 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -52,6 +52,7 @@ static int
 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,
 	uint8_t dev_id,
 	int driver_id,
 	char *test_msg)
@@ -64,8 +65,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 	struct rte_crypto_sym_xform *init_xform = NULL;
 	struct rte_crypto_sym_op *sym_op = NULL;
 	struct rte_crypto_op *op = NULL;
-	struct rte_cryptodev_sym_session *sess = NULL;
 	struct rte_cryptodev_info dev_info;
+	struct rte_cryptodev_sym_session *sess = NULL;
 
 	int status = TEST_SUCCESS;
 	const struct blockcipher_test_data *tdata = t->test_data;
@@ -349,8 +350,10 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 
 	/* create session for sessioned op */
 	if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
-		sess = rte_cryptodev_sym_session_create(dev_id,
-			init_xform);
+		sess = rte_cryptodev_sym_session_create(sess_mpool);
+
+		rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
+				sess_mpool);
 		if (!sess) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
@@ -448,7 +451,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 		else
 			auth_res = pktmbuf_mtod_offset(iobuf,
 					tdata->ciphertext.len);
-
 		if (memcmp(auth_res, tdata->digest.data, digest_len)) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__, "Generated "
@@ -577,7 +579,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 error_exit:
 	if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
 		if (sess)
-			rte_cryptodev_sym_session_free(dev_id, sess);
+			rte_cryptodev_sym_session_free(sess);
 		if (cipher_xform)
 			rte_free(cipher_xform);
 		if (auth_xform)
@@ -599,6 +601,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
+	struct rte_mempool *sess_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type)
@@ -690,7 +693,7 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			continue;
 
 		status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
-			dev_id, driver_id, test_msg);
+			sess_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 22fb420..22b8d20 100644
--- a/test/test/test_cryptodev_blockcipher.h
+++ b/test/test/test_cryptodev_blockcipher.h
@@ -125,6 +125,7 @@ struct blockcipher_test_data {
 int
 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 	struct rte_mempool *op_mpool,
+	struct rte_mempool *sess_mpool,
 	uint8_t dev_id,
 	int driver_id,
 	enum blockcipher_test_type test_type);
diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c
index 526be82..68c5fdd 100644
--- a/test/test/test_cryptodev_perf.c
+++ b/test/test/test_cryptodev_perf.c
@@ -50,7 +50,7 @@
 struct crypto_testsuite_params {
 	struct rte_mempool *mbuf_mp;
 	struct rte_mempool *op_mpool;
-	struct rte_mempool *session_mpool;
+	struct rte_mempool *sess_mp;
 
 	uint16_t nb_queue_pairs;
 
@@ -100,6 +100,8 @@ struct symmetric_session_attrs {
 	uint32_t digest_len;
 };
 
+static struct rte_cryptodev_sym_session *test_crypto_session;
+
 #define ALIGN_POW2_ROUNDUP(num, align) \
 	(((num) + (align) - 1) & ~((align) - 1))
 
@@ -148,17 +150,17 @@ struct crypto_unittest_params {
 	uint8_t *digest;
 };
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
 		enum rte_crypto_cipher_algorithm cipher_algo,
 		unsigned int cipher_key_len,
 		enum rte_crypto_auth_algorithm auth_algo);
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
 		enum rte_crypto_cipher_algorithm cipher_algo,
 		unsigned int cipher_key_len,
 		enum rte_crypto_auth_algorithm auth_algo);
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
 		enum rte_crypto_cipher_algorithm cipher_algo,
 		unsigned int cipher_key_len,
@@ -399,7 +401,7 @@ testsuite_setup(void)
 	unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
 		rte_cryptodev_get_private_session_size(ts_params->dev_id);
 
-	ts_params->session_mpool = rte_mempool_create(
+	ts_params->sess_mp = rte_mempool_create(
 				"test_sess_mp_perf",
 				info.sym.max_nb_sessions,
 				session_size,
@@ -407,11 +409,11 @@ testsuite_setup(void)
 				NULL, SOCKET_ID_ANY,
 				0);
 
-	TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+	TEST_ASSERT_NOT_NULL(ts_params->sess_mp,
 			"session mempool allocation failed");
 
 	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id,
-			&ts_params->conf, ts_params->session_mpool),
+			&ts_params->conf, ts_params->sess_mp),
 			"Failed to configure cryptodev %u",
 			ts_params->dev_id);
 
@@ -441,8 +443,10 @@ testsuite_teardown(void)
 		RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_OP POOL count %u\n",
 		rte_mempool_avail_count(ts_params->op_mpool));
 	/* Free session mempool */
-	if (ts_params->session_mpool != NULL)
-		rte_mempool_free(ts_params->session_mpool);
+	if (ts_params->sess_mp != NULL) {
+		rte_mempool_free(ts_params->sess_mp);
+		ts_params->sess_mp = NULL;
+	}
 
 }
 
@@ -476,8 +480,7 @@ ut_teardown(void)
 
 	/* free crypto session structure */
 	if (ut_params->sess)
-		rte_cryptodev_sym_session_free(ts_params->dev_id,
-				ut_params->sess);
+		rte_cryptodev_sym_session_free(ut_params->sess);
 
 	/* free crypto operation structure */
 	if (ut_params->op)
@@ -1956,10 +1959,13 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
 	ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256;
 
 	/* Create Crypto session*/
-	ut_params->sess = rte_cryptodev_sym_session_create(ts_params->dev_id,
-		&ut_params->cipher_xform);
 
-	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+	test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
+
+	rte_cryptodev_sym_session_init(ts_params->dev_id, test_crypto_session,
+			&ut_params->cipher_xform, ts_params->sess_mp);
+
+	TEST_ASSERT_NOT_NULL(test_crypto_session, "Session creation failed");
 
 	/* Generate Crypto op data structure(s) */
 	for (i = 0; i < num_to_submit ; i++) {
@@ -1981,7 +1987,7 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
 				rte_crypto_op_alloc(ts_params->op_mpool,
 						RTE_CRYPTO_OP_TYPE_SYMMETRIC);
 
-		rte_crypto_op_attach_sym_session(op, ut_params->sess);
+		rte_crypto_op_attach_sym_session(op, test_crypto_session);
 
 		op->sym->auth.digest.data = ut_params->digest;
 		op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
@@ -2099,9 +2105,12 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
 	}
 
 	/* Create Crypto session*/
-	sess = test_perf_create_snow3g_session(ts_params->dev_id,
+	if (test_perf_create_snow3g_session(ts_params->dev_id,
 			pparams->chain, pparams->cipher_algo,
-			pparams->cipher_key_length, pparams->auth_algo);
+			pparams->cipher_key_length, pparams->auth_algo) == 0)
+		sess = test_crypto_session;
+	else
+		sess = NULL;
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate Crypto op data structure(s)*/
@@ -2197,7 +2206,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
 		rte_pktmbuf_free(c_ops[i]->sym->m_src);
 		rte_crypto_op_free(c_ops[i]);
 	}
-	rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
+	rte_cryptodev_sym_session_free(sess);
 
 	return TEST_SUCCESS;
 }
@@ -2278,9 +2287,13 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
 	}
 
 	/* Create Crypto session*/
-	sess = test_perf_create_openssl_session(ts_params->dev_id,
+	if (test_perf_create_openssl_session(ts_params->dev_id,
 			pparams->chain, pparams->cipher_algo,
-			pparams->cipher_key_length, pparams->auth_algo);
+			pparams->cipher_key_length, pparams->auth_algo) == 0)
+		sess = test_crypto_session;
+	else
+		sess = NULL;
+
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate Crypto op data structure(s)*/
@@ -2401,7 +2414,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
 		rte_pktmbuf_free(c_ops[i]->sym->m_src);
 		rte_crypto_op_free(c_ops[i]);
 	}
-	rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
+	rte_cryptodev_sym_session_free(sess);
 
 	return TEST_SUCCESS;
 }
@@ -2430,9 +2443,12 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
 	}
 
 	/* Create Crypto session*/
-	sess = test_perf_create_armv8_session(ts_params->dev_id,
+	if (test_perf_create_armv8_session(ts_params->dev_id,
 			pparams->chain, pparams->cipher_algo,
-			pparams->cipher_key_length, pparams->auth_algo);
+			pparams->cipher_key_length, pparams->auth_algo) == 0)
+		sess = test_crypto_session;
+	else
+		sess = NULL;
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate Crypto op data structure(s)*/
@@ -2644,12 +2660,13 @@ static uint8_t snow3g_hash_key[] = {
 		0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
 };
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
 		enum rte_crypto_cipher_algorithm cipher_algo,
 		unsigned cipher_key_len,
 		enum rte_crypto_auth_algorithm auth_algo)
 {
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct rte_crypto_sym_xform cipher_xform = { 0 };
 	struct rte_crypto_sym_xform auth_xform = { 0 };
 
@@ -2671,33 +2688,42 @@ test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
 		auth_xform.auth.digest_length =
 					get_auth_digest_length(auth_algo);
 	}
+
+	test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
 	switch (chain) {
 	case CIPHER_HASH:
 		cipher_xform.next = &auth_xform;
 		auth_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&cipher_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &cipher_xform,
+				ts_params->sess_mp);
 	case HASH_CIPHER:
 		auth_xform.next = &cipher_xform;
 		cipher_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&auth_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &auth_xform,
+				ts_params->sess_mp);
 	case CIPHER_ONLY:
 		cipher_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&cipher_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &cipher_xform,
+				ts_params->sess_mp);
 	default:
-		return NULL;
+		return -1;
 	}
 }
 
 #define SNOW3G_CIPHER_IV_LENGTH 16
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
 		enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len,
 		enum rte_crypto_auth_algorithm auth_algo)
 {
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct rte_crypto_sym_xform cipher_xform = {0};
 	struct rte_crypto_sym_xform auth_xform = {0};
 
@@ -2720,36 +2746,46 @@ test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
 	auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
 	auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
 
+	test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
 	switch (chain) {
 	case CIPHER_HASH:
 		cipher_xform.next = &auth_xform;
 		auth_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&cipher_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &cipher_xform,
+				ts_params->sess_mp);
 	case HASH_CIPHER:
 		auth_xform.next = &cipher_xform;
 		cipher_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&auth_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &auth_xform,
+				ts_params->sess_mp);
 	case CIPHER_ONLY:
 		cipher_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &cipher_xform,
+				ts_params->sess_mp);
 	case HASH_ONLY:
 		auth_xform.next = NULL;
 		/* Create Crypto session */
-		return rte_cryptodev_sym_session_create(dev_id,	&auth_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &auth_xform,
+				ts_params->sess_mp);
 	default:
-		return NULL;
+		return -1;
 	}
 }
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
 		enum rte_crypto_cipher_algorithm cipher_algo,
 		unsigned int cipher_key_len,
 		enum rte_crypto_auth_algorithm auth_algo)
 {
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct rte_crypto_sym_xform cipher_xform = { 0 };
 	struct rte_crypto_sym_xform auth_xform = { 0 };
 
@@ -2769,7 +2805,7 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
 		cipher_xform.cipher.key.data = aes_key;
 		break;
 	default:
-		return NULL;
+		return -1;
 	}
 
 	cipher_xform.cipher.key.length = cipher_key_len;
@@ -2787,34 +2823,40 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
 		auth_xform.auth.key.data = NULL;
 		break;
 	default:
-		return NULL;
+		return -1;
 	}
 
 	auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
 	auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
 
+	test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
 	switch (chain) {
 	case CIPHER_HASH:
 		cipher_xform.next = &auth_xform;
 		auth_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&cipher_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &cipher_xform,
+				ts_params->sess_mp);
 	case HASH_CIPHER:
 		auth_xform.next = &cipher_xform;
 		cipher_xform.next = NULL;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&auth_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &auth_xform,
+				ts_params->sess_mp);
 	default:
-		return NULL;
+		return -1;
 	}
 }
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
 		enum rte_crypto_cipher_algorithm cipher_algo,
 		unsigned int cipher_key_len,
 		enum rte_crypto_auth_algorithm auth_algo)
 {
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct rte_crypto_sym_xform cipher_xform = { 0 };
 	struct rte_crypto_sym_xform auth_xform = { 0 };
 
@@ -2827,7 +2869,7 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
 		cipher_xform.cipher.key.data = aes_cbc_128_key;
 		break;
 	default:
-		return NULL;
+		return -1;
 	}
 
 	cipher_xform.cipher.key.length = cipher_key_len;
@@ -2839,6 +2881,8 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
 
 	auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
 
+	rte_cryptodev_sym_session_create(ts_params->sess_mp);
+
 	switch (chain) {
 	case CIPHER_HASH:
 		cipher_xform.next = &auth_xform;
@@ -2846,16 +2890,20 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
 		/* Encrypt and hash the result */
 		cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&cipher_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &cipher_xform,
+				ts_params->sess_mp);
 	case HASH_CIPHER:
 		auth_xform.next = &cipher_xform;
 		cipher_xform.next = NULL;
 		/* Hash encrypted message and decrypt */
 		cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
 		/* Create Crypto session*/
-		return rte_cryptodev_sym_session_create(dev_id,	&auth_xform);
+		return rte_cryptodev_sym_session_init(dev_id,
+				test_crypto_session, &auth_xform,
+				ts_params->sess_mp);
 	default:
-		return NULL;
+		return -1;
 	}
 }
 
@@ -3123,9 +3171,12 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
 	}
 
 	/* Create Crypto session*/
-	sess = test_perf_create_aes_sha_session(ts_params->dev_id,
+	if (test_perf_create_aes_sha_session(ts_params->dev_id,
 			pparams->chain, pparams->cipher_algo,
-			pparams->cipher_key_length, pparams->auth_algo);
+			pparams->cipher_key_length, pparams->auth_algo) == 0)
+		sess = test_crypto_session;
+	else
+		sess = NULL;
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate a burst of crypto operations */
@@ -3221,7 +3272,7 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
 
 	for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
 		rte_pktmbuf_free(mbufs[i]);
-	rte_cryptodev_sym_session_free(dev_id, sess);
+	rte_cryptodev_sym_session_free(sess);
 
 	printf("\n");
 	return TEST_SUCCESS;
@@ -3257,9 +3308,12 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
 	}
 
 	/* Create Crypto session*/
-	sess = test_perf_create_snow3g_session(ts_params->dev_id,
+	if (test_perf_create_snow3g_session(ts_params->dev_id,
 			pparams->chain, pparams->cipher_algo,
-			pparams->cipher_key_length, pparams->auth_algo);
+			pparams->cipher_key_length, pparams->auth_algo) == 0)
+		sess = test_crypto_session;
+	else
+		sess = NULL;
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate a burst of crypto operations */
@@ -3386,7 +3440,7 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
 
 	for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
 		rte_pktmbuf_free(mbufs[i]);
-	rte_cryptodev_sym_session_free(dev_id, sess);
+	rte_cryptodev_sym_session_free(sess);
 
 	printf("\n");
 	return TEST_SUCCESS;
@@ -3443,9 +3497,12 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
 	}
 
 	/* Create Crypto session*/
-	sess = test_perf_create_openssl_session(ts_params->dev_id,
+	if (test_perf_create_openssl_session(ts_params->dev_id,
 			pparams->chain, pparams->cipher_algo,
-			pparams->cipher_key_length, pparams->auth_algo);
+			pparams->cipher_key_length, pparams->auth_algo) == 0)
+		sess = test_crypto_session;
+	else
+		sess = NULL;
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate a burst of crypto operations */
@@ -3538,7 +3595,7 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
 
 	for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
 		rte_pktmbuf_free(mbufs[i]);
-	rte_cryptodev_sym_session_free(dev_id, sess);
+	rte_cryptodev_sym_session_free(sess);
 
 	printf("\n");
 	return TEST_SUCCESS;
@@ -3575,9 +3632,12 @@ test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
 	}
 
 	/* Create Crypto session*/
-	sess = test_perf_create_armv8_session(ts_params->dev_id,
+	if (test_perf_create_armv8_session(ts_params->dev_id,
 			pparams->chain, pparams->cipher_algo,
-			pparams->cipher_key_length, pparams->auth_algo);
+			pparams->cipher_key_length, pparams->auth_algo) == 0)
+		sess = test_crypto_session;
+	else
+		sess = NULL;
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate a burst of crypto operations */
@@ -4122,7 +4182,7 @@ test_perf_aes_cbc_vary_burst_size(void)
 static struct rte_cryptodev_sym_session *
 test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
 {
-	static struct rte_cryptodev_sym_session *sess;
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct rte_crypto_sym_xform cipher_xform = { 0 };
 	struct rte_crypto_sym_xform auth_xform = { 0 };
 
@@ -4151,19 +4211,20 @@ test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
 	auth_xform.auth.digest_length = pparams->session_attrs->digest_len;
 	auth_xform.auth.key.length = pparams->session_attrs->key_auth_len;
 
+	test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
 
 	cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 	if (cipher_xform.cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
 		cipher_xform.next = &auth_xform;
-		sess = rte_cryptodev_sym_session_create(dev_id,
-				&cipher_xform);
+		rte_cryptodev_sym_session_init(dev_id, test_crypto_session,
+				&cipher_xform, ts_params->sess_mp);
 	} else {
 		auth_xform.next = &cipher_xform;
-		sess = rte_cryptodev_sym_session_create(dev_id,
-				&auth_xform);
+		rte_cryptodev_sym_session_init(dev_id, test_crypto_session,
+				&auth_xform, ts_params->sess_mp);
 	}
 
-	return sess;
+	return test_crypto_session;
 }
 
 static inline struct rte_crypto_op *
@@ -4405,7 +4466,7 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
 
 	for (i = 0; i < burst; i++)
 		rte_pktmbuf_free(mbufs[i]);
-	rte_cryptodev_sym_session_free(dev_id, sess);
+	rte_cryptodev_sym_session_free(sess);
 
 	return 0;
 }
-- 
2.9.4



More information about the dev mailing list