[dpdk-dev] [PATCH v2] latency: clear mbuf timestamp after latency calculation
longtb5 at viettel.com.vn
longtb5 at viettel.com.vn
Thu Sep 20 13:16:33 CEST 2018
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 at dpdk.org
Signed-off-by: Bao-Long Tran <longtb5 at viettel.com.vn>
Acked-by: Reshma Pattan <reshma.pattan at intel.com>
---
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
More information about the dev
mailing list