[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201204221257.GH2400258@lunn.ch>
Date: Fri, 4 Dec 2020 23:12:57 +0100
From: Andrew Lunn <andrew@...n.ch>
To: George McCollister <george.mccollister@...il.com>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Russell King <linux@...linux.org.uk>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
netdev@...r.kernel.org, open list <linux-kernel@...r.kernel.org>,
linux-mips@...r.kernel.org
Subject: Re: [PATCH v4 net-next 2/2] net: dsa: qca: ar9331: export stats64
> > +struct ar9331_sw_stats {
> > + u64 rxbroad;
> > + u64 rxpause;
> > + u64 rxmulti;
> > +};
7> > +struct ar9331_sw_port {
> > + int idx;
> > + struct ar9331_sw_priv *priv;
> > + struct delayed_work mib_read;
> > + struct ar9331_sw_stats stats;
> > +static void ar9331_stats_update(struct ar9331_sw_port *port,
> > + struct rtnl_link_stats64 *stats)
> > +{
> > + struct ar9331_sw_stats *s = &port->stats;
> > +
> > + stats->rx_packets = s->rxbroad + s->rxmulti + s->rx64byte +
> > + s->rx128byte + s->rx256byte + s->rx512byte + s->rx1024byte +
> > + s->rx1518byte + s->rxmaxbyte;
>
> Are all of these port->stats accesses always atomic? I'll need to do
> something similar in my xrs700x driver and want to make sure there
> doesn't need to be a lock between here and where they're updated in
> the delayed work.
Since these are u64, they are not atomic on 32 bit systems.
Take a look at
include/linux/u64_stats_sync.h
Andrewu
Powered by blists - more mailing lists