All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shradha Shah <sshah@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@solarflare.com>
Subject: [PATCH net-next 08/14] sfc: update netdevice statistics to use vadaptor stats
Date: Fri, 29 May 2015 11:02:30 +0100	[thread overview]
Message-ID: <55683936.7010107@solarflare.com> (raw)
In-Reply-To: <55683895.2090408@solarflare.com>

From: Daniel Pieczko <dpieczko@solarflare.com>

The netdevice statistics (in /proc/net/dev) are per-function
stats so they must use the vadaptor stats. Change the use of
MAC stats to vadaptor stats, and remove any statistics that
can only be measured per-port.  All stats that are removed
will be shown as zeroes when these statistics are displayed.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
---
 drivers/net/ethernet/sfc/ef10.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 6aaec4e..1e83c18 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1224,24 +1224,25 @@ static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats,
 	}
 
 	if (core_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] +
+		core_stats->rx_packets = stats[EF10_STAT_rx_unicast] +
+					 stats[EF10_STAT_rx_multicast] +
+					 stats[EF10_STAT_rx_broadcast];
+		core_stats->tx_packets = stats[EF10_STAT_tx_unicast] +
+					 stats[EF10_STAT_tx_multicast] +
+					 stats[EF10_STAT_tx_broadcast];
+		core_stats->rx_bytes = stats[EF10_STAT_rx_unicast_bytes] +
+				       stats[EF10_STAT_rx_multicast_bytes] +
+				       stats[EF10_STAT_rx_broadcast_bytes];
+		core_stats->tx_bytes = stats[EF10_STAT_tx_unicast_bytes] +
+				       stats[EF10_STAT_tx_multicast_bytes] +
+				       stats[EF10_STAT_tx_broadcast_bytes];
+		core_stats->rx_dropped = 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);
+		core_stats->multicast = stats[EF10_STAT_rx_multicast];
+		core_stats->rx_crc_errors = stats[EF10_STAT_rx_bad];
+		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];
 	}
 
 	return stats_count;
@@ -1324,7 +1325,7 @@ static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx)
 
 	MCDI_SET_QWORD(inbuf, MAC_STATS_IN_DMA_ADDR, stats_buf.dma_addr);
 	MCDI_POPULATE_DWORD_1(inbuf, MAC_STATS_IN_CMD,
-			      MAC_STATS_IN_DMA, true);
+			      MAC_STATS_IN_DMA, 1);
 	MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len);
 	MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, EVB_PORT_ID_ASSIGNED);
 
@@ -1336,8 +1337,10 @@ static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx)
 		goto out;
 
 	generation_end = dma_stats[MC_CMD_MAC_GENERATION_END];
-	if (generation_end == EFX_MC_STATS_GENERATION_INVALID)
+	if (generation_end == EFX_MC_STATS_GENERATION_INVALID) {
+		WARN_ON_ONCE(1);
 		goto out;
+	}
 	rmb();
 	efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, mask,
 			     stats, stats_buf.addr, false);

  parent reply	other threads:[~2015-05-29 10:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29  9:59 [PATCH net-next 00/14] sfc: ndo_get_phys_port_id, vadaptor stats and PF unload when Vf's assigned to guest Shradha Shah
2015-05-29 10:01 ` [PATCH net-next 01/14] sfc: Add sysfs entry for physical port Shradha Shah
2015-06-01  0:32   ` David Miller
2015-05-29 10:01 ` [PATCH net-next 02/14] sfc: Add sysfs entry for flags (link control and primary) Shradha Shah
2015-05-29 10:48   ` David Laight
2015-05-29 13:09     ` Edward Cree
2015-05-29 10:01 ` [PATCH net-next 03/14] sfc: Implement ndo_gets_phys_port_id() for EF10 VFs Shradha Shah
2015-05-29 10:01 ` [PATCH net-next 04/14] sfc: add "port_" prefix to MAC stats Shradha Shah
2015-05-29 10:01 ` [PATCH net-next 05/14] sfc: set the port-id when calling MC_CMD_MAC_STATS Shradha Shah
2015-05-29 10:02 ` [PATCH net-next 06/14] sfc: display vadaptor statistics for all interfaces Shradha Shah
2015-05-29 10:02 ` [PATCH net-next 07/14] sfc: DMA the VF stats only when requested Shradha Shah
2015-05-29 10:02 ` Shradha Shah [this message]
2015-05-29 10:02 ` [PATCH net-next 09/14] sfc: suppress ENOENT error messages from MC_CMD_MAC_STATS Shradha Shah
2015-05-29 10:03 ` [PATCH net-next 11/14] sfc: don't update stats on VF when called in atomic context Shradha Shah
2015-05-29 10:03 ` [PATCH net-next 12/14] sfc: do not allow VFs to be destroyed if assigned to guests Shradha Shah
2015-05-29 10:03 ` [PATCH net-next 13/14] sfc: force removal of VF and vport on driver removal Shradha Shah
2015-05-29 10:03 ` [PATCH net-next 14/14] sfc: leak vports if a VF is assigned during PF unload Shradha Shah
2015-05-29 10:08 ` [PATCH net-next 10/14] sfc: suppress vadaptor stats when EVB is not present Shradha Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55683936.7010107@solarflare.com \
    --to=sshah@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.