From patchwork Thu Nov 12 17:05:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56442 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp535415lbb; Thu, 12 Nov 2015 09:08:02 -0800 (PST) X-Received: by 10.140.95.66 with SMTP id h60mr17490143qge.14.1447348082507; Thu, 12 Nov 2015 09:08:02 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b94si12288927qga.13.2015.11.12.09.08.02; Thu, 12 Nov 2015 09:08:02 -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 1085F62025; Thu, 12 Nov 2015 17:08:02 +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 B37BA62033; Thu, 12 Nov 2015 17:06:13 +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 8145A6201E; Thu, 12 Nov 2015 17:05:57 +0000 (UTC) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by lists.linaro.org (Postfix) with ESMTPS id 6654762016 for ; Thu, 12 Nov 2015 17:05:55 +0000 (UTC) Received: by lbblt2 with SMTP id lt2so39127427lbb.3 for ; Thu, 12 Nov 2015 09:05:54 -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=utAbhD4uZ08dSgwDwtBBFBp9uj8QZUpIvsyDjrGkB0l3z2661cFENO/ib2w0gMipka jWQ+Lp7M0nreHnNH6a1+bZXvssFo4CMs3ab+WIaMoRGFzGPgJ/f78SIumvojEKtOCHU+ DXyO8EtJqcp82r2DmWqEEHCF6X0EfaDd+BD1WiPOoswayCzY/o3FLr1lzceaHD/uoL+W el87r3mtt4OjzCPwge9DzMb5aKGsDUYkwoioYJ9AzMRIJgiJLxBOP7/2Ru1h+mafj4zW tujddOFqtVbqvDm/aggh4u5IArsdFXKSfVoykS8FFSEUyoNieGyL3dCn6NnBF2cbDgHr 5kVg== 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=Apbx4MchpUBK8PmUZjNUivyJAmvUcqmmqJwYLX0/7bhKT/ErTwNuw6Di/+RTgJaXZs 8N2Gvn/zO23VlXSRwjhEDi0hC7oNERh/9vbaJzJLESgE6JyLN34fwtyGpefELyQhhEuW 7/HG+UU/CyCjw561Y/P2vcPcavk5i+GkoGaW4LJ870mdF2a6s37R4JnCP66Nv8hxROWS OdFHidIYG9h8xL0/0HJWiDhFuyuerynTJRykhEKbjKtjs7vLtg532OY+IeNqknEaZlK2 S9LR3ZHCZ2PI8PZK3lt2CczzWIWNJrjk0FtRnsVWeHl+UtNTZpKgD7ABqXLWlWjkN8Au 5Kug== X-Gm-Message-State: ALoCoQktuzt0Uj5Z8mzglSzGFKV0PkcPksr8nWfLhv1loOzwxA8R1Dka3XR1s9AvaNGT/4c55wrB X-Received: by 10.112.72.67 with SMTP id b3mr8055836lbv.34.1447347954317; Thu, 12 Nov 2015 09:05:54 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id nb1sm2412412lbb.9.2015.11.12.09.05.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Nov 2015 09:05:53 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 12 Nov 2015 19:05:39 +0200 Message-Id: <1447347943-16807-4-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447347943-16807-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1447347943-16807-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [lng] [PATCH 3/7] 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; }