[PATCH] ethdev: document that stats reset APIs are not thread-safe

Stephen Hemminger stephen at networkplumber.org
Sat Oct 5 00:27:54 CEST 2024


On Thu, 25 Apr 2024 17:53:08 +0100
Ferruh Yigit <ferruh.yigit at amd.com> wrote:

> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 548fada1c7ad..40f04c0e191b 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -3136,6 +3136,9 @@ int rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats);
>  /**
>   * Reset the general I/O statistics of an Ethernet device.
>   *
> + * API is not multi-thread safe.
> + * Application should stop forwarding before calling this API.
> + *
>   * @param port_id
>   *   The port identifier of the Ethernet device.
>   * @return

Putting a note in the documentation is good, but it would be better to
be more explicit about what happens if used unsafely.

Something like adding a not to stats_reset like.

* Resetting the statistics while device is active is not an atomic operation;
* doing a reset while forwarding may lead to inconsistent counter values.



More information about the dev mailing list