Skip to contentSkip to conversation

net: mvneta: use ethtool_puts

PATCH Applied Rosen Penev 3 participants 3 messages Oct 11, 2024 – Oct 15, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: mvneta: use ethtool_puts

Allows simplifying get_strings and avoids manual pointer manipulation.

Tested on Turris Omnia.

---
 drivers/net/ethernet/marvell/mvneta.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +1 -3
index fcd89c67094f..7bb781fb93b5 100644
@@ -4795,11 +4795,9 @@ static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
 		int i;
 
 		for (i = 0; i < ARRAY_SIZE(mvneta_statistics); i++)
-			memcpy(data + i * ETH_GSTRING_LEN,
-			       mvneta_statistics[i].name, ETH_GSTRING_LEN);
+			ethtool_puts(&data, mvneta_statistics[i].name);
 
 		if (!pp->bm_priv) {
-			data += ETH_GSTRING_LEN * ARRAY_SIZE(mvneta_statistics);
 			page_pool_ethtool_stats_get_strings(data);
 		}
 	}
Signature · 1 line
2.47.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Rosen Penev

Allows simplifying get_strings and avoids manual pointer manipulation.

Tested on Turris Omnia.

---
  drivers/net/ethernet/marvell/mvneta.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +0 -0
index fcd89c67094f..7bb781fb93b5 100644

drivers/net/ethernet/marvell/mvneta.c static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset, · line 4802

Quoted 9 lines
drivers/net/ethernet/marvell/mvneta.c +1 -3
@@ -4795,11 +4795,9 @@ static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
  		int i;
 
  		for (i = 0; i < ARRAY_SIZE(mvneta_statistics); i++)
-			memcpy(data + i * ETH_GSTRING_LEN,
-			       mvneta_statistics[i].name, ETH_GSTRING_LEN);
+			ethtool_puts(&data, mvneta_statistics[i].name);
 
  		if (!pp->bm_priv) {
-			data += ETH_GSTRING_LEN * ARRAY_SIZE(mvneta_statistics);
#2 lore raw
In reply to Rosen Penev
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Fri, 11 Oct 2024 12:59:55 -0700 you wrote:

Allows simplifying get_strings and avoids manual pointer manipulation.

Tested on Turris Omnia.

---
 drivers/net/ethernet/marvell/mvneta.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Here is the summary with links:
- net: mvneta: use ethtool_puts

    https://git.kernel.org/netdev/net-next/c/9de722c144d2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html