mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-06 05:45:29 +02:00
net: hinic: use ethtool_sprintf/puts
Simpler and avoids manual pointer addition. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20240809044957.4534-1-rosenp@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
2c9c2a3d1a
commit
dd1bf9f9df
|
@ -1471,7 +1471,6 @@ static void hinic_get_strings(struct net_device *netdev,
|
|||
u32 stringset, u8 *data)
|
||||
{
|
||||
struct hinic_dev *nic_dev = netdev_priv(netdev);
|
||||
char *p = (char *)data;
|
||||
u16 i, j;
|
||||
|
||||
switch (stringset) {
|
||||
|
@ -1479,31 +1478,19 @@ static void hinic_get_strings(struct net_device *netdev,
|
|||
memcpy(data, *hinic_test_strings, sizeof(hinic_test_strings));
|
||||
return;
|
||||
case ETH_SS_STATS:
|
||||
for (i = 0; i < ARRAY_SIZE(hinic_function_stats); i++) {
|
||||
memcpy(p, hinic_function_stats[i].name,
|
||||
ETH_GSTRING_LEN);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(hinic_function_stats); i++)
|
||||
ethtool_puts(&data, hinic_function_stats[i].name);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(hinic_port_stats); i++) {
|
||||
memcpy(p, hinic_port_stats[i].name,
|
||||
ETH_GSTRING_LEN);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(hinic_port_stats); i++)
|
||||
ethtool_puts(&data, hinic_port_stats[i].name);
|
||||
|
||||
for (i = 0; i < nic_dev->num_qps; i++) {
|
||||
for (j = 0; j < ARRAY_SIZE(hinic_tx_queue_stats); j++) {
|
||||
sprintf(p, hinic_tx_queue_stats[j].name, i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < nic_dev->num_qps; i++)
|
||||
for (j = 0; j < ARRAY_SIZE(hinic_tx_queue_stats); j++)
|
||||
ethtool_sprintf(&data, hinic_tx_queue_stats[j].name, i);
|
||||
|
||||
for (i = 0; i < nic_dev->num_qps; i++) {
|
||||
for (j = 0; j < ARRAY_SIZE(hinic_rx_queue_stats); j++) {
|
||||
sprintf(p, hinic_rx_queue_stats[j].name, i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < nic_dev->num_qps; i++)
|
||||
for (j = 0; j < ARRAY_SIZE(hinic_rx_queue_stats); j++)
|
||||
ethtool_sprintf(&data, hinic_rx_queue_stats[j].name, i);
|
||||
|
||||
return;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue
Block a user