|
@@ -140,14 +140,18 @@ static int mlx4_ib_get_cq_umem(struct mlx4_ib_dev *dev, struct ib_ucontext *cont
|
|
{
|
|
{
|
|
int err;
|
|
int err;
|
|
int cqe_size = dev->dev->caps.cqe_size;
|
|
int cqe_size = dev->dev->caps.cqe_size;
|
|
|
|
+ int shift;
|
|
|
|
+ int n;
|
|
|
|
|
|
*umem = ib_umem_get(context, buf_addr, cqe * cqe_size,
|
|
*umem = ib_umem_get(context, buf_addr, cqe * cqe_size,
|
|
IB_ACCESS_LOCAL_WRITE, 1);
|
|
IB_ACCESS_LOCAL_WRITE, 1);
|
|
if (IS_ERR(*umem))
|
|
if (IS_ERR(*umem))
|
|
return PTR_ERR(*umem);
|
|
return PTR_ERR(*umem);
|
|
|
|
|
|
- err = mlx4_mtt_init(dev->dev, ib_umem_page_count(*umem),
|
|
|
|
- (*umem)->page_shift, &buf->mtt);
|
|
|
|
|
|
+ n = ib_umem_page_count(*umem);
|
|
|
|
+ shift = mlx4_ib_umem_calc_optimal_mtt_size(*umem, 0, &n);
|
|
|
|
+ err = mlx4_mtt_init(dev->dev, n, shift, &buf->mtt);
|
|
|
|
+
|
|
if (err)
|
|
if (err)
|
|
goto err_buf;
|
|
goto err_buf;
|
|
|
|
|