DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Vivien Didelot <vivien.didelot@gmail.com>, dev@dpdk.org
Cc: patrick.keroulas@radio-canada.ca, Olivier MATZ <olivier.matz@6wind.com>
Subject: Re: [dpdk-dev] [PATCH] net/pcap: support hardware Tx timestamps
Date: Wed, 17 Jun 2020 09:16:51 +0100	[thread overview]
Message-ID: <5991f5d8-5d7f-4caf-733c-a5d29110a046@intel.com> (raw)
In-Reply-To: <20200610193938.218768-1-vivien.didelot@gmail.com>

On 6/10/2020 8:39 PM, Vivien Didelot wrote:
> When hardware timestamping is enabled on Rx path, system time should
> no longer be used to calculate the timestamps when dumping packets.
> 
> Instead, use the value stored by the driver in mbuf->timestamp
> and assume it is already converted to nanoseconds (otherwise the
> application may edit the packet headers itself afterwards).
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
> Signed-off-by: Patrick Keroulas <patrick.keroulas@radio-canada.ca>
> ---
>  doc/guides/rel_notes/release_20_08.rst |  1 +
>  drivers/net/pcap/rte_eth_pcap.c        | 30 +++++++++++++++-----------
>  2 files changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
> index 7a67c960c..cedceaf9d 100644
> --- a/doc/guides/rel_notes/release_20_08.rst
> +++ b/doc/guides/rel_notes/release_20_08.rst
> @@ -61,6 +61,7 @@ New Features
>    Updated PCAP driver with new features and improvements, including:
>  
>    * Support software Tx nanosecond timestamps precision.
> +  * Support hardware Tx timestamps.
>  
>  * **Updated Mellanox mlx5 driver.**
>  
> diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
> index 13a3d0ac7..3d80b699b 100644
> --- a/drivers/net/pcap/rte_eth_pcap.c
> +++ b/drivers/net/pcap/rte_eth_pcap.c
> @@ -290,19 +290,23 @@ eth_null_rx(void *queue __rte_unused,
>  #define NSEC_PER_SEC	1000000000L
>  
>  static inline void
> -calculate_timestamp(struct timeval *ts) {
> -	uint64_t cycles;
> -	struct timeval cur_time;
> +calculate_timestamp(const struct rte_mbuf *mbuf, struct timeval *ts) {
> +	if (mbuf->ol_flags & PKT_RX_TIMESTAMP) {
> +		ts->tv_sec = mbuf->timestamp / NSEC_PER_SEC;
> +		ts->tv_usec = mbuf->timestamp % NSEC_PER_SEC;

Hi Vivien,

No objection from pcap PMD point of view.

But should we have a Tx mbuf flag, 'PKT_TX_TIMESTAMP', for applications to
request drivers to use the timestamp field on Tx path? Not sure if there can be
any problem on using Rx flag on both direction?

Also the metric is not defined for the 'mbuf->timestamp', it doesn't need to be
nanoseconds, not sure if it is correct to assume it is. Or should we define a
metric for timestamp on the Tx path?

cc'ed Oliver, I think he can comment better on above two questions.

Thanks,
ferruh


  parent reply	other threads:[~2020-06-17  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 19:39 Vivien Didelot
2020-06-16 19:02 ` Vivien Didelot
2020-06-17  8:16 ` Ferruh Yigit [this message]
2020-06-23 22:10   ` Vivien Didelot
2020-06-25 16:35     ` Olivier Matz
2020-06-25 18:49       ` Vivien Didelot
2020-06-26 13:52         ` 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=5991f5d8-5d7f-4caf-733c-a5d29110a046@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=patrick.keroulas@radio-canada.ca \
    --cc=vivien.didelot@gmail.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).