* [PATCH net-next] ibmvnic: use ethtool string helpers
@ 2024-10-22 20:32 Rosen Penev
2024-10-23 18:58 ` Nick Child
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rosen Penev @ 2024-10-22 20:32 UTC (permalink / raw)
To: netdev
Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Madhavan Srinivasan, Haren Myneni, Rick Lindsley, Nick Child,
Thomas Falcon, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni,
open list:LINUX FOR POWERPC (32-BIT AND 64-BIT), open list
They are the prefered way to copy ethtool strings.
Avoids manually incrementing the data pointer.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 30 +++++++++---------------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index cca2ed6ad289..e95ae0d39948 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3808,32 +3808,20 @@ static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
if (stringset != ETH_SS_STATS)
return;
- for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++, data += ETH_GSTRING_LEN)
- memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN);
+ for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++)
+ ethtool_puts(&data, ibmvnic_stats[i].name);
for (i = 0; i < adapter->req_tx_queues; i++) {
- snprintf(data, ETH_GSTRING_LEN, "tx%d_batched_packets", i);
- data += ETH_GSTRING_LEN;
-
- snprintf(data, ETH_GSTRING_LEN, "tx%d_direct_packets", i);
- data += ETH_GSTRING_LEN;
-
- snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i);
- data += ETH_GSTRING_LEN;
-
- snprintf(data, ETH_GSTRING_LEN, "tx%d_dropped_packets", i);
- data += ETH_GSTRING_LEN;
+ ethtool_sprintf(&data, "tx%d_batched_packets", i);
+ ethtool_sprintf(&data, "tx%d_direct_packets", i);
+ ethtool_sprintf(&data, "tx%d_bytes", i);
+ ethtool_sprintf(&data, "tx%d_dropped_packets", i);
}
for (i = 0; i < adapter->req_rx_queues; i++) {
- snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i);
- data += ETH_GSTRING_LEN;
-
- snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i);
- data += ETH_GSTRING_LEN;
-
- snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i);
- data += ETH_GSTRING_LEN;
+ ethtool_sprintf(&data, "rx%d_packets", i);
+ ethtool_sprintf(&data, "rx%d_bytes", i);
+ ethtool_sprintf(&data, "rx%d_interrupts", i);
}
}
--
2.47.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next] ibmvnic: use ethtool string helpers
2024-10-22 20:32 [PATCH net-next] ibmvnic: use ethtool string helpers Rosen Penev
@ 2024-10-23 18:58 ` Nick Child
2024-10-24 15:13 ` Simon Horman
2024-10-29 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Nick Child @ 2024-10-23 18:58 UTC (permalink / raw)
To: Rosen Penev, netdev
Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Madhavan Srinivasan, Haren Myneni, Rick Lindsley, Thomas Falcon,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, open list:LINUX FOR POWERPC (32-BIT AND 64-BIT),
open list
On 10/22/24 15:32, Rosen Penev wrote:
> They are the prefered way to copy ethtool strings.
>
> Avoids manually incrementing the data pointer.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/net/ethernet/ibm/ibmvnic.c | 30 +++++++++---------------------
> 1 file changed, 9 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index cca2ed6ad289..e95ae0d39948 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -3808,32 +3808,20 @@ static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
> if (stringset != ETH_SS_STATS)
> return;
>
> - for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++, data += ETH_GSTRING_LEN)
> - memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN);
> + for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++)
> + ethtool_puts(&data, ibmvnic_stats[i].name);
>
> for (i = 0; i < adapter->req_tx_queues; i++) {
> - snprintf(data, ETH_GSTRING_LEN, "tx%d_batched_packets", i);
> - data += ETH_GSTRING_LEN;
> -
> - snprintf(data, ETH_GSTRING_LEN, "tx%d_direct_packets", i);
> - data += ETH_GSTRING_LEN;
> -
> - snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i);
> - data += ETH_GSTRING_LEN;
> -
> - snprintf(data, ETH_GSTRING_LEN, "tx%d_dropped_packets", i);
> - data += ETH_GSTRING_LEN;
> + ethtool_sprintf(&data, "tx%d_batched_packets", i);
> + ethtool_sprintf(&data, "tx%d_direct_packets", i);
> + ethtool_sprintf(&data, "tx%d_bytes", i);
> + ethtool_sprintf(&data, "tx%d_dropped_packets", i);
> }
>
> for (i = 0; i < adapter->req_rx_queues; i++) {
> - snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i);
> - data += ETH_GSTRING_LEN;
> -
> - snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i);
> - data += ETH_GSTRING_LEN;
> -
> - snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i);
> - data += ETH_GSTRING_LEN;
> + ethtool_sprintf(&data, "rx%d_packets", i);
> + ethtool_sprintf(&data, "rx%d_bytes", i);
> + ethtool_sprintf(&data, "rx%d_interrupts", i);
> }
> }
>
Tested-by: Nick Child <nnac123@linux.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next] ibmvnic: use ethtool string helpers
2024-10-22 20:32 [PATCH net-next] ibmvnic: use ethtool string helpers Rosen Penev
2024-10-23 18:58 ` Nick Child
@ 2024-10-24 15:13 ` Simon Horman
2024-10-29 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2024-10-24 15:13 UTC (permalink / raw)
To: Rosen Penev
Cc: netdev, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
Naveen N Rao, Madhavan Srinivasan, Haren Myneni, Rick Lindsley,
Nick Child, Thomas Falcon, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:LINUX FOR POWERPC (32-BIT AND 64-BIT), open list
On Tue, Oct 22, 2024 at 01:32:40PM -0700, Rosen Penev wrote:
> They are the prefered way to copy ethtool strings.
>
> Avoids manually incrementing the data pointer.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ibmvnic: use ethtool string helpers
2024-10-22 20:32 [PATCH net-next] ibmvnic: use ethtool string helpers Rosen Penev
2024-10-23 18:58 ` Nick Child
2024-10-24 15:13 ` Simon Horman
@ 2024-10-29 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-29 23:00 UTC (permalink / raw)
To: Rosen Penev
Cc: netdev, mpe, npiggin, christophe.leroy, naveen, maddy, haren,
ricklind, nnac123, tlfalcon, andrew+netdev, davem, edumazet, kuba,
pabeni, linuxppc-dev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 22 Oct 2024 13:32:40 -0700 you wrote:
> They are the prefered way to copy ethtool strings.
>
> Avoids manually incrementing the data pointer.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/net/ethernet/ibm/ibmvnic.c | 30 +++++++++---------------------
> 1 file changed, 9 insertions(+), 21 deletions(-)
Here is the summary with links:
- [net-next] ibmvnic: use ethtool string helpers
https://git.kernel.org/netdev/net-next/c/89abb6b3bd7b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-29 23:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 20:32 [PATCH net-next] ibmvnic: use ethtool string helpers Rosen Penev
2024-10-23 18:58 ` Nick Child
2024-10-24 15:13 ` Simon Horman
2024-10-29 23:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).