From patchwork Sun May 28 21:05:12 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: 24844 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com 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 28C097CC8; Sun, 28 May 2017 23:05:18 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3124B7CB5 for ; Sun, 28 May 2017 23:05:10 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 May 2017 14:05:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.38,411,1491289200"; d="scan'208"; a="1135678803" Received: from silpixa00381631.ir.intel.com (HELO silpixa00381631.ger.corp.intel.com) ([10.237.222.122]) by orsmga001.jf.intel.com with ESMTP; 28 May 2017 14:05:08 -0700 From: Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, zbigniew.bodek@caviumnetworks.com, jerin.jacob@caviumnetworks.com Cc: dev@dpdk.org, Pablo de Lara Date: Sun, 28 May 2017 22:05:12 +0100 Message-Id: <1496005522-134934-4-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496005522-134934-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1496005522-134934-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH 03/13] cryptodev: remove opaque data pointer in crypto op 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" Storing a pointer to the user data is unnecessary, since user can store additional data, after the crypto operation. Signed-off-by: Pablo de Lara --- app/test-crypto-perf/cperf_test_latency.c | 30 +++++++++++++++++++----------- lib/librte_cryptodev/rte_crypto.h | 5 ----- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index e61ac97..215614e 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -66,6 +66,10 @@ struct cperf_latency_ctx { struct cperf_op_result *res; }; +struct priv_op_data { + struct cperf_op_result *result; +}; + #define max(a, b) (a > b ? (uint64_t)a : (uint64_t)b) #define min(a, b) (a < b ? (uint64_t)a : (uint64_t)b) @@ -276,8 +280,9 @@ cperf_latency_test_constructor(uint8_t dev_id, uint16_t qp_id, snprintf(pool_name, sizeof(pool_name), "cperf_op_pool_cdev_%d", dev_id); + uint16_t priv_size = sizeof(struct priv_op_data); ctx->crypto_op_pool = rte_crypto_op_pool_create(pool_name, - RTE_CRYPTO_OP_TYPE_SYMMETRIC, options->pool_sz, 0, 0, + RTE_CRYPTO_OP_TYPE_SYMMETRIC, options->pool_sz, 0, priv_size, rte_socket_id()); if (ctx->crypto_op_pool == NULL) goto err; @@ -299,7 +304,6 @@ int cperf_latency_test_runner(void *arg) { struct cperf_latency_ctx *ctx = arg; - struct cperf_op_result *pres; uint16_t test_burst_size; uint8_t burst_size_idx = 0; @@ -311,6 +315,7 @@ cperf_latency_test_runner(void *arg) struct rte_crypto_op *ops[ctx->options->max_burst_size]; struct rte_crypto_op *ops_processed[ctx->options->max_burst_size]; uint64_t i; + struct priv_op_data *priv_data; uint32_t lcore = rte_lcore_id(); @@ -398,7 +403,12 @@ cperf_latency_test_runner(void *arg) for (i = 0; i < ops_enqd; i++) { ctx->res[tsc_idx].tsc_start = tsc_start; - ops[i]->opaque_data = (void *)&ctx->res[tsc_idx]; + /* + * Private data structure starts after the end of the + * rte_crypto_sym_op structure. + */ + priv_data = (struct priv_op_data *) (ops[i]->sym + 1); + priv_data->result = (void *)&ctx->res[tsc_idx]; tsc_idx++; } @@ -410,10 +420,9 @@ cperf_latency_test_runner(void *arg) * failures. */ for (i = 0; i < ops_deqd; i++) { - pres = (struct cperf_op_result *) - (ops_processed[i]->opaque_data); - pres->status = ops_processed[i]->status; - pres->tsc_end = tsc_end; + priv_data = (struct priv_op_data *) (ops[i]->sym + 1); + priv_data->result->status = ops_processed[i]->status; + priv_data->result->tsc_end = tsc_end; rte_crypto_op_free(ops_processed[i]); } @@ -446,10 +455,9 @@ cperf_latency_test_runner(void *arg) if (ops_deqd != 0) { for (i = 0; i < ops_deqd; i++) { - pres = (struct cperf_op_result *) - (ops_processed[i]->opaque_data); - pres->status = ops_processed[i]->status; - pres->tsc_end = tsc_end; + priv_data = (struct priv_op_data *) (ops[i]->sym + 1); + priv_data->result->status = ops_processed[i]->status; + priv_data->result->tsc_end = tsc_end; rte_crypto_op_free(ops_processed[i]); } diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h index 8e2b640..c2677fa 100644 --- a/lib/librte_cryptodev/rte_crypto.h +++ b/lib/librte_cryptodev/rte_crypto.h @@ -122,9 +122,6 @@ struct rte_crypto_op { phys_addr_t phys_addr; /**< physical address of crypto operation */ - void *opaque_data; - /**< Opaque pointer for user data */ - RTE_STD_C11 union { struct rte_crypto_sym_op *sym; @@ -158,8 +155,6 @@ __rte_crypto_op_reset(struct rte_crypto_op *op, enum rte_crypto_op_type type) default: break; } - - op->opaque_data = NULL; } /**