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.
Unified · Split
| @@ -1282,7 +1282,12 @@ static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, · 1281 unmodified lines | ||
| 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 | 1291 | core_stats->rx_packets = stats[EF10_STAT_rx_unicast] + |
| 1287 | 1292 | stats[EF10_STAT_rx_multicast] + |
| 1288 | 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, · 13 unmodified lines | ||
| 1302 | 1307 | core_stats->rx_fifo_errors = stats[EF10_STAT_rx_overflow]; |
| 1303 | 1308 | core_stats->rx_errors = core_stats->rx_crc_errors; |
| 1304 | 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 | 1332 | return stats_count; |