DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] pcap: propagate timestamp from pcap_pkthdr to mbuf
@ 2019-07-31 15:18 Sylvain Rodon
  2019-08-02  8:57 ` [dpdk-dev] [PATCH v2] net/pcap: " Sylvain Rodon
  0 siblings, 1 reply; 4+ messages in thread
From: Sylvain Rodon @ 2019-07-31 15:18 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sylvain Rodon

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). 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..3e80f0c 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] net/pcap: propagate timestamp from pcap_pkthdr to mbuf
  2019-07-31 15:18 [dpdk-dev] [PATCH] pcap: propagate timestamp from pcap_pkthdr to mbuf Sylvain Rodon
@ 2019-08-02  8:57 ` Sylvain Rodon
  2019-08-02  8:57   ` Sylvain Rodon
  0 siblings, 1 reply; 4+ messages in thread
From: Sylvain Rodon @ 2019-08-02  8:57 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sylvain Rodon

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>
---
v2:
* Be more compliant about DPDK patch rules

 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] net/pcap: propagate timestamp from pcap_pkthdr to mbuf
  2019-08-02  8:57 ` [dpdk-dev] [PATCH v2] net/pcap: " Sylvain Rodon
@ 2019-08-02  8:57   ` Sylvain Rodon
  2019-08-27 11:54     ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Sylvain Rodon @ 2019-08-02  8:57 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sylvain Rodon

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/pcap: propagate timestamp from pcap_pkthdr to mbuf
  2019-08-02  8:57   ` Sylvain Rodon
@ 2019-08-27 11:54     ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2019-08-27 11:54 UTC (permalink / raw)
  To: Sylvain Rodon; +Cc: dev

On 8/2/2019 9:57 AM, Sylvain Rodon wrote:
> 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>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-27 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 15:18 [dpdk-dev] [PATCH] pcap: propagate timestamp from pcap_pkthdr to mbuf Sylvain Rodon
2019-08-02  8:57 ` [dpdk-dev] [PATCH v2] net/pcap: " Sylvain Rodon
2019-08-02  8:57   ` Sylvain Rodon
2019-08-27 11:54     ` Ferruh Yigit

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).