From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Colin Foster <colin.foster@in-advantage.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>
Subject: Re: [PATCH v5 net-next 3/3] net: mscc: ocelot: use bulk reads for stats
Date: Tue, 8 Feb 2022 15:34:49 +0000 [thread overview]
Message-ID: <20220208153449.wyv7xrv4kotji7mb@skbuf> (raw)
In-Reply-To: <20220208150303.afoabx742j4ijry7@skbuf>
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.
next prev parent reply other threads:[~2022-02-08 15:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 4:46 [PATCH v5 net-next 0/3] use bulk reads for ocelot statistics Colin Foster
2022-02-08 4:46 ` [PATCH v5 net-next 1/3] net: ocelot: align macros for consistency Colin Foster
2022-02-08 13:06 ` Vladimir Oltean
2022-02-08 4:46 ` [PATCH v5 net-next 2/3] net: mscc: ocelot: add ability to perform bulk reads Colin Foster
2022-02-08 13:07 ` Vladimir Oltean
2022-02-08 4:46 ` [PATCH v5 net-next 3/3] net: mscc: ocelot: use bulk reads for stats Colin Foster
2022-02-08 13:18 ` Vladimir Oltean
2022-02-08 15:03 ` Vladimir Oltean
2022-02-08 15:34 ` Vladimir Oltean [this message]
2022-02-08 16:07 ` Colin Foster
2022-02-08 16:10 ` Vladimir Oltean
2022-02-08 15:41 ` Colin Foster
2022-02-08 15:45 ` Vladimir Oltean
2022-02-08 16:49 ` Colin Foster
2022-02-08 17:02 ` Vladimir Oltean
2022-02-08 13:30 ` [PATCH v5 net-next 0/3] use bulk reads for ocelot statistics Vladimir Oltean
2022-02-08 13:55 ` Colin Foster
2022-02-08 14:53 ` Vladimir Oltean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220208153449.wyv7xrv4kotji7mb@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.manoil@nxp.com \
--cc=colin.foster@in-advantage.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox