[dpdk-stable] patch 'latency: fix timestamp marking and latency calculation' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Thu Nov 22 17:49:18 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/28/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From 038552d73ef112748344c9175b736bb59a0028c6 Mon Sep 17 00:00:00 2001
From: Reshma Pattan <reshma.pattan at intel.com>
Date: Tue, 25 Sep 2018 15:51:26 +0100
Subject: [PATCH] latency: fix timestamp marking and latency calculation

[ upstream commit 77b7485af7f63f7d528f614ce27a5ce014cfd2c7 ]

Latency calculation logic is not correct for the case where
packets gets dropped before TX. As for the dropped packets,
the timestamp is not cleared, and such packets still gets
counted for latency calculation in next runs, that will result
in inaccurate latency measurement.

So fix this issue as below,

Before setting timestamp in mbuf, check mbuf don't have
any prior valid time stamp flag set and after marking
the timestamp, set mbuf flags to indicate timestamp is
valid.

Before calculating timestamp check mbuf flags are set to
indicate timestamp is valid.

With the above logic it is guaranteed that correct timestamps
have been used.

Fixes: 5cd3cac9ed ("latency: added new library for latency stats")

Reported-by: Bao-Long Tran <longtb5 at viettel.com.vn>
Signed-off-by: Reshma Pattan <reshma.pattan at intel.com>
Tested-by: Bao-Long Tran <longtb5 at viettel.com.vn>
Acked-by: Konstantin Ananyev <konstantin.ananyev at intel.com>
---
 lib/librte_latencystats/rte_latencystats.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c
index 1fdec68e3..5715549e4 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -126,6 +126,9 @@ add_time_stamps(uint16_t pid __rte_unused,
 		diff_tsc = now - prev_tsc;
 		timer_tsc += diff_tsc;
-		if (timer_tsc >= samp_intvl) {
+
+		if ((pkts[i]->ol_flags & PKT_RX_TIMESTAMP) == 0
+				&& (timer_tsc >= samp_intvl)) {
 			pkts[i]->timestamp = now;
+			pkts[i]->ol_flags |= PKT_RX_TIMESTAMP;
 			timer_tsc = 0;
 		}
@@ -157,5 +160,5 @@ calc_latency(uint16_t pid __rte_unused,
 	now = rte_rdtsc();
 	for (i = 0; i < nb_pkts; i++) {
-		if (pkts[i]->timestamp)
+		if (pkts[i]->ol_flags & PKT_RX_TIMESTAMP)
 			latency[cnt++] = now - pkts[i]->timestamp;
 	}
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-22 16:47:32.941265818 +0000
+++ 0026-latency-fix-timestamp-marking-and-latency-calculatio.patch	2018-11-22 16:47:32.000000000 +0000
@@ -1,8 +1,10 @@
-From 77b7485af7f63f7d528f614ce27a5ce014cfd2c7 Mon Sep 17 00:00:00 2001
+From 038552d73ef112748344c9175b736bb59a0028c6 Mon Sep 17 00:00:00 2001
 From: Reshma Pattan <reshma.pattan at intel.com>
 Date: Tue, 25 Sep 2018 15:51:26 +0100
 Subject: [PATCH] latency: fix timestamp marking and latency calculation
 
+[ upstream commit 77b7485af7f63f7d528f614ce27a5ce014cfd2c7 ]
+
 Latency calculation logic is not correct for the case where
 packets gets dropped before TX. As for the dropped packets,
 the timestamp is not cleared, and such packets still gets
@@ -23,7 +25,6 @@
 have been used.
 
 Fixes: 5cd3cac9ed ("latency: added new library for latency stats")
-Cc: stable at dpdk.org
 
 Reported-by: Bao-Long Tran <longtb5 at viettel.com.vn>
 Signed-off-by: Reshma Pattan <reshma.pattan at intel.com>


More information about the stable mailing list