From patchwork Tue Dec 1 15:08:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 57508 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2240858lbb; Tue, 1 Dec 2015 07:17:33 -0800 (PST) X-Received: by 10.140.227.72 with SMTP id x69mr47254406qhb.46.1448983053242; Tue, 01 Dec 2015 07:17:33 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o125si50462779qho.122.2015.12.01.07.17.31; Tue, 01 Dec 2015 07:17:33 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 3EA9561E64; Tue, 1 Dec 2015 15:17:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id BC87B61FB5; Tue, 1 Dec 2015 15:11:43 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9E9EB61E56; Tue, 1 Dec 2015 15:11:34 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by lists.linaro.org (Postfix) with ESMTPS id EF05061E6F for ; Tue, 1 Dec 2015 15:08:26 +0000 (UTC) Received: by lfs39 with SMTP id 39so11040317lfs.3 for ; Tue, 01 Dec 2015 07:08:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xu4K1InUmZ5axnpaHzDBBC+pqR5vU6rRT/Pf8q5x4yk=; b=ztRYnLzbCAug+KghVzocJxVf2TJRYbKEzSYVtq/HdeDTzcUHRISbr2ics61rf26P/K UtvlYhsy3LNO8i3guDpS+61bsGR7pj44lJb/L4Fv0dUJ3Yk/8VG5OWsXw0OXHljCIPrK owmIpEDDc0OWYt2BA1VFZnbcS7ip/1fAoDcAYVGtE6ywi3i+yVp7I12qxhqYdqO1+fRL 2GqBNuSBxsvCSJ/2pnr0P5CvvZ9BwS6QndnYZgAhcckAsKhTJ3ALRXx7NXobomiNeGgC aXJtxuVgTHZOrHXy40jDpD8aP7me81xggTqGrBbqm0UiE28i44ckUVLr41misLBwOa07 TCBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xu4K1InUmZ5axnpaHzDBBC+pqR5vU6rRT/Pf8q5x4yk=; b=XWrAV8Nfhr95P/3NoNRRxL5OFp3kLAZPpb0Tx1K++4GSmW7tTtTsSXm2YqVVdhCgtr sYIn+WrcCXUYnqNBoAGK8h7iFBspiC+gxWSt265NkahSyPekF74c1dwCAU7t1EAo0GCF OPNWr/YTSQTqEVlzU2O5+wh6OI681ysBYK/1AKCLN3Kxvv8lNsftN1i/pBJ0MS0u4O+J uPDFvP3U6HhJvC/FCR2YVp/Y4/ovrdfAQhfIgdeuU61VYMn5ZmFVCmTVRmd2BNho2tAY NBnF04qtqO3uU96FVzT0TF4ZgL1K09B67sGXqSGPIGgt3mPEZAWQEb2EBnl19HPr9ndn FOMw== X-Gm-Message-State: ALoCoQlsWmQe81tT6lZVyovYH+GnzDazS9nvS9Nhhy4eFURTQ9uFBzz0tXqwVkM8rPRtIRmEeQSF X-Received: by 10.25.160.213 with SMTP id j204mr31174387lfe.85.1448982503817; Tue, 01 Dec 2015 07:08:23 -0800 (PST) Received: from localhost.localdomain ([212.90.60.8]) by smtp.gmail.com with ESMTPSA id i194sm8278535lfg.20.2015.12.01.07.08.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Dec 2015 07:08:23 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 1 Dec 2015 17:08:07 +0200 Message-Id: <1448982493-8236-4-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448982493-8236-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1448982493-8236-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v5 3/9] linux-generic: schedule: use schedule time in ns X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" In the schedule_loop the wait time is passed in units of scheduler time. At this moment there is no difference between wait time and odp_time, but in case if odp_time is smth different from uint64_t, it cannot be directly passed as uint64_t. So better to pass scheduler time as ns and convert them before entering a loop. Signed-off-by: Ivan Khoronzhuk --- platform/linux-generic/odp_schedule.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 884ae60..96b3ac5 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -586,11 +586,10 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait, odp_event_t out_ev[], unsigned int max_num, unsigned int max_deq) { - odp_time_t start_time, time, diff; + odp_time_t start_time, time, diff, wtime; + int first = 1; int ret; - start_time = ODP_TIME_NULL; - while (1) { ret = schedule(out_queue, out_ev, max_num, max_deq); @@ -603,15 +602,17 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait, if (wait == ODP_SCHED_NO_WAIT) break; - if (!odp_time_cmp(ODP_TIME_NULL, start_time)) { + if (first) { + wtime = odp_time_local_from_ns(wait); start_time = odp_time_local(); + first = 0; continue; } time = odp_time_local(); diff = odp_time_diff(time, start_time); - if (odp_time_cmp(wait, diff) < 0) + if (odp_time_cmp(wtime, diff) < 0) break; } @@ -652,7 +653,7 @@ void odp_schedule_resume(void) uint64_t odp_schedule_wait_time(uint64_t ns) { - return odp_time_to_u64(odp_time_local_from_ns(ns)); + return ns; }