This is my attempt to demonstrate: - generic counters for SW drivers, the example does af_packet and tap but same should be applied to af_xdp, virtio, etc. - counters are safe against 64 bit tearing on 32 bit platform The naming and organization could be improved: - should this be in rte_ethdev? - better name for struct and vairables? - audit and handle errors better.
Stephen Hemminger (3): ethdev: add internal helper of SW driver statistics net/af_packet: use SW stats helper net/tap: use generic SW stats drivers/net/af_packet/rte_eth_af_packet.c | 97 ++----- drivers/net/tap/rte_eth_tap.c | 100 ++------ drivers/net/tap/rte_eth_tap.h | 17 +- lib/ethdev/ethdev_swstats.c | 294 ++++++++++++++++++++++ lib/ethdev/ethdev_swstats.h | 60 +++++ lib/ethdev/meson.build | 2 + lib/ethdev/version.map | 7 + 7 files changed, 400 insertions(+), 177 deletions(-) create mode 100644 lib/ethdev/ethdev_swstats.c create mode 100644 lib/ethdev/ethdev_swstats.h -- 2.43.0