summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Rodon <srn@nexatech.fr>2019-08-02 10:57:24 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2019-08-27 13:52:53 +0200
commitce276d9ec35b7e1200d7946a5e30117ce1162950 (patch)
tree5c7335732a60c7efad676e4a92210985675ebb7c
parenta9b28a4391b2a3a9f1afc0bf98a2b3a01aed9473 (diff)
downloaddpdk-next-eventdev-ce276d9ec35b7e1200d7946a5e30117ce1162950.zip
dpdk-next-eventdev-ce276d9ec35b7e1200d7946a5e30117ce1162950.tar.gz
dpdk-next-eventdev-ce276d9ec35b7e1200d7946a5e30117ce1162950.tar.xz
net/pcap: propagate timestamp from header to mbuf
Timestamp is always set in PCAP header, whether it reads a file or listen on an interface. This information can be important for some applications and it cannot be obtained otherwise (especially when reading a PCAP file, where the timestamp is not the current time). Timestamp here is the number of microseconds since epoch. Signed-off-by: Sylvain Rodon <srn@nexatech.fr> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--drivers/net/pcap/rte_eth_pcap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 95d4b5b..5489010 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -265,6 +265,9 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
}
mbuf->pkt_len = (uint16_t)header.caplen;
+ mbuf->timestamp = (uint64_t)header.ts.tv_sec * 1000000
+ + header.ts.tv_usec;
+ mbuf->ol_flags |= PKT_RX_TIMESTAMP;
mbuf->port = pcap_q->port_id;
bufs[num_rx] = mbuf;
num_rx++;