From patchwork Wed Jan 21 04:57:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 43436 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 802F62034D for ; Wed, 21 Jan 2015 04:58:36 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id hs14sf22463403lab.1 for ; Tue, 20 Jan 2015 20:58:35 -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=3qJ0t57LLCxCENgj3HyKbB7nu2kS9IpdOmAN6yYs04o=; b=Z1wQhkkKBY33bIWqQ+snQ0KEiKODWOHggQmMreIyDzSIhQw1L/FBg+0rGzR97Zh2u7 vCOA3sJvLtjCwyHo4YMJ43hxaxxV9E0xOLZyok9nOuizOYd61RTFf3YFDUeQqhCnSp74 6TfT2s7NYcWBy5FdH//4wjJLzIpACc6AQA5zOp4c00fazknl+N4nFBLLEITnH/4I2Ssw t0yVGZqHSoOjBzA5JjCBM1n43VuKFvQ8n52xWE+ijHl29Ipd5FtgYZeZ7L3DZLpN71nE Iy31BWE1fyf3AXliVrKbuwe+kvwc8VaACM9vEU+0U8qTggMNyz+s99g1ZDSrwD/c7npX 7XFA== X-Gm-Message-State: ALoCoQlPXc938WIInBe/xClFDGEyZKslN7PEfwjSahzZqJIt35iuAFHQVJOFJWQ3R3gPSFkpSsX7 X-Received: by 10.180.94.134 with SMTP id dc6mr1158694wib.2.1421816315485; Tue, 20 Jan 2015 20:58:35 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.11 with SMTP id lk11ls811611lac.8.gmail; Tue, 20 Jan 2015 20:58:35 -0800 (PST) X-Received: by 10.152.5.132 with SMTP id s4mr36169172las.39.1421816315117; Tue, 20 Jan 2015 20:58:35 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id gl8si16955399lbc.60.2015.01.20.20.58.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 20:58:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id p9so14054361lbv.4 for ; Tue, 20 Jan 2015 20:58:35 -0800 (PST) X-Received: by 10.112.64.35 with SMTP id l3mr41663349lbs.82.1421816314993; Tue, 20 Jan 2015 20:58:34 -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 c8csp1651595lbb; Tue, 20 Jan 2015 20:58:34 -0800 (PST) X-Received: by 10.140.38.114 with SMTP id s105mr61706135qgs.106.1421816313590; Tue, 20 Jan 2015 20:58:33 -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 c13si3233234qaw.34.2015.01.20.20.58.32 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 20:58:33 -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 1YDnN8-0002OX-MR; Wed, 21 Jan 2015 04:58:30 +0000 Received: from mail-oi0-f44.google.com ([209.85.218.44]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDnMo-0002FY-Ie for lng-odp@lists.linaro.org; Wed, 21 Jan 2015 04:58:10 +0000 Received: by mail-oi0-f44.google.com with SMTP id a3so11567346oib.3 for ; Tue, 20 Jan 2015 20:58:05 -0800 (PST) X-Received: by 10.202.169.200 with SMTP id s191mr22660649oie.7.1421816285274; Tue, 20 Jan 2015 20:58: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 a15sm2891071oic.18.2015.01.20.20.58.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jan 2015 20:58:04 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 22:57:44 -0600 Message-Id: <1421816266-31223-7-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1421816266-31223-1-git-send-email-bill.fischofer@linaro.org> References: <1421816266-31223-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 6/8] api: schedule: switch schedule from buffers to events 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.173 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 Signed-off-by: Bill Fischofer --- platform/linux-generic/include/api/odp_schedule.h | 32 +++++++-------- platform/linux-generic/odp_schedule.c | 48 ++++++++++++++--------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/platform/linux-generic/include/api/odp_schedule.h b/platform/linux-generic/include/api/odp_schedule.h index cdf6705..688a6db 100644 --- a/platform/linux-generic/include/api/odp_schedule.h +++ b/platform/linux-generic/include/api/odp_schedule.h @@ -47,39 +47,39 @@ uint64_t odp_schedule_wait_time(uint64_t ns); * Schedule * * Schedules all queues created with ODP_QUEUE_TYPE_SCHED type. Returns - * next highest priority buffer which is available for the calling thread. - * Outputs the source queue of the buffer. If there's no buffer available, waits - * for a buffer according to the wait parameter setting. Returns - * ODP_BUFFER_INVALID if reaches end of the wait period. + * next highest priority event which is available for the calling thread. + * Outputs the source queue of the event. If there's no event available, waits + * for an event according to the wait parameter setting. Returns + * ODP_EVENT_INVALID if reaches end of the wait period. * - * @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. * - * @return Next highest priority buffer, or ODP_BUFFER_INVALID + * @return Next highest priority event, or ODP_EVENT_INVALID */ -odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait); +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_schedule.c b/platform/linux-generic/odp_schedule.c index f7c3588..4a288f5 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -43,10 +43,10 @@ _ODP_STATIC_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO, typedef struct { - odp_queue_t pri_queue[ODP_CONFIG_SCHED_PRIOS][QUEUES_PER_PRIO]; - pri_mask_t pri_mask[ODP_CONFIG_SCHED_PRIOS]; - odp_spinlock_t mask_lock; - odp_buffer_pool_t pool; + odp_queue_t pri_queue[ODP_CONFIG_SCHED_PRIOS][QUEUES_PER_PRIO]; + pri_mask_t pri_mask[ODP_CONFIG_SCHED_PRIOS]; + odp_spinlock_t mask_lock; + odp_pool_t pool; } sched_t; typedef struct { @@ -83,7 +83,7 @@ static inline odp_queue_t select_pri_queue(odp_queue_t queue, int prio) int odp_schedule_init_global(void) { odp_shm_t shm; - odp_buffer_pool_t pool; + odp_pool_t pool; int i, j; odp_buffer_pool_param_t params; @@ -107,7 +107,7 @@ int odp_schedule_init_global(void) pool = odp_buffer_pool_create("odp_sched_pool", ODP_SHM_NULL, ¶ms); - if (pool == ODP_BUFFER_POOL_INVALID) { + if (pool == ODP_POOL_INVALID) { ODP_ERR("Schedule init: Pool create failed.\n"); return -1; } @@ -198,7 +198,7 @@ void odp_schedule_queue(odp_queue_t queue, int prio) pri_queue = select_pri_queue(queue, prio); desc_buf = queue_sched_buf(queue); - odp_queue_enq(pri_queue, desc_buf); + odp_queue_enq(pri_queue, odp_buffer_to_event(desc_buf)); } @@ -207,7 +207,8 @@ void odp_schedule_release_atomic(void) if (sched_local.pri_queue != ODP_QUEUE_INVALID && sched_local.num == 0) { /* Release current atomic queue */ - odp_queue_enq(sched_local.pri_queue, sched_local.desc_buf); + odp_queue_enq(sched_local.pri_queue, + odp_buffer_to_event(sched_local.desc_buf)); sched_local.pri_queue = ODP_QUEUE_INVALID; } } @@ -267,6 +268,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 +278,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; @@ -286,9 +289,10 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], desc = odp_buffer_addr(desc_buf); queue = desc->queue; - num = odp_queue_deq_multi(queue, - sched_local.buf, - max_deq); + num = odp_queue_deq_multi + (queue, + (odp_event_t *)sched_local.buf, + max_deq); if (num == 0) { /* Remove empty queue from scheduling, @@ -297,7 +301,10 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], if (odp_queue_type(queue) == ODP_QUEUE_TYPE_PKTIN && !queue_is_destroyed(queue)) - odp_queue_enq(pri_q, desc_buf); + odp_queue_enq( + pri_q, + odp_buffer_to_event + (desc_buf)); continue; } @@ -314,7 +321,9 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], sched_local.desc_buf = desc_buf; } else { /* Continue scheduling the queue */ - odp_queue_enq(pri_q, desc_buf); + odp_queue_enq(pri_q, + odp_buffer_to_event + (desc_buf)); } /* Output the source queue handle */ @@ -367,7 +376,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait, } -odp_buffer_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) +odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) { odp_buffer_t buf; @@ -375,14 +384,15 @@ odp_buffer_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) schedule_loop(out_queue, wait, &buf, 1, MAX_DEQ); - return buf; + return odp_buffer_to_event(buf); } 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); }