[v5,13/16] ethdev: add doxygen comment for Rx timestamp API

Message ID 20201103140931.488700-14-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series remove mbuf timestamp |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon Nov. 3, 2020, 2:09 p.m. UTC
  The offload flag DEV_RX_OFFLOAD_TIMESTAMP had no documentation.
After switching to dynamic mbuf flag and field,
it becomes even more important to explicit the feature behaviour.

A doxygen comment for the timesync API was mentioning
the deprecated timestamp field, so it is also updated.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 lib/librte_ethdev/rte_ethdev.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Ajit Khaparde Nov. 3, 2020, 7:07 p.m. UTC | #1
On Tue, Nov 3, 2020 at 6:15 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The offload flag DEV_RX_OFFLOAD_TIMESTAMP had no documentation.
> After switching to dynamic mbuf flag and field,
> it becomes even more important to explicit the feature behaviour.
>
> A doxygen comment for the timesync API was mentioning
> the deprecated timestamp field, so it is also updated.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
>  lib/librte_ethdev/rte_ethdev.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index e341a08817..4988054cb2 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -1344,6 +1344,11 @@ struct rte_eth_conf {
>  #define DEV_RX_OFFLOAD_VLAN_EXTEND     0x00000400
>  #define DEV_RX_OFFLOAD_JUMBO_FRAME     0x00000800
>  #define DEV_RX_OFFLOAD_SCATTER         0x00002000
> +/**
> + * Timestamp is set by the driver in RTE_MBUF_DYNFIELD_TIMESTAMP_NAME
> + * and RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME is set in ol_flags.
> + * The mbuf field and flag are registered when the offload is configured.
> + */
>  #define DEV_RX_OFFLOAD_TIMESTAMP       0x00004000
>  #define DEV_RX_OFFLOAD_SECURITY         0x00008000
>  #define DEV_RX_OFFLOAD_KEEP_CRC                0x00010000
> @@ -4646,7 +4651,7 @@ int rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *time);
>   * rte_eth_read_clock(port, base_clock);
>   *
>   * Then, convert the raw mbuf timestamp with:
> - * base_time_sec + (double)(mbuf->timestamp - base_clock) / freq;
> + * base_time_sec + (double)(*timestamp_dynfield(mbuf) - 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.
> --
> 2.28.0
>
  

Patch

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index e341a08817..4988054cb2 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1344,6 +1344,11 @@  struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_VLAN_EXTEND	0x00000400
 #define DEV_RX_OFFLOAD_JUMBO_FRAME	0x00000800
 #define DEV_RX_OFFLOAD_SCATTER		0x00002000
+/**
+ * Timestamp is set by the driver in RTE_MBUF_DYNFIELD_TIMESTAMP_NAME
+ * and RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME is set in ol_flags.
+ * The mbuf field and flag are registered when the offload is configured.
+ */
 #define DEV_RX_OFFLOAD_TIMESTAMP	0x00004000
 #define DEV_RX_OFFLOAD_SECURITY         0x00008000
 #define DEV_RX_OFFLOAD_KEEP_CRC		0x00010000
@@ -4646,7 +4651,7 @@  int rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *time);
  * rte_eth_read_clock(port, base_clock);
  *
  * Then, convert the raw mbuf timestamp with:
- * base_time_sec + (double)(mbuf->timestamp - base_clock) / freq;
+ * base_time_sec + (double)(*timestamp_dynfield(mbuf) - 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.