Adds common code for collecting basic statistics used by many SW based PMD's such as af_packet, af_xdp, null, tap and ring.
This version uses two counters (current and offset) to implement SMP safe reset on 64 bit platforms; this avoids having to do locked operation in the fast path. On 32 bit platforms, the compiler will split access to 64 bit variables by default; therefore it has to use std atomic. By using common code, it also fixes missing counts in several drivers. And fixes several bugs. v8 - use counter and offset (based on mailing list discussion) to avoid having to locked operation on x86 64. Stephen Hemminger (8): eal: generic 64 bit counter ethdev: add common counters for statistics net/af_packet: use generic SW stats net/af_xdp: use generic SW stats net/pcap: use generic SW stats net/ring: use generic SW stats net/tap: use generic SW stats net/null: use generic SW stats drivers/net/af_packet/rte_eth_af_packet.c | 78 +++-------- drivers/net/af_xdp/rte_eth_af_xdp.c | 85 ++++-------- drivers/net/null/rte_eth_null.c | 83 +++--------- drivers/net/pcap/pcap_ethdev.c | 100 ++++----------- drivers/net/ring/rte_eth_ring.c | 63 +++------ drivers/net/tap/rte_eth_tap.c | 75 ++--------- drivers/net/tap/rte_eth_tap.h | 15 +-- lib/eal/include/meson.build | 1 + lib/eal/include/rte_counter.h | 150 ++++++++++++++++++++++ lib/ethdev/ethdev_swstats.c | 101 +++++++++++++++ lib/ethdev/ethdev_swstats.h | 111 ++++++++++++++++ lib/ethdev/meson.build | 2 + lib/ethdev/version.map | 3 + 13 files changed, 486 insertions(+), 381 deletions(-) create mode 100644 lib/eal/include/rte_counter.h create mode 100644 lib/ethdev/ethdev_swstats.c create mode 100644 lib/ethdev/ethdev_swstats.h -- 2.43.0