aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-04-03 16:27:00 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-04-14 18:35:33 -0400
commitfbdb159f7d662b32111b489a50ce59a1f5d4a817 (patch)
treec30e1de60e0d53be2f711d08341793e24af19235 /drivers/net/ethernet/intel
parentc0e61781a8cb1c5d1b092a4d9776dbefe799444e (diff)
fm10k: separate PF only stats so that VF does not display them
This patch resolves an issue with ethtool stats displaying useless values on the VF, because some stats simply have no meaning to the VF. Resolve this by splitting these out into PF_STATS and only showing them if we aren't the VF. Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Acked-by: Matthew Vick <matthew.vick@intel.com> Tested-by: Krishneil Singh <krishneil.k.singh@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index cbfaf94d144d..4687f3756fae 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -57,7 +57,7 @@ static const struct fm10k_stats fm10k_gstrings_net_stats[] = {
57 .stat_offset = offsetof(struct fm10k_intfc, _stat) \ 57 .stat_offset = offsetof(struct fm10k_intfc, _stat) \
58} 58}
59 59
60static const struct fm10k_stats fm10k_gstrings_stats[] = { 60static const struct fm10k_stats fm10k_gstrings_global_stats[] = {
61 FM10K_STAT("tx_restart_queue", restart_queue), 61 FM10K_STAT("tx_restart_queue", restart_queue),
62 FM10K_STAT("tx_busy", tx_busy), 62 FM10K_STAT("tx_busy", tx_busy),
63 FM10K_STAT("tx_csum_errors", tx_csum_errors), 63 FM10K_STAT("tx_csum_errors", tx_csum_errors),
@@ -72,15 +72,6 @@ static const struct fm10k_stats fm10k_gstrings_stats[] = {
72 FM10K_STAT("rx_overrun_pf", rx_overrun_pf), 72 FM10K_STAT("rx_overrun_pf", rx_overrun_pf),
73 FM10K_STAT("rx_overrun_vf", rx_overrun_vf), 73 FM10K_STAT("rx_overrun_vf", rx_overrun_vf),
74 74
75 FM10K_STAT("timeout", stats.timeout.count),
76 FM10K_STAT("ur", stats.ur.count),
77 FM10K_STAT("ca", stats.ca.count),
78 FM10K_STAT("um", stats.um.count),
79 FM10K_STAT("xec", stats.xec.count),
80 FM10K_STAT("vlan_drop", stats.vlan_drop.count),
81 FM10K_STAT("loopback_drop", stats.loopback_drop.count),
82 FM10K_STAT("nodesc_drop", stats.nodesc_drop.count),
83
84 FM10K_STAT("swapi_status", hw.swapi.status), 75 FM10K_STAT("swapi_status", hw.swapi.status),
85 FM10K_STAT("mac_rules_used", hw.swapi.mac.used), 76 FM10K_STAT("mac_rules_used", hw.swapi.mac.used),
86 FM10K_STAT("mac_rules_avail", hw.swapi.mac.avail), 77 FM10K_STAT("mac_rules_avail", hw.swapi.mac.avail),
@@ -96,7 +87,19 @@ static const struct fm10k_stats fm10k_gstrings_stats[] = {
96 FM10K_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts), 87 FM10K_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
97}; 88};
98 89
99#define FM10K_GLOBAL_STATS_LEN ARRAY_SIZE(fm10k_gstrings_stats) 90static const struct fm10k_stats fm10k_gstrings_pf_stats[] = {
91 FM10K_STAT("timeout", stats.timeout.count),
92 FM10K_STAT("ur", stats.ur.count),
93 FM10K_STAT("ca", stats.ca.count),
94 FM10K_STAT("um", stats.um.count),
95 FM10K_STAT("xec", stats.xec.count),
96 FM10K_STAT("vlan_drop", stats.vlan_drop.count),
97 FM10K_STAT("loopback_drop", stats.loopback_drop.count),
98 FM10K_STAT("nodesc_drop", stats.nodesc_drop.count),
99};
100
101#define FM10K_GLOBAL_STATS_LEN ARRAY_SIZE(fm10k_gstrings_global_stats)
102#define FM10K_PF_STATS_LEN ARRAY_SIZE(fm10k_gstrings_pf_stats)
100 103
101#define FM10K_QUEUE_STATS_LEN(_n) \ 104#define FM10K_QUEUE_STATS_LEN(_n) \
102 ( (_n) * 2 * (sizeof(struct fm10k_queue_stats) / sizeof(u64))) 105 ( (_n) * 2 * (sizeof(struct fm10k_queue_stats) / sizeof(u64)))
@@ -133,11 +136,18 @@ static void fm10k_get_strings(struct net_device *dev, u32 stringset, u8 *data)
133 p += ETH_GSTRING_LEN; 136 p += ETH_GSTRING_LEN;
134 } 137 }
135 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) { 138 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) {
136 memcpy(p, fm10k_gstrings_stats[i].stat_string, 139 memcpy(p, fm10k_gstrings_global_stats[i].stat_string,
137 ETH_GSTRING_LEN); 140 ETH_GSTRING_LEN);
138 p += ETH_GSTRING_LEN; 141 p += ETH_GSTRING_LEN;
139 } 142 }
140 143
144 if (interface->hw.mac.type != fm10k_mac_vf)
145 for (i = 0; i < FM10K_PF_STATS_LEN; i++) {
146 memcpy(p, fm10k_gstrings_pf_stats[i].stat_string,
147 ETH_GSTRING_LEN);
148 p += ETH_GSTRING_LEN;
149 }
150
141 for (i = 0; i < interface->hw.mac.max_queues; i++) { 151 for (i = 0; i < interface->hw.mac.max_queues; i++) {
142 sprintf(p, "tx_queue_%u_packets", i); 152 sprintf(p, "tx_queue_%u_packets", i);
143 p += ETH_GSTRING_LEN; 153 p += ETH_GSTRING_LEN;
@@ -163,6 +173,10 @@ static int fm10k_get_sset_count(struct net_device *dev, int sset)
163 return FM10K_TEST_LEN; 173 return FM10K_TEST_LEN;
164 case ETH_SS_STATS: 174 case ETH_SS_STATS:
165 stats_len += FM10K_QUEUE_STATS_LEN(hw->mac.max_queues); 175 stats_len += FM10K_QUEUE_STATS_LEN(hw->mac.max_queues);
176
177 if (hw->mac.type != fm10k_mac_vf)
178 stats_len += FM10K_PF_STATS_LEN;
179
166 return stats_len; 180 return stats_len;
167 default: 181 default:
168 return -EOPNOTSUPP; 182 return -EOPNOTSUPP;
@@ -188,11 +202,20 @@ static void fm10k_get_ethtool_stats(struct net_device *netdev,
188 } 202 }
189 203
190 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) { 204 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) {
191 p = (char *)interface + fm10k_gstrings_stats[i].stat_offset; 205 p = (char *)interface +
192 *(data++) = (fm10k_gstrings_stats[i].sizeof_stat == 206 fm10k_gstrings_global_stats[i].stat_offset;
207 *(data++) = (fm10k_gstrings_global_stats[i].sizeof_stat ==
193 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 208 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
194 } 209 }
195 210
211 if (interface->hw.mac.type != fm10k_mac_vf)
212 for (i = 0; i < FM10K_PF_STATS_LEN; i++) {
213 p = (char *)interface +
214 fm10k_gstrings_pf_stats[i].stat_offset;
215 *(data++) = (fm10k_gstrings_pf_stats[i].sizeof_stat ==
216 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
217 }
218
196 for (i = 0; i < interface->hw.mac.max_queues; i++) { 219 for (i = 0; i < interface->hw.mac.max_queues; i++) {
197 struct fm10k_ring *ring; 220 struct fm10k_ring *ring;
198 u64 *queue_stat; 221 u64 *queue_stat;