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

Mattias Rönnblom hofors at lysator.liu.se
Sun Apr 28 17:52:46 CEST 2024


On 2024-04-26 17:17, Morten Brørup wrote:
>> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
>> Sent: Friday, 26 April 2024 17.14
>>
>> On Fri, 26 Apr 2024 14:20:01 +0200
>> Morten Brørup <mb at smartsharesystems.com> wrote:
>>
>>>> From: Ferruh Yigit [mailto:ferruh.yigit at amd.com]
>>>> Sent: Thursday, 25 April 2024 18.53
>>>>
>>>> Making 'rte_eth_stats_reset()' and 'rte_eth_xstats_reset()' APIs thread
>>>> safe has performance impact on datapath.
>>>>
>>>> Instead document APIs as not thread safe and add condition for reliable
>>>> stats reset functionality, forwarding should be stopped.
>>>
>>> I'm not sure stopping forwarding suffices.
>>> NIC hardware counters will keep progressing unless RX and TX is stopped at
>> NIC level.
>>>
>>> I don't have any suggestions for a better wording, though. :-(
>>>
>>> Anyway, better with the patch than without...
>>> Acked-by: Morten Brørup <mb at smartsharesystems.com>
>>>
>>
>> The safest option would be:
>> 	rte_eth_dev_stop
>> 	rte_eth_stats_reset
>> 	rte_eth_dev_start
> 
> Yes, but this will cause packet loss.
> Network admins should be able to clear the counters without causing packet loss.
> 

For sure, and they would do it via some O&M interface, which would in 
turn talk the control plane, which in turn would talk to the data plane 
(including <rte_ethdev.h>).

Either the control plane or the O&M layer could keep track of a reset 
offset. Doesn't have to be on the PMD level.


More information about the stable mailing list