netdev.vger.kernel.org archive mirror
 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 10/14] sfc: suppress vadaptor stats when EVB is not present
Date: Fri, 29 May 2015 11:08:02 +0100	[thread overview]
Message-ID: <55683A82.6000702@solarflare.com> (raw)
In-Reply-To: <55683895.2090408@solarflare.com>

From: Daniel Pieczko <dpieczko@solarflare.com>

The raw_mask array is not initialised, so it needs to be
explicitly set to zero in the 'else' branch.

If the EVB capability is not present, a port cannot have multiple
functions so the per-port MAC stats are correct and should match
the corresponding vadaptor stats, so this redundancy can be
removed from the ethtool stats output.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
---
 drivers/net/ethernet/sfc/ef10.c      | 12 +++++++++---
 drivers/net/ethernet/sfc/mcdi_pcol.h |  2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index c68bf55..8be9191 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1176,13 +1176,19 @@ static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx)
 
 static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask)
 {
+	struct efx_ef10_nic_data *nic_data = efx->nic_data;
 	u64 raw_mask[2];
 
 	raw_mask[0] = efx_ef10_raw_stat_mask(efx);
 
-	/* All functions see the vadaptor stats */
-	raw_mask[0] |= ~((1ULL << EF10_STAT_rx_unicast) - 1);
-	raw_mask[1] = (1ULL << (EF10_STAT_COUNT - 63)) - 1;
+	/* Only show vadaptor stats when EVB capability is present */
+	if (nic_data->datapath_caps &
+	    (1 << MC_CMD_GET_CAPABILITIES_OUT_EVB_LBN)) {
+		raw_mask[0] |= ~((1ULL << EF10_STAT_rx_unicast) - 1);
+		raw_mask[1] = (1ULL << (EF10_STAT_COUNT - 63)) - 1;
+	} else {
+		raw_mask[1] = 0;
+	}
 
 #if BITS_PER_LONG == 64
 	mask[0] = raw_mask[0];
diff --git a/drivers/net/ethernet/sfc/mcdi_pcol.h b/drivers/net/ethernet/sfc/mcdi_pcol.h
index 181978d..45fca9f 100644
--- a/drivers/net/ethernet/sfc/mcdi_pcol.h
+++ b/drivers/net/ethernet/sfc/mcdi_pcol.h
@@ -5600,6 +5600,8 @@
 #define        MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_WIDTH 1
 #define        MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_LBN 27
 #define        MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_WIDTH 1
+#define        MC_CMD_GET_CAPABILITIES_OUT_EVB_LBN 30
+#define        MC_CMD_GET_CAPABILITIES_OUT_EVB_WIDTH 1
 /* RxDPCPU firmware id. */
 #define       MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_OFST 4
 #define       MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_LEN 2

      parent reply	other threads:[~2015-05-29 10:08 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 ` [PATCH net-next 08/14] sfc: update netdevice statistics to use vadaptor stats Shradha Shah
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 ` Shradha Shah [this message]

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=55683A82.6000702@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).