netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, andrew@lunn.ch,
	mkubecek@suse.cz, idosch@nvidia.com
Subject: Re: [RFC net-next 4/6] ethtool: add interface to read standard MAC stats
Date: Thu, 15 Apr 2021 16:52:44 -0700	[thread overview]
Message-ID: <27df679a1307131b8f515435f0991f185d72c4fa.camel@kernel.org> (raw)
In-Reply-To: <20210415160556.1b4f32b3@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On Thu, 2021-04-15 at 16:05 -0700, Jakub Kicinski wrote:
> On Thu, 15 Apr 2021 15:46:52 -0700 Saeed Mahameed wrote:
> > > > best practice here is to centralize all the data structures and
> > > > information definitions in one place, you define the stat id,
> > > > string,
> > > > and value offset, then a generic loop can generate the strset
> > > > and
> > > > fill
> > > > up values in the correct offset.
> > > > 
> > > > similar implementation is already in mlx5:
> > > > 
> > > > see pport_802_3_stats_desc:
> > > >   
> > > > https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c#L682
> > > > 
> > > > the "pport_802_3_stats_desc" has a description of the strings
> > > > and
> > > > offsets of all stats in this stats group
> > > > and the fill/put functions are very simple and they just
> > > > iterate
> > > > over
> > > > the array/group and fill up according to the descriptor.  
> > > 
> > > We can maybe save 60 lines if we generate stats_eth_mac_names 
> > > in a initcall, is it really worth it? I prefer the readability 
> > > / grepability.  
> > 
> > I don't think readability will be an issue if the infrastructure is
> > generic enough.. 
> > 
> > This just a preference, of course you can go with the current code.
> > My point is that someone doesn't need to change multiple places and
> > possibly files every time they need to expose a new stat, you just
> > update some central database of the new data you want to expose.
> 
> Understood, I've written those table-based generators for ethtool
> stats
> in the drivers in the past as well, but here we can only generate the
> dumping and the names. We'll need to manually fill in defines/enums
> in
> uAPI, struct members and the generator table. I'd rather stick to
> real struct members in the core<->driver API than indexing an array
> with an enums. So the savings are 4 places => 3 places?
> 
> Unless I'm missing some clever, yet robust and readable ways of
> coding
> this up..
> 
> Can we leave as is as starting point and see where we go from here?
> So far MAC stats are the only sizable ones were we'd see noticeable
> gain.

Sure ! if we see it is exploding with stats and long if conditions, we
can reconsider :) .. 




  reply	other threads:[~2021-04-15 23:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 20:23 [RFC net-next 0/6] ethtool: add uAPI for reading standard stats Jakub Kicinski
2021-04-14 20:23 ` [RFC net-next 1/6] docs: networking: extend the statistics documentation Jakub Kicinski
2021-04-14 20:23 ` [RFC net-next 2/6] docs: ethtool: document standard statistics Jakub Kicinski
2021-04-14 20:23 ` [RFC net-next 3/6] ethtool: add a new command for reading standard stats Jakub Kicinski
2021-04-14 20:23 ` [RFC net-next 4/6] ethtool: add interface to read standard MAC stats Jakub Kicinski
2021-04-15  6:12   ` Saeed Mahameed
2021-04-15 15:38     ` Jakub Kicinski
2021-04-15 22:46       ` Saeed Mahameed
2021-04-15 23:05         ` Jakub Kicinski
2021-04-15 23:52           ` Saeed Mahameed [this message]
2021-04-14 20:23 ` [RFC net-next 5/6] ethtool: add interface to read standard MAC Ctrl stats Jakub Kicinski
2021-04-14 20:23 ` [RFC net-next 6/6] ethtool: add interface to read RMON stats Jakub Kicinski
2021-04-15  5:51 ` [RFC net-next 0/6] ethtool: add uAPI for reading standard stats Saeed Mahameed
2021-04-15 15:45   ` Jakub Kicinski

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=27df679a1307131b8f515435f0991f185d72c4fa.camel@kernel.org \
    --to=saeed@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mkubecek@suse.cz \
    --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;
as well as URLs for NNTP newsgroup(s).