On Sun, 14 Jun 2026 17:23:12 +0800
[email protected] wrote:

> From: Jie Liu <[email protected]>
> 
> - The statistics support includes:
> - Basic statistics (ipackets, opackets, ibytes, obytes, etc.)
> - Extended statistics (xstats) for detailed hardware counters.
> - Per-queue statistics for both RX and TX.
> 
> The multi-process support allows secondary processes to retrieve
> statistics. Since secondary processes cannot access hardware registers
> directly, an IPC mechanism is implemented using the DPDK MP API.
> 
> Atomic operations are used when reading 64-bit counters to ensure
> data consistency between processes.
> 
> Signed-off-by: Jie Liu <[email protected]>
> ---

The software stats do not need to be optional. You mentioned that they
have a performance cost, but that is because of the choice to use atomic 
counters.

Atomic operations are slow and not required for per-queue software statistics.
Even with memory order relaxed, the atomic operations cause a locked instruction
on x86. Thats what you are observing.
The DPDK follows the pattern of BSD and Linux kernel and does not use atomic
for software stats. When using per-queue statistics in some case, the point
in time measurement (summation) will be inaccurate but that is ok.

If you take off the atomic, I bet the cost of doing the conditional branch
outweighs the cost of simple basic arithmetic operation.

Please have them always on, drivers should only have options when
there is no other choice.

Reply via email to