Changed crypto API to use odp_event_t instead of odp_buffer_t.

Signed-off-by: Petri Savolainen <[email protected]>
---
 example/ipsec/odp_ipsec.c                       | 12 ++++++------
 platform/linux-generic/include/api/odp_crypto.h | 12 ++++++------
 platform/linux-generic/odp_crypto.c             | 26 ++++++++++++-------------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index fd1b9b1..faef46d 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -740,7 +740,7 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt,
        *skip = FALSE;
        if (odp_crypto_operation(&params,
                                 &posted,
-                                
odp_buffer_from_event(odp_packet_to_event(pkt)))) {
+                                odp_packet_to_event(pkt))) {
                abort();
        }
        return (posted) ? PKT_POSTED : PKT_CONTINUE;
@@ -758,7 +758,7 @@ static
 pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt,
                                     pkt_ctx_t *ctx)
 {
-       odp_buffer_t event;
+       odp_event_t event;
        odp_crypto_compl_status_t cipher_rc;
        odp_crypto_compl_status_t auth_rc;
        odph_ipv4hdr_t *ip;
@@ -766,7 +766,7 @@ pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt,
        int trl_len = 0;
 
        /* Check crypto result */
-       event = odp_buffer_from_event(odp_packet_to_event(pkt));
+       event = odp_packet_to_event(pkt);
        odp_crypto_get_operation_compl_status(event, &auth_rc, &cipher_rc);
        if (!is_crypto_compl_status_ok(&cipher_rc))
                return PKT_DROP;
@@ -974,7 +974,7 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t pkt,
        /* Issue crypto request */
        if (odp_crypto_operation(&ctx->ipsec.params,
                                 &posted,
-                                
odp_buffer_from_event(odp_packet_to_event(pkt)))) {
+                                odp_packet_to_event(pkt))) {
                abort();
        }
        return (posted) ? PKT_POSTED : PKT_CONTINUE;
@@ -992,13 +992,13 @@ static
 pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt,
                                      pkt_ctx_t *ctx)
 {
-       odp_buffer_t event;
+       odp_event_t event;
        odp_crypto_compl_status_t cipher_rc;
        odp_crypto_compl_status_t auth_rc;
        odph_ipv4hdr_t *ip;
 
        /* Check crypto result */
-       event = odp_buffer_from_event(odp_packet_to_event(pkt));
+       event = odp_packet_to_event(pkt);
        odp_crypto_get_operation_compl_status(event, &auth_rc, &cipher_rc);
        if (!is_crypto_compl_status_ok(&cipher_rc))
                return PKT_DROP;
diff --git a/platform/linux-generic/include/api/odp_crypto.h 
b/platform/linux-generic/include/api/odp_crypto.h
index 337e7cf..00a0090 100644
--- a/platform/linux-generic/include/api/odp_crypto.h
+++ b/platform/linux-generic/include/api/odp_crypto.h
@@ -19,7 +19,7 @@ extern "C" {
 #endif
 
 #include <odp_std_types.h>
-#include <odp_buffer.h>
+#include <odp_event.h>
 #include <odp_buffer_pool.h>
 #include <odp_queue.h>
 #include <odp_packet.h>
@@ -247,7 +247,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);
+                    odp_event_t completion_event);
 
 /**
  * Crypto per packet operation set user context in completion event
@@ -256,7 +256,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
  * @param ctx               User data
  */
 void
-odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event,
+odp_crypto_set_operation_compl_ctx(odp_event_t completion_event,
                                   void *ctx);
 
 /**
@@ -269,7 +269,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_event_t completion_event,
                                      odp_crypto_compl_status_t *auth,
                                      odp_crypto_compl_status_t *cipher);
 
@@ -284,7 +284,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_event_t completion_event);
 
 /**
  * Crypto per packet operation query user context in completion event
@@ -294,7 +294,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_event_t completion_event);
 
 /**
  * Generate random byte string
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index ab76484..463f7b4 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -344,7 +344,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)
+                    odp_event_t completion_event)
 {
        enum crypto_alg_err rc_cipher = ODP_CRYPTO_ALG_ERR_NONE;
        enum crypto_alg_err rc_auth = ODP_CRYPTO_ALG_ERR_NONE;
@@ -364,9 +364,9 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
                        ODP_ABORT();
                _odp_packet_copy_to_packet(params->pkt, 0, params->out_pkt, 0,
                                           odp_packet_len(params->pkt));
-               if (completion_event == _odp_packet_to_buffer(params->pkt))
+               if (completion_event == odp_packet_to_event(params->pkt))
                        completion_event =
-                               _odp_packet_to_buffer(params->out_pkt);
+                               odp_packet_to_event(params->out_pkt);
                odp_packet_free(params->pkt);
                params->pkt = ODP_PACKET_INVALID;
        }
@@ -381,7 +381,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
        }
 
        /* Build Result (no HW so no errors) */
-       result = get_op_result_from_buffer(completion_event);
+       result = 
get_op_result_from_buffer(odp_buffer_from_event(completion_event));
        result->magic = OP_RESULT_MAGIC;
        result->cipher.alg_err = rc_cipher;
        result->cipher.hw_err = ODP_CRYPTO_HW_ERR_NONE;
@@ -391,7 +391,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
 
        /* If specified during creation post event to completion queue */
        if (ODP_QUEUE_INVALID != session->compl_queue) {
-               odp_queue_enq(session->compl_queue, 
odp_buffer_to_event(completion_event));
+               odp_queue_enq(session->compl_queue, completion_event);
                *posted = 1;
        }
        return 0;
@@ -431,13 +431,13 @@ odp_hw_random_get(uint8_t *buf, size_t *len, bool 
use_entropy ODP_UNUSED)
 }
 
 void
-odp_crypto_get_operation_compl_status(odp_buffer_t completion_event,
+odp_crypto_get_operation_compl_status(odp_event_t completion_event,
                                      odp_crypto_compl_status_t *auth,
                                      odp_crypto_compl_status_t *cipher)
 {
        odp_crypto_generic_op_result_t *result;
 
-       result = get_op_result_from_buffer(completion_event);
+       result = 
get_op_result_from_buffer(odp_buffer_from_event(completion_event));
 
        if (OP_RESULT_MAGIC != result->magic)
                ODP_ABORT();
@@ -448,12 +448,12 @@ odp_crypto_get_operation_compl_status(odp_buffer_t 
completion_event,
 
 
 void
-odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event,
+odp_crypto_set_operation_compl_ctx(odp_event_t completion_event,
                                   void *ctx)
 {
        odp_crypto_generic_op_result_t *result;
 
-       result = get_op_result_from_buffer(completion_event);
+       result = 
get_op_result_from_buffer(odp_buffer_from_event(completion_event));
        /*
         * Completion event magic can't be checked here, because it is filled
         * later in odp_crypto_operation() function.
@@ -463,22 +463,22 @@ odp_crypto_set_operation_compl_ctx(odp_buffer_t 
completion_event,
 }
 
 void
-*odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event)
+*odp_crypto_get_operation_compl_ctx(odp_event_t completion_event)
 {
        odp_crypto_generic_op_result_t *result;
 
-       result = get_op_result_from_buffer(completion_event);
+       result = 
get_op_result_from_buffer(odp_buffer_from_event(completion_event));
        ODP_ASSERT(OP_RESULT_MAGIC == result->magic, "Bad completion magic");
 
        return result->op_context;
 }
 
 odp_packet_t
-odp_crypto_get_operation_compl_packet(odp_buffer_t completion_event)
+odp_crypto_get_operation_compl_packet(odp_event_t completion_event)
 {
        odp_crypto_generic_op_result_t *result;
 
-       result = get_op_result_from_buffer(completion_event);
+       result = 
get_op_result_from_buffer(odp_buffer_from_event(completion_event));
        ODP_ASSERT(OP_RESULT_MAGIC == result->magic, "Bad completion magic");
 
        return result->out_pkt;
-- 
2.2.2


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

Reply via email to