From c953aea983c6e2175074f97fde76806072d7970a Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 20 Feb 2018 07:34:02 +0000 Subject: [PATCH] net/sfc: size MAC stats DMA buffer to support Medford2 Medford2 supports more MAC stats than previous HW. So DMA buffer must be sized properly. Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_port.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index c423f52741..0272b553d3 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -323,6 +323,8 @@ sfc_port_attach(struct sfc_adapter *sa) struct sfc_port *port = &sa->port; const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); const struct ether_addr *from; + uint32_t mac_nstats; + size_t mac_stats_size; long kvarg_stats_update_period_ms; int rc; @@ -358,7 +360,9 @@ sfc_port_attach(struct sfc_adapter *sa) if (port->mac_stats_buf == NULL) goto fail_mac_stats_buf_alloc; - rc = sfc_dma_alloc(sa, "mac_stats", 0, EFX_MAC_STATS_SIZE, + mac_nstats = efx_nic_cfg_get(sa->nic)->enc_mac_stats_nstats; + mac_stats_size = RTE_ALIGN(mac_nstats * sizeof(uint64_t), EFX_BUF_SIZE); + rc = sfc_dma_alloc(sa, "mac_stats", 0, mac_stats_size, sa->socket_id, &port->mac_stats_dma_mem); if (rc != 0) goto fail_mac_stats_dma_alloc; -- 2.20.1