From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailfilter02.viettel.com.vn (mailfilter02.viettel.com.vn [125.235.240.54]) by dpdk.org (Postfix) with ESMTP id 5C997F04 for ; Wed, 19 Sep 2018 10:15:26 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.53,393,1531760400"; d="scan'208";a="94053756" Received: from 125.235.240.44.adsl.viettel.vn (HELO mta1.viettel.com.vn) ([125.235.240.44]) by mailfilter02.viettel.com.vn with ESMTP; 19 Sep 2018 15:15:24 +0700 Received: from localhost (localhost [127.0.0.1]) by mta1.viettel.com.vn (Postfix) with ESMTP id 13E53612CAB; Wed, 19 Sep 2018 15:15:14 +0700 (ICT) Received: from mta1.viettel.com.vn ([127.0.0.1]) by localhost (mta1.viettel.com.vn [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Na7YBKUYqp9i; Wed, 19 Sep 2018 15:15:14 +0700 (ICT) Received: from localhost (localhost [127.0.0.1]) by mta1.viettel.com.vn (Postfix) with ESMTP id E6F46612C70; Wed, 19 Sep 2018 15:15:13 +0700 (ICT) X-Virus-Scanned: amavisd-new at Received: from mta1.viettel.com.vn ([127.0.0.1]) by localhost (mta1.viettel.com.vn [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KVjiOQNvytdJ; Wed, 19 Sep 2018 15:15:13 +0700 (ICT) Received: from localhost.localdomain (unknown [27.68.241.28]) by mta1.viettel.com.vn (Postfix) with ESMTPSA id AEF20612CAB; Wed, 19 Sep 2018 15:15:13 +0700 (ICT) To: longtb5@viettel.com.vn Cc: stable@dpdk.org Message-Id: <1537345361-70088-2-git-send-email-longtb5@viettel.com.vn> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537345361-70088-1-git-send-email-longtb5@viettel.com.vn> References: <1537345361-70088-1-git-send-email-longtb5@viettel.com.vn> MilterAction: FORWARD Date: Wed, 19 Sep 2018 15:15:13 +0700 (ICT) From: longtb5@viettel.com.vn Subject: [dpdk-stable] [PATCH] latency: clear mbuf timestamp after latency calculation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2018 08:15:27 -0000 The timestamp of a mbuf should be cleared after that mbuf was used for latency calculation, otherwise future packets which reuse the same mbuf would inherit that previous timestamp. The latencystats library looks for mbuf with non-zero timestamp, thus incorrectly inherited value would result in incorrect latency measurement. Cc: stable@dpdk.org Signed-off-by: Bao-Long Tran --- lib/librte_latencystats/rte_latencystats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c index 1fdec68..2d5384e 100644 --- a/lib/librte_latencystats/rte_latencystats.c +++ b/lib/librte_latencystats/rte_latencystats.c @@ -156,8 +156,10 @@ calc_latency(uint16_t pid __rte_unused, now = rte_rdtsc(); for (i = 0; i < nb_pkts; i++) { - if (pkts[i]->timestamp) + if (pkts[i]->timestamp) { latency[cnt++] = now - pkts[i]->timestamp; + pkts[i]->timestamp = 0; + } } for (i = 0; i < cnt; i++) { -- 2.7.4