Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1712323

RE: [PATCH net-next 06/11] net: dsa: debugfs: add port registers

From <Woojung.Huh@microchip.com>
Newsgroups linux.kernel
Subject RE: [PATCH net-next 06/11] net: dsa: debugfs: add port registers
Date 2017-08-15 18:30 +0200
Message-ID <ueMT9-3Ar-39@gated-at.bofh.it> (permalink)
References <uew1Y-1pG-9@gated-at.bofh.it> <uewbD-1sJ-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Vivien,

> Subject: [PATCH net-next 06/11] net: dsa: debugfs: add port registers
> 
> Add a debug filesystem "regs" entry to query a port's hardware registers
> through the .get_regs_len and .get_regs_len switch operations.
> 
> This is very convenient because it allows one to dump the registers of
> DSA links, which are not exposed to userspace.
This series will be very useful to get various debug information.
Do you have any plan to expand 32bit register access and switch-level registers
In addition to port-level registers?

> +static void dsa_debugfs_regs_read_count(struct dsa_switch *ds, int id,
> +					struct seq_file *seq, int count)
> +{
> +	u16 data[count * ETH_GSTRING_LEN];
I think this should be u16 data[count] because it is value of registers.

> +	struct ethtool_regs regs;
> +	int i;
> +
> +	ds->ops->get_regs(ds, id, &regs, data);
> +
> +	for (i = 0; i < count / 2; i++)
> +		seq_printf(seq, "%2d: %04x\n", i, data[i]);
> +}
> +
> +static int dsa_debugfs_regs_read(struct dsa_switch *ds, int id,
> +				 struct seq_file *seq)
> +{
> +	int count;
> +
> +	if (!ds->ops->get_regs_len || !ds->ops->get_regs)
> +		return -EOPNOTSUPP;
> +
> +	count = ds->ops->get_regs_len(ds, id);
> +	if (count < 0)
> +		return count;
Because get_regs_len returns length than count per mv88e6xxx/chip.c,
it requires some math before passing to dsa_debugfs_regs_read_count().

It does "count/2" in dsa-debugfs_regs_read_count(), however,
As commented above, "count" is used at "u16 data[...]".
So, it would be nice to match with name. Ie, count or size/length.

Thanks.
Woojung

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 00/11] net: dsa: add generic debugfs interface Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:30 +0200
  [PATCH net-next 09/11] net: dsa: debugfs: add port mdb Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:30 +0200
    Re: [PATCH net-next 09/11] net: dsa: debugfs: add port mdb Andrew Lunn <andrew@lunn.ch> - 2017-08-15 01:00 +0200
    Re: [PATCH net-next 09/11] net: dsa: debugfs: add port mdb Florian Fainelli <f.fainelli@gmail.com> - 2017-08-15 19:40 +0200
  [PATCH net-next 01/11] net: dsa: legacy: assign dst->applied Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:30 +0200
    Re: [PATCH net-next 01/11] net: dsa: legacy: assign dst->applied Andrew Lunn <andrew@lunn.ch> - 2017-08-15 01:00 +0200
  [PATCH net-next 08/11] net: dsa: restore mdb dump Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:30 +0200
    Re: [PATCH net-next 08/11] net: dsa: restore mdb dump Andrew Lunn <andrew@lunn.ch> - 2017-08-15 00:50 +0200
    Re: [PATCH net-next 08/11] net: dsa: restore mdb dump Florian Fainelli <f.fainelli@gmail.com> - 2017-08-15 19:40 +0200
  [PATCH net-next 07/11] net: dsa: debugfs: add port fdb Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:40 +0200
    Re: [PATCH net-next 07/11] net: dsa: debugfs: add port fdb Andrew Lunn <andrew@lunn.ch> - 2017-08-15 00:50 +0200
    Re: [PATCH net-next 07/11] net: dsa: debugfs: add port fdb Florian Fainelli <f.fainelli@gmail.com> - 2017-08-15 19:40 +0200
  [PATCH net-next 06/11] net: dsa: debugfs: add port registers Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:40 +0200
    Re: [PATCH net-next 06/11] net: dsa: debugfs: add port registers Andrew Lunn <andrew@lunn.ch> - 2017-08-15 00:50 +0200
    RE: [PATCH net-next 06/11] net: dsa: debugfs: add port registers <Woojung.Huh@microchip.com> - 2017-08-15 18:30 +0200
    Re: [PATCH net-next 06/11] net: dsa: debugfs: add port registers Florian Fainelli <f.fainelli@gmail.com> - 2017-08-15 19:40 +0200
  [PATCH net-next 05/11] net: dsa: debugfs: add port stats Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:40 +0200
    Re: [PATCH net-next 05/11] net: dsa: debugfs: add port stats Andrew Lunn <andrew@lunn.ch> - 2017-08-15 00:50 +0200
    Re: [PATCH net-next 05/11] net: dsa: debugfs: add port stats Florian Fainelli <f.fainelli@gmail.com> - 2017-08-15 19:40 +0200
  [PATCH net-next 02/11] net: dsa: add debugfs interface Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-08-15 00:40 +0200
    Re: [PATCH net-next 02/11] net: dsa: add debugfs interface Florian Fainelli <f.fainelli@gmail.com> - 2017-08-15 19:30 +0200
  Re: [PATCH net-next 00/11] net: dsa: add generic debugfs interface Florian Fainelli <f.fainelli@gmail.com> - 2017-08-19 00:00 +0200

csiph-web