[RFC,4/8] pdump: stamp packets with current timestamp
diff mbox series

Message ID 20191007165232.14535-5-stephen@networkplumber.org
State RFC
Headers show
Series
  • Packet Capture enhancements
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger Oct. 7, 2019, 4:52 p.m. UTC
Put the current cycle count in as timestamp when
they are placed in the ring for packet capture.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_pdump/rte_pdump.c | 2 ++
 1 file changed, 2 insertions(+)

Patch
diff mbox series

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index 830decef91e2..41f2ec17a26b 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -75,6 +75,7 @@  pdump_copy(uint16_t port, struct rte_mbuf **pkts,
 	unsigned i;
 	int ring_enq;
 	uint16_t d_pkts = 0;
+	uint64_t now = rte_get_tsc_cycles();
 	struct rte_mbuf *dup_bufs[nb_pkts];
 	struct pdump_rxtx_cbs *cbs;
 	struct rte_ring *ring;
@@ -88,6 +89,7 @@  pdump_copy(uint16_t port, struct rte_mbuf **pkts,
 		p = rte_pktmbuf_copy(pkts[i], mp, 0, UINT32_MAX);
 		if (p) {
 			p->port = port;
+			p->timestamp = now;
 			dup_bufs[d_pkts++] = p;
 		}
 	}