From: Ido Schimmel <idosch@nvidia.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: netdev@vger.kernel.org, Petr Machata <petrm@nvidia.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: mellanox: use ethtool string helpers
Date: Wed, 30 Oct 2024 15:28:38 +0200 [thread overview]
Message-ID: <ZyI0htf7Q9ocD6Oc@shredder.mtl.com> (raw)
In-Reply-To: <20241029235422.101202-1-rosenp@gmail.com>
Wasn't able to apply the patch. Seems to be corrupted. See below.
On Tue, Oct 29, 2024 at 04:54:22PM -0700, Rosen Penev wrote:
[...]
> static void mlxsw_sp_port_get_strings(struct net_device *dev,
> u32 stringset, u8 *data)
> {
> struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
> - u8 *p = data;
> int i;
>
> - switch (stringset) {
> - case ETH_SS_STATS:
> - for (i = 0; i < MLXSW_SP_PORT_HW_STATS_LEN; i++) {
> - memcpy(p, mlxsw_sp_port_hw_stats[i].str,
> - ETH_GSTRING_LEN);
> - p += ETH_GSTRING_LEN;
> - }
> + if (stringset != ETH_SS_STATS)
> + return;
>
> - for (i = 0; i < MLXSW_SP_PORT_HW_RFC_2863_STATS_LEN; i++) {
> - memcpy(p, mlxsw_sp_port_hw_rfc_2863_stats[i].str,
> - ETH_GSTRING_LEN);
> - p += ETH_GSTRING_LEN;
> - }
> + for (i = 0; i < MLXSW_SP_PORT_HW_STATS_LEN; i++)
> + ethtool_puts(&data, mlxsw_sp_port_hw_stats[i].str);
>
> - for (i = 0; i < MLXSW_SP_PORT_HW_RFC_2819_STATS_LEN; i++) {
> - memcpy(p, mlxsw_sp_port_hw_rfc_2819_stats[i].str,
> - ETH_GSTRING_LEN);
> - p += ETH_GSTRING_LEN;
> - }
> + for (i = 0; i < MLXSW_SP_PORT_HW_RFC_2863_STATS_LEN; i++)
> + ethtool_puts(&data, mlxsw_sp_port_hw_rfc_2863_stats[i].str);
>
> - for (i = 0; i < MLXSW_SP_PORT_HW_RFC_3635_STATS_LEN; i++) {
> - memcpy(p, mlxsw_sp_port_hw_rfc_3635_stats[i].str,
> - ETH_GSTRING_LEN);
> - p += ETH_GSTRING_LEN;
> - }
> + for (i = 0; i < MLXSW_SP_PORT_HW_RFC_2819_STATS_LEN; i++)
> + ethtool_puts(&data, mlxsw_sp_port_hw_rfc_2819_stats[i].str);
>
> - for (i = 0; i < MLXSW_SP_PORT_HW_EXT_STATS_LEN; i++) {
> - memcpy(p, mlxsw_sp_port_hw_ext_stats[i].str,
> - ETH_GSTRING_LEN);
> - p += ETH_GSTRING_LEN;
> - }
> + for (i = 0; i < MLXSW_SP_PORT_HW_RFC_3635_STATS_LEN; i++)
> + ethtool_puts(&data, mlxsw_sp_port_hw_rfc_3635_stats[i].str);
>
> - for (i = 0; i < MLXSW_SP_PORT_HW_DISCARD_STATS_LEN; i++) {
> - memcpy(p, mlxsw_sp_port_hw_discard_stats[i].str,
> - ETH_GSTRING_LEN);
> - p += ETH_GSTRING_LEN;
> - }
> + for (i = 0; i < MLXSW_SP_PORT_HW_EXT_STATS_LEN; i++)
> + ethtool_puts(&data, mlxsw_sp_port_hw_ext_stats[i].str);
>
> - for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
> - mlxsw_sp_port_get_prio_strings(&data, i);
s/data/p/ in current code
> + for (i = 0; i < MLXSW_SP_PORT_HW_DISCARD_STATS_LEN; i++)
> + ethtool_puts(&data, mlxsw_sp_port_hw_discard_stats[i].str);
>
> - for (i = 0; i < TC_MAX_QUEUE; i++)
> - mlxsw_sp_port_get_tc_strings(&data, i);
Likewise
> + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
> + mlxsw_sp_port_get_prio_strings(&data, i);
>
> - mlxsw_sp_port->mlxsw_sp->ptp_ops->get_stats_strings(&data);
Likewise
> + for (i = 0; i < TC_MAX_QUEUE; i++)
> + mlxsw_sp_port_get_tc_strings(&data, i);
>
> - for (i = 0; i < MLXSW_SP_PORT_HW_TRANSCEIVER_STATS_LEN; i++) {
> - memcpy(p, mlxsw_sp_port_transceiver_stats[i].str,
> - ETH_GSTRING_LEN);
> - p += ETH_GSTRING_LEN;
> - }
> - break;
> - }
> + mlxsw_sp_port->mlxsw_sp->ptp_ops->get_stats_strings(&data);
> +
> + for (i = 0; i < MLXSW_SP_PORT_HW_TRANSCEIVER_STATS_LEN; i++)
> + ethtool_puts(&data, mlxsw_sp_port_transceiver_stats[i].str);
> }
prev parent reply other threads:[~2024-10-30 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 23:54 Rosen Penev
2024-10-30 13:28 ` Ido Schimmel [this message]
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=ZyI0htf7Q9ocD6Oc@shredder.mtl.com \
--to=idosch@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=richardcochran@gmail.com \
--cc=rosenp@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
all inboxes | Powered by JetHome®