Re: [PATCH net-next v20 08/13] rtase: Implement net_device_ops

From: Jakub Kicinski
Date: Wed Jun 12 2024 - 20:39:53 EST


On Fri, 7 Jun 2024 16:43:16 +0800 Justin Lai wrote:
> +static void rtase_get_stats64(struct net_device *dev,
> + struct rtnl_link_stats64 *stats)
> +{
> + const struct rtase_private *tp = netdev_priv(dev);
> + const struct rtase_counters *counters;
> +
> + counters = tp->tally_vaddr;
> +
> + if (!counters)
> + return;

Same question about how this can be null as in the ethtool patch..

> + netdev_stats_to_stats64(stats, &dev->stats);

Please dont use this field, there is a comment on it:

struct net_device_stats stats; /* not used by modern drivers */

You can store the fields you need for counters in struct rtase_private

> + dev_fetch_sw_netstats(stats, dev->tstats);