From patchwork Wed Jan 21 15:15:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43449 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 46CB7218DB for ; Wed, 21 Jan 2015 15:17:50 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf9451165wid.3 for ; Wed, 21 Jan 2015 07:17:49 -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=leBk0CUqfzBvjqk3fa/S9MHBbDrsZ+qWLg626+rfxyE=; b=AoS4Am+5Zz4oXnE3xm4gRNN55saHlODIh85Rf9Jf8emoQwS3kvMQdUv6SmiuThr2z/ LiNZqs3YMd0Q048Wx8vE86Hq8MKGUdN+VPB8ovPvuR2KGanUlJXvYFwtimbqADT8IX9o qfAbUXPMbyKeLNQ4s+Y7uO/GYQOQcFKC98RqTfzeOIBsOqGp5oOdPamCl2vPwC5qewDy 90nrWfWm+tvWcAp9Z3NzpCr4ZCfJmmYTDCi8DrOcSc6wRumjQUk65TtXwmN93EAge41d JlDI2/UxgbLPIGcz2ZIj3kGMG2C+vrwg1YQ16uSgOU6gaQti3b+kBnumH+Qxqq7W6hWq BwDw== X-Gm-Message-State: ALoCoQlkWT/eVWZLN6j/o8RKASIQMKMArLD283DQmlD9iMPEioouS52f02NIR7RD5Vywrq2zmKRj X-Received: by 10.152.5.98 with SMTP id r2mr375802lar.6.1421853469532; Wed, 21 Jan 2015 07:17:49 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.67 with SMTP id g3ls47876lab.25.gmail; Wed, 21 Jan 2015 07:17:49 -0800 (PST) X-Received: by 10.152.180.136 with SMTP id do8mr18463313lac.31.1421853469384; Wed, 21 Jan 2015 07:17:49 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id k1si19604967lam.30.2015.01.21.07.17.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id f15so19089440lbj.0 for ; Wed, 21 Jan 2015 07:17:49 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr44906602lal.29.1421853469250; Wed, 21 Jan 2015 07:17: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 c8csp1810294lbb; Wed, 21 Jan 2015 07:17:47 -0800 (PST) X-Received: by 10.224.112.9 with SMTP id u9mr69223137qap.18.1421853467199; Wed, 21 Jan 2015 07:17: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 p5si4834920qak.86.2015.01.21.07.17.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17: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 1YDx2B-0007z8-W6; Wed, 21 Jan 2015 15:17:32 +0000 Received: from mail-qa0-f45.google.com ([209.85.216.45]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDx1w-0007vu-E7 for lng-odp@lists.linaro.org; Wed, 21 Jan 2015 15:17:16 +0000 Received: by mail-qa0-f45.google.com with SMTP id n8so33298249qaq.4 for ; Wed, 21 Jan 2015 07:17:11 -0800 (PST) X-Received: by 10.229.102.68 with SMTP id f4mr59149501qco.15.1421853430185; Wed, 21 Jan 2015 07:17:10 -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 91sm415056qgf.1.2015.01.21.07.17.08 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:09 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Wed, 21 Jan 2015 17:15:32 +0200 Message-Id: <1421853343-22138-6-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421853343-22138-1-git-send-email-petri.savolainen@linaro.org> References: <1421853343-22138-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 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: 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.169 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 | 18 ++++++++++-------- 5 files changed, 25 insertions(+), 25 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 842df37..505acec 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -290,7 +290,7 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], queue = desc->queue; 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 7c5e8dd..07e37ee 100644 --- a/test/validation/odp_queue.c +++ b/test/validation/odp_queue.c @@ -36,11 +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; @@ -68,9 +69,10 @@ static void test_odp_queue_sunnyday(void) msg_pool = odp_buffer_pool_lookup("msg_pool"); buf = odp_buffer_alloc(msg_pool); + ev = odp_buffer_to_event(buf); - odp_queue_enq(queue_id, odp_buffer_to_event(buf)); - CU_ASSERT_EQUAL(buf, odp_queue_deq(queue_id)); + odp_queue_enq(queue_id, ev); + CU_ASSERT_EQUAL(ev, odp_queue_deq(queue_id)); odp_buffer_free(buf); for (i = 0; i < MAX_BUFFER_QUEUE; i++) { @@ -84,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); }