From patchwork Thu Jan 15 15:40:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43205 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4900F240BA for ; Thu, 15 Jan 2015 15:41:24 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id b6sf2335280lbj.2 for ; Thu, 15 Jan 2015 07:41:23 -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=NU6IAm4HtNduZ9KA6WPnt+dqK0tg5KYZwKvqLb9Rvdo=; b=dw7YntZBbOsKgmhY/jnAZGJD2arCj1Kd6rvVmxmvuyZPDeZBAxUZHSvC8Hac4ZaGb8 +7Sjy6/9U915XKflFklY1IvCpQkHvWwk9HR2Y59xXk4WAj9CsSyY5ddLfaaiJFpQLqkw h0XynLs/9xLHp7cW16j7ykm0n79Oi6tSLt+onYnxZo70hcojZHxmhXUVmby+JtN7Dh1U Y6PFgLHBU6m6SR+JxSRKrHgPRyNd86/qBNGUv5ENHsdi1fvqivuWCKn8zobznbOIxcLS Wf6Zplh0t8TL8qfA+uxeLaP2O4n2sFY0GuHcUSigMAew18mBQXT6qJ4VFPL0IjGvjUj5 CKpg== X-Gm-Message-State: ALoCoQkkm1RVrvfxLtirVGJWNUzHvrJqF2BA9urwddWLnHvDI/TrQxwCVgwDKjti3DdtDywn9Y6K X-Received: by 10.180.228.38 with SMTP id sf6mr4422894wic.5.1421336483233; Thu, 15 Jan 2015 07:41:23 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.234 with SMTP id r10ls214728lal.17.gmail; Thu, 15 Jan 2015 07:41:23 -0800 (PST) X-Received: by 10.152.45.65 with SMTP id k1mr10751977lam.14.1421336483069; Thu, 15 Jan 2015 07:41:23 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id v4si1753510lav.88.2015.01.15.07.41.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:22 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id ge10so4486445lab.5 for ; Thu, 15 Jan 2015 07:41:22 -0800 (PST) X-Received: by 10.152.5.226 with SMTP id v2mr10636374lav.34.1421336482895; Thu, 15 Jan 2015 07:41:22 -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 c8csp21873lbb; Thu, 15 Jan 2015 07:41:22 -0800 (PST) X-Received: by 10.229.114.137 with SMTP id e9mr17282423qcq.0.1421336481540; Thu, 15 Jan 2015 07:41:21 -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 q89si2361213qgd.39.2015.01.15.07.41.20 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:21 -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 1YBmXv-0007NZ-19; Thu, 15 Jan 2015 15:41:19 +0000 Received: from mail-qc0-f176.google.com ([209.85.216.176]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBmXm-0007JQ-BF for lng-odp@lists.linaro.org; Thu, 15 Jan 2015 15:41:10 +0000 Received: by mail-qc0-f176.google.com with SMTP id b13so1781828qcw.7 for ; Thu, 15 Jan 2015 07:41:05 -0800 (PST) X-Received: by 10.224.46.200 with SMTP id k8mr16881319qaf.89.1421336464995; Thu, 15 Jan 2015 07:41:04 -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.02 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:03 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Thu, 15 Jan 2015 17:40:12 +0200 Message-Id: <1421336423-19382-5-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: patch Subject: [lng-odp] [PATCH 04/15] 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.215.46 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 +++++++-- 5 files changed, 19 insertions(+), 10 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 b770270..51ea16b 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 ebf0609..e12da56 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);