summaryrefslogtreecommitdiffstats
path: root/net/dsa/user.c
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2024-10-28 05:48:28 +0100
committerJakub Kicinski <kuba@kernel.org>2024-11-03 19:36:34 +0100
commitf12b363887c706c40611fba645265527a8415832 (patch)
treeee7507d1cdb621b8dc13f9aec37b96805dfd7012 /net/dsa/user.c
parentMerge branch 'add-noinline_for_tracing-and-apply-it-to-tcp_drop_reason' (diff)
downloadlinux-f12b363887c706c40611fba645265527a8415832.tar.xz
linux-f12b363887c706c40611fba645265527a8415832.zip
net: dsa: use ethtool string helpers
These are the preferred way to copy ethtool strings. Avoids incrementing pointers all over the place. Signed-off-by: Rosen Penev <rosenp@gmail.com> (for hellcreek driver) Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Link: https://patch.msgid.link/20241028044828.1639668-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa/user.c')
-rw-r--r--net/dsa/user.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/dsa/user.c b/net/dsa/user.c
index b18ad0105b01..06c30a9e29ff 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -1042,15 +1042,12 @@ static void dsa_user_get_strings(struct net_device *dev,
struct dsa_switch *ds = dp->ds;
if (stringset == ETH_SS_STATS) {
- int len = ETH_GSTRING_LEN;
-
- strscpy_pad(data, "tx_packets", len);
- strscpy_pad(data + len, "tx_bytes", len);
- strscpy_pad(data + 2 * len, "rx_packets", len);
- strscpy_pad(data + 3 * len, "rx_bytes", len);
+ ethtool_puts(&data, "tx_packets");
+ ethtool_puts(&data, "tx_bytes");
+ ethtool_puts(&data, "rx_packets");
+ ethtool_puts(&data, "rx_bytes");
if (ds->ops->get_strings)
- ds->ops->get_strings(ds, dp->index, stringset,
- data + 4 * len);
+ ds->ops->get_strings(ds, dp->index, stringset, data);
} else if (stringset == ETH_SS_TEST) {
net_selftest_get_strings(data);
}