Commit 3ae0ed37 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

netvsc: Update driver to use ethtool_sprintf

Replace instances of sprintf or memcpy with a pointer update with
ethtool_sprintf.
Signed-off-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent efbbe4fb
...@@ -1612,34 +1612,23 @@ static void netvsc_get_strings(struct net_device *dev, u32 stringset, u8 *data) ...@@ -1612,34 +1612,23 @@ static void netvsc_get_strings(struct net_device *dev, u32 stringset, u8 *data)
switch (stringset) { switch (stringset) {
case ETH_SS_STATS: case ETH_SS_STATS:
for (i = 0; i < ARRAY_SIZE(netvsc_stats); i++) { for (i = 0; i < ARRAY_SIZE(netvsc_stats); i++)
memcpy(p, netvsc_stats[i].name, ETH_GSTRING_LEN); ethtool_sprintf(&p, netvsc_stats[i].name);
p += ETH_GSTRING_LEN;
}
for (i = 0; i < ARRAY_SIZE(vf_stats); i++) { for (i = 0; i < ARRAY_SIZE(vf_stats); i++)
memcpy(p, vf_stats[i].name, ETH_GSTRING_LEN); ethtool_sprintf(&p, vf_stats[i].name);
p += ETH_GSTRING_LEN;
}
for (i = 0; i < nvdev->num_chn; i++) { for (i = 0; i < nvdev->num_chn; i++) {
sprintf(p, "tx_queue_%u_packets", i); ethtool_sprintf(&p, "tx_queue_%u_packets", i);
p += ETH_GSTRING_LEN; ethtool_sprintf(&p, "tx_queue_%u_bytes", i);
sprintf(p, "tx_queue_%u_bytes", i); ethtool_sprintf(&p, "rx_queue_%u_packets", i);
p += ETH_GSTRING_LEN; ethtool_sprintf(&p, "rx_queue_%u_bytes", i);
sprintf(p, "rx_queue_%u_packets", i); ethtool_sprintf(&p, "rx_queue_%u_xdp_drop", i);
p += ETH_GSTRING_LEN;
sprintf(p, "rx_queue_%u_bytes", i);
p += ETH_GSTRING_LEN;
sprintf(p, "rx_queue_%u_xdp_drop", i);
p += ETH_GSTRING_LEN;
} }
for_each_present_cpu(cpu) { for_each_present_cpu(cpu) {
for (i = 0; i < ARRAY_SIZE(pcpu_stats); i++) { for (i = 0; i < ARRAY_SIZE(pcpu_stats); i++)
sprintf(p, pcpu_stats[i].name, cpu); ethtool_sprintf(&p, pcpu_stats[i].name, cpu);
p += ETH_GSTRING_LEN;
}
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment