netdevsim: migrate to dstats stats collection
authorBreno Leitao <leitao@debian.org>
Wed, 18 Jun 2025 08:32:42 +0000 (01:32 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 19 Jun 2025 23:15:34 +0000 (16:15 -0700)
commitf9e2511d80c2eaeb940c5f8280d7eea9d7946ece
tree8133946fcdd2f534a9b27a75c3a6258d4bedc43e
parentc3ee72ded0d2fc6433a009291d7825b28426e4c0
netdevsim: migrate to dstats stats collection

Replace custom statistics tracking with the kernel's dstats infrastructure
to simplify code and improve consistency with other network drivers.

This change:
- Sets dev->pcpu_stat_type = NETDEV_PCPU_STAT_DSTATS for automatic
  automatic allocation and deallocation.
- Removes manual stats fields and their update
- Replaces custom nsim_get_stats64() with dev_get_stats()
- Uses dev_dstats_tx_add() and dev_dstats_tx_dropped() helpers
- Eliminates the need for manual synchronization primitives

The dstats framework provides the same functionality with less code.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Joe Damato <joe@dama.to>
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20250618-netdevsim_stat-v4-1-19fe0d35e28e@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netdevsim/netdev.c
drivers/net/netdevsim/netdevsim.h