mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
igc: Update driver to use ethtool_sprintf
Complete to commit c8d4725e98
("intel: Update drivers to use
ethtool_sprintf")
Update the igc driver to make use of ethtool_sprintf. The general idea
is to reduce code size and overhead by replacing the repeated pattern of
string printf statements and ETH_STRING_LEN counter increments.
Suggested-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
ebbf5fcb94
commit
220ef1f97e
1 changed files with 13 additions and 26 deletions
|
@ -765,35 +765,22 @@ static void igc_ethtool_get_strings(struct net_device *netdev, u32 stringset,
|
|||
IGC_TEST_LEN * ETH_GSTRING_LEN);
|
||||
break;
|
||||
case ETH_SS_STATS:
|
||||
for (i = 0; i < IGC_GLOBAL_STATS_LEN; i++) {
|
||||
memcpy(p, igc_gstrings_stats[i].stat_string,
|
||||
ETH_GSTRING_LEN);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
for (i = 0; i < IGC_NETDEV_STATS_LEN; i++) {
|
||||
memcpy(p, igc_gstrings_net_stats[i].stat_string,
|
||||
ETH_GSTRING_LEN);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
for (i = 0; i < IGC_GLOBAL_STATS_LEN; i++)
|
||||
ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
|
||||
for (i = 0; i < IGC_NETDEV_STATS_LEN; i++)
|
||||
ethtool_sprintf(&p,
|
||||
igc_gstrings_net_stats[i].stat_string);
|
||||
for (i = 0; i < adapter->num_tx_queues; i++) {
|
||||
sprintf(p, "tx_queue_%u_packets", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
sprintf(p, "tx_queue_%u_bytes", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
sprintf(p, "tx_queue_%u_restart", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
ethtool_sprintf(&p, "tx_queue_%u_packets", i);
|
||||
ethtool_sprintf(&p, "tx_queue_%u_bytes", i);
|
||||
ethtool_sprintf(&p, "tx_queue_%u_restart", i);
|
||||
}
|
||||
for (i = 0; i < adapter->num_rx_queues; i++) {
|
||||
sprintf(p, "rx_queue_%u_packets", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
sprintf(p, "rx_queue_%u_bytes", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
sprintf(p, "rx_queue_%u_drops", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
sprintf(p, "rx_queue_%u_csum_err", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
sprintf(p, "rx_queue_%u_alloc_failed", i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
ethtool_sprintf(&p, "rx_queue_%u_packets", i);
|
||||
ethtool_sprintf(&p, "rx_queue_%u_bytes", i);
|
||||
ethtool_sprintf(&p, "rx_queue_%u_drops", i);
|
||||
ethtool_sprintf(&p, "rx_queue_%u_csum_err", i);
|
||||
ethtool_sprintf(&p, "rx_queue_%u_alloc_failed", i);
|
||||
}
|
||||
/* BUG_ON(p - data != IGC_STATS_LEN * ETH_GSTRING_LEN); */
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue