ice: fix overlong string, update stats output
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Fri, 8 Feb 2019 20:50:43 +0000 (12:50 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Mon, 25 Feb 2019 16:56:02 +0000 (08:56 -0800)
A test started warning on a string truncation. This led to an unfortunate
realization that we are likely not accounting for the stats length
correctly before this patch, so fix the issue by putting "port." in front
of all the PF stats, instead of magically prepending it at runtime.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ice/ice_ethtool.c

index 295571b1c4e82a2afdf05205d8f829e343925d9c..eb8d149e317ceab9be78fd96c6db0aed69cf23f6 100644 (file)
@@ -63,45 +63,45 @@ static const struct ice_stats ice_gstrings_vsi_stats[] = {
  * is queried on the base PF netdev.
  */
 static const struct ice_stats ice_gstrings_pf_stats[] = {
-       ICE_PF_STAT("tx_bytes", stats.eth.tx_bytes),
-       ICE_PF_STAT("rx_bytes", stats.eth.rx_bytes),
-       ICE_PF_STAT("tx_unicast", stats.eth.tx_unicast),
-       ICE_PF_STAT("rx_unicast", stats.eth.rx_unicast),
-       ICE_PF_STAT("tx_multicast", stats.eth.tx_multicast),
-       ICE_PF_STAT("rx_multicast", stats.eth.rx_multicast),
-       ICE_PF_STAT("tx_broadcast", stats.eth.tx_broadcast),
-       ICE_PF_STAT("rx_broadcast", stats.eth.rx_broadcast),
-       ICE_PF_STAT("tx_errors", stats.eth.tx_errors),
-       ICE_PF_STAT("tx_size_64", stats.tx_size_64),
-       ICE_PF_STAT("rx_size_64", stats.rx_size_64),
-       ICE_PF_STAT("tx_size_127", stats.tx_size_127),
-       ICE_PF_STAT("rx_size_127", stats.rx_size_127),
-       ICE_PF_STAT("tx_size_255", stats.tx_size_255),
-       ICE_PF_STAT("rx_size_255", stats.rx_size_255),
-       ICE_PF_STAT("tx_size_511", stats.tx_size_511),
-       ICE_PF_STAT("rx_size_511", stats.rx_size_511),
-       ICE_PF_STAT("tx_size_1023", stats.tx_size_1023),
-       ICE_PF_STAT("rx_size_1023", stats.rx_size_1023),
-       ICE_PF_STAT("tx_size_1522", stats.tx_size_1522),
-       ICE_PF_STAT("rx_size_1522", stats.rx_size_1522),
-       ICE_PF_STAT("tx_size_big", stats.tx_size_big),
-       ICE_PF_STAT("rx_size_big", stats.rx_size_big),
-       ICE_PF_STAT("link_xon_tx", stats.link_xon_tx),
-       ICE_PF_STAT("link_xon_rx", stats.link_xon_rx),
-       ICE_PF_STAT("link_xoff_tx", stats.link_xoff_tx),
-       ICE_PF_STAT("link_xoff_rx", stats.link_xoff_rx),
-       ICE_PF_STAT("tx_dropped_link_down", stats.tx_dropped_link_down),
-       ICE_PF_STAT("rx_undersize", stats.rx_undersize),
-       ICE_PF_STAT("rx_fragments", stats.rx_fragments),
-       ICE_PF_STAT("rx_oversize", stats.rx_oversize),
-       ICE_PF_STAT("rx_jabber", stats.rx_jabber),
-       ICE_PF_STAT("rx_csum_bad", hw_csum_rx_error),
-       ICE_PF_STAT("rx_length_errors", stats.rx_len_errors),
-       ICE_PF_STAT("rx_dropped", stats.eth.rx_discards),
-       ICE_PF_STAT("rx_crc_errors", stats.crc_errors),
-       ICE_PF_STAT("illegal_bytes", stats.illegal_bytes),
-       ICE_PF_STAT("mac_local_faults", stats.mac_local_faults),
-       ICE_PF_STAT("mac_remote_faults", stats.mac_remote_faults),
+       ICE_PF_STAT("port.tx_bytes", stats.eth.tx_bytes),
+       ICE_PF_STAT("port.rx_bytes", stats.eth.rx_bytes),
+       ICE_PF_STAT("port.tx_unicast", stats.eth.tx_unicast),
+       ICE_PF_STAT("port.rx_unicast", stats.eth.rx_unicast),
+       ICE_PF_STAT("port.tx_multicast", stats.eth.tx_multicast),
+       ICE_PF_STAT("port.rx_multicast", stats.eth.rx_multicast),
+       ICE_PF_STAT("port.tx_broadcast", stats.eth.tx_broadcast),
+       ICE_PF_STAT("port.rx_broadcast", stats.eth.rx_broadcast),
+       ICE_PF_STAT("port.tx_errors", stats.eth.tx_errors),
+       ICE_PF_STAT("port.tx_size_64", stats.tx_size_64),
+       ICE_PF_STAT("port.rx_size_64", stats.rx_size_64),
+       ICE_PF_STAT("port.tx_size_127", stats.tx_size_127),
+       ICE_PF_STAT("port.rx_size_127", stats.rx_size_127),
+       ICE_PF_STAT("port.tx_size_255", stats.tx_size_255),
+       ICE_PF_STAT("port.rx_size_255", stats.rx_size_255),
+       ICE_PF_STAT("port.tx_size_511", stats.tx_size_511),
+       ICE_PF_STAT("port.rx_size_511", stats.rx_size_511),
+       ICE_PF_STAT("port.tx_size_1023", stats.tx_size_1023),
+       ICE_PF_STAT("port.rx_size_1023", stats.rx_size_1023),
+       ICE_PF_STAT("port.tx_size_1522", stats.tx_size_1522),
+       ICE_PF_STAT("port.rx_size_1522", stats.rx_size_1522),
+       ICE_PF_STAT("port.tx_size_big", stats.tx_size_big),
+       ICE_PF_STAT("port.rx_size_big", stats.rx_size_big),
+       ICE_PF_STAT("port.link_xon_tx", stats.link_xon_tx),
+       ICE_PF_STAT("port.link_xon_rx", stats.link_xon_rx),
+       ICE_PF_STAT("port.link_xoff_tx", stats.link_xoff_tx),
+       ICE_PF_STAT("port.link_xoff_rx", stats.link_xoff_rx),
+       ICE_PF_STAT("port.tx_dropped_link_down", stats.tx_dropped_link_down),
+       ICE_PF_STAT("port.rx_undersize", stats.rx_undersize),
+       ICE_PF_STAT("port.rx_fragments", stats.rx_fragments),
+       ICE_PF_STAT("port.rx_oversize", stats.rx_oversize),
+       ICE_PF_STAT("port.rx_jabber", stats.rx_jabber),
+       ICE_PF_STAT("port.rx_csum_bad", hw_csum_rx_error),
+       ICE_PF_STAT("port.rx_length_errors", stats.rx_len_errors),
+       ICE_PF_STAT("port.rx_dropped", stats.eth.rx_discards),
+       ICE_PF_STAT("port.rx_crc_errors", stats.crc_errors),
+       ICE_PF_STAT("port.illegal_bytes", stats.illegal_bytes),
+       ICE_PF_STAT("port.mac_local_faults", stats.mac_local_faults),
+       ICE_PF_STAT("port.mac_remote_faults", stats.mac_remote_faults),
 };
 
 static const u32 ice_regs_dump_list[] = {
@@ -304,7 +304,7 @@ static void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
                        return;
 
                for (i = 0; i < ICE_PF_STATS_LEN; i++) {
-                       snprintf(p, ETH_GSTRING_LEN, "port.%s",
+                       snprintf(p, ETH_GSTRING_LEN, "%s",
                                 ice_gstrings_pf_stats[i].stat_string);
                        p += ETH_GSTRING_LEN;
                }