From patchwork Wed Jun 21 07:47:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "De Lara Guarch, Pablo" X-Patchwork-Id: 25581 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 8A0067CC3; Wed, 21 Jun 2017 17:47:28 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 6D6D77CC4 for ; Wed, 21 Jun 2017 17:47:18 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2017 08:47:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,369,1493708400"; d="scan'208";a="100153468" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by orsmga004.jf.intel.com with ESMTP; 21 Jun 2017 08:47:16 -0700 From: Pablo de Lara To: pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org Date: Wed, 21 Jun 2017 08:47:13 +0100 Message-Id: <20170621074731.45013-4-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170621074731.45013-1-pablo.de.lara.guarch@intel.com> References: <20170621074731.45013-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH 04/22] cryptodev: do not store pointer to op specific params X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 --- examples/ipsec-secgw/ipsec.c | 1 - lib/librte_cryptodev/rte_crypto.h | 12 +++--------- lib/librte_cryptodev/rte_crypto_sym.h | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index edca5f0..126d79f 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -140,7 +140,6 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, priv->cop.status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; rte_prefetch0(&priv->sym_cop); - priv->cop.sym = &priv->sym_cop; if ((unlikely(sa->crypto_session == NULL)) && create_session(ipsec_ctx, sa)) { 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; +}; /**