DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Tom Barbette <barbette@kth.se>, dev@dpdk.org
Cc: bruce.richardson@intel.com, john.mcnamara@intel.com,
	Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Yongseok Koh <yskoh@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH v2 3/3] rxtx_callbacks: Add support for HW timestamp
Date: Tue, 2 Apr 2019 19:22:25 +0100	[thread overview]
Message-ID: <5ea4b14e-6db9-7d7a-6b15-33fef4c3cd16@intel.com> (raw)
Message-ID: <20190402182225.-M7KlRTqo0Z3GEI1mQOrC2_MwZUurau8YQfw8NVkCcU@z> (raw)
In-Reply-To: <20190327061935.19572-4-barbette@kth.se>

On 3/27/2019 6:19 AM, Tom Barbette wrote:
> Use rxtx callback to demonstrate a way to use rte_eth_read_clock to
> convert the hardware timestamps to an amount of cycles.
> 
> This allows to get the amount of time the packet spent since its entry
> in the device. While the regular latency only shows the latency from
> when it entered the software stack.
> 
> Signed-off-by: Tom Barbette <barbette@kth.se>
<...>

> @@ -50,6 +50,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
>  
>  CFLAGS += $(WERROR_FLAGS)
>  
> +
> +CFLAGS += -DALLOW_EXPERIMENTAL_API

Can you please add the experimental API as a comment.

>  # workaround for a gcc bug with noreturn attribute
>  # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
>  ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
> diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
> index 2058be627..7000464e1 100644
> --- a/examples/rxtx_callbacks/main.c
> +++ b/examples/rxtx_callbacks/main.c
> @@ -10,6 +10,8 @@
>  #include <rte_lcore.h>
>  #include <rte_mbuf.h>
>  
> +#include <getopt.h>

libc includes are already together above, can you move this above

> +
>  #define RX_RING_SIZE 1024
>  #define TX_RING_SIZE 1024
>  
> @@ -17,6 +19,9 @@
>  #define MBUF_CACHE_SIZE 250
>  #define BURST_SIZE 32
>  
> +static const char usage[] =
> +	"%s EAL_ARGS -- [-t]\n";
> +
>  static const struct rte_eth_conf port_conf_default = {
>  	.rxmode = {
>  		.max_rx_pkt_len = ETHER_MAX_LEN,
> @@ -25,9 +30,14 @@ static const struct rte_eth_conf port_conf_default = {
>  
>  static struct {
>  	uint64_t total_cycles;
> +	uint64_t total_queue_cycles;
>  	uint64_t total_pkts;
>  } latency_numbers;
>  
> +int hw_timestamping;
> +
> +#define TICKS_PER_CYCLE_SHIFT 16
> +uint64_t ticks_per_cycle_mult;

I am aware this is single .c file application, but as a good practice can you
please make above global variables static.

<...>

> @@ -95,9 +126,20 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
>  	if (retval != 0)
>  		return retval;
>  
> +	rxconf = dev_info.default_rxconf;
> +
> +	if (hw_timestamping) {
> +		if (!(dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)) {
> +			printf("\nERROR: Port %u does not support hardware timestamping\n"
> +					, port);
> +			return -1;
> +		}
> +		rxconf.offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
> +	}

Same comment as ethdev one, above code assume if driver announces
'DEV_RX_OFFLOAD_TIMESTAMP' capability, it have to implement 'read_clock'
dev_ops, should it be the case?

Write now only mlx implements it so this is not a problem at all, but I don't
know if all PMDs supports timestamping packets must implement 'read_clock'.

<...>

> @@ -6,6 +6,7 @@
>  # To build this example as a standalone application with an already-installed
>  # DPDK instance, use 'make'
>  
> +allow_experimental_apis = true

Can you please add the experimental API as a comment.

>  sources = files(
>  	'main.c'
>  )
> 


  parent reply	other threads:[~2019-04-02 18:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  6:19 [dpdk-dev] [PATCH v2 0/3] Add rte_eth_read_clock API Tom Barbette
2019-03-27  6:19 ` Tom Barbette
2019-03-27  6:19 ` [dpdk-dev] [PATCH v2 1/3] rte_ethdev: Add API function to read dev clock Tom Barbette
2019-03-27  6:19   ` Tom Barbette
2019-04-02 17:46   ` Ferruh Yigit
2019-04-02 17:46     ` Ferruh Yigit
2019-04-02 19:24     ` Tom Barbette
2019-04-02 19:24       ` Tom Barbette
2019-03-27  6:19 ` [dpdk-dev] [PATCH v2 2/3] mlx5: Implement support for read_clock Tom Barbette
2019-03-27  6:19   ` Tom Barbette
2019-04-02 17:47   ` Ferruh Yigit
2019-04-02 17:47     ` Ferruh Yigit
2019-04-02 18:26   ` Ferruh Yigit
2019-04-02 18:26     ` Ferruh Yigit
2019-04-02 19:05     ` Tom Barbette
2019-04-02 19:05       ` Tom Barbette
2019-04-03  5:28   ` Shahaf Shuler
2019-04-03  5:28     ` Shahaf Shuler
2019-03-27  6:19 ` [dpdk-dev] [PATCH v2 3/3] rxtx_callbacks: Add support for HW timestamp Tom Barbette
2019-03-27  6:19   ` Tom Barbette
2019-04-02 18:22   ` Ferruh Yigit [this message]
2019-04-02 18:22     ` Ferruh Yigit
2019-04-02 19:39     ` Tom Barbette
2019-04-02 19:39       ` Tom Barbette
2019-03-27 14:41 ` [dpdk-dev] [PATCH v2 0/3] Add rte_eth_read_clock API Stephen Hemminger
2019-03-27 14:41   ` Stephen Hemminger
2019-03-27 14:48   ` Thomas Monjalon
2019-03-27 14:48     ` Thomas Monjalon
2019-03-27 14:54   ` Wiles, Keith
2019-03-27 14:54     ` Wiles, Keith
2019-03-27 16:08     ` Tom Barbette
2019-03-27 16:08       ` Tom Barbette

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=5ea4b14e-6db9-7d7a-6b15-33fef4c3cd16@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=arybchenko@solarflare.com \
    --cc=barbette@kth.se \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=yskoh@mellanox.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).