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 F0486255; Wed, 19 Sep 2018 10:22:58 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.53,393,1531760400"; d="scan'208";a="94057053" 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:22:57 +0700 Received: from localhost (localhost [127.0.0.1]) by mta1.viettel.com.vn (Postfix) with ESMTP id E91BF612CF4; Wed, 19 Sep 2018 15:22:56 +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 8aTw7fk4bioc; Wed, 19 Sep 2018 15:22:56 +0700 (ICT) Received: from localhost (localhost [127.0.0.1]) by mta1.viettel.com.vn (Postfix) with ESMTP id C6118612CF9; Wed, 19 Sep 2018 15:22:56 +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 Zne59QVAQGl2; Wed, 19 Sep 2018 15:22:56 +0700 (ICT) Received: from localhost.localdomain (unknown [27.68.241.28]) by mta1.viettel.com.vn (Postfix) with ESMTPSA id 83930612CF4; Wed, 19 Sep 2018 15:22:56 +0700 (ICT) To: reshma.pattan@intel.com Cc: dev@dpdk.org, Bao-Long Tran , stable@dpdk.org Message-Id: <1537345834-70456-1-git-send-email-longtb5@viettel.com.vn> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537345496-70207-1-git-send-email-longtb5@viettel.com.vn> References: <1537345496-70207-1-git-send-email-longtb5@viettel.com.vn> MilterAction: FORWARD Date: Wed, 19 Sep 2018 15:22:56 +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:22:59 -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