[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220817130531.5zludhgmobkdjc32@skbuf>
Date: Wed, 17 Aug 2022 13:05:32 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Colin Foster <colin.foster@...advantage.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxim Kochetkov <fido_max@...ox.ru>
Subject: Re: [PATCH net 6/8] net: mscc: ocelot: make struct ocelot_stat_layout
array indexable
On Wed, Aug 17, 2022 at 02:06:44PM +0300, Vladimir Oltean wrote:
> I think in practice this means that ocelot_prepare_stats_regions() would
> need to be modified to first sort the ocelot_stat_layout array by "reg"
> value (to keep bulking efficient), and then, I think I'd have to keep to
> introduce another array of u32 *ocelot->stat_indices (to keep specific
> indexing possible). Then I'd have to go through one extra layer of
> indirection; RX_OCTETS would be available at
>
> ocelot->stats[port * OCELOT_NUM_STATS + ocelot->stat_indices[OCELOT_STAT_RX_OCTETS]].
>
> (I can wrap this behind a helper, of course)
>
> This is a bit complicated, but I'm not aware of something simpler that
> would do what you want and what I want. What are your thoughts?
Or simpler, we can keep enum ocelot_stat sorted in ascending order of
the associated SYS_COUNT_* register addresses. That should be very much
possible, we just need to add a comment to watch out for that. Between
switch revisions, the counter relative ordering won't differ. It's just
that RX and TX counters have a larger space between each other.
Powered by blists - more mailing lists