From patchwork Tue Jan 20 11:18:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43347 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F367E2034D for ; Tue, 20 Jan 2015 11:19:32 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf5986952wiv.2 for ; Tue, 20 Jan 2015 03:19:32 -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=ivgJ/7BZ+0zzN2C2b9RcTemGHKFn5SRg7T3af60LwpQ=; b=fS0wzWfqWGn0khOf3cTeJ7LV7MuPWrm88d05gvyzok+WzDRuYed+PheOtnwo6EDPpj F6KXcFlWA4ydxhN+s1cKreRkg4Skj4xMZTCrV9nYshIuhn2v0gL6NuoR4bS4ZY7C5trX n19i3chfjUJkRm2yNnh4UZE0uJnSp6TuY3WEASpH3V5JA/5CI8CL6aMuUF0K0B/mLL80 tD2rOosy5U8512UTzwpFMoYbqAwcZlKHz4CbrAxTn2aaswleNL0N3Ly7IgKjVbpFFeCK VEx8jMNrmfx1T2/ecAvj+Uf/dY6o4ytNdg/Mrrl9T8myoYxZ7c8Wytr848q4ZiBm3edq GSgQ== X-Gm-Message-State: ALoCoQmgxQTeXzd5ZbI84pgF28eI1dEtnFQHdOSzdlkcxaKrciquM/rl4wGANKo9y84b30TuZ6ST X-Received: by 10.180.92.66 with SMTP id ck2mr2541700wib.3.1421752772205; Tue, 20 Jan 2015 03:19:32 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.1 with SMTP id ku1ls710074lac.80.gmail; Tue, 20 Jan 2015 03:19:31 -0800 (PST) X-Received: by 10.152.22.67 with SMTP id b3mr37965228laf.82.1421752771919; Tue, 20 Jan 2015 03:19:31 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id eh12si8118571lac.105.2015.01.20.03.19.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id z11so32987822lbi.6 for ; Tue, 20 Jan 2015 03:19:31 -0800 (PST) X-Received: by 10.152.23.38 with SMTP id j6mr37574220laf.81.1421752771794; Tue, 20 Jan 2015 03:19:31 -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 c8csp1380782lbb; Tue, 20 Jan 2015 03:19:30 -0800 (PST) X-Received: by 10.224.80.67 with SMTP id s3mr56569152qak.84.1421752770102; Tue, 20 Jan 2015 03:19:30 -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 n7si21670994qai.76.2015.01.20.03.19.28 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:30 -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 1YDWqE-0006Fn-M3; Tue, 20 Jan 2015 11:19:26 +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 1YDWq0-0006Bj-BC for lng-odp@lists.linaro.org; Tue, 20 Jan 2015 11:19:12 +0000 Received: by mail-qg0-f53.google.com with SMTP id a108so20621033qge.12 for ; Tue, 20 Jan 2015 03:19:07 -0800 (PST) X-Received: by 10.229.212.67 with SMTP id gr3mr56697313qcb.6.1421752747192; Tue, 20 Jan 2015 03:19:07 -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.05 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:06 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 13:18:00 +0200 Message-Id: <1421752692-24439-5-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 04/16] api: event: odp_queue_deq 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.175 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 odp_queue_deq() to use events instead of buffers. Signed-off-by: Petri Savolainen --- example/ipsec/odp_ipsec_stream.c | 4 +++- platform/linux-generic/include/api/odp_queue.h | 6 +++--- platform/linux-generic/odp_queue.c | 6 +++--- platform/linux-generic/odp_schedule.c | 4 +++- test/performance/odp_scheduling.c | 9 +++++++-- test/validation/crypto/odp_crypto_test_async_inp.c | 14 +++++++------- test/validation/odp_pktio.c | 8 ++++---- test/validation/odp_timer.c | 19 +++++++++++-------- 8 files changed, 41 insertions(+), 29 deletions(-) diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index 8900483..dc78d77 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -531,7 +531,9 @@ bool verify_stream_db_outputs(void) buf_tbl, LOOP_DEQ_COUNT); #else - buf_tbl[0] = odp_queue_deq(queue); + odp_event_t ev; + ev = odp_queue_deq(queue); + buf_tbl[0] = odp_buffer_from_event(ev); count = (buf_tbl[0] != ODP_BUFFER_INVALID) ? 1 : 0; #endif if (!count) diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h index 61afd36..d502f15 100644 --- a/platform/linux-generic/include/api/odp_queue.h +++ b/platform/linux-generic/include/api/odp_queue.h @@ -194,14 +194,14 @@ int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num); /** * Queue dequeue * - * Dequeues next buffer from head of the queue. Cannot be used for + * Dequeues next event from head of the queue. Cannot be used for * ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead). * * @param queue Queue handle * - * @return Buffer handle, or ODP_BUFFER_INVALID + * @return Event handle, or ODP_EVENT_INVALID */ -odp_buffer_t odp_queue_deq(odp_queue_t queue); +odp_event_t odp_queue_deq(odp_queue_t queue); /** * Dequeue multiple buffers from a queue diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index f3046e2..b77f3d6 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -514,7 +514,7 @@ int odp_queue_deq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) } -odp_buffer_t odp_queue_deq(odp_queue_t handle) +odp_event_t odp_queue_deq(odp_queue_t handle) { queue_entry_t *queue; odp_buffer_hdr_t *buf_hdr; @@ -523,9 +523,9 @@ odp_buffer_t odp_queue_deq(odp_queue_t handle) buf_hdr = queue->s.dequeue(queue); if (buf_hdr) - return buf_hdr->handle.handle; + return odp_buffer_to_event(buf_hdr->handle.handle); - return ODP_BUFFER_INVALID; + return ODP_EVENT_INVALID; } diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 1e54fd2..e5e7ae3 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -267,6 +267,7 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], for (j = 0; j < QUEUES_PER_PRIO; j++, id++) { odp_queue_t pri_q; + odp_event_t ev; odp_buffer_t desc_buf; if (id >= QUEUES_PER_PRIO) @@ -276,7 +277,8 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], continue; pri_q = sched->pri_queue[i][id]; - desc_buf = odp_queue_deq(pri_q); + ev = odp_queue_deq(pri_q); + desc_buf = odp_buffer_from_event(ev); if (desc_buf != ODP_BUFFER_INVALID) { queue_desc_t *desc; diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 7a48eed..9f6eca1 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -258,6 +258,7 @@ static int test_alloc_multi(int thr, odp_buffer_pool_t pool) */ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) { + odp_event_t ev; odp_buffer_t buf; test_message_t *t_msg; odp_queue_t queue; @@ -288,12 +289,16 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) t1 = odp_time_cycles(); for (i = 0; i < QUEUE_ROUNDS; i++) { - if (odp_queue_enq(queue, odp_buffer_to_event(buf))) { + ev = odp_buffer_to_event(buf); + + if (odp_queue_enq(queue, ev)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } - buf = odp_queue_deq(queue); + ev = odp_queue_deq(queue); + + buf = odp_buffer_from_event(ev); if (!odp_buffer_is_valid(buf)) { LOG_ERR(" [%i] Queue empty.\n", thr); diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c b/test/validation/crypto/odp_crypto_test_async_inp.c index 96d4c3f..01e4d7d 100644 --- a/test/validation/crypto/odp_crypto_test_async_inp.c +++ b/test/validation/crypto/odp_crypto_test_async_inp.c @@ -35,7 +35,7 @@ static void alg_test(enum odp_crypto_op op, int rc; enum odp_crypto_ses_create_err status; bool posted; - odp_buffer_t compl_event; + odp_event_t compl_event; odp_queue_t compl_queue = odp_queue_lookup("crypto-out"); CU_ASSERT(compl_queue != ODP_QUEUE_INVALID); @@ -103,15 +103,15 @@ static void alg_test(enum odp_crypto_op op, /* Poll completion queue for results */ do { compl_event = odp_queue_deq(compl_queue); - } while (compl_event == ODP_BUFFER_INVALID); + } while (compl_event == ODP_EVENT_INVALID); if (compl_new == ODP_BUFFER_INVALID) - CU_ASSERT(compl_event == buf) + CU_ASSERT(odp_buffer_from_event(compl_event) == buf) else - CU_ASSERT(compl_event == compl_new) + CU_ASSERT(odp_buffer_from_event(compl_event) == compl_new) struct odp_crypto_compl_status auth_status, cipher_status; - odp_crypto_get_operation_compl_status(compl_event, + odp_crypto_get_operation_compl_status(odp_buffer_from_event(compl_event), &auth_status, &cipher_status); CU_ASSERT(auth_status.alg_err == ODP_CRYPTO_ALG_ERR_NONE); CU_ASSERT(auth_status.hw_err == ODP_CRYPTO_HW_ERR_NONE); @@ -119,12 +119,12 @@ static void alg_test(enum odp_crypto_op op, CU_ASSERT(cipher_status.hw_err == ODP_CRYPTO_HW_ERR_NONE); odp_packet_t out_pkt; - out_pkt = odp_crypto_get_operation_compl_packet(compl_event); + out_pkt = odp_crypto_get_operation_compl_packet(odp_buffer_from_event(compl_event)); CU_ASSERT(out_pkt == pkt); CU_ASSERT(!memcmp(data_addr, output_vec, output_vec_len)); - void *ctx = odp_crypto_get_operation_compl_ctx(compl_event); + void *ctx = odp_crypto_get_operation_compl_ctx(odp_buffer_from_event(compl_event)); CU_ASSERT(ctx == (void *)0xdeadbeef); odp_buffer_free(buf); diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index 16e85fa..b1eb61e 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -247,14 +247,14 @@ static int create_inq(odp_pktio_t pktio) static odp_buffer_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns) { uint64_t start, now, diff; - odp_buffer_t buf; + odp_event_t ev; start = odp_time_cycles(); do { - buf = odp_queue_deq(queue); - if (buf != ODP_BUFFER_INVALID) - return buf; + ev = odp_queue_deq(queue); + if (ev != ODP_EVENT_INVALID) + return odp_buffer_from_event(ev); now = odp_time_cycles(); diff = odp_time_diff_cycles(start, now); } while (odp_time_cycles_to_ns(diff) < ns); diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 4c93f71..eca7e7f 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -157,8 +157,10 @@ static void *worker_entrypoint(void *arg) uint32_t ms; uint64_t prev_tick = odp_timer_current_tick(tp); for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) { - odp_buffer_t buf; - while ((buf = odp_queue_deq(queue)) != ODP_BUFFER_INVALID) { + odp_event_t ev; + while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) { + odp_buffer_t buf; + buf = odp_buffer_from_event(ev); /* Subtract one from prev_tick to allow for timeouts * to be delivered a tick late */ handle_tmo(buf, false, prev_tick - 1); @@ -233,8 +235,9 @@ static void *worker_entrypoint(void *arg) * received */ usleep(1000/*1ms*/); while (nstale != 0) { - odp_buffer_t buf = odp_queue_deq(queue); - if (buf != ODP_BUFFER_INVALID) { + odp_event_t ev = odp_queue_deq(queue); + if (ev != ODP_EVENT_INVALID) { + odp_buffer_t buf = odp_buffer_from_event(ev); handle_tmo(buf, true, 0/*Dont' care for stale tmo's*/); nstale--; } else { @@ -242,10 +245,10 @@ static void *worker_entrypoint(void *arg) break; } } - /* Check if there any more (unexpected) buffers */ - odp_buffer_t buf = odp_queue_deq(queue); - if (buf != ODP_BUFFER_INVALID) - CU_FAIL("Unexpected buffer received"); + /* Check if there any more (unexpected) events */ + odp_event_t ev = odp_queue_deq(queue); + if (ev != ODP_EVENT_INVALID) + CU_FAIL("Unexpected event received"); printf("Thread %u: exiting\n", thr); return NULL;