From patchwork Thu Aug 6 14:07:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 52003 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id D832520539 for ; Thu, 6 Aug 2015 14:08:45 +0000 (UTC) Received: by wilj18 with SMTP id j18sf6269655wil.0 for ; Thu, 06 Aug 2015 07:08:45 -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=FS7t+OGzbLcy4mhOfL8ndCnTDwKV1HQPjHUp0/PdYCU=; b=ZOeGPSMYEvZ4gvNxYfJ1hIKUwCFWbxVqvnicX5Jk0AaAD9tylwRvPfyVPOV1fFUoIn le/KRwjemDQnUqwiJtMozqAYgHOZyng1sf0cWSwd+j57fe3RRLBKRMKCdW2HujDgrm75 kZJUF6marUKeqZxHkmSrIQwJ0/3q8iP/MzLVTP68Ssyp2q/wI6uqoycQpQFiv+XOvZLX 2c7pGbS3ITpB+x/bAoVZmLUTQ/j5WmCz1nN30DJZecRbH9TArWHI/JTPSPMo6MT8oFzg gRFp14odZo79WVk2QDQb0da9F+Wd4/DGLaSCiFLDaZ0RoM6coj5U1shYNqNn5sQYbBPh mL4Q== X-Gm-Message-State: ALoCoQk5suXjEJm277wxfp7OunZx3gcMU4WTb1lWWHzmPYeKzq//QNi88UvITxxqXfUrvltQOHTB X-Received: by 10.112.173.230 with SMTP id bn6mr546771lbc.15.1438870125166; Thu, 06 Aug 2015 07:08:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.8 with SMTP id lk8ls36060lac.26.gmail; Thu, 06 Aug 2015 07:08:44 -0700 (PDT) X-Received: by 10.152.20.106 with SMTP id m10mr1981939lae.7.1438870124891; Thu, 06 Aug 2015 07:08:44 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id x10si4851008lbo.118.2015.08.06.07.08.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Aug 2015 07:08:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbtg9 with SMTP id tg9so5587604lbb.1 for ; Thu, 06 Aug 2015 07:08:44 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr1931538laj.19.1438870122373; Thu, 06 Aug 2015 07:08:42 -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 l6csp973779lba; Thu, 6 Aug 2015 07:08:41 -0700 (PDT) X-Received: by 10.107.138.216 with SMTP id c85mr2134037ioj.187.1438870120559; Thu, 06 Aug 2015 07:08:40 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h9si1796097igg.24.2015.08.06.07.08.39; Thu, 06 Aug 2015 07:08:40 -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 7450262079; Thu, 6 Aug 2015 14:08:39 +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 B879C620F4; Thu, 6 Aug 2015 14:07:35 +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 1482F62068; Thu, 6 Aug 2015 14:07:28 +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 0EF5A62070 for ; Thu, 6 Aug 2015 14:07:26 +0000 (UTC) Received: by lbbyj8 with SMTP id yj8so43437217lbb.0 for ; Thu, 06 Aug 2015 07:07:25 -0700 (PDT) X-Received: by 10.152.1.66 with SMTP id 2mr1967622lak.56.1438870044956; Thu, 06 Aug 2015 07:07:24 -0700 (PDT) Received: from khorivan.itg.ti.com ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id gg1sm1407529lbc.27.2015.08.06.07.07.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Aug 2015 07:07:24 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 6 Aug 2015 17:07:18 +0300 Message-Id: <1438870038-25155-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438870038-25155-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1438870038-25155-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [Patch 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.217.169 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 8f1daeb..4a537ec 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;