Skip to content

Commit 427b1f3

Browse files
nehebrleon
authored andcommitted
RDMA: Use ethtool string helpers
Avoids having to manually increment the pointer. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20241021011543.5922-1-rosenp@gmail.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 52f70de commit 427b1f3

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

drivers/infiniband/ulp/ipoib/ipoib_ethtool.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,13 @@ static void ipoib_get_ethtool_stats(struct net_device *dev,
128128
static void ipoib_get_strings(struct net_device __always_unused *dev,
129129
u32 stringset, u8 *data)
130130
{
131-
u8 *p = data;
132131
int i;
133132

134133
switch (stringset) {
135134
case ETH_SS_STATS:
136-
for (i = 0; i < IPOIB_GLOBAL_STATS_LEN; i++) {
137-
memcpy(p, ipoib_gstrings_stats[i].stat_string,
138-
ETH_GSTRING_LEN);
139-
p += ETH_GSTRING_LEN;
140-
}
135+
for (i = 0; i < IPOIB_GLOBAL_STATS_LEN; i++)
136+
ethtool_puts(&data,
137+
ipoib_gstrings_stats[i].stat_string);
141138
break;
142139
default:
143140
break;

drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ static void vnic_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
164164
return;
165165

166166
for (i = 0; i < VNIC_STATS_LEN; i++)
167-
memcpy(data + i * ETH_GSTRING_LEN,
168-
vnic_gstrings_stats[i].stat_string,
169-
ETH_GSTRING_LEN);
167+
ethtool_puts(&data, vnic_gstrings_stats[i].stat_string);
170168
}
171169

172170
/* ethtool ops */

0 commit comments

Comments
 (0)