[v2] latency: clear mbuf timestamp after latency calculation
Checks
Commit Message
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 <longtb5@viettel.com.vn>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---
lib/librte_latencystats/rte_latencystats.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@@ -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++) {