net/mlx5: Fix QP fragmented buffer allocation
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / alloc.c
index 323ffe8bf7e473c49261b7446530a7354e69f954..456f30007ad659e98a197f969edd5611b1728127 100644 (file)
@@ -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);