From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailfilter01.viettel.com.vn (mailfilter01.viettel.com.vn [125.235.240.53]) by dpdk.org (Postfix) with ESMTP id 7A4B3262E; Thu, 20 Sep 2018 13:16:42 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.53,398,1531760400"; d="scan'208";a="94209971" Received: from 125.235.240.44.adsl.viettel.vn (HELO mta1.viettel.com.vn) ([125.235.240.44]) by mailfilter01.viettel.com.vn with ESMTP; 20 Sep 2018 18:16:40 +0700 Received: from localhost (localhost [127.0.0.1]) by mta1.viettel.com.vn (Postfix) with ESMTP id DBD9A60F388; Thu, 20 Sep 2018 18:16:33 +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 g03O6SDbPVNT; Thu, 20 Sep 2018 18:16:33 +0700 (ICT) Received: from localhost (localhost [127.0.0.1]) by mta1.viettel.com.vn (Postfix) with ESMTP id B9FEB60F2FD; Thu, 20 Sep 2018 18:16:33 +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 e8qwYjuVsnw4; Thu, 20 Sep 2018 18:16:33 +0700 (ICT) Received: from localhost.localdomain (unknown [27.68.241.28]) by mta1.viettel.com.vn (Postfix) with ESMTPSA id 6DE1760F389; Thu, 20 Sep 2018 18:16:33 +0700 (ICT) To: reshma.pattan@intel.com Cc: dev@dpdk.org, Bao-Long Tran , stable@dpdk.org Message-Id: <1537442655-99749-1-git-send-email-longtb5@viettel.com.vn> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537345834-70456-1-git-send-email-longtb5@viettel.com.vn> References: <1537345834-70456-1-git-send-email-longtb5@viettel.com.vn> MilterAction: FORWARD Date: Thu, 20 Sep 2018 18:16:33 +0700 (ICT) From: longtb5@viettel.com.vn Subject: [dpdk-dev] [PATCH v2] 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: Thu, 20 Sep 2018 11:16:44 -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. Fixes: 5cd3cac9ed ("latency: added new library for latency stats"). Cc: stable@dpdk.org Signed-off-by: Bao-Long Tran Acked-by: Reshma Pattan --- 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