Subject: Re: [PATCH net-next v16 5/5] eea: introduce ethtool support

From: Jakub Kicinski <[email-masked]>
Date: Wed, 26 Nov 2025 16:55:10 -0800

On Mon, 24 Nov 2025 09:42:51 +0800 Xuan Zhuo wrote:
> +void eea_stats(struct net_device *netdev, struct rtnl_link_stats64 *tot)

..ethtool.c is not a great place for an ndo, I missed this in previous
reviews

> +	struct eea_net *enet = netdev_priv(netdev);
> +	u64 packets, bytes;
> +	u32 start;
> +	int i;
> +
> +	if (enet->rx) {
> +		for (i = 0; i < enet->cfg.rx_ring_num; i++) {
> +			struct eea_net_rx *rx = enet->rx[i];

Could you document here what prevents enet->rx from getting swapped /
going away half way thru the iteration? The implicit RCU sync in
netif_napi_del() ?

ndo get_stats runs under RCU and without rtnl_lock if read via profcs
(tools/testing/selftests/drivers/net/stats.py has a test case for it
FWIW)

> +			do {
> +				start = u64_stats_fetch_begin(&rx->stats.syncp);
> +				packets = u64_stats_read(&rx->stats.packets);
> +				bytes = u64_stats_read(&rx->stats.bytes);
> +			} while (u64_stats_fetch_retry(&rx->stats.syncp,
> +						       start));
> +
> +			tot->rx_packets += packets;
> +			tot->rx_bytes   += bytes;
> +		}
> +	}
> +
> +	if (enet->tx) {
> +		for (i = 0; i < enet->cfg.tx_ring_num; i++) {
> +			struct eea_net_tx *tx = &enet->tx[i];
> +
> +			do {
> +				start = u64_stats_fetch_begin(&tx->stats.syncp);
> +				packets = u64_stats_read(&tx->stats.packets);
> +				bytes = u64_stats_read(&tx->stats.bytes);
> +			} while (u64_stats_fetch_retry(&tx->stats.syncp,
> +						       start));
> +
> +			tot->tx_packets += packets;
> +			tot->tx_bytes   += bytes;
> +		}
> +	}
> +}