* [PATCH net 1/1] sfc: only use vadaptor stats if firmware is capable
@ 2015-08-26 15:39 Shradha Shah
2015-08-27 18:27 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Shradha Shah @ 2015-08-26 15:39 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
From: Bert Kenward <bkenward@solarflare.com>
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>
---
drivers/net/ethernet/sfc/ef10.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 605cc89..b1a4ea2 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,
}
}
- if (core_stats) {
+ if (!core_stats)
+ return stats_count;
+
+ if (nic_data->datapath_caps &
+ 1 << MC_CMD_GET_CAPABILITIES_OUT_EVB_LBN) {
+ /* Use vadaptor stats. */
core_stats->rx_packets = stats[EF10_STAT_rx_unicast] +
stats[EF10_STAT_rx_multicast] +
stats[EF10_STAT_rx_broadcast];
@@ -1302,6 +1307,26 @@ static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats,
core_stats->rx_fifo_errors = stats[EF10_STAT_rx_overflow];
core_stats->rx_errors = core_stats->rx_crc_errors;
core_stats->tx_errors = stats[EF10_STAT_tx_bad];
+ } else {
+ /* Use port stats. */
+ core_stats->rx_packets = stats[EF10_STAT_port_rx_packets];
+ core_stats->tx_packets = stats[EF10_STAT_port_tx_packets];
+ core_stats->rx_bytes = stats[EF10_STAT_port_rx_bytes];
+ core_stats->tx_bytes = stats[EF10_STAT_port_tx_bytes];
+ core_stats->rx_dropped = stats[EF10_STAT_port_rx_nodesc_drops] +
+ stats[GENERIC_STAT_rx_nodesc_trunc] +
+ stats[GENERIC_STAT_rx_noskb_drops];
+ core_stats->multicast = stats[EF10_STAT_port_rx_multicast];
+ core_stats->rx_length_errors =
+ stats[EF10_STAT_port_rx_gtjumbo] +
+ stats[EF10_STAT_port_rx_length_error];
+ core_stats->rx_crc_errors = stats[EF10_STAT_port_rx_bad];
+ core_stats->rx_frame_errors =
+ stats[EF10_STAT_port_rx_align_error];
+ core_stats->rx_fifo_errors = stats[EF10_STAT_port_rx_overflow];
+ core_stats->rx_errors = (core_stats->rx_length_errors +
+ core_stats->rx_crc_errors +
+ core_stats->rx_frame_errors);
}
return stats_count;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net 1/1] sfc: only use vadaptor stats if firmware is capable
2015-08-26 15:39 [PATCH net 1/1] sfc: only use vadaptor stats if firmware is capable Shradha Shah
@ 2015-08-27 18:27 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-08-27 18:27 UTC (permalink / raw)
To: sshah; +Cc: netdev, linux-net-drivers
From: Shradha Shah <sshah@solarflare.com>
Date: Wed, 26 Aug 2015 16:39:03 +0100
> From: Bert Kenward <bkenward@solarflare.com>
>
> 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>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-27 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26 15:39 [PATCH net 1/1] sfc: only use vadaptor stats if firmware is capable Shradha Shah
2015-08-27 18:27 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.