net/sfc: size MAC stats DMA buffer to support Medford2
authorAndrew Rybchenko <arybchenko@solarflare.com>
Tue, 20 Feb 2018 07:34:02 +0000 (07:34 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:42 +0000 (14:08 +0200)
Medford2 supports more MAC stats than previous HW. So DMA
buffer must be sized properly.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/sfc_port.c

index c423f52..0272b55 100644 (file)
@@ -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;