[RFC v2] net/af_packet: make stats reset reliable
Stephen Hemminger
stephen at networkplumber.org
Thu May 2 20:26:02 CEST 2024
On Thu, 2 May 2024 19:37:28 +0200
Mattias Rönnblom <hofors at lysator.liu.se> wrote:
> >
> > Do we need to declare count as '_Atomic', I wasn't planning to make
> > variable _Atomic. This way assignment won't introduce any memory barrier.
> >
>
> To use atomics in DPDK, the current requirements seems to be to use
> RTE_ATOMIC(). That macro expands to _Atomic in enable_stdatomic=true
> builds, and nothing otherwise.
>
> Carefully crafted code using atomics will achieved the same performance
> and be more correct than the non-atomic variant. However, in practice, I
> think the non-atomic variant is very likely to produce the desired results.
You are confusing atomic usage for thread safety, with the necessity
of compiler barriers.
Stats should not be volatile.
More information about the dev
mailing list