From patchwork Tue Jan 20 11:18:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43352 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C6B232034D for ; Tue, 20 Jan 2015 11:19:50 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id u56sf19638152wes.3 for ; Tue, 20 Jan 2015 03:19: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=nHAot9JwKOiq8xYsIikx2ZaLAulC3rX6MaHBg0fl+oc=; b=ks73FDqw5DX0jmSnGfp0N6oGLIna/B2VTz3bimr3vPRe19y49P1AyMad54EmAY9Ngu 1iPsi/qtUB5/v/H904y5rJlhI6eA5TkcLe62YKwwNK0NWn6kUd17tMjfaRztU6/drdi/ y+/SJq/Icatb0Gpuc2uORT7t64rGcDEoT4JdUaxf8cXdmeZQ1jTxofxwxEpKWHXJvxWk nS4U20yeRSrYrrsno8GhDVFgrgsegjX2cQYK9xmcCGzICB03a2LPnH2uVFeFAGN85hgY lF4feC8LtzG6oPUpePYKxVkMHhLsifCTp8hqb8qW2EqFrXU0QAl6LEBoCSbQW3B4nmss cK0A== X-Gm-Message-State: ALoCoQkQ+2D2qjZHob1kVHPJ9X6OTGhPgONo0gtoU/xAXr8VXoNhyTjbKAXl6XrUUvXmaoFYGc45 X-Received: by 10.112.64.197 with SMTP id q5mr4326306lbs.4.1421752790129; Tue, 20 Jan 2015 03:19:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.133 with SMTP id o5ls585072lal.78.gmail; Tue, 20 Jan 2015 03:19:50 -0800 (PST) X-Received: by 10.152.180.136 with SMTP id do8mr11126497lac.31.1421752789987; Tue, 20 Jan 2015 03:19:49 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id jd8si14876999lbc.99.2015.01.20.03.19.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id b6so7325566lbj.11 for ; Tue, 20 Jan 2015 03:19:49 -0800 (PST) X-Received: by 10.152.26.201 with SMTP id n9mr37821519lag.50.1421752789895; Tue, 20 Jan 2015 03:19: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 c8csp1380862lbb; Tue, 20 Jan 2015 03:19:48 -0800 (PST) X-Received: by 10.224.164.205 with SMTP id f13mr55165996qay.73.1421752787512; Tue, 20 Jan 2015 03:19:47 -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 v76si13772058qge.35.2015.01.20.03.19.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:47 -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 1YDWqV-0006Jk-If; Tue, 20 Jan 2015 11:19:43 +0000 Received: from mail-qg0-f53.google.com ([209.85.192.53]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDWq9-0006ER-6t for lng-odp@lists.linaro.org; Tue, 20 Jan 2015 11:19:21 +0000 Received: by mail-qg0-f53.google.com with SMTP id a108so20621510qge.12 for ; Tue, 20 Jan 2015 03:19:16 -0800 (PST) X-Received: by 10.140.39.167 with SMTP id v36mr54222900qgv.77.1421752756094; Tue, 20 Jan 2015 03:19:16 -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 t2sm14975907qae.6.2015.01.20.03.19.13 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:14 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 13:18:04 +0200 Message-Id: <1421752692-24439-9-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421752692-24439-1-git-send-email-petri.savolainen@linaro.org> References: <1421752692-24439-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 08/16] api: packet: Removed odp_packet_from_buffer 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.180 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 Removed buffer to packet conversion. Signed-off-by: Petri Savolainen --- platform/linux-generic/include/api/odp_packet.h | 9 --------- platform/linux-generic/include/odp_packet_internal.h | 11 ++++------- platform/linux-generic/odp_packet.c | 2 +- platform/linux-generic/odp_packet_io.c | 4 ++-- test/validation/crypto/odp_crypto_test_async_inp.c | 10 +++++----- test/validation/crypto/odp_crypto_test_sync_inp.c | 6 ++---- 6 files changed, 14 insertions(+), 28 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index c67fd62..03f2b18 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -96,15 +96,6 @@ void odp_packet_free(odp_packet_t pkt); int odp_packet_reset(odp_packet_t pkt, uint32_t len); /** - * Convert a buffer handle to a packet handle - * - * @param buf Buffer handle - * - * @return Packet handle - */ -odp_packet_t odp_packet_from_buffer(odp_buffer_t buf); - -/** * Get packet handle from event * * Converts an ODP_EVENT_PACKET type event to a packet. diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index fe4a223..33c9d92 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -257,15 +257,12 @@ odp_packet_t _odp_packet_alloc(odp_buffer_pool_t pool_hdl); int _odp_packet_parse(odp_packet_t pkt); -/* - * Convert a packet handle to a buffer handle - * - * @param pkt Packet handle - * - * @return Buffer handle - */ +/* Convert a packet handle to a buffer handle */ odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt); +/* Convert a buffer handle to a packet handle */ +odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index bcbac79..3ce6f47 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -65,7 +65,7 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len) return 0; } -odp_packet_t odp_packet_from_buffer(odp_buffer_t buf) +odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf) { return (odp_packet_t)buf; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 7f5a95d..abbc9f6 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -454,7 +454,7 @@ odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id) int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr) { - odp_packet_t pkt = odp_packet_from_buffer(buf_hdr->handle.handle); + odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle); int len = 1; int nbr; @@ -476,7 +476,7 @@ int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[], int i; for (i = 0; i < num; ++i) - pkt_tbl[i] = odp_packet_from_buffer(buf_hdr[i]->handle.handle); + pkt_tbl[i] = _odp_packet_from_buffer(buf_hdr[i]->handle.handle); nbr = odp_pktio_send(qentry->s.pktout, pkt_tbl, num); return (nbr == num ? 0 : -1); diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c b/test/validation/crypto/odp_crypto_test_async_inp.c index 01e4d7d..e771b2c 100644 --- a/test/validation/crypto/odp_crypto_test_async_inp.c +++ b/test/validation/crypto/odp_crypto_test_async_inp.c @@ -61,9 +61,7 @@ static void alg_test(enum odp_crypto_op op, CU_ASSERT(status == ODP_CRYPTO_SES_CREATE_ERR_NONE); /* Prepare input data */ - odp_buffer_t buf = odp_buffer_alloc(pool); - CU_ASSERT(buf != ODP_BUFFER_INVALID); - odp_packet_t pkt = odp_packet_from_buffer(buf); + odp_packet_t pkt = odp_packet_alloc(pool, input_vec_len); CU_ASSERT(pkt != ODP_PACKET_INVALID); uint8_t *data_addr = odp_packet_data(pkt); memcpy(data_addr, input_vec, input_vec_len); @@ -91,6 +89,8 @@ static void alg_test(enum odp_crypto_op op, } if (compl_new == ODP_BUFFER_INVALID) { + /* hack: buf is removed after crypto API update tp events */ + odp_buffer_t buf = odp_buffer_from_event(odp_packet_to_event(pkt)); odp_crypto_set_operation_compl_ctx(buf, (void *)0xdeadbeef); rc = odp_crypto_operation(&op_params, &posted, buf); } else { @@ -106,7 +106,7 @@ static void alg_test(enum odp_crypto_op op, } while (compl_event == ODP_EVENT_INVALID); if (compl_new == ODP_BUFFER_INVALID) - CU_ASSERT(odp_buffer_from_event(compl_event) == buf) + CU_ASSERT(compl_event == odp_packet_to_event(pkt)) else CU_ASSERT(odp_buffer_from_event(compl_event) == compl_new) @@ -127,7 +127,7 @@ static void alg_test(enum odp_crypto_op op, void *ctx = odp_crypto_get_operation_compl_ctx(odp_buffer_from_event(compl_event)); CU_ASSERT(ctx == (void *)0xdeadbeef); - odp_buffer_free(buf); + odp_packet_free(pkt); } /* This test verifies the correctness of encode (plaintext -> ciphertext) diff --git a/test/validation/crypto/odp_crypto_test_sync_inp.c b/test/validation/crypto/odp_crypto_test_sync_inp.c index f37ad54..c527b90 100644 --- a/test/validation/crypto/odp_crypto_test_sync_inp.c +++ b/test/validation/crypto/odp_crypto_test_sync_inp.c @@ -50,9 +50,7 @@ static void alg_test(enum odp_crypto_op op, CU_ASSERT(status == ODP_CRYPTO_SES_CREATE_ERR_NONE); /* Prepare input data */ - odp_buffer_t buf = odp_buffer_alloc(pool); - CU_ASSERT(buf != ODP_BUFFER_INVALID); - odp_packet_t pkt = odp_packet_from_buffer(buf); + odp_packet_t pkt = odp_packet_alloc(pool, input_vec_len); CU_ASSERT(pkt != ODP_PACKET_INVALID); uint8_t *data_addr = odp_packet_data(pkt); memcpy(data_addr, input_vec, input_vec_len); @@ -80,7 +78,7 @@ static void alg_test(enum odp_crypto_op op, } /* TEST : odp_crypto_operation */ - rc = odp_crypto_operation(&op_params, &posted, buf); + rc = odp_crypto_operation(&op_params, &posted, odp_buffer_from_event(odp_packet_to_event(pkt))); CU_ASSERT(!rc); /* indication that the operation completed */ CU_ASSERT(!posted);