IB/mlx5: Remove ib_get_dma_mr calls
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Thu, 30 Jul 2015 23:22:19 +0000 (17:22 -0600)
committerDoug Ledford <dledford@redhat.com>
Sun, 30 Aug 2015 22:12:34 +0000 (18:12 -0400)
The pd now has a local_dma_lkey member which completely replaces
ib_get_dma_mr, use it instead.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/mr.c

index ce7587538badd8689ec6212156b0dc4fe7aebc49..41d6911e244e1765a34b77fe067cf4e4ddeab172 100644 (file)
@@ -1123,7 +1123,6 @@ static void destroy_umrc_res(struct mlx5_ib_dev *dev)
 
        mlx5_ib_destroy_qp(dev->umrc.qp);
        ib_destroy_cq(dev->umrc.cq);
-       ib_dereg_mr(dev->umrc.mr);
        ib_dealloc_pd(dev->umrc.pd);
 }
 
@@ -1138,7 +1137,6 @@ static int create_umr_res(struct mlx5_ib_dev *dev)
        struct ib_pd *pd;
        struct ib_cq *cq;
        struct ib_qp *qp;
-       struct ib_mr *mr;
        struct ib_cq_init_attr cq_attr = {};
        int ret;
 
@@ -1156,13 +1154,6 @@ static int create_umr_res(struct mlx5_ib_dev *dev)
                goto error_0;
        }
 
-       mr = ib_get_dma_mr(pd,  IB_ACCESS_LOCAL_WRITE);
-       if (IS_ERR(mr)) {
-               mlx5_ib_dbg(dev, "Couldn't create DMA MR for sync UMR QP\n");
-               ret = PTR_ERR(mr);
-               goto error_1;
-       }
-
        cq_attr.cqe = 128;
        cq = ib_create_cq(&dev->ib_dev, mlx5_umr_cq_handler, NULL, NULL,
                          &cq_attr);
@@ -1220,7 +1211,6 @@ static int create_umr_res(struct mlx5_ib_dev *dev)
 
        dev->umrc.qp = qp;
        dev->umrc.cq = cq;
-       dev->umrc.mr = mr;
        dev->umrc.pd = pd;
 
        sema_init(&dev->umrc.sem, MAX_UMR_WR);
@@ -1242,9 +1232,6 @@ error_3:
        ib_destroy_cq(cq);
 
 error_2:
-       ib_dereg_mr(mr);
-
-error_1:
        ib_dealloc_pd(pd);
 
 error_0:
index 62b06ae2c87db63f782348512e459af53284b644..a5fa0b9c7580295146037408a247c13b273ec6d5 100644 (file)
@@ -349,7 +349,6 @@ struct umr_common {
        struct ib_pd    *pd;
        struct ib_cq    *cq;
        struct ib_qp    *qp;
-       struct ib_mr    *mr;
        /* control access to UMR QP
         */
        struct semaphore        sem;
index dad82db892210ac5f6d25de6632c6fb2be85ebee..0dfd379b9bad5a550689671f9fc093ff6cb3fa8a 100644 (file)
@@ -687,12 +687,11 @@ static void prep_umr_reg_wqe(struct ib_pd *pd, struct ib_send_wr *wr,
                             int access_flags)
 {
        struct mlx5_ib_dev *dev = to_mdev(pd->device);
-       struct ib_mr *mr = dev->umrc.mr;
        struct mlx5_umr_wr *umrwr = (struct mlx5_umr_wr *)&wr->wr.fast_reg;
 
        sg->addr = dma;
        sg->length = ALIGN(sizeof(u64) * n, 64);
-       sg->lkey = mr->lkey;
+       sg->lkey = dev->umrc.pd->local_dma_lkey;
 
        wr->next = NULL;
        wr->send_flags = 0;
@@ -923,7 +922,7 @@ int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index, int npages,
                sg.addr = dma;
                sg.length = ALIGN(npages * sizeof(u64),
                                MLX5_UMR_MTT_ALIGNMENT);
-               sg.lkey = dev->umrc.mr->lkey;
+               sg.lkey = dev->umrc.pd->local_dma_lkey;
 
                wr.send_flags = MLX5_IB_SEND_UMR_FAIL_IF_FREE |
                                MLX5_IB_SEND_UMR_UPDATE_MTT;