From patchwork Sat Jan 24 18:40:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 43721 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 256BD2055F for ; Sat, 24 Jan 2015 18:41:23 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf1281777wgh.1 for ; Sat, 24 Jan 2015 10:41:22 -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: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=CdGpzBf6H3Mm3nKWTqVXPlmFxbv1ZpNmHH2oJq/iWAs=; b=J6q8EteVrQvaXJdHrRzfk0s0hZHATGedQBsCaLN74puaEihEDhHIV3QvO/ctQfBUl6 b7OC31XVw9vO5M53fg7Lp5OSHp6iXXXbifbYIQS6f9j//J+EnE0wUXyZLiO3KJ8AGFyj FWbo+3M/dJBLepPkKFYzxX+TWSUX8cF0UjNMemUUFScH3ZaJDEVeYMs5/o9zcfx6W/eP qja34XZ3gz9gDFvwfwNIviOcazMrnMUnCKxNkSMOPvGbTkwo1TgRNIE2CSVzgIt937fa vNkkk1BuK7ybz0UjRs7k2UUD83h6fav0QQAwz9P2l1VNuBruvCGVLRLGoeXUrMJR8xoY ETyg== X-Gm-Message-State: ALoCoQm0O0pd4ijqr+DEnE/KhzIVjIGkEJGyyJvVw5sNh0HqZIbPYp5zRDL7r+VV74bx49LpJknK X-Received: by 10.180.105.129 with SMTP id gm1mr973811wib.3.1422124882436; Sat, 24 Jan 2015 10:41:22 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.197 with SMTP id g5ls400401lam.99.gmail; Sat, 24 Jan 2015 10:41:22 -0800 (PST) X-Received: by 10.112.130.65 with SMTP id oc1mr13505725lbb.7.1422124882268; Sat, 24 Jan 2015 10:41:22 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id vp9si4619232lbb.134.2015.01.24.10.41.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 Jan 2015 10:41:22 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id u10so2359471lbd.12 for ; Sat, 24 Jan 2015 10:41:22 -0800 (PST) X-Received: by 10.112.41.234 with SMTP id i10mr13619828lbl.25.1422124882117; Sat, 24 Jan 2015 10: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.35.133 with SMTP id h5csp308643lbj; Sat, 24 Jan 2015 10:41:21 -0800 (PST) X-Received: by 10.224.61.203 with SMTP id u11mr7369555qah.33.1422124880456; Sat, 24 Jan 2015 10:41:20 -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 65si6826898qgx.47.2015.01.24.10.41.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 24 Jan 2015 10:41:20 -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 1YF5e0-0007X2-ME; Sat, 24 Jan 2015 18:41:16 +0000 Received: from mail-oi0-f47.google.com ([209.85.218.47]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YF5du-0007Uw-SE for lng-odp@lists.linaro.org; Sat, 24 Jan 2015 18:41:10 +0000 Received: by mail-oi0-f47.google.com with SMTP id a141so2235936oig.6 for ; Sat, 24 Jan 2015 10:41:05 -0800 (PST) X-Received: by 10.60.16.230 with SMTP id j6mr5206410oed.8.1422124865435; Sat, 24 Jan 2015 10:41:05 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id e196sm2712355oig.5.2015.01.24.10.41.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Jan 2015 10:41:04 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sat, 24 Jan 2015 12:40:58 -0600 Message-Id: <1422124858-31443-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCHv5 05/16] 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: bill.fischofer@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.181 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 From: Petri Savolainen Changed odp_queue_deq_multi() to use events instead of buffers. Signed-off-by: Petri Savolainen Signed-off-by: Bill Fischofer --- v5 applies to ODP v0.9.0, v4 runs afoul of update: linux-generic: fix odp_pktio_inq_remdef 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); }