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

From: Jakub Kicinski <[email-masked]>
Date: Wed, 12 Jun 2024 17:39:44 -0700

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);