[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220208153449.wyv7xrv4kotji7mb@skbuf>
Date: Tue, 8 Feb 2022 15:34:49 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Colin Foster <colin.foster@...advantage.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Manoil <claudiu.manoil@....com>
Subject: Re: [PATCH v5 net-next 3/3] net: mscc: ocelot: use bulk reads for
stats
On Tue, Feb 08, 2022 at 05:03:03PM +0200, Vladimir Oltean wrote:
> > for (i = 0; i < ocelot->num_phys_ports; i++) {
> > + unsigned int idx = 0;
> > +
>
> This is a bug which causes ocelot->stats to be overwritten with the
> statistics of port 0, for all ports. Either move the variable
> declaration and initialization with 0 in the larger scope (outside the
> "for" loop), or initialize idx with i * ocelot->num_stats.
My analysis was slightly incorrect. Somehow I managed to fool myself
into thinking that you had tested this in a limited scenario, hence the
reason you didn't notice it's not working. But apparently you didn't
test with traffic at all.
So ocelot->stats isn't overwritten with the stats of port 0 for all
ports. But rather, all ports write into the ocelot->stats space
dedicated for port 0, effectively overwriting the stats of port 0 with
the stats of the last port. And no one populates the ocelot->stats space
for ports [1 .. last]. So no port has good statistics, I don't see a
circumstance where testing could have misled you.
Powered by blists - more mailing lists