patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] latency: clear mbuf timestamp after latency calculation
@ 2018-09-19  8:18 longtb5
  0 siblings, 0 replies; 6+ messages in thread
From: longtb5 @ 2018-09-19  8:18 UTC (permalink / raw)
  To: reshma.pattan; +Cc: dev, Bao-Long Tran, stable

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 <longtb5@viettel.com.vn>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <1537345496-70207-1-git-send-email-longtb5@viettel.com.vn>]
[parent not found: <1537345361-70088-1-git-send-email-longtb5@viettel.com.vn>]

end of thread, other threads:[~2018-09-25 12:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19  8:18 [dpdk-stable] [PATCH] latency: clear mbuf timestamp after latency calculation longtb5
     [not found] <1537345496-70207-1-git-send-email-longtb5@viettel.com.vn>
2018-09-19  8:22 ` longtb5
2018-09-20 10:25   ` Pattan, Reshma
2018-09-20 12:16     ` longtb5
     [not found] <1537345361-70088-1-git-send-email-longtb5@viettel.com.vn>
2018-09-19  8:15 ` longtb5
2018-09-25 12:37   ` Luca Boccassi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).