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 1/3] rte_ethdev: Add API function to read dev clock
Date: Thu, 20 Dec 2018 19:55:11 +0000 [thread overview]
Message-ID: <491a4e29-83dd-ad0c-8904-d1e2ccca1f68@intel.com> (raw)
In-Reply-To: <20181219134934.24693-2-barbette@kth.se>
On 12/19/2018 1:49 PM, Tom Barbette wrote:
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice.
> + *
> + * Read the current clock counter of an Ethernet device
> + *
> + * This returns the current raw clock value of an Ethernet device.
> + * The value returned here is from the same clock than the one
> + * filling timestamp field of RX packets. Therefore it can be used
> + * to compute a precise conversion of the device clock to the real time.
> + *
> + * E.g, a simple heuristic to derivate the frequency would be:
> + * uint64_t start, end;
> + * rte_eth_read_clock(port, start);
> + * rte_delay_ms(100);
> + * rte_eth_read_clock(port, end);
> + * double freq = (end - start) * 10;
> + *
> + * Compute a common reference with:
> + * uint64_t base_time_sec = current_time();
> + * uint64_t base_clock;
> + * rte_eth_read_clock(port, base_clock);
> + *
> + * Then, convert the raw mbuf timestamp with:
> + * base_time_sec + (double)(mbuf->timestamp - base_clock) / freq;
> + *
> + * This simple example will not provide a very good accuracy. One must
> + * at least measure multiple times the frequency and do a regression.
> + * To avoid deviation from the system time, the common reference can
> + * be repeated from time to time. The integer division can also be
> + * converted by a multiplication and a shift for better performance.
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param time
> + * Pointer to the uint64_t that holds the raw clock value.
> + *
> + * @return
> + * - 0: Success.
> + * - -ENODEV: The port ID is invalid.
> + * - -ENOTSUP: The function is not supported by the Ethernet driver.
> + */
> +int __rte_experimental rte_eth_read_clock(uint16_t port_id, uint64_t *time);
Is this a common enough feature to include into ethdev abstraction layer? Or a
feature for a single vendor?
I would like to get more input from other vendors if this is something they can
benefit from?
next prev parent reply other threads:[~2018-12-20 19:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 13:49 [dpdk-dev] [PATCH 0/3] Add rte_eth_read_clock API Tom Barbette
2018-12-19 13:49 ` [dpdk-dev] [PATCH 1/3] rte_ethdev: Add API function to read dev clock Tom Barbette
2018-12-20 6:42 ` Shahaf Shuler
2018-12-20 19:55 ` Ferruh Yigit [this message]
2018-12-19 13:49 ` [dpdk-dev] [PATCH 2/3] mlx5: Implement support for read_clock Tom Barbette
2018-12-20 6:46 ` Shahaf Shuler
2018-12-19 13:49 ` [dpdk-dev] [PATCH 3/3] rxtx_callbacks: Add support for HW timestamp Tom Barbette
2018-12-21 8:25 [dpdk-dev] [PATCH 1/3] rte_ethdev: Add API function to read dev clock Tom Barbette
2018-12-23 6:06 ` Shahaf Shuler
2019-01-02 17:44 ` Ferruh Yigit
2019-01-08 11:30 ` Tom Barbette
2019-03-19 13:32 ` Yigit, Ferruh
2019-03-19 13:32 ` Yigit, Ferruh
2019-03-20 14:48 ` Thomas Monjalon
2019-03-20 14:48 ` Thomas Monjalon
2019-03-20 15:57 ` Andrew Rybchenko
2019-03-20 15:57 ` Andrew Rybchenko
2019-03-21 19:37 ` Ferruh Yigit
2019-03-21 19:37 ` 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=491a4e29-83dd-ad0c-8904-d1e2ccca1f68@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).