Commit d8c13f22 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net/mlx4_en: try to use high order pages for RX rings

RX rings can fit most of the time in a contiguous piece of memory,
so lets use kvzalloc_node/kvfree instead of vzalloc_node/vfree

Note that kvzalloc_node() automatically falls back to another node,
there is no need to do the fallback ourselves.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7d99429a
...@@ -291,14 +291,11 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, ...@@ -291,14 +291,11 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
tmp = size * roundup_pow_of_two(MLX4_EN_MAX_RX_FRAGS * tmp = size * roundup_pow_of_two(MLX4_EN_MAX_RX_FRAGS *
sizeof(struct mlx4_en_rx_alloc)); sizeof(struct mlx4_en_rx_alloc));
ring->rx_info = vzalloc_node(tmp, node); ring->rx_info = kvzalloc_node(tmp, GFP_KERNEL, node);
if (!ring->rx_info) {
ring->rx_info = vzalloc(tmp);
if (!ring->rx_info) { if (!ring->rx_info) {
err = -ENOMEM; err = -ENOMEM;
goto err_xdp_info; goto err_xdp_info;
} }
}
en_dbg(DRV, priv, "Allocated rx_info ring at addr:%p size:%d\n", en_dbg(DRV, priv, "Allocated rx_info ring at addr:%p size:%d\n",
ring->rx_info, tmp); ring->rx_info, tmp);
...@@ -318,7 +315,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, ...@@ -318,7 +315,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
return 0; return 0;
err_info: err_info:
vfree(ring->rx_info); kvfree(ring->rx_info);
ring->rx_info = NULL; ring->rx_info = NULL;
err_xdp_info: err_xdp_info:
xdp_rxq_info_unreg(&ring->xdp_rxq); xdp_rxq_info_unreg(&ring->xdp_rxq);
...@@ -447,7 +444,7 @@ void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, ...@@ -447,7 +444,7 @@ void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
bpf_prog_put(old_prog); bpf_prog_put(old_prog);
xdp_rxq_info_unreg(&ring->xdp_rxq); xdp_rxq_info_unreg(&ring->xdp_rxq);
mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE); mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE);
vfree(ring->rx_info); kvfree(ring->rx_info);
ring->rx_info = NULL; ring->rx_info = NULL;
kfree(ring); kfree(ring);
*pring = NULL; *pring = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment