[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1758783617.5882711-3-xuanzhuo@linux.alibaba.com>
Date: Thu, 25 Sep 2025 15:00:17 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
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>,
Lukas Bulwahn <lukas.bulwahn@...hat.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Vivian Wang <wangruikang@...as.ac.cn>,
Troy Mitchell <troy.mitchell@...ux.spacemit.com>,
Dust Li <dust.li@...ux.alibaba.com>
Subject: Re: [PATCH net-next v3] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor
On Fri, 19 Sep 2025 18:40:47 +0200, Andrew Lunn <andrew@...n.ch> wrote:
> > +void eea_stats(struct net_device *netdev, struct rtnl_link_stats64 *tot)
> > +{
> > + 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 enet_rx *rx = enet->rx[i];
> > +
> > + 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) {
>
> Why would enet->rx and/or enet->tx not be set?
We allocate enet->rx, tx only when the driver is open.
>
> > + for (i = 0; i < enet->cfg.tx_ring_num; i++) {
> > + struct enet_tx *tx = &enet->tx[i];
>
> What prevents them from going away while in this loop?
rtnl_lock
Thanks.
>
> Andrew
Powered by blists - more mailing lists