From patchwork Tue Jan 23 08:54:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gujjar, Abhinandan S" X-Patchwork-Id: 34303 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E5FA1B00C; Tue, 23 Jan 2018 09:54:41 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 1EAFB12009 for ; Tue, 23 Jan 2018 09:54:30 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2018 00:54:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,400,1511856000"; d="scan'208";a="12758291" Received: from unknown (HELO localhost.localdomain) ([10.224.122.195]) by orsmga006.jf.intel.com with ESMTP; 23 Jan 2018 00:54:25 -0800 From: Abhinandan Gujjar To: declan.doherty@intel.com, akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com, Jerin.JacobKollanukkaran@cavium.com Cc: dev@dpdk.org, narender.vangati@intel.com, Abhinandan Gujjar , Nikhil Rao Date: Tue, 23 Jan 2018 14:24:19 +0530 Message-Id: <1516697659-44375-1-git-send-email-abhinandan.gujjar@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [RFC v2, 1/2] cryptodev: add support to set session private data 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" Update rte_crypto_op to indicate private data offset. The application may want to store private data along with the rte_cryptodev that is transparent to the rte_cryptodev layer. For e.g., If an eventdev based application is submitting a rte_cryptodev_sym_session operation and wants to indicate event information required to construct a new event that will be enqueued to eventdev after completion of the rte_cryptodev_sym_session operation. This patch provides a mechanism for the application to associate this information with the rte_cryptodev_sym_session session. The application can set the private data using rte_cryptodev_sym_session_set_private_data() and retrieve it using rte_cryptodev_sym_session_get_private_data(). Signed-off-by: Abhinandan Gujjar Signed-off-by: Nikhil Rao --- Notes: V2: 1. Removed enum rte_crypto_op_private_data_type 2. Corrected formatting lib/librte_cryptodev/rte_crypto.h | 8 ++++++-- lib/librte_cryptodev/rte_cryptodev.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h index 95cf861..14c87c8 100644 --- a/lib/librte_cryptodev/rte_crypto.h +++ b/lib/librte_cryptodev/rte_crypto.h @@ -84,8 +84,12 @@ struct rte_crypto_op { */ uint8_t sess_type; /**< operation session type */ - - uint8_t reserved[5]; + uint16_t private_data_offset; + /**< Offset to indicate start of private data (if any). The private + * data may be used by the application to store information which + * should remain untouched in the library/driver + */ + uint8_t reserved[3]; /**< Reserved bytes to fill 64 bits for future additions */ struct rte_mempool *mempool; /**< crypto operation mempool which operation is allocated from */ diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index c8fa689..2f4affe 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -1037,6 +1037,38 @@ struct rte_cryptodev_sym_session * */ const char *rte_cryptodev_driver_name_get(uint8_t driver_id); +/** + * Set private data for a session. + * + * @param sess Session pointer allocated by + * *rte_cryptodev_sym_session_create*. + * @param data Pointer to the private data. + * @param size Size of the private data. + * + * @return + * - On success, zero. + * - On failure, a negative value. + */ +int +rte_cryptodev_sym_session_set_private_data( + struct rte_cryptodev_sym_session *sess, + void *data, + uint16_t size); + +/** + * Get private data of a session. + * + * @param sess Session pointer allocated by + * *rte_cryptodev_sym_session_create*. + * + * @return + * - On success return pointer to private data. + * - On failure returns NULL. + */ +void * +rte_cryptodev_sym_session_get_private_data( + const struct rte_cryptodev_sym_session *sess); + #ifdef __cplusplus } #endif