Re: [PATCH V10 net-next 01/10] net: hibmcge: Add pci table supported in this module

From: Jakub Kicinski
Date: Sun Sep 15 2024 - 11:11:00 EST


On Thu, 12 Sep 2024 10:51:18 +0800 Jijie Shao wrote:
> + netdev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev,
> + struct pcpu_sw_netstats);
> + if (!netdev->tstats)
> + return -ENOMEM;
> + netdev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;

take a look at how pcpu_stat_type is used in net/core/dev.c
core will automatically allocate the stats for you and handle them in
the ndo for reading stats
your current code repeats what core already does so it will leak the
memory and I think double count