diff options
author | Bert Kenward <bkenward@solarflare.com> | 2015-08-26 11:39:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-27 14:27:01 -0400 |
commit | fbe4307e9ffd9b9c9d4631a37c8f16080da8df85 (patch) | |
tree | ec33ca0f7b99f06c3879acdc8f97b656babb0320 /drivers/net/ethernet/sfc/ef10.c | |
parent | 4b195360914583899070835a08ceb06ac7b848d6 (diff) |
sfc: only use vadaptor stats if firmware is capable
Some of the stats handling code differs based on SR-IOV support,
and SRIOV support is only available if full-featured firmware is
used.
Do not use vadaptor stats if firmware mode is not set to
full-featured.
Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/ef10.c')
-rw-r--r-- | drivers/net/ethernet/sfc/ef10.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 605cc8948594..b1a4ea21c91c 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -1282,7 +1282,12 @@ static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, | |||
1282 | } | 1282 | } |
1283 | } | 1283 | } |
1284 | 1284 | ||
1285 | if (core_stats) { | 1285 | if (!core_stats) |
1286 | return stats_count; | ||
1287 | |||
1288 | if (nic_data->datapath_caps & | ||
1289 | 1 << MC_CMD_GET_CAPABILITIES_OUT_EVB_LBN) { | ||
1290 | /* Use vadaptor stats. */ | ||
1286 | core_stats->rx_packets = stats[EF10_STAT_rx_unicast] + | 1291 | core_stats->rx_packets = stats[EF10_STAT_rx_unicast] + |
1287 | stats[EF10_STAT_rx_multicast] + | 1292 | stats[EF10_STAT_rx_multicast] + |
1288 | stats[EF10_STAT_rx_broadcast]; | 1293 | stats[EF10_STAT_rx_broadcast]; |
@@ -1302,6 +1307,26 @@ static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, | |||
1302 | core_stats->rx_fifo_errors = stats[EF10_STAT_rx_overflow]; | 1307 | core_stats->rx_fifo_errors = stats[EF10_STAT_rx_overflow]; |
1303 | core_stats->rx_errors = core_stats->rx_crc_errors; | 1308 | core_stats->rx_errors = core_stats->rx_crc_errors; |
1304 | core_stats->tx_errors = stats[EF10_STAT_tx_bad]; | 1309 | core_stats->tx_errors = stats[EF10_STAT_tx_bad]; |
1310 | } else { | ||
1311 | /* Use port stats. */ | ||
1312 | core_stats->rx_packets = stats[EF10_STAT_port_rx_packets]; | ||
1313 | core_stats->tx_packets = stats[EF10_STAT_port_tx_packets]; | ||
1314 | core_stats->rx_bytes = stats[EF10_STAT_port_rx_bytes]; | ||
1315 | core_stats->tx_bytes = stats[EF10_STAT_port_tx_bytes]; | ||
1316 | core_stats->rx_dropped = stats[EF10_STAT_port_rx_nodesc_drops] + | ||
1317 | stats[GENERIC_STAT_rx_nodesc_trunc] + | ||
1318 | stats[GENERIC_STAT_rx_noskb_drops]; | ||
1319 | core_stats->multicast = stats[EF10_STAT_port_rx_multicast]; | ||
1320 | core_stats->rx_length_errors = | ||
1321 | stats[EF10_STAT_port_rx_gtjumbo] + | ||
1322 | stats[EF10_STAT_port_rx_length_error]; | ||
1323 | core_stats->rx_crc_errors = stats[EF10_STAT_port_rx_bad]; | ||
1324 | core_stats->rx_frame_errors = | ||
1325 | stats[EF10_STAT_port_rx_align_error]; | ||
1326 | core_stats->rx_fifo_errors = stats[EF10_STAT_port_rx_overflow]; | ||
1327 | core_stats->rx_errors = (core_stats->rx_length_errors + | ||
1328 | core_stats->rx_crc_errors + | ||
1329 | core_stats->rx_frame_errors); | ||
1305 | } | 1330 | } |
1306 | 1331 | ||
1307 | return stats_count; | 1332 | return stats_count; |