[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZyI0htf7Q9ocD6Oc@shredder.mtl.com>
Date: Wed, 30 Oct 2024 15:28:38 +0200
From: Ido Schimmel <idosch@...dia.com>
To: Rosen Penev <rosenp@...il.com>
Cc: netdev@...r.kernel.org, Petr Machata <petrm@...dia.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Richard Cochran <richardcochran@...il.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net: mellanox: use ethtool string helpers
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);
> }
Powered by blists - more mailing lists