diff options
author | Eric Dumazet <edumazet@google.com> | 2017-03-08 19:17:10 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-09 20:54:46 +0300 |
commit | acd7628de05c73118aab7ae4847a5b5b2c6999c9 (patch) | |
tree | cf5fdd8b5d863154c34126938872dab684c9aeda /drivers/net/ethernet/mellanox/mlx4/en_rx.c | |
parent | d85f6c14e967b0bddfa9712daa17d79e297d18b8 (diff) | |
download | linux-acd7628de05c73118aab7ae4847a5b5b2c6999c9.tar.xz |
mlx4: reduce rx ring page_cache size
We only need to store the page and dma address.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_rx.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_rx.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index bb33032a280f..453313d404e3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -250,7 +250,10 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, (index << priv->log_rx_info); if (ring->page_cache.index > 0) { - frags[0] = ring->page_cache.buf[--ring->page_cache.index]; + ring->page_cache.index--; + frags[0].page = ring->page_cache.buf[ring->page_cache.index].page; + frags[0].dma = ring->page_cache.buf[ring->page_cache.index].dma; + frags[0].page_offset = XDP_PACKET_HEADROOM; rx_desc->data[0].addr = cpu_to_be64(frags[0].dma + frags[0].page_offset); return 0; @@ -537,7 +540,9 @@ bool mlx4_en_rx_recycle(struct mlx4_en_rx_ring *ring, if (cache->index >= MLX4_EN_CACHE_SIZE) return false; - cache->buf[cache->index++] = *frame; + cache->buf[cache->index].page = frame->page; + cache->buf[cache->index].dma = frame->dma; + cache->index++; return true; } @@ -567,11 +572,9 @@ void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, int i; for (i = 0; i < ring->page_cache.index; i++) { - struct mlx4_en_rx_alloc *frame = &ring->page_cache.buf[i]; - - dma_unmap_page(priv->ddev, frame->dma, frame->page_size, - priv->dma_dir); - put_page(frame->page); + dma_unmap_page(priv->ddev, ring->page_cache.buf[i].dma, + PAGE_SIZE, priv->dma_dir); + put_page(ring->page_cache.buf[i].page); } ring->page_cache.index = 0; mlx4_en_free_rx_buf(priv, ring); |