Skip to contentSkip to conversation

net: mtk_eth_soc: use ethtool_puts

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

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

PATCH 1/1 net: mtk_eth_soc: use ethtool_puts

Allows simplifying get_strings and avoids manual pointer manipulation.

Tested on Belkin RT1800.

---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +2 -4
index 9aaaaa2a27dc..6d93f64f8748 100644
@@ -4328,10 +4328,8 @@ static void mtk_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 	case ETH_SS_STATS: {
 		struct mtk_mac *mac = netdev_priv(dev);
 
-		for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) {
-			memcpy(data, mtk_ethtool_stats[i].str, ETH_GSTRING_LEN);
-			data += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++)
+			ethtool_puts(&data, mtk_ethtool_stats[i].str);
 		if (mtk_page_pool_enabled(mac->hw))
 			page_pool_ethtool_stats_get_strings(data);
 		break;
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 Belkin RT1800.

---
  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +0 -0
index 9aaaaa2a27dc..6d93f64f8748 100644

drivers/net/ethernet/mediatek/mtk_eth_soc.c static void mtk_get_strings(struct net_device *dev, u32 stringset, u8 *data) · line 4332

Quoted 9 lines
drivers/net/ethernet/mediatek/mtk_eth_soc.c +2 -4
@@ -4328,10 +4328,8 @@ static void mtk_get_strings(struct net_device *dev, u32 stringset, u8 *data)
  	case ETH_SS_STATS: {
  		struct mtk_mac *mac = netdev_priv(dev);
 
-		for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) {
-			memcpy(data, mtk_ethtool_stats[i].str, ETH_GSTRING_LEN);
-			data += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++)
+			ethtool_puts(&data, mtk_ethtool_stats[i].str);
#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 13:02:25 -0700 you wrote:

Allows simplifying get_strings and avoids manual pointer manipulation.

Tested on Belkin RT1800.

---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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

    https://git.kernel.org/netdev/net-next/c/2a22bead433e

You are awesome, thank you!

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