netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kubecek <mkubecek@suse.cz>
To: netdev@vger.kernel.org
Cc: Vivien Didelot <vivien.didelot@gmail.com>,
	f.fainelli@gmail.com, andrew@lunn.ch, davem@davemloft.net,
	linville@redhat.com, cphealy@gmail.com
Subject: Re: [PATCH ethtool] ethtool: dump nested registers
Date: Tue, 6 Aug 2019 07:20:02 +0200	[thread overview]
Message-ID: <20190806052002.GD31971@unicorn.suse.cz> (raw)
In-Reply-To: <20190805105216.GB31482@t480s.localdomain>

On Mon, Aug 05, 2019 at 10:52:16AM -0400, Vivien Didelot wrote:
> Hi Michal!
> 
> On Mon, 5 Aug 2019 10:04:48 +0200, Michal Kubecek <mkubecek@suse.cz> wrote:
> > On Fri, Aug 02, 2019 at 03:34:54PM -0400, Vivien Didelot wrote:
> > > Usually kernel drivers set the regs->len value to the same length as
> > > info->regdump_len, which was used for the allocation. In case where
> > > regs->len is smaller than the allocated info->regdump_len length,
> > > we may assume that the dump contains a nested set of registers.
> > > 
> > > This becomes handy for kernel drivers to expose registers of an
> > > underlying network conduit unfortunately not exposed to userspace,
> > > as found in network switching equipment for example.
> > > 
> > > This patch adds support for recursing into the dump operation if there
> > > is enough room for a nested ethtool_drvinfo structure containing a
> > > valid driver name, followed by a ethtool_regs structure like this:
> > > 
> > >     0      regs->len                        info->regdump_len
> > >     v              v                                        v
> > >     +--------------+-----------------+--------------+-- - --+
> > >     | ethtool_regs | ethtool_drvinfo | ethtool_regs |       |
> > >     +--------------+-----------------+--------------+-- - --+
> > > 
> > > Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
> > > ---
> > 
> > I'm not sure about this approach. If these additional objects with their
> > own registers are represented by a network device, we can query their
> > registers directly. If they are not (which, IIUC, is the case in your
> > use case), we should use an appropriate interface. AFAIK the CPU ports
> > are already represented in devlink, shouldn't devlink be also used to
> > query their registers?
> 
> Yet another interface wasn't that much appropriate for DSA, making the
> stack unnecessarily complex.

AFAICS, there is already devlink support in dsa and CPU ports are
presented as devlink ports. So it wouldn't be a completely new
interface.

> In fact we are already glueing the statistics of the CPU port into the
> master's ethtool ops (both physical ports are wired together).

The ethtool statistics (in general) are one big mess, I don't think it's
an example worth following; rather one showing us what to avoid.

> Adding support for nested registers dump in ethtool makes it simple to
> (pretty) dump CPU port's registers without too much userspace
> addition.

It is indeed convenient for pretty print - but very hard to use for any
automated processing. My point is that CPU port is not represented by
a network device but it is already represented by a devlink port so that
it makes much more sense to tie its register dump to that object than to
add add it to register dump of port's master.

In the future, I would like to transform the ethtool register dump from
current opaque block of data to an actual dump of registers. It is
unfortunate that drivers are already mixing information specific to
a network device with information common for the whole physical device.
Adding more data which is actually related to a different object would
only make things worse.

Michal Kubecek

  reply	other threads:[~2019-08-06  5:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 19:34 [PATCH ethtool] ethtool: dump nested registers Vivien Didelot
2019-08-02 19:34 ` [PATCH net-next] net: dsa: dump CPU port regs through master Vivien Didelot
2019-08-06 21:08   ` David Miller
2019-08-05  8:04 ` [PATCH ethtool] ethtool: dump nested registers Michal Kubecek
2019-08-05 14:52   ` Vivien Didelot
2019-08-06  5:20     ` Michal Kubecek [this message]
2019-08-06 17:24       ` Vivien Didelot
2019-08-07  6:34       ` Jiri Pirko
2019-08-09 16:23 ` John W. Linville
2019-08-09 17:21   ` Michal Kubecek

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=20190806052002.GD31971@unicorn.suse.cz \
    --to=mkubecek@suse.cz \
    --cc=andrew@lunn.ch \
    --cc=cphealy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linville@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.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 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).