From patchwork Thu Jan 15 15:40:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43204 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 CCC91240BA for ; Thu, 15 Jan 2015 15:41:19 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id y19sf8313840wgg.1 for ; Thu, 15 Jan 2015 07:41:19 -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=8qH+X6D5CV3AaZ+chzARpyYlt4lwfCutEvjRP1H91Dg=; b=j6/mm/9kX3uaGfBycJXyvdFM8HeaCg6pZHLA+I1PhqImJI/1ffddRn/OPNtdecOGEN OZwTJvS9URJWxc1zCHCPagdDLjMmLUda7dq0TgThUVKIr1mz2bi4gzzqK8TlZRX4IqQl KCCBZtD+n/Zm8xMT+vl95tL8N9mWP8s/d28SepCJhPO2Ear5oWQS1LyFCMz1RSAZXxMa bCX2yF0V/pJwRXwBITneykLuh5Wx3p+HRaZBFspKqLyNSkIrSELVU4S9o/msTHH+Rpju 5e89kIw3xpNUssCM/O5LQUs3PX8c3hJcbcDlSJAefknUlBKGl2vAKw06CjwSKtIZDsD2 ZKvg== X-Gm-Message-State: ALoCoQnT5LXWuHbzBGLB4JbGGdJZzejwhc2OXVbF8IuCUjUKJB4DVPSHUaO+OtBbuEopQf2jpoD2 X-Received: by 10.112.137.136 with SMTP id qi8mr368739lbb.13.1421336479099; Thu, 15 Jan 2015 07:41:19 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.229 with SMTP id e5ls199678laa.105.gmail; Thu, 15 Jan 2015 07:41:18 -0800 (PST) X-Received: by 10.153.5.1 with SMTP id ci1mr10250171lad.67.1421336478885; Thu, 15 Jan 2015 07:41:18 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id zd4si364448lbb.75.2015.01.15.07.41.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:18 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id f15so4357736lbj.11 for ; Thu, 15 Jan 2015 07:41:18 -0800 (PST) X-Received: by 10.112.98.99 with SMTP id eh3mr10430396lbb.32.1421336478795; Thu, 15 Jan 2015 07:41:18 -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 c8csp21856lbb; Thu, 15 Jan 2015 07:41:18 -0800 (PST) X-Received: by 10.140.102.165 with SMTP id w34mr5443210qge.26.1421336477388; Thu, 15 Jan 2015 07:41:17 -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 l78si2325335qgd.65.2015.01.15.07.41.16 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:17 -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 1YBmXq-0007MD-HF; Thu, 15 Jan 2015 15:41:14 +0000 Received: from mail-qa0-f50.google.com ([209.85.216.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBmXi-0007JA-PU for lng-odp@lists.linaro.org; Thu, 15 Jan 2015 15:41:06 +0000 Received: by mail-qa0-f50.google.com with SMTP id k15so11604623qaq.9 for ; Thu, 15 Jan 2015 07:41:01 -0800 (PST) X-Received: by 10.229.219.74 with SMTP id ht10mr11739185qcb.25.1421336461539; Thu, 15 Jan 2015 07:41:01 -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.40.58 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:00 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Thu, 15 Jan 2015 17:40:11 +0200 Message-Id: <1421336423-19382-4-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 03/15] api: event: schedule_multi and queue_enq_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.180 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_schedule_multi() and odp_queue_enq_multi() to use events instead of buffers. Signed-off-by: Petri Savolainen --- platform/linux-generic/include/api/odp_queue.h | 8 ++++---- platform/linux-generic/include/api/odp_schedule.h | 16 ++++++++-------- platform/linux-generic/odp_queue.c | 4 ++-- platform/linux-generic/odp_schedule.c | 4 ++-- test/performance/odp_scheduling.c | 22 +++++++++++++--------- 5 files changed, 29 insertions(+), 25 deletions(-) diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h index 589d07a..b770270 100644 --- a/platform/linux-generic/include/api/odp_queue.h +++ b/platform/linux-generic/include/api/odp_queue.h @@ -181,15 +181,15 @@ void *odp_queue_get_context(odp_queue_t queue); int odp_queue_enq(odp_queue_t queue, odp_event_t ev); /** - * Enqueue multiple buffers to a queue + * Enqueue multiple events to a queue * * @param queue Queue handle - * @param buf Buffer handles - * @param num Number of buffer handles + * @param ev Event handles + * @param num Number of event handles * * @return 0 if succesful */ -int odp_queue_enq_multi(odp_queue_t queue, odp_buffer_t buf[], int num); +int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num); /** * Queue dequeue diff --git a/platform/linux-generic/include/api/odp_schedule.h b/platform/linux-generic/include/api/odp_schedule.h index 45fa48c..688a6db 100644 --- a/platform/linux-generic/include/api/odp_schedule.h +++ b/platform/linux-generic/include/api/odp_schedule.h @@ -64,22 +64,22 @@ uint64_t odp_schedule_wait_time(uint64_t ns); odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait); /** - * Schedule multiple buffers + * Schedule multiple events * - * Like odp_schedule(), but returns multiple buffers from a queue. + * Like odp_schedule(), but returns multiple events from a queue. * - * @param from Output parameter for the source queue (where the buffer was + * @param from Output parameter for the source queue (where the event was * dequeued from). Ignored if NULL. - * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to + * @param wait Minimum time to wait for an event. Waits infinitely, if set to * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. * Use odp_schedule_wait_time() to convert time to other wait * values. - * @param out_buf Buffer array for output - * @param num Maximum number of buffers to output + * @param events Event array for output + * @param num Maximum number of events to output * - * @return Number of buffers outputed (0 ... num) + * @return Number of events outputed (0 ... num) */ -int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_buffer_t out_buf[], +int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], unsigned int num); /** diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index c027f23..f3046e2 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -385,7 +385,7 @@ int queue_enq_multi_dummy(queue_entry_t *queue ODP_UNUSED, return -1; } -int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) +int odp_queue_enq_multi(odp_queue_t handle, odp_event_t ev[], int num) { odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX]; queue_entry_t *queue; @@ -397,7 +397,7 @@ int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) queue = queue_to_qentry(handle); for (i = 0; i < num; i++) - buf_hdr[i] = odp_buf_to_hdr(buf[i]); + buf_hdr[i] = odp_buf_to_hdr(odp_buffer_from_event(ev[i])); return queue->s.enqueue_multi(queue, buf_hdr, num); } diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 7b25e8a..1e54fd2 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -380,9 +380,9 @@ odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) int odp_schedule_multi(odp_queue_t *out_queue, uint64_t wait, - odp_buffer_t out_buf[], unsigned int num) + odp_event_t events[], unsigned int num) { - return schedule_loop(out_queue, wait, out_buf, num, MAX_DEQ); + return schedule_loop(out_queue, wait, (odp_buffer_t *)events, num, MAX_DEQ); } diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 1196ef9..ebf0609 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -481,7 +481,7 @@ static int test_schedule_multi(const char *str, int thr, odp_buffer_pool_t msg_pool, int prio, odp_barrier_t *barrier) { - odp_buffer_t buf[MULTI_BUFS_MAX]; + odp_event_t ev[MULTI_BUFS_MAX]; odp_queue_t queue; uint64_t t1 = 0; uint64_t t2 = 0; @@ -508,16 +508,20 @@ static int test_schedule_multi(const char *str, int thr, } for (j = 0; j < MULTI_BUFS_MAX; j++) { - buf[j] = odp_buffer_alloc(msg_pool); + odp_buffer_t buf; - if (!odp_buffer_is_valid(buf[j])) { + buf = odp_buffer_alloc(msg_pool); + + if (!odp_buffer_is_valid(buf)) { LOG_ERR(" [%i] msg_pool alloc failed\n", thr); return -1; } + + ev[j] = odp_buffer_to_event(buf); } - if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) { + if (odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -527,22 +531,22 @@ static int test_schedule_multi(const char *str, int thr, t1 = odp_time_cycles(); for (i = 0; i < QUEUE_ROUNDS; i++) { - num = odp_schedule_multi(&queue, ODP_SCHED_WAIT, buf, + num = odp_schedule_multi(&queue, ODP_SCHED_WAIT, ev, MULTI_BUFS_MAX); tot += num; - if (odp_queue_enq_multi(queue, buf, num)) { + if (odp_queue_enq_multi(queue, ev, num)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } - /* Clear possible locally stored buffers */ + /* Clear possible locally stored events */ odp_schedule_pause(); while (1) { - num = odp_schedule_multi(&queue, ODP_SCHED_NO_WAIT, buf, + num = odp_schedule_multi(&queue, ODP_SCHED_NO_WAIT, ev, MULTI_BUFS_MAX); if (num == 0) @@ -550,7 +554,7 @@ static int test_schedule_multi(const char *str, int thr, tot += num; - if (odp_queue_enq_multi(queue, buf, num)) { + if (odp_queue_enq_multi(queue, ev, num)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; }