From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E252571B3 for ; Mon, 15 Jan 2018 12:51:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2018 03:51:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,363,1511856000"; d="scan'208";a="19782954" Received: from unknown (HELO localhost.localdomain) ([10.224.122.195]) by FMSMGA003.fm.intel.com with ESMTP; 15 Jan 2018 03:51:22 -0800 From: Abhinandan Gujjar To: declan.doherty@intel.com Cc: dev@dpdk.org, narender.vangati@intel.com, Abhinandan Gujjar , Nikhil Rao Date: Mon, 15 Jan 2018 17:21:18 +0530 Message-Id: <1516017078-166766-1-git-send-email-abhinandan.gujjar@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH 1/2] lib/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: , X-List-Received-Date: Mon, 15 Jan 2018 11:51:26 -0000 Update rte_crypto_op to indicate private data type and 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 --- lib/librte_cryptodev/rte_crypto.h | 19 +++++++++++++++++-- lib/librte_cryptodev/rte_cryptodev.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h index bbc510d..3a98cbf 100644 --- a/lib/librte_cryptodev/rte_crypto.h +++ b/lib/librte_cryptodev/rte_crypto.h @@ -62,6 +62,18 @@ enum rte_crypto_op_sess_type { RTE_CRYPTO_OP_SECURITY_SESSION /**< Security session crypto operation */ }; +/** Private data types for cryptographic operation + * @see rte_crypto_op::private_data_type */ +enum rte_crypto_op_private_data_type { + RTE_CRYPTO_OP_PRIVATE_DATA_NONE, + /**< No private data */ + RTE_CRYPTO_OP_PRIVATE_DATA_OP, + /**< Private data is part of rte_crypto_op and indicated by + * private_data_offset */ + RTE_CRYPTO_OP_PRIVATE_DATA_SESSION + /**< Private data is available at session */ +}; + /** * Cryptographic Operation. * @@ -84,8 +96,11 @@ struct rte_crypto_op { */ uint8_t sess_type; /**< operation session type */ - - uint8_t reserved[5]; + uint8_t private_data_type; + /**< Private data type. @see enum rte_crypto_op_private_data_type */ + uint16_t private_data_offset; + /**< Offset to indicate start of private data */ + 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 dade554..56958a6 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -1033,6 +1033,36 @@ 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 -- 1.9.1