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

sfc: suppress ENOENT error messages from MC_CMD_MAC_STATS

MC_CMD_MAC_STATS can be called on a function before a
vadaptor has been created, as the kernel can call into this
through ndo_get_stats/ndo_get_stats64.

If MC_CMD_MAC_STATS is called before the DMA queues have been
setup, so that a vadaptor has not been created yet, firmware
will return ENOENT. This is expected, so suppress the MCDI
error message in this case.

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
6dd4859b 0fc95fca

+14 -5
+8 -3
drivers/net/ethernet/sfc/ef10.c
··· 1316 1316 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, EVB_PORT_ID_ASSIGNED); 1317 1317 1318 1318 spin_unlock_bh(&efx->stats_lock); 1319 - rc = efx_mcdi_rpc(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), NULL, 1320 - 0, NULL); 1319 + rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), 1320 + NULL, 0, NULL); 1321 1321 spin_lock_bh(&efx->stats_lock); 1322 - if (rc) 1322 + if (rc) { 1323 + /* Expect ENOENT if DMA queues have not been set up */ 1324 + if (rc != -ENOENT || atomic_read(&efx->active_queues)) 1325 + efx_mcdi_display_error(efx, MC_CMD_MAC_STATS, 1326 + sizeof(inbuf), NULL, 0, rc); 1323 1327 goto out; 1328 + } 1324 1329 1325 1330 generation_end = dma_stats[MC_CMD_MAC_GENERATION_END]; 1326 1331 if (generation_end == EFX_MC_STATS_GENERATION_INVALID) {
+6 -2
drivers/net/ethernet/sfc/mcdi_port.c
··· 948 948 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len); 949 949 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, nic_data->vport_id); 950 950 951 - rc = efx_mcdi_rpc(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), 952 - NULL, 0, NULL); 951 + rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), 952 + NULL, 0, NULL); 953 + /* Expect ENOENT if DMA queues have not been set up */ 954 + if (rc && (rc != -ENOENT || atomic_read(&efx->active_queues))) 955 + efx_mcdi_display_error(efx, MC_CMD_MAC_STATS, sizeof(inbuf), 956 + NULL, 0, rc); 953 957 return rc; 954 958 } 955 959