Re: [PATCH net-next 1/2] netdevsim: migrate to dstats stats collection
From: Joe Damato
Date: Thu Jun 12 2025 - 10:18:05 EST
On Wed, Jun 11, 2025 at 08:06:19AM -0700, Breno Leitao wrote:
> 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.
Ignorable minor nits: "automatic" repeated twice in the list item above and the
other items in the list below do not end with periods.
> - 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@xxxxxxxxxx>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> ---
> drivers/net/netdevsim/netdev.c | 33 ++++++---------------------------
> drivers/net/netdevsim/netdevsim.h | 5 -----
> 2 files changed, 6 insertions(+), 32 deletions(-)
Reviewed-by: Joe Damato <joe@xxxxxxx>