Subject: Re: [PATCH net-next v10 4/7] net: tn40xx: add basic Tx handling

From: Jakub Kicinski <[email-masked]>
Date: Fri, 14 Jun 2024 08:23:51 -0700

On Fri, 14 Jun 2024 11:41:52 +0900 (JST) FUJITA Tomonori wrote:
> >> +static void tn40_get_stats(struct net_device *ndev,
> >> +			   struct rtnl_link_stats64 *stats)
> >> +{
> >> +	struct tn40_priv *priv = netdev_priv(ndev);
> >> +
> >> +	netdev_stats_to_stats64(stats, &priv->net_stats);  
> > 
> > You should hold the stats in driver priv, probably:
> > 
> > from struct net_device:
> > 
> > 	struct net_device_stats	stats; /* not used by modern drivers */
> >  
> 
> Currently, net_device_stats struct is in tn40_priv struct. You meant
> the driver shouldn't use net_device_stats struct?

Oh, I misread, I just saw netdev_stats_to_stats64( and didn't read
further. Doesn't look like you're using any of the magic properties
of struct net_device_stats, so yes, just replace it with struct
rtnl_link_stats64 in the priv, and with minor adjustments that should be it.

> Note that some TX40xx chips support HW statistics. Seems that my NIC
> supports the feature so I plan to send a patch for that after the
> initial driver is merged.

Sounds like a good plan :)