]> git.karo-electronics.de Git - linux-beck.git/commitdiff
sfc: display vadaptor statistics for all interfaces
authorDaniel Pieczko <dpieczko@solarflare.com>
Tue, 2 Jun 2015 10:39:06 +0000 (11:39 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jun 2015 19:57:28 +0000 (12:57 -0700)
All interfaces will display vadaptor statistics, so set all the
relevant bits in the stats bitmask. Only functions with the
LINKCTRL flag will see other stats, including (per-port) MAC stats.

The vadaptor stats are from rx_unicast to tx_overflow.

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
drivers/net/ethernet/sfc/nic.h

index f44a56a68f3ab029eb021dfe8bb29908698b9fa1..3da554f848bc44e217dd669410e9e870825469dd 100644 (file)
@@ -1046,6 +1046,24 @@ static const struct efx_hw_stat_desc efx_ef10_stat_desc[EF10_STAT_COUNT] = {
        EF10_DMA_STAT(port_rx_dp_streaming_packets, RXDP_STREAMING_PKTS),
        EF10_DMA_STAT(port_rx_dp_hlb_fetch, RXDP_HLB_FETCH_CONDITIONS),
        EF10_DMA_STAT(port_rx_dp_hlb_wait, RXDP_HLB_WAIT_CONDITIONS),
+       EF10_DMA_STAT(rx_unicast, VADAPTER_RX_UNICAST_PACKETS),
+       EF10_DMA_STAT(rx_unicast_bytes, VADAPTER_RX_UNICAST_BYTES),
+       EF10_DMA_STAT(rx_multicast, VADAPTER_RX_MULTICAST_PACKETS),
+       EF10_DMA_STAT(rx_multicast_bytes, VADAPTER_RX_MULTICAST_BYTES),
+       EF10_DMA_STAT(rx_broadcast, VADAPTER_RX_BROADCAST_PACKETS),
+       EF10_DMA_STAT(rx_broadcast_bytes, VADAPTER_RX_BROADCAST_BYTES),
+       EF10_DMA_STAT(rx_bad, VADAPTER_RX_BAD_PACKETS),
+       EF10_DMA_STAT(rx_bad_bytes, VADAPTER_RX_BAD_BYTES),
+       EF10_DMA_STAT(rx_overflow, VADAPTER_RX_OVERFLOW),
+       EF10_DMA_STAT(tx_unicast, VADAPTER_TX_UNICAST_PACKETS),
+       EF10_DMA_STAT(tx_unicast_bytes, VADAPTER_TX_UNICAST_BYTES),
+       EF10_DMA_STAT(tx_multicast, VADAPTER_TX_MULTICAST_PACKETS),
+       EF10_DMA_STAT(tx_multicast_bytes, VADAPTER_TX_MULTICAST_BYTES),
+       EF10_DMA_STAT(tx_broadcast, VADAPTER_TX_BROADCAST_PACKETS),
+       EF10_DMA_STAT(tx_broadcast_bytes, VADAPTER_TX_BROADCAST_BYTES),
+       EF10_DMA_STAT(tx_bad, VADAPTER_TX_BAD_PACKETS),
+       EF10_DMA_STAT(tx_bad_bytes, VADAPTER_TX_BAD_BYTES),
+       EF10_DMA_STAT(tx_overflow, VADAPTER_TX_OVERFLOW),
 };
 
 #define HUNT_COMMON_STAT_MASK ((1ULL << EF10_STAT_port_tx_bytes) |     \
@@ -1126,6 +1144,10 @@ static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx)
        u32 port_caps = efx_mcdi_phy_get_caps(efx);
        struct efx_ef10_nic_data *nic_data = efx->nic_data;
 
+       if (!(efx->mcdi->fn_flags &
+             1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL))
+               return 0;
+
        if (port_caps & (1 << MC_CMD_PHY_CAP_40000FDX_LBN))
                raw_mask |= HUNT_40G_EXTRA_STAT_MASK;
        else
@@ -1140,13 +1162,22 @@ 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)
 {
-       u64 raw_mask = efx_ef10_raw_stat_mask(efx);
+       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;
 
 #if BITS_PER_LONG == 64
-       mask[0] = raw_mask;
+       mask[0] = raw_mask[0];
+       mask[1] = raw_mask[1];
 #else
-       mask[0] = raw_mask & 0xffffffff;
-       mask[1] = raw_mask >> 32;
+       mask[0] = raw_mask[0] & 0xffffffff;
+       mask[1] = raw_mask[0] >> 32;
+       mask[2] = raw_mask[1] & 0xffffffff;
+       mask[3] = raw_mask[1] >> 32;
 #endif
 }
 
index 1e11bb8a95a344e9c7b1add5fe2a9bbc3e66a254..0e497b36f53ea9f63c4fd76221f01599a5c87844 100644 (file)
  * descriptor fetch. Valid for EF10 with PM_AND_RXDP_COUNTERS capability only.
  */
 #define          MC_CMD_MAC_RXDP_HLB_WAIT_CONDITIONS  0x48
+#define          MC_CMD_MAC_VADAPTER_RX_DMABUF_START  0x4c /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_UNICAST_PACKETS  0x4c /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_UNICAST_BYTES  0x4d /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_MULTICAST_PACKETS  0x4e /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_MULTICAST_BYTES  0x4f /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_BROADCAST_PACKETS  0x50 /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_BROADCAST_BYTES  0x51 /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_BAD_PACKETS  0x52 /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_BAD_BYTES  0x53 /* enum */
+#define          MC_CMD_MAC_VADAPTER_RX_OVERFLOW  0x54 /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_DMABUF_START  0x57 /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_UNICAST_PACKETS  0x57 /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_UNICAST_BYTES  0x58 /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_MULTICAST_PACKETS  0x59 /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_MULTICAST_BYTES  0x5a /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_BROADCAST_PACKETS  0x5b /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_BROADCAST_BYTES  0x5c /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_BAD_PACKETS  0x5d /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_BAD_BYTES  0x5e /* enum */
+#define          MC_CMD_MAC_VADAPTER_TX_OVERFLOW  0x5f /* enum */
 /* enum: Start of GMAC stats buffer space, for Siena only. */
 #define          MC_CMD_GMAC_DMABUF_START  0x40
 /* enum: End of GMAC stats buffer space, for Siena only. */
index 8b69a31a0ee4a5d9f34bd832bbcb773581d68c63..31ff9084d9a46624d3a2350a10fdddfc18bbfc08 100644 (file)
@@ -460,6 +460,24 @@ enum {
        EF10_STAT_port_rx_dp_streaming_packets,
        EF10_STAT_port_rx_dp_hlb_fetch,
        EF10_STAT_port_rx_dp_hlb_wait,
+       EF10_STAT_rx_unicast,
+       EF10_STAT_rx_unicast_bytes,
+       EF10_STAT_rx_multicast,
+       EF10_STAT_rx_multicast_bytes,
+       EF10_STAT_rx_broadcast,
+       EF10_STAT_rx_broadcast_bytes,
+       EF10_STAT_rx_bad,
+       EF10_STAT_rx_bad_bytes,
+       EF10_STAT_rx_overflow,
+       EF10_STAT_tx_unicast,
+       EF10_STAT_tx_unicast_bytes,
+       EF10_STAT_tx_multicast,
+       EF10_STAT_tx_multicast_bytes,
+       EF10_STAT_tx_broadcast,
+       EF10_STAT_tx_broadcast_bytes,
+       EF10_STAT_tx_bad,
+       EF10_STAT_tx_bad_bytes,
+       EF10_STAT_tx_overflow,
        EF10_STAT_COUNT
 };