DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sylvain Rodon <srn@nexatech.fr>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, Sylvain Rodon <srn@nexatech.fr>
Subject: [dpdk-dev] [PATCH v2] net/pcap: propagate timestamp from pcap_pkthdr to mbuf
Date: Fri,  2 Aug 2019 10:57:24 +0200	[thread overview]
Message-ID: <1564736244-5906-2-git-send-email-s.rodon@mail.nexatech.local> (raw)
In-Reply-To: <1564736244-5906-1-git-send-email-s.rodon@mail.nexatech.local>

From: Sylvain Rodon <srn@nexatech.fr>

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>
---
 drivers/net/pcap/rte_eth_pcap.c | 3 +++
 1 file changed, 3 insertions(+)

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 @@ struct pmd_devargs_all {
 		}
 
 		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++;
-- 
1.9.1


  reply	other threads:[~2019-08-02  9:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 15:18 [dpdk-dev] [PATCH] pcap: " Sylvain Rodon
2019-08-02  8:57 ` [dpdk-dev] [PATCH v2] net/pcap: " Sylvain Rodon
2019-08-02  8:57   ` Sylvain Rodon [this message]
2019-08-27 11:54     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1564736244-5906-2-git-send-email-s.rodon@mail.nexatech.local \
    --to=srn@nexatech.fr \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).