[dpdk-dev] [PATCH v4 08/12] cryptodev: remove mempool from session

Pablo de Lara pablo.de.lara.guarch at intel.com
Wed Jul 5 07:26:16 CEST 2017


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

Mempool pointer can be obtained from the object itself,
which means that it is not required to actually store the pointer
in the session.

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
---
 doc/guides/rel_notes/release_17_08.rst | 1 +
 lib/librte_cryptodev/rte_cryptodev.c   | 7 +++----
 lib/librte_cryptodev/rte_cryptodev.h   | 6 ------
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst
index c3d3b34..74275e0 100644
--- a/doc/guides/rel_notes/release_17_08.rst
+++ b/doc/guides/rel_notes/release_17_08.rst
@@ -210,6 +210,7 @@ API Changes
     the new parameter ``device id``.
   * ``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.
 
 
 ABI Changes
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index c2123cd..dfced85 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1087,8 +1087,6 @@ rte_cryptodev_sym_session_init(struct rte_mempool *mp,
 {
 	memset(sess, 0, mp->elt_size);
 
-	sess->mp = mp;
-
 	if (dev->dev_ops->session_initialize)
 		(*dev->dev_ops->session_initialize)(mp, sess);
 }
@@ -1126,7 +1124,7 @@ rte_cryptodev_sym_session_create(uint8_t dev_id,
 				dev_id);
 
 		/* Return session to mempool */
-		rte_mempool_put(sess->mp, _sess);
+		rte_mempool_put(dev->data->session_pool, _sess);
 		return NULL;
 	}
 
@@ -1198,7 +1196,8 @@ rte_cryptodev_sym_session_free(uint8_t dev_id,
 	dev->dev_ops->session_clear(dev, (void *)sess->_private);
 
 	/* Return session to mempool */
-	rte_mempool_put(sess->mp, (void *)sess);
+	struct rte_mempool *mp = rte_mempool_from_obj(sess);
+	rte_mempool_put(mp, (void *)sess);
 
 	return NULL;
 }
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 0fb5608..508c672 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -883,12 +883,6 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 /** Cryptodev symmetric crypto session */
 struct rte_cryptodev_sym_session {
 	RTE_STD_C11
-	struct {
-		struct rte_mempool *mp;
-		/**< Mempool session allocated from */
-	} __rte_aligned(8);
-	/**< Public symmetric session details */
-
 	__extension__ char _private[0];
 	/**< Private session material */
 };
-- 
2.9.4



More information about the dev mailing list