From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 3E55537A6 for ; Thu, 29 Jun 2017 21:35:32 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jun 2017 12:35:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,282,1496127600"; d="scan'208";a="873176308" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by FMSMGA003.fm.intel.com with ESMTP; 29 Jun 2017 12:35:09 -0700 From: Pablo de Lara To: declan.doherty@intel.com, zbigniew.bodek@caviumnetworks.com, jerin.jacob@caviumnetworks.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, fiona.trahe@intel.com, john.griffin@intel.com, deepak.k.jain@intel.com Cc: dev@dpdk.org, Pablo de Lara Date: Thu, 29 Jun 2017 12:34:58 +0100 Message-Id: <20170629113521.5560-4-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170629113521.5560-1-pablo.de.lara.guarch@intel.com> References: <20170626102300.56637-1-pablo.de.lara.guarch@intel.com> <20170629113521.5560-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v3 03/26] 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: , X-List-Received-Date: Thu, 29 Jun 2017 19:35:32 -0000 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 Acked-by: Akhil Goyal --- app/test-crypto-perf/cperf_test_latency.c | 36 +++++++++++++++++++++---------- doc/guides/prog_guide/cryptodev_lib.rst | 3 +-- doc/guides/rel_notes/release_17_08.rst | 1 + lib/librte_cryptodev/rte_crypto.h | 5 ----- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index e61ac97..a7443a3 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; @@ -295,11 +300,20 @@ cperf_latency_test_constructor(uint8_t dev_id, uint16_t qp_id, return NULL; } +static inline void +store_timestamp(struct rte_crypto_op *op, uint64_t timestamp) +{ + struct priv_op_data *priv_data; + + priv_data = (struct priv_op_data *) (op->sym + 1); + priv_data->result->status = op->status; + priv_data->result->tsc_end = timestamp; +} + 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 +325,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 +413,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 +430,7 @@ 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; + store_timestamp(ops_processed[i], tsc_end); rte_crypto_op_free(ops_processed[i]); } @@ -446,10 +463,7 @@ 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; + store_timestamp(ops_processed[i], tsc_end); rte_crypto_op_free(ops_processed[i]); } diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 229cb7a..c9a29f8 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -363,8 +363,7 @@ The operation structure includes the operation type, the operation status and the session type (session-based/less), a reference to the operation specific data, which can vary in size and content depending on the operation being provisioned. It also contains the source mempool for the operation, -if it allocate from a mempool. Finally an opaque pointer for user specific -data is provided. +if it allocated from a mempool. If Crypto operations are allocated from a Crypto operation mempool, see next section, there is also the ability to allocate private memory with the diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst index bbb14a9..20f459e 100644 --- a/doc/guides/rel_notes/release_17_08.rst +++ b/doc/guides/rel_notes/release_17_08.rst @@ -154,6 +154,7 @@ API Changes * 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. + * Removed the field ``opaque_data`` from ``rte_crypto_op``. ABI Changes 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; } /** -- 2.9.4