[dpdk-dev,RFC,v3,3/3] security: add support to set session private data

Message ID 1517477442-169297-1-git-send-email-abhinandan.gujjar@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Gujjar, Abhinandan S Feb. 1, 2018, 9:30 a.m. UTC
  The application may want to store private data along with the
rte_security that is transparent to the rte_security layer.
For e.g., If an eventdev based application is submitting a
rte_security_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_security operation. This patch provides a
mechanism for the application to associate this information with the
rte_security session. The application can set the private data using
rte_security_session_set_private_data() and retrieve it using
rte_security_session_get_private_data()

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
 lib/librte_security/rte_security.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
  

Patch

diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index c75c121..baf168c 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -560,6 +560,35 @@  struct rte_security_capability_idx {
 rte_security_capability_get(struct rte_security_ctx *instance,
 			    struct rte_security_capability_idx *idx);
 
+/**
+ * Set private data for a security session.
+ *
+ * @param	sess		security session
+ * @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_security_session_set_private_data(struct rte_security_session *sess,
+				       void *data,
+				       uint16_t size);
+
+/**
+ * Get private data of a security session.
+ *
+ * @param	sess		security session
+ *
+ * @return
+ *  - On success return pointer to private data.
+ *  - On failure returns NULL.
+ */
+void *
+rte_security_session_get_private_data(
+				const struct rte_security_session *session);
+
 #ifdef __cplusplus
 }
 #endif