summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
diff options
context:
space:
mode:
authorTariq Toukan <tariqt@mellanox.com>2018-07-08 12:14:59 +0300
committerSaeed Mahameed <saeedm@mellanox.com>2018-07-18 18:16:58 -0700
commitd7037ad73daa9598b8caa7d5fdf41e8ceee6ef73 (patch)
tree45a88454360fce7a902b9e9e53ea638ab233ef09 /drivers/net/ethernet/mellanox/mlx5/core/alloc.c
parent8c49f54a3f48ddb516e7e12e5c065317c06a58fa (diff)
downloadlinux-d7037ad73daa9598b8caa7d5fdf41e8ceee6ef73.tar.gz
linux-d7037ad73daa9598b8caa7d5fdf41e8ceee6ef73.tar.bz2
linux-d7037ad73daa9598b8caa7d5fdf41e8ceee6ef73.zip
net/mlx5: Fix QP fragmented buffer allocation
Fix bad alignment of SQ buffer in fragmented QP allocation. It should start directly after RQ buffer ends. Take special care of the end case where the RQ buffer does not occupy a whole page. RQ size is a power of two, so would be the case only for small RQ sizes (RQ size < PAGE_SIZE). Fix wrong assignments for sqb->size (mistakenly assigned RQ size), and for npages value of RQ and SQ. Fixes: 3a2f70331226 ("net/mlx5: Use order-0 allocations for all WQ types") Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/alloc.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/alloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
index 323ffe8bf7e4..456f30007ad6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
@@ -123,7 +123,7 @@ int mlx5_frag_buf_alloc_node(struct mlx5_core_dev *dev, int size,
int i;
buf->size = size;
- buf->npages = 1 << get_order(size);
+ buf->npages = DIV_ROUND_UP(size, PAGE_SIZE);
buf->page_shift = PAGE_SHIFT;
buf->frags = kcalloc(buf->npages, sizeof(struct mlx5_buf_list),
GFP_KERNEL);