All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Foster <colin.foster@in-advantage.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH v1 net-next 1/2] net: mscc: ocelot: remove redundant stats_layout pointers
Date: Tue, 15 Nov 2022 09:10:57 -0800	[thread overview]
Message-ID: <Y3PIIQeGD9LUs2np@colin-ia-desktop> (raw)
In-Reply-To: <20221115160839.rgyoa23yabrklpxd@skbuf>

On Tue, Nov 15, 2022 at 04:08:40PM +0000, Vladimir Oltean wrote:
> On Mon, Nov 14, 2022 at 07:43:48PM -0800, Colin Foster wrote:
> > > The issue is that not all Ocelot family switches support the MAC merge
> > > layer. Namely, only vsc9959 does.
> > > 
> > > With your removal of the ability to have a custom per-switch stats layout,
> > > the only remaining thing for vsc9959 to do is to add a "bool mm_supported"
> > > to the common struct ocelot, and all the above extra stats will only be read
> > > from the common code in ocelot_stats.c only if mm_supported is set to true.
> > > 
> > > What do you think, is this acceptable?
> > 
> > That's an interesting solution. I don't really have any strong opinions
> > on this one. I remember we'd had the discussion about making sure the
> > stats are ordered (so that bulk stat reads don't get fragmented) and that
> > wasn't an issue here. So I'm happy to go any route, either:
> 
> Oops, I completely forgot about this patch, which I promised I'd submit
> to net-next and I never did:
> https://patchwork.kernel.org/project/netdevbpf/patch/20220816135352.1431497-7-vladimir.oltean@nxp.com/#24973682
> 
> Would you mind picking it up since you're dealing with stats ATM anyway?

I'll bring that patch into v2 of this set. I plan to get that out late
this week / end.

> 
> > 
> > 1. I fix up this patch and resubmit
> 
> Honestly, I don't quite remember today what I had in mind yesterday with
> "mm_supported" - I'm not sure how that would work. I guess it involves
> creating an extra struct ocelot_stat_layout array beyond ocelot_stats_layout[],
> which would be called ocelot_mm_stats_layout[].
> 
> What you mentioned just above with the stats ordering is going to be a
> problem with this approach, because we'd need to modify ocelot_prepare_stats_regions()
> to construct the regions based on 2 distinct struct ocelot_stat_layout
> arrays, depending on whether ocelot->mm_supported is set (at least that's
> what I believe I was saying yesterday). But if we merge the arrays if
> mm_supported is set, we need to merge them in a sorted way. Complicates
> a lot of things.
> 
> > 2. I wait until the 9959 code lands, and do some tweaks for mac merge stats
> 
> Hmm, waiting for me to do something sounds like a potentially long wait.
> Why do you need to make these changes exactly? To reduce the amount of
> stuff exposed for vsc7512, right?
> 
> > 3. Maybe we deem this patch set unnecessary and drop it, since 9959 will
> > start using custom stats again.
> > 
> > 
> > Or maybe a 4th route, where ocelot->stats_layout remains in tact and
> > felix->info->stats_layout defaults to the common stats. Only the 9959
> > would have to override it?
> 
> Something like that, maybe we could have a helper that is used in
> ocelot_stats.c like this:
> 
> static const struct ocelot_stat_layout *
> ocelot_get_stats_layout(struct ocelot *ocelot)
> {
> 	if (ocelot->stats_layout)
> 		return ocelot->stats_layout;
> 
> 	return ocelot_stats_layout; // common for everyone except VSC9959
> }
> 
> and we keep exposing to the world the OCELOT_COMMON_STATS macro and
> whatever else is needed for VSC9959 to construct its own vsc9959_stats_layout.
> 
> Or..... hmm (sorry, this is a single-pass email, not gonna delete
> anything previous), maybe we could implement the helper function like
> this:
> 
> static const struct ocelot_stat_layout ocelot_stats_layout[OCELOT_NUM_STATS] = {
> 	OCELOT_COMMON_STATS,
> };
> 
> static const struct ocelot_stat_layout ocelot_mm_stats_layout[OCELOT_NUM_STATS] = {
> 	OCELOT_COMMON_STATS,
> 	OCELOT_STAT(RX_ASSEMBLY_ERRS),
> 	OCELOT_STAT(RX_SMD_ERRS),
> 	OCELOT_STAT(RX_ASSEMBLY_OK),
> 	OCELOT_STAT(RX_MERGE_FRAGMENTS),
> 	OCELOT_STAT(TX_MERGE_FRAGMENTS),
> 	OCELOT_STAT(RX_PMAC_OCTETS),
> 	OCELOT_STAT(RX_PMAC_UNICAST),
> 	OCELOT_STAT(RX_PMAC_MULTICAST),
> 	OCELOT_STAT(RX_PMAC_BROADCAST),
> 	OCELOT_STAT(RX_PMAC_SHORTS),
> 	OCELOT_STAT(RX_PMAC_FRAGMENTS),
> 	OCELOT_STAT(RX_PMAC_JABBERS),
> 	OCELOT_STAT(RX_PMAC_CRC_ALIGN_ERRS),
> 	OCELOT_STAT(RX_PMAC_SYM_ERRS),
> 	OCELOT_STAT(RX_PMAC_64),
> 	OCELOT_STAT(RX_PMAC_65_127),
> 	OCELOT_STAT(RX_PMAC_128_255),
> 	OCELOT_STAT(RX_PMAC_256_511),
> 	OCELOT_STAT(RX_PMAC_512_1023),
> 	OCELOT_STAT(RX_PMAC_1024_1526),
> 	OCELOT_STAT(RX_PMAC_1527_MAX),
> 	OCELOT_STAT(RX_PMAC_PAUSE),
> 	OCELOT_STAT(RX_PMAC_CONTROL),
> 	OCELOT_STAT(RX_PMAC_LONGS),
> 	OCELOT_STAT(TX_PMAC_OCTETS),
> 	OCELOT_STAT(TX_PMAC_UNICAST),
> 	OCELOT_STAT(TX_PMAC_MULTICAST),
> 	OCELOT_STAT(TX_PMAC_BROADCAST),
> 	OCELOT_STAT(TX_PMAC_PAUSE),
> 	OCELOT_STAT(TX_PMAC_64),
> 	OCELOT_STAT(TX_PMAC_65_127),
> 	OCELOT_STAT(TX_PMAC_128_255),
> 	OCELOT_STAT(TX_PMAC_256_511),
> 	OCELOT_STAT(TX_PMAC_512_1023),
> 	OCELOT_STAT(TX_PMAC_1024_1526),
> 	OCELOT_STAT(TX_PMAC_1527_MAX),
> };
> 
> static const struct ocelot_stat_layout *
> ocelot_get_stats_layout(struct ocelot *ocelot)
> {
> 	if (ocelot->mm_supported)
> 		return ocelot_mm_stats_layout; // common + MM stats
> 
> 	return ocelot_stats_layout; // just common stats
> }
> 
> Then, setting mm_supported = true from vsc9959 would be enough, no need
> to provide its own stats layout, no need to sort/merge anything.
> 
> How does this sound?

That should work. If there end up being 10 different struct
ocelot_stat_layout[]s, we might reconsider... but in the foreseeable
future there will only be two.

So this applies to patch 2 of my set, which means I'll pretty much keep
it as-is. The get_stats_layout and the ocelot_mm_stats_layout can be
added when the 9959 stuff gets applied.

Thanks for the feedback / suggestions as always!

  reply	other threads:[~2022-11-15 17:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 20:49 [PATCH v1 net-next 0/2] cleanup ocelot_stats exposure Colin Foster
2022-11-11 20:49 ` [PATCH v1 net-next 1/2] net: mscc: ocelot: remove redundant stats_layout pointers Colin Foster
2022-11-12  1:08   ` kernel test robot
2022-11-12 18:05   ` Colin Foster
2022-11-14 15:15   ` Vladimir Oltean
2022-11-15  3:43     ` Colin Foster
2022-11-15 16:08       ` Vladimir Oltean
2022-11-15 17:10         ` Colin Foster [this message]
2022-11-15 17:39           ` Vladimir Oltean
2022-11-11 20:49 ` [PATCH v1 net-next 2/2] net: mscc: ocelot: remove unnecessary exposure of stats structures Colin Foster
2022-11-12 10:34   ` kernel test robot
2022-11-14 15:19   ` Vladimir Oltean
2022-11-15  3:47     ` Colin Foster

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=Y3PIIQeGD9LUs2np@colin-ia-desktop \
    --to=colin.foster@in-advantage.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.