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 4EE9D255; Wed, 19 Sep 2018 10:18:23 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.53,393,1531760400"; d="scan'208";a="94054713" Received: from 125.235.240.45.adsl.viettel.vn (HELO mta2.viettel.com.vn) ([125.235.240.45]) by mailfilter02.viettel.com.vn with ESMTP; 19 Sep 2018 15:18:21 +0700 Received: from localhost (localhost [127.0.0.1]) by mta2.viettel.com.vn (Postfix) with ESMTP id 98BBF68D980; Wed, 19 Sep 2018 15:18:09 +0700 (ICT) Received: from mta2.viettel.com.vn ([127.0.0.1]) by localhost (mta2.viettel.com.vn [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2Tb1IcnJTtgj; Wed, 19 Sep 2018 15:18:09 +0700 (ICT) Received: from localhost (localhost [127.0.0.1]) by mta2.viettel.com.vn (Postfix) with ESMTP id 76C4368D999; Wed, 19 Sep 2018 15:18:09 +0700 (ICT) X-Virus-Scanned: amavisd-new at Received: from mta2.viettel.com.vn ([127.0.0.1]) by localhost (mta2.viettel.com.vn [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wzsmTPQEikHg; Wed, 19 Sep 2018 15:18:09 +0700 (ICT) Received: from localhost.localdomain (unknown [27.68.241.28]) by mta2.viettel.com.vn (Postfix) with ESMTPSA id 34DD168D980; Wed, 19 Sep 2018 15:18:09 +0700 (ICT) To: reshma.pattan@intel.com Cc: dev@dpdk.org, Bao-Long Tran , stable@dpdk.org Message-Id: <1537345551-70316-1-git-send-email-longtb5@viettel.com.vn> X-Mailer: git-send-email 2.7.4 MilterAction: FORWARD Date: Wed, 19 Sep 2018 15:18:09 +0700 (ICT) From: longtb5@viettel.com.vn Subject: [dpdk-dev] [PATCH] latency: clear mbuf timestamp after latency calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2018 08:18:24 -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