From: Rosen Penev <rosenp@gmail.com>
To: netdev@vger.kernel.org
Cc: vburru@marvell.com, sedara@marvell.com, srasheed@marvell.com,
sburla@marvell.com, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH net-next] net: octeon_ep_vf: use ethtool_sprintf/puts
Date: Thu, 8 Aug 2024 21:47:27 -0700 [thread overview]
Message-ID: <20240809044738.4347-1-rosenp@gmail.com> (raw)
Simplifies the function and avoids manual pointer manipulation.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
.../marvell/octeon_ep_vf/octep_vf_ethtool.c | 36 ++++++++-----------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_ethtool.c b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_ethtool.c
index a1979b45e355..c7622159d195 100644
--- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_ethtool.c
@@ -58,32 +58,24 @@ static void octep_vf_get_strings(struct net_device *netdev,
{
struct octep_vf_device *oct = netdev_priv(netdev);
u16 num_queues = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
- char *strings = (char *)data;
int i, j;
switch (stringset) {
case ETH_SS_STATS:
- for (i = 0; i < OCTEP_VF_GLOBAL_STATS_CNT; i++) {
- snprintf(strings, ETH_GSTRING_LEN,
- octep_vf_gstrings_global_stats[i]);
- strings += ETH_GSTRING_LEN;
- }
-
- for (i = 0; i < num_queues; i++) {
- for (j = 0; j < OCTEP_VF_TX_Q_STATS_CNT; j++) {
- snprintf(strings, ETH_GSTRING_LEN,
- octep_vf_gstrings_tx_q_stats[j], i);
- strings += ETH_GSTRING_LEN;
- }
- }
-
- for (i = 0; i < num_queues; i++) {
- for (j = 0; j < OCTEP_VF_RX_Q_STATS_CNT; j++) {
- snprintf(strings, ETH_GSTRING_LEN,
- octep_vf_gstrings_rx_q_stats[j], i);
- strings += ETH_GSTRING_LEN;
- }
- }
+ for (i = 0; i < OCTEP_VF_GLOBAL_STATS_CNT; i++)
+ ethtool_puts(&data, octep_vf_gstrings_global_stats[i]);
+
+ for (i = 0; i < num_queues; i++)
+ for (j = 0; j < OCTEP_VF_TX_Q_STATS_CNT; j++)
+ ethtool_sprintf(&data,
+ octep_vf_gstrings_tx_q_stats[j],
+ i);
+
+ for (i = 0; i < num_queues; i++)
+ for (j = 0; j < OCTEP_VF_RX_Q_STATS_CNT; j++)
+ ethtool_sprintf(&data,
+ octep_vf_gstrings_rx_q_stats[j],
+ i);
break;
default:
break;
--
2.46.0
next reply other threads:[~2024-08-09 4:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 4:47 Rosen Penev [this message]
2024-08-12 12:42 ` [PATCH net-next] net: octeon_ep_vf: use ethtool_sprintf/puts Simon Horman
2024-08-12 17:04 ` Rosen Penev
2024-08-12 21:03 ` Andrew Lunn
2024-08-13 7:54 ` Simon Horman
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=20240809044738.4347-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--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=sburla@marvell.com \
--cc=sedara@marvell.com \
--cc=srasheed@marvell.com \
--cc=vburru@marvell.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