Re: [PATCH net-next 2/2] selftests: drv-net: let ethtool stats settle before reading

David Ahern <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
On 8/8/26 10:36 AM, Jakub Kicinski wrote:
> Some devices refresh the statistics exposed via ethtool only
> periodically, every stats-block-usecs (as reported by ethtool -c).
> ethtool_std_stats and ethtool_rmon sample the counters immediately
> after generating traffic, so on such devices they can read stale
> values and fail with a delta short of the packets just sent.
> 
> Add a hw_stats_settle() helper which sleeps for 1.25x the configured
> stats-block-usecs (defaulting to 20ms when the device reports no, or
> a zero, period). Use it for ethtool std stats and RMON.
> The 1.25x/20msec heuristic matches what the Python tests do.
> 
> Signed-off-by: Jakub Kicinski <[email protected]>
> ---
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> ---
>  .../selftests/drivers/net/hw/ethtool_rmon.sh      |  2 ++
>  .../selftests/drivers/net/hw/ethtool_std_stats.sh |  2 ++
>  tools/testing/selftests/net/forwarding/lib.sh     | 15 +++++++++++++++
>  3 files changed, 19 insertions(+)
> 


Reviewed-by: David Ahern <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.