From patchwork Thu Nov 12 17:45:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56450 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp555872lbb; Thu, 12 Nov 2015 09:47:07 -0800 (PST) X-Received: by 10.55.217.27 with SMTP id u27mr17482028qki.55.1447350427717; Thu, 12 Nov 2015 09:47:07 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e51si12391527qga.99.2015.11.12.09.47.07; Thu, 12 Nov 2015 09:47:07 -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 256E662044; Thu, 12 Nov 2015 17:47:07 +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 1220262043; Thu, 12 Nov 2015 17:45:31 +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 863ED62034; Thu, 12 Nov 2015 17:45:18 +0000 (UTC) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by lists.linaro.org (Postfix) with ESMTPS id 899AB62025 for ; Thu, 12 Nov 2015 17:45:17 +0000 (UTC) Received: by lbbsy6 with SMTP id sy6so11026233lbb.2 for ; Thu, 12 Nov 2015 09:45:16 -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=jB8BD5mdZlai/Lj3uCUsB+nZQRLb1zJ7oH9IUqkIM34pAA7tIpVAFr7QbKZkl0ume7 Fj0bp6gZFBleIXyLv0y+7mk7C4j/2s9yuM39FDSjf8kg8wAOmjVKVvnErXPvr+EeyUai zT/LgmedP3E8uHRGvWaDeoJnhCW7Kwo2aoa6vCv7W37WQoL3b4zeSanEAbcyyxDyRJvv 6WBndrHQlYCHf0hQ6pup5YqStiUIJNVpqY4duMkCLh48BETz/x2qHXRcjiTLcNsLzqiz 0L7/I1lwF52205VOugK+fmD1TPYrKMs8dkgQsjmrH1KpLPcttFgpBOybJ+Dr3TNiYQ2F U5oA== 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=LFdskuK6w4w/sPooHEhFJUhm6car1iugLr3bXvdCHpU39d4UNH/VIomz3+4MaItUtL puv8hzExmhdppLIchkys8IP8Si14kdyUntq1fpy8mIoWP9yyCmSb2e+6OgZ1GC50mrdD MiNFc+EP7y2qbUSQqRiOGZRuZJovCa4V2nX6UDVPCLI5AZtRqi1u9uBjQQZV3Bwa0DGx 3SPm3Cz03F8HpSAFHwSIY/uPSIVzsUc8Dmv0KGRz2hh8IYBlp2Qjl83g6ZHosv4vu8Ci u7aemWoMi5AzI4lyhdNqclYmxaoX4YxX6srW5lkAXh12pUk6k8HgSyJX04pRwvjZk7va GTCg== X-Gm-Message-State: ALoCoQnPRYI0jVSs09hPPyTz4gboduRAjb7nsbGPezq1SEfTrDSqGES6/oCpZoVrGEtfG6kb6lSB X-Received: by 10.112.173.198 with SMTP id bm6mr7975191lbc.43.1447350316276; Thu, 12 Nov 2015 09:45:16 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id k14sm2350983lfb.49.2015.11.12.09.45.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Nov 2015 09:45:15 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 12 Nov 2015 19:45:01 +0200 Message-Id: <1447350305-3254-4-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447350305-3254-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1447350305-3254-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [lng] [API-NEXT PATCH v2 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; }