[dpdk-dev] [PATCH v4 02/26] cryptodev: replace enums with 1-byte variables

Pablo de Lara pablo.de.lara.guarch at intel.com
Sun Jul 2 07:41:03 CEST 2017


Instead of storing some crypto operation flags,
such as operation status, as enumerations,
store them as uint8_t, for memory efficiency.

Also, reserve extra 5 bytes in the crypto operation,
for future additions.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
Acked-by: Akhil Goyal <akhil.goyal at nxp.com>
Acked-by: Fiona Trahe <fiona.trahe at intel.com>
---
 doc/guides/rel_notes/release_17_08.rst | 3 +++
 lib/librte_cryptodev/rte_crypto.h      | 9 +++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst
index 2bc405d..bbb14a9 100644
--- a/doc/guides/rel_notes/release_17_08.rst
+++ b/doc/guides/rel_notes/release_17_08.rst
@@ -151,6 +151,9 @@ API Changes
 
   * Removed the field ``rte_crypto_sym_op_sess_type`` from ``rte_crypto_sym_op``,
     and moved it to ``rte_crypto_op`` as ``rte_crypto_op_sess_type``.
+  * Enumerations ``rte_crypto_op_sess_type``, ``rte_crypto_op_status`` and
+    ``rte_crypto_op_sess_type`` in ``rte_crypto_op`` have been modified to be
+    uint8_t values.
 
 
 ABI Changes
diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h
index ac5c184..8e2b640 100644
--- a/lib/librte_cryptodev/rte_crypto.h
+++ b/lib/librte_cryptodev/rte_crypto.h
@@ -102,19 +102,20 @@ enum rte_crypto_op_sess_type {
  * rte_cryptodev_enqueue_burst() / rte_cryptodev_dequeue_burst() .
  */
 struct rte_crypto_op {
-	enum rte_crypto_op_type type;
+	uint8_t type;
 	/**< operation type */
-
-	enum rte_crypto_op_status status;
+	uint8_t status;
 	/**<
 	 * operation status - this is reset to
 	 * RTE_CRYPTO_OP_STATUS_NOT_PROCESSED on allocation from mempool and
 	 * will be set to RTE_CRYPTO_OP_STATUS_SUCCESS after crypto operation
 	 * is successfully processed by a crypto PMD
 	 */
-	enum rte_crypto_op_sess_type  sess_type;
+	uint8_t sess_type;
 	/**< operation session type */
 
+	uint8_t reserved[5];
+	/**< Reserved bytes to fill 64 bits for future additions */
 	struct rte_mempool *mempool;
 	/**< crypto operation mempool which operation is allocated from */
 
-- 
2.9.4



More information about the dev mailing list