/* This call is responsible for hooking in the MAC and PHY operations */ static int siena_probe_port(struct efx_nic *efx) { int rc; /* Hook in PHY operations table */ efx->phy_op = &efx_mcdi_phy_ops; /* Set up MDIO structure for PHY */ efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; efx->mdio.mdio_read = siena_mdio_read; efx->mdio.mdio_write = siena_mdio_write; /* Fill out MDIO structure, loopback modes, and initial link state */ rc = efx->phy_op->probe(efx); if (rc != 0) return rc; /* Allocate buffer for stats */ rc = efx_nic_alloc_buffer(efx, &efx->stats_buffer, MC_CMD_MAC_NSTATS * sizeof(u64)); if (rc) return rc; netif_dbg(efx, probe, efx->net_dev, "stats buffer at %llx (virt %p phys %llx)\n", (u64)efx->stats_buffer.dma_addr, efx->stats_buffer.addr, (u64)virt_to_phys(efx->stats_buffer.addr)); efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, 0, 0, 1); return 0; }
void efx_mcdi_mac_start_stats(struct efx_nic *efx) { __le64 *dma_stats = efx->stats_buffer.addr; dma_stats[MC_CMD_MAC_GENERATION_END] = EFX_MC_STATS_GENERATION_INVALID; efx_mcdi_mac_stats(efx, EFX_STATS_ENABLE, 0); }
static void siena_start_nic_stats(struct efx_nic *efx) { u64 *dma_stats = (u64 *)efx->stats_buffer.addr; dma_stats[MC_CMD_MAC_GENERATION_END] = STATS_GENERATION_INVALID; efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, MC_CMD_MAC_NSTATS * sizeof(u64), 1, 0); }
void efx_mcdi_mac_pull_stats(struct efx_nic *efx) { __le64 *dma_stats = efx->stats_buffer.addr; int attempts = EFX_MAC_STATS_WAIT_ATTEMPTS; dma_stats[MC_CMD_MAC_GENERATION_END] = EFX_MC_STATS_GENERATION_INVALID; efx_mcdi_mac_stats(efx, EFX_STATS_PULL, 0); while (dma_stats[MC_CMD_MAC_GENERATION_END] == EFX_MC_STATS_GENERATION_INVALID && attempts-- != 0) udelay(EFX_MAC_STATS_WAIT_US); }
static void siena_stop_nic_stats(struct efx_nic *efx) { efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, 0, 0, 0); }
void efx_mcdi_mac_stop_stats(struct efx_nic *efx) { efx_mcdi_mac_stats(efx, EFX_STATS_DISABLE, 0); }