From patchwork Mon Jan 26 13:05:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43744 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 57AB423FFF for ; Mon, 26 Jan 2015 13:06:51 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id s18sf4207564lam.2 for ; Mon, 26 Jan 2015 05:06: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=J2Jy9QE1MrZV0grv5FnwCwo0aIAik2Pjff0IIsbMwUM=; b=gy4ET97jGt3kN016Vsy2JeDAYm3AIyikNkkfkVC16+7BJ9COrx7zVs18hnprp9rk/j r9fXin5kU68vn4vu4wnAQ0vL5X50mJtr5Dpxioa1Xk+0oa/03G4gIkYsBSMO5fk8q2zX WZ+jeToQqUv/K86kBZipJNRrb4D0C6xGrDo16sjB0KPc8eSLOx/saTMI+zCY3zTLne1m 94t8WR52K+iRv8JyVt4op9afmVqiUejbfYOufp6aRJ7zjyQ/9XYIAU/myyj1tg9/qpYQ MaR+vWng8YAW15Ok2AmKogIsdyETN/SJ5HxjQ13hWspPsPQF2oK+1raHCkNBNKcB9/0L RXYA== X-Gm-Message-State: ALoCoQkNP+AlfwHWtKX9BRqXreWMPmjz3Kkk2b2za72cGZpov7dZqTRaaaeS+PLw50zvEmcxUBha X-Received: by 10.180.92.133 with SMTP id cm5mr403436wib.4.1422277610322; Mon, 26 Jan 2015 05:06:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.205 with SMTP id q13ls483652lal.85.gmail; Mon, 26 Jan 2015 05:06:50 -0800 (PST) X-Received: by 10.112.150.98 with SMTP id uh2mr21167484lbb.92.1422277610154; Mon, 26 Jan 2015 05:06:50 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id wm7si8965947lbb.72.2015.01.26.05.06.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 05:06:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id f15so7431593lbj.5 for ; Mon, 26 Jan 2015 05:06:50 -0800 (PST) X-Received: by 10.112.26.135 with SMTP id l7mr20590433lbg.56.1422277610062; Mon, 26 Jan 2015 05:06:50 -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.35.133 with SMTP id h5csp774133lbj; Mon, 26 Jan 2015 05:06:49 -0800 (PST) X-Received: by 10.140.33.162 with SMTP id j31mr39445690qgj.10.1422277608422; Mon, 26 Jan 2015 05:06: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 u17si13146466qgd.7.2015.01.26.05.06.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 26 Jan 2015 05:06: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 1YFjNN-0004ov-BE; Mon, 26 Jan 2015 13:06:45 +0000 Received: from mail-qa0-f41.google.com ([209.85.216.41]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YFjN4-0004kj-At for lng-odp@lists.linaro.org; Mon, 26 Jan 2015 13:06:26 +0000 Received: by mail-qa0-f41.google.com with SMTP id bm13so6556198qab.0 for ; Mon, 26 Jan 2015 05:06:21 -0800 (PST) X-Received: by 10.140.51.104 with SMTP id t95mr26946338qga.88.1422277581133; Mon, 26 Jan 2015 05:06: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 a1sm4972929qab.28.2015.01.26.05.06.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 05:06:20 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Mon, 26 Jan 2015 15:05:39 +0200 Message-Id: <1422277551-16417-6-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422277551-16417-1-git-send-email-petri.savolainen@linaro.org> References: <1422277551-16417-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v5 05/17] api: event: odp_queue_deq_multi 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.174 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_multi() to use events instead of buffers. Signed-off-by: Petri Savolainen --- example/ipsec/odp_ipsec_stream.c | 12 +++++------- platform/linux-generic/include/api/odp_queue.h | 14 +++++++------- platform/linux-generic/odp_queue.c | 4 ++-- platform/linux-generic/odp_schedule.c | 2 +- test/validation/odp_queue.c | 12 ++++++------ 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index dc78d77..7e3ad4a 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -518,7 +518,7 @@ bool verify_stream_db_outputs(void) int idx; int count; odp_queue_t queue; - odp_buffer_t buf_tbl[LOOP_DEQ_COUNT]; + odp_event_t ev_tbl[LOOP_DEQ_COUNT]; queue = query_loopback_db_outq(stream->output.loop); @@ -528,13 +528,11 @@ bool verify_stream_db_outputs(void) for (;;) { #if LOOP_DEQ_MULTIPLE count = odp_queue_deq_multi(queue, - buf_tbl, + ev_tbl, LOOP_DEQ_COUNT); #else - 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; + ev_tbl[0] = odp_queue_deq(queue); + count = (ev_tbl[0] != ODP_EVENT_INVALID) ? 1 : 0; #endif if (!count) break; @@ -542,7 +540,7 @@ bool verify_stream_db_outputs(void) bool good; odp_packet_t pkt; - pkt = odp_packet_from_buffer(buf_tbl[idx]); + pkt = odp_packet_from_event(ev_tbl[idx]); good = verify_ipv4_packet(stream, pkt); if (good) diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h index d502f15..fceed4d 100644 --- a/platform/linux-generic/include/api/odp_queue.h +++ b/platform/linux-generic/include/api/odp_queue.h @@ -20,7 +20,7 @@ extern "C" { #include -#include +#include /** @defgroup odp_queue ODP QUEUE * Macros and operation on a queue. @@ -204,18 +204,18 @@ int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num); odp_event_t odp_queue_deq(odp_queue_t queue); /** - * Dequeue multiple buffers from a queue + * Dequeue multiple events from a queue * - * Dequeues multiple buffers from head of the queue. Cannot be used for + * Dequeues multiple events from head of the queue. Cannot be used for * ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead). * * @param queue Queue handle - * @param buf Buffer handles for output - * @param num Maximum number of buffer handles + * @param events Event handle array for output + * @param num Maximum number of event handles - * @return Number of buffers written (0 ... num) + * @return Number of events written (0 ... num) */ -int odp_queue_deq_multi(odp_queue_t queue, odp_buffer_t buf[], int num); +int odp_queue_deq_multi(odp_queue_t queue, odp_event_t events[], int num); /** * Queue type diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index b77f3d6..17ff7c1 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -494,7 +494,7 @@ int queue_deq_multi_destroy(queue_entry_t *queue, return 0; } -int odp_queue_deq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) +int odp_queue_deq_multi(odp_queue_t handle, odp_event_t events[], int num) { queue_entry_t *queue; odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX]; @@ -508,7 +508,7 @@ int odp_queue_deq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) ret = queue->s.dequeue_multi(queue, buf_hdr, num); for (i = 0; i < ret; i++) - buf[i] = buf_hdr[i]->handle.handle; + events[i] = odp_buffer_to_event(buf_hdr[i]->handle.handle); return ret; } diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 81db458..6b2a123 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -295,7 +295,7 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], continue; num = odp_queue_deq_multi(queue, - sched_local.buf, + (odp_event_t *)sched_local.buf, max_deq); if (num == 0) { diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c index 00b8078..07e37ee 100644 --- a/test/validation/odp_queue.c +++ b/test/validation/odp_queue.c @@ -36,12 +36,12 @@ static void test_odp_queue_sunnyday(void) { odp_queue_t queue_creat_id, queue_id; odp_event_t enev[MAX_BUFFER_QUEUE]; - odp_buffer_t debuf[MAX_BUFFER_QUEUE]; + odp_event_t deev[MAX_BUFFER_QUEUE]; odp_buffer_t buf; odp_event_t ev; odp_buffer_pool_t msg_pool; odp_queue_param_t param; - odp_buffer_t *pbuf_tmp; + odp_event_t *pev_tmp; int i, deq_ret, ret; int nr_deq_entries = 0; int max_iteration = CONFIG_MAX_ITERATION; @@ -86,19 +86,19 @@ static void test_odp_queue_sunnyday(void) */ ret = odp_queue_enq_multi(queue_id, enev, MAX_BUFFER_QUEUE); CU_ASSERT(0 == ret); - pbuf_tmp = debuf; + pev_tmp = deev; do { - deq_ret = odp_queue_deq_multi(queue_id, pbuf_tmp, + deq_ret = odp_queue_deq_multi(queue_id, pev_tmp, MAX_BUFFER_QUEUE); nr_deq_entries += deq_ret; max_iteration--; - pbuf_tmp += deq_ret; + pev_tmp += deq_ret; CU_ASSERT(max_iteration >= 0); } while (nr_deq_entries < MAX_BUFFER_QUEUE); for (i = 0; i < MAX_BUFFER_QUEUE; i++) { odp_buffer_t enbuf = odp_buffer_from_event(enev[i]); - CU_ASSERT_EQUAL(enbuf, debuf[i]); + CU_ASSERT_EQUAL(enev[i], deev[i]); odp_buffer_free(enbuf); }