[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251126165510.34698f35@kernel.org>
Date: Wed, 26 Nov 2025 16:55:10 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo
Abeni <pabeni@...hat.com>, Wen Gu <guwen@...ux.alibaba.com>, Philo Lu
<lulie@...ux.alibaba.com>, Lorenzo Bianconi <lorenzo@...nel.org>, Vadim
Fedorenko <vadim.fedorenko@...ux.dev>, Dong Yibo <dong100@...se.com>, Lukas
Bulwahn <lukas.bulwahn@...hat.com>, Geert Uytterhoeven
<geert+renesas@...der.be>, Vivian Wang <wangruikang@...as.ac.cn>, MD Danish
Anwar <danishanwar@...com>, Dust Li <dust.li@...ux.alibaba.com>, Andrew
Lunn <andrew@...n.ch>
Subject: Re: [PATCH net-next v16 5/5] eea: introduce ethtool support
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;
> + }
> + }
> +}
Powered by blists - more mailing lists