From patchwork Thu Aug 6 14:30:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 52004 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 9031720539 for ; Thu, 6 Aug 2015 14:31:34 +0000 (UTC) Received: by labia3 with SMTP id ia3sf6290075lab.1 for ; Thu, 06 Aug 2015 07:31:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to: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=x5XgfKWju4eG07DCTXiO1eUr+MOyC4XLA7a2pb//f6M=; b=N/bE45UUOquNsHi6wIj2axKSqD6w05v/o691af0zI1Pu10CE7lIHudWCP11GQsMXFX wzLDlhhl497K+ARCR9/ldK8oqOZzBJd2WSeWFvOQyqzaTjCYGr1XNzv8xawOvt0CcgVR jgpPzIjuEZR9N/bp0A0IreeUIr1hepecQaJFicUVNJo+n0V3NdHD0Z3HMw7VLpYqxv+6 v8QbcD3wGryNlZomFct/vtgXbfy2ftkH5UBWbW9bjW7vJIpqajZpLyAHPSlzK6poAb0G RCXbn31icBNv5z1RsK0hNZPvme5FdfGLjl+wBs9+03eTDvxJlWJsPlu6v45YvgAoAcbx nxfQ== X-Gm-Message-State: ALoCoQmpIu+Obi3kVhLZ7hYyC+1ZDSGZmmLsrbFlps8tg1gJLjQT/KY4QdMYMebxbHf+qB6bHjO/ X-Received: by 10.180.35.162 with SMTP id i2mr1051542wij.6.1438871493514; Thu, 06 Aug 2015 07:31:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.100 with SMTP id j4ls339061lah.9.gmail; Thu, 06 Aug 2015 07:31:33 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr2132806laj.19.1438871493342; Thu, 06 Aug 2015 07:31:33 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id ld20si4959799lbb.61.2015.08.06.07.31.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Aug 2015 07:31:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagz9 with SMTP id z9so4473969lag.3 for ; Thu, 06 Aug 2015 07:31:33 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr2126472laj.88.1438871493234; Thu, 06 Aug 2015 07:31:33 -0700 (PDT) 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.7.198 with SMTP id l6csp986309lba; Thu, 6 Aug 2015 07:31:32 -0700 (PDT) X-Received: by 10.55.56.73 with SMTP id f70mr3534318qka.78.1438871489736; Thu, 06 Aug 2015 07:31:29 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 41si12181773qgc.12.2015.08.06.07.31.28; Thu, 06 Aug 2015 07:31:29 -0700 (PDT) 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; Received: by lists.linaro.org (Postfix, from userid 109) id E3593620F2; Thu, 6 Aug 2015 14:31:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 922B2620D2; Thu, 6 Aug 2015 14:30: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 EAD32620D4; Thu, 6 Aug 2015 14:30:41 +0000 (UTC) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 1B13A620C2 for ; Thu, 6 Aug 2015 14:30:40 +0000 (UTC) Received: by lagz9 with SMTP id z9so4455011lag.3 for ; Thu, 06 Aug 2015 07:30:39 -0700 (PDT) X-Received: by 10.112.63.201 with SMTP id i9mr2103436lbs.93.1438871439009; Thu, 06 Aug 2015 07:30:39 -0700 (PDT) Received: from khorivan.itg.ti.com ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id kl3sm489437lbb.28.2015.08.06.07.30.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Aug 2015 07:30:38 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 6 Aug 2015 17:30:31 +0300 Message-Id: <1438871431-27825-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438871431-27825-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1438871431-27825-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [Patch v2 2/2] performance: odp_pktio_perf: fix potential overflow for burst_gap X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.khoronzhuk@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.215.43 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 The direct comparing of "cur_cycles" and "next_tx_cycles" is not valid, as "next_tx_cycles" can be overflowed and comparison will give wrong result. So use odp_time_diff_cycles() for that, as it takes in account ticks overflow. Signed-off-by: Ivan Khoronzhuk --- test/performance/odp_pktio_perf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 360d832..be7b185 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -338,7 +338,8 @@ static void *run_thread_tx(void *arg) while (odp_time_diff_cycles(cur_cycles, end_cycles) <= send_duration) { unsigned alloc_cnt = 0, tx_cnt; - if (cur_cycles < next_tx_cycles) { + if (odp_time_diff_cycles(cur_cycles, next_tx_cycles) + <= burst_gap_cycles) { cur_cycles = odp_time_cycles(); if (idle_start == 0) idle_start = cur_cycles;