From patchwork Thu Jan 15 15:40:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43211 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 297B2240BA for ; Thu, 15 Jan 2015 15:41:52 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id s18sf2571533lam.2 for ; Thu, 15 Jan 2015 07:41:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=gmbrPuOFI25sQP3+denUiaXwjj/d5oxPlK2HpXGZVUk=; b=lAupgdTwAB9CkK3ZX8mNRRjJNJQdFY3lqOJl8kLd3c2LJroUT84OP+cEv85foKx94b CgATV/VaZRNKy25YVuZK2GJk5QqDSGKcwjiJUBP/w5cUflEkEBDf6wELyFbQCvhlii5R FPzn12DQ4x45zMVU5rVMhnzsNaNY1aQucx0TjfufX0UC2fFy9ChQYN1C5HHGaxPDXOKM 4TuDE/jUPuqJEAIIW1qP6g2XYIHIWVq7v38HZcmEgawJOn8BN2CGpYrGF8q5iowctg7v g+zrexTH1yCzGVX54zLsY2paBGhcQAuV4SE+oNTb29mZm+ebLdjAyjbz6J4BP1wqe8rA NifQ== X-Gm-Message-State: ALoCoQlyZQqV+dAbWP7H4CFbnutWoleVItSY6st60bc9KtpP8DF/QvgpLwXR6amwfIOjeE8c5JKC X-Received: by 10.180.74.132 with SMTP id t4mr1255479wiv.3.1421336510398; Thu, 15 Jan 2015 07:41:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.132 with SMTP id lc4ls257472lab.1.gmail; Thu, 15 Jan 2015 07:41:50 -0800 (PST) X-Received: by 10.112.50.239 with SMTP id f15mr10401855lbo.31.1421336510161; Thu, 15 Jan 2015 07:41:50 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id e1si1728810laa.119.2015.01.15.07.41.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id z11so13903346lbi.10 for ; Thu, 15 Jan 2015 07:41:50 -0800 (PST) X-Received: by 10.112.173.202 with SMTP id bm10mr2044105lbc.24.1421336509942; Thu, 15 Jan 2015 07:41:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp21999lbb; Thu, 15 Jan 2015 07:41:49 -0800 (PST) X-Received: by 10.224.120.8 with SMTP id b8mr17469716qar.36.1421336508552; Thu, 15 Jan 2015 07:41:48 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id s8si2284648qas.95.2015.01.15.07.41.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:48 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBmYM-0007Vg-BJ; Thu, 15 Jan 2015 15:41:46 +0000 Received: from mail-qc0-f181.google.com ([209.85.216.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBmY3-0007PM-3G for lng-odp@lists.linaro.org; Thu, 15 Jan 2015 15:41:27 +0000 Received: by mail-qc0-f181.google.com with SMTP id l6so4010941qcy.12 for ; Thu, 15 Jan 2015 07:41:22 -0800 (PST) X-Received: by 10.140.18.131 with SMTP id 3mr16223867qgf.50.1421336481960; Thu, 15 Jan 2015 07:41:21 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id g12sm1563340qay.44.2015.01.15.07.41.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:20 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Thu, 15 Jan 2015 17:40:18 +0200 Message-Id: <1421336423-19382-11-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421336423-19382-1-git-send-email-petri.savolainen@linaro.org> References: <1421336423-19382-1-git-send-email-petri.savolainen@linaro.org> X-Topics: crypto patch Subject: [lng-odp] [PATCH 10/15] api: crypto: Use odp_event_t instead of odp_buffer_t X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Changed crypto API to use odp_event_t instead of odp_buffer_t. Signed-off-by: Petri Savolainen --- 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(¶ms, &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 -#include +#include #include #include #include @@ -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;