From patchwork Fri Dec 4 17:51:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 57714 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp701645lbb; Fri, 4 Dec 2015 09:53:37 -0800 (PST) X-Received: by 10.140.18.199 with SMTP id 65mr20364260qgf.10.1449251617455; Fri, 04 Dec 2015 09:53:37 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d14si7308652qhc.95.2015.12.04.09.53.36; Fri, 04 Dec 2015 09:53:37 -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 2FC0662D69; Fri, 4 Dec 2015 17:53:36 +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 B680562D78; Fri, 4 Dec 2015 17:51:57 +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 C0BAF62D6E; Fri, 4 Dec 2015 17:51:51 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.linaro.org (Postfix) with ESMTPS id 1F90362D63 for ; Fri, 4 Dec 2015 17:51:48 +0000 (UTC) Received: by lffu14 with SMTP id u14so117093721lff.1 for ; Fri, 04 Dec 2015 09:51:47 -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=9fYEK+tk+KwC7MPguZY+XSvvqcYAnSn2An3EX8hfT0c=; b=vHwPhWw0lwtP8YC/8lK7AJHtN6nPT6IMXmwto2G5CV6BC429HGKsLnlIqvAN4KNsUv sUPLfkfAt3ovhxPS1OdzsbokYHcWeZoB6qcErLEobhkQWSpDEVjm3va6hRd/Jqd58Woz lttucV1TAETUYvKVk3f0m9u29Cmh5uVwG4TDQc5FSUvrYcxuvlyB0qx5Hht52d9cO9Eu klxESbRW3SbJSAE5VwOYGmbKDwflAgWvQdEDzfwVAtVc7CXxDixw9PEx/l5s+P9fNjC1 FqgeRyNG2MKHBGlAAkELRuhLJbJG/KjCsoy3VX/DFwaph7Z5F5PJGiWAjPoRvj1qaGw7 CZWg== 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=9fYEK+tk+KwC7MPguZY+XSvvqcYAnSn2An3EX8hfT0c=; b=Mwv81UNZYyUNzfYz603G1nzbzXeZsenm1UR3mt22VIN4dQFY1YpU5e8tQ7JV5tRJaY ub9v84E6SNQeqXZquim+2aFMQRJLVp7ZbX7SUaggdN45qWQ4BK+8JxNsLC+1bsWfGE75 ckDXaYbs43hguRHn8vFBLFotCWVniLQt1acWHXlTUmO/nQ4cpZ1kz02V39kkKDaR45MF xGW2GDNSIDvlBQfRztP9gVrUBUQVhByNIjcRQyRxscGzHSPSCYktg1MhjrURv7cHwEhW CVUm47BUFXOC+4V2F8XxwdDTUdh2pLvb1QvXxUTklLrWj0vxR05fglDEt+S2N9gv0F4+ Tkfw== X-Gm-Message-State: ALoCoQnZH1yApMtJKMTZMqZCxS46pYh94UtvdTyoKDWGIO1/E0Vg/C+7aZtiRmP25/Gg5XWcKPos X-Received: by 10.25.22.214 with SMTP id 83mr9061009lfw.8.1449251506961; Fri, 04 Dec 2015 09:51:46 -0800 (PST) Received: from localhost.localdomain ([212.90.60.8]) by smtp.gmail.com with ESMTPSA id rm5sm2483518lbb.20.2015.12.04.09.51.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Dec 2015 09:51:46 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Fri, 4 Dec 2015 19:51:28 +0200 Message-Id: <1449251494-23210-4-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449251494-23210-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1449251494-23210-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v7 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. Reviewed-by: Petri Savolainen 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; }