From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo de Lara Subject: [PATCH 04/13] cryptodev: do not store pointer to op specific params Date: Sun, 28 May 2017 22:05:13 +0100 Message-ID: <1496005522-134934-5-git-send-email-pablo.de.lara.guarch@intel.com> References: <1496005522-134934-1-git-send-email-pablo.de.lara.guarch@intel.com> Cc: dev@dpdk.org, Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, zbigniew.bodek@caviumnetworks.com, jerin.jacob@caviumnetworks.com Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 228B57CBF for ; Sun, 28 May 2017 23:05:11 +0200 (CEST) In-Reply-To: <1496005522-134934-1-git-send-email-pablo.de.lara.guarch@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Instead of storing a pointer to operation specific parameters, such as symmetric crypto parameters, use a zero-length array, to mark that these parameters will be stored after the generic crypto operation structure, which was already assumed in the code. Signed-off-by: Pablo de Lara --- lib/librte_cryptodev/rte_crypto.h | 12 +++--------- lib/librte_cryptodev/rte_crypto_sym.h | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h index c2677fa..23fad79 100644 --- a/lib/librte_cryptodev/rte_crypto.h +++ b/lib/librte_cryptodev/rte_crypto.h @@ -124,10 +124,10 @@ struct rte_crypto_op { RTE_STD_C11 union { - struct rte_crypto_sym_op *sym; + struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ - }; /**< operation specific parameters */ -} __rte_cache_aligned; + } /**< operation specific parameters */ __rte_aligned(8); +}; /** * Reset the fields of a crypto operation to their default values. @@ -144,12 +144,6 @@ __rte_crypto_op_reset(struct rte_crypto_op *op, enum rte_crypto_op_type type) switch (type) { case RTE_CRYPTO_OP_TYPE_SYMMETRIC: - /** Symmetric operation structure starts after the end of the - * rte_crypto_op structure. - */ - op->sym = (struct rte_crypto_sym_op *)(op + 1); - op->type = type; - __rte_crypto_sym_op_reset(op->sym); break; default: diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index 386b120..39ad1e3 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -640,7 +640,7 @@ struct rte_crypto_sym_op { } aad; /**< Additional authentication parameters */ } auth; -} __rte_cache_aligned; +}; /** -- 2.7.4