Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: suppress vadaptor stats when EVB is not present

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>

authored by

Daniel Pieczko and committed by
David S. Miller
d94619cd 6dd4859b

+11 -3
+9 -3
drivers/net/ethernet/sfc/ef10.c
··· 1162 1162 1163 1163 static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) 1164 1164 { 1165 + struct efx_ef10_nic_data *nic_data = efx->nic_data; 1165 1166 u64 raw_mask[2]; 1166 1167 1167 1168 raw_mask[0] = efx_ef10_raw_stat_mask(efx); 1168 1169 1169 - /* All functions see the vadaptor stats */ 1170 - raw_mask[0] |= ~((1ULL << EF10_STAT_rx_unicast) - 1); 1171 - raw_mask[1] = (1ULL << (EF10_STAT_COUNT - 63)) - 1; 1170 + /* Only show vadaptor stats when EVB capability is present */ 1171 + if (nic_data->datapath_caps & 1172 + (1 << MC_CMD_GET_CAPABILITIES_OUT_EVB_LBN)) { 1173 + raw_mask[0] |= ~((1ULL << EF10_STAT_rx_unicast) - 1); 1174 + raw_mask[1] = (1ULL << (EF10_STAT_COUNT - 63)) - 1; 1175 + } else { 1176 + raw_mask[1] = 0; 1177 + } 1172 1178 1173 1179 #if BITS_PER_LONG == 64 1174 1180 mask[0] = raw_mask[0];
+2
drivers/net/ethernet/sfc/mcdi_pcol.h
··· 5600 5600 #define MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_WIDTH 1 5601 5601 #define MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_LBN 27 5602 5602 #define MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_WIDTH 1 5603 + #define MC_CMD_GET_CAPABILITIES_OUT_EVB_LBN 30 5604 + #define MC_CMD_GET_CAPABILITIES_OUT_EVB_WIDTH 1 5603 5605 /* RxDPCPU firmware id. */ 5604 5606 #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_OFST 4 5605 5607 #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_LEN 2