All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Saeed Mahameed <saeed@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:05:56 -0700	[thread overview]
Message-ID: <20210415160556.1b4f32b3@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <7e82c145335a2cdd080cf9bcb731a315ca317fb3.camel@kernel.org>

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.

  reply	other threads:[~2021-04-15 23:05 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 [this message]
2021-04-15 23:52           ` Saeed Mahameed
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=20210415160556.1b4f32b3@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=idosch@nvidia.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@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 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.