sfc: suppress vadaptor stats when EVB is not present
authorDaniel Pieczko <dpieczko@solarflare.com>
Tue, 2 Jun 2015 10:40:05 +0000 (11:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jun 2015 19:57:29 +0000 (12:57 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/sfc/mcdi_pcol.h

index a79a24f94123877231eaeb4161e269e7ae3ecd88..03f464fdd2b90ab7508173762f57f00ef2f5b605 100644 (file)
@@ -1162,13 +1162,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];
index 181978d64845104e9fc4b3e003ce12eb099b4664..45fca9fc66b7c9b2512abef1d3363dfbf1ab5344 100644 (file)
 #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
This page took 0.042193 seconds and 5 git commands to generate.