Signed-off-by: Robbie King <[email protected]>
---
 platform/linux-generic/include/api/odp_crypto.h | 56 ++++++++++++++++++-------
 1 file changed, 42 insertions(+), 14 deletions(-)

diff --git a/platform/linux-generic/include/api/odp_crypto.h 
b/platform/linux-generic/include/api/odp_crypto.h
index 337e7cf..a907f8a 100644
--- a/platform/linux-generic/include/api/odp_crypto.h
+++ b/platform/linux-generic/include/api/odp_crypto.h
@@ -210,6 +210,13 @@ typedef struct odp_crypto_compl_status {
        enum crypto_hw_err  hw_err;   /**< Hardware specific return code */
 } odp_crypto_compl_status_t;
 
+/**
+ * Cryto API completion event
+ */
+typedef union odp_crypto_compl_event {
+       void        *ptr;             /**< Sync, single request outstanding */
+       odp_buffer_t buffer;          /**< Async and multi sync request */
+} odp_crypto_compl_event_t;
 
 /**
  * Crypto session creation (synchronous)
@@ -225,6 +232,37 @@ odp_crypto_session_create(odp_crypto_session_params_t 
*params,
                          odp_crypto_session_t *session,
                          enum odp_crypto_ses_create_err *status);
 
+/**
+ * Obtain crypto completion event for upcoming request
+ *
+ * Retrieve an appropriate completion event based on the request we are
+ * getting ready to issue.  Getting the event handle ahead of time allows
+ * us to perform any extra initialization (such as set user context).
+ *
+ * @param params            Operation parameters
+ * 
+ * @return completion event (error handling?)
+ */
+odp_crypto_compl_event_t
+odp_crypto_get_compl_event(odp_crypto_op_params_t *params);
+
+/**
+ * Release crypto completion event
+ *
+ * @param completion_event  Completion event we are done accessing
+ */
+void
+odp_crypto_release_compl_event(odp_crypto_compl_event_t completion_event);
+
+/**
+ * Crypto per packet operation set user context in completion event
+ *
+ * @param completion_event  Event containing operation results
+ * @param ctx               User data
+ */
+void
+odp_crypto_set_operation_compl_ctx(odp_crypto_compl_event_t completion_event,
+                                  void *ctx);
 
 /**
  * Crypto per packet operation
@@ -247,17 +285,7 @@ odp_crypto_session_create(odp_crypto_session_params_t 
*params,
 int
 odp_crypto_operation(odp_crypto_op_params_t *params,
                     bool *posted,
-                    odp_buffer_t completion_event);
-
-/**
- * Crypto per packet operation set user context in completion event
- *
- * @param completion_event  Event containing operation results
- * @param ctx               User data
- */
-void
-odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event,
-                                  void *ctx);
+                    odp_crypto_compl_event_t completion_event);
 
 /**
  * Crypto per packet operation completion status
@@ -269,7 +297,7 @@ odp_crypto_set_operation_compl_ctx(odp_buffer_t 
completion_event,
  * @param cipher            Pointer to store cipher results
  */
 void
-odp_crypto_get_operation_compl_status(odp_buffer_t completion_event,
+odp_crypto_get_operation_compl_status(odp_crypto_compl_event_t 
completion_event,
                                      odp_crypto_compl_status_t *auth,
                                      odp_crypto_compl_status_t *cipher);
 
@@ -284,7 +312,7 @@ odp_crypto_get_operation_compl_status(odp_buffer_t 
completion_event,
  * @return Packet structure where data now resides
  */
 odp_packet_t
-odp_crypto_get_operation_compl_packet(odp_buffer_t completion_event);
+odp_crypto_get_operation_compl_packet(odp_crypto_compl_event_t 
completion_event);
 
 /**
  * Crypto per packet operation query user context in completion event
@@ -294,7 +322,7 @@ odp_crypto_get_operation_compl_packet(odp_buffer_t 
completion_event);
  * @return User data
  */
 void *
-odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event);
+odp_crypto_get_operation_compl_ctx(odp_crypto_compl_event_t completion_event);
 
 /**
  * Generate random byte string
-- 
1.9.1


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to