From: Vladimir Oltean <olteanv@gmail.com>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch,
f.fainelli@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/4] net: dsa: mv88e6xxx: Create API to read a single stat counter
Date: Mon, 4 Dec 2023 18:18:23 +0200 [thread overview]
Message-ID: <20231204161823.eyac4mwjakizygmz@skbuf> (raw)
In-Reply-To: <20231201125812.1052078-2-tobias@waldekranz.com> <20231201125812.1052078-2-tobias@waldekranz.com>
On Fri, Dec 01, 2023 at 01:58:09PM +0100, Tobias Waldekranz wrote:
> This change contains no functional change. We simply push the hardware
> specific stats logic to a function reading a single counter, rather
> than the whole set.
>
> This is a preparatory change for the upcoming standard ethtool
> statistics support (i.e. "eth-mac", "eth-ctrl" etc.).
>
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---
I think I like this patch set. Some nitpicks below.
> -static int mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port,
> - uint64_t *data)
> +static int mv88e6xxx_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
> + const struct mv88e6xxx_hw_stat *stat,
> + uint64_t *data)
> {
> - return mv88e6xxx_stats_get_stats(chip, port, data,
> - STATS_TYPE_BANK0 | STATS_TYPE_BANK1,
> - MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9,
> - MV88E6XXX_G1_STATS_OP_HIST_RX_TX);
> + int ret = 0;
> +
> + if (chip->info->ops->stats_get_stat) {
> + mv88e6xxx_reg_lock(chip);
> + ret = chip->info->ops->stats_get_stat(chip, port, stat, data);
> + mv88e6xxx_reg_unlock(chip);
> + }
There is no chip->info->ops which does not provide stats_get_stat().
As a separate change, I suppose you could drop the "if".
> +
> + return ret;
> }
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
> index 44383a03ef2f..b0dfbcae0be9 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.h
> +++ b/drivers/net/dsa/mv88e6xxx/chip.h
> @@ -574,8 +585,9 @@ struct mv88e6xxx_ops {
> /* Return the number of strings describing statistics */
> int (*stats_get_sset_count)(struct mv88e6xxx_chip *chip);
> int (*stats_get_strings)(struct mv88e6xxx_chip *chip, uint8_t *data);
> - int (*stats_get_stats)(struct mv88e6xxx_chip *chip, int port,
> - uint64_t *data);
> + int (*stats_get_stat)(struct mv88e6xxx_chip *chip, int port,
> + const struct mv88e6xxx_hw_stat *stat,
> + uint64_t *data);
Since you are touching this function prototype anyway, I guess you could
change its return type. Int assumes it can also return a negative error
code, which it doesn't. Maybe size_t to denote that it returns an unsigned
count of statistics?
Also, there is an extraneous space before the "int port" argument which
you could fix up now.
> int (*set_cpu_port)(struct mv88e6xxx_chip *chip, int port);
> int (*set_egress_port)(struct mv88e6xxx_chip *chip,
> enum mv88e6xxx_egress_direction direction,
next prev parent reply other threads:[~2023-12-04 16:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 12:58 [PATCH net-next 0/4] net: dsa: mv88e6xxx: Add "eth-mac" and "rmon" counter group support Tobias Waldekranz
2023-12-01 12:58 ` [PATCH net-next 1/4] net: dsa: mv88e6xxx: Create API to read a single stat counter Tobias Waldekranz
2023-12-04 16:18 ` Vladimir Oltean [this message]
2023-12-01 12:58 ` [PATCH net-next 2/4] net: dsa: mv88e6xxx: Give each hw stat an ID Tobias Waldekranz
2023-12-04 16:20 ` Vladimir Oltean
2023-12-01 12:58 ` [PATCH net-next 3/4] net: dsa: mv88e6xxx: Add "eth-mac" counter group support Tobias Waldekranz
2023-12-04 16:34 ` Vladimir Oltean
2023-12-01 12:58 ` [PATCH net-next 4/4] net: dsa: mv88e6xxx: Add "rmon" " Tobias Waldekranz
2023-12-04 16:48 ` [PATCH net-next 0/4] net: dsa: mv88e6xxx: Add "eth-mac" and " Vladimir Oltean
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=20231204161823.eyac4mwjakizygmz@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tobias@waldekranz.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