From: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
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 <abhinandan.gujjar@intel.com>,
Nikhil Rao <nikhil.rao@intel.com>
Subject: [dpdk-dev] [RFC v2, 1/2] cryptodev: add support to set session private data
Date: Tue, 23 Jan 2018 14:24:19 +0530 [thread overview]
Message-ID: <1516697659-44375-1-git-send-email-abhinandan.gujjar@intel.com> (raw)
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 <abhinandan.gujjar@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
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
--
1.9.1
next reply other threads:[~2018-01-23 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 8:54 Abhinandan Gujjar [this message]
2018-01-24 19:46 ` De Lara Guarch, Pablo
2018-01-25 6:42 ` Akhil Goyal
2018-01-25 15:37 ` Gujjar, Abhinandan S
2018-01-31 13:40 ` De Lara Guarch, Pablo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516697659-44375-1-git-send-email-abhinandan.gujjar@intel.com \
--to=abhinandan.gujjar@intel.com \
--cc=Jerin.JacobKollanukkaran@cavium.com \
--cc=akhil.goyal@nxp.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=narender.vangati@intel.com \
--cc=nikhil.rao@intel.com \
--cc=pablo.de.lara.guarch@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).