IB/mlx4: Remove ib_get_dma_mr calls
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Thu, 30 Jul 2015 23:22:18 +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/mlx4/mad.c
drivers/infiniband/hw/mlx4/mlx4_ib.h

index 68b3dfa922bf3e01ce3c00a60674ca508fd50912..1cd75ff0225193c475c9a9debe2ccedcf9bdb8b8 100644 (file)
@@ -580,7 +580,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
 
        list.addr = tun_qp->tx_ring[tun_tx_ix].buf.map;
        list.length = sizeof (struct mlx4_rcv_tunnel_mad);
-       list.lkey = tun_ctx->mr->lkey;
+       list.lkey = tun_ctx->pd->local_dma_lkey;
 
        wr.wr.ud.ah = ah;
        wr.wr.ud.port_num = port;
@@ -1133,7 +1133,7 @@ static int mlx4_ib_post_pv_qp_buf(struct mlx4_ib_demux_pv_ctx *ctx,
 
        sg_list.addr = tun_qp->ring[index].map;
        sg_list.length = size;
-       sg_list.lkey = ctx->mr->lkey;
+       sg_list.lkey = ctx->pd->local_dma_lkey;
 
        recv_wr.next = NULL;
        recv_wr.sg_list = &sg_list;
@@ -1244,7 +1244,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port,
 
        list.addr = sqp->tx_ring[wire_tx_ix].buf.map;
        list.length = sizeof (struct mlx4_mad_snd_buf);
-       list.lkey = sqp_ctx->mr->lkey;
+       list.lkey = sqp_ctx->pd->local_dma_lkey;
 
        wr.wr.ud.ah = ah;
        wr.wr.ud.port_num = port;
@@ -1827,19 +1827,12 @@ static int create_pv_resources(struct ib_device *ibdev, int slave, int port,
                goto err_cq;
        }
 
-       ctx->mr = ib_get_dma_mr(ctx->pd, IB_ACCESS_LOCAL_WRITE);
-       if (IS_ERR(ctx->mr)) {
-               ret = PTR_ERR(ctx->mr);
-               pr_err("Couldn't get tunnel DMA MR (%d)\n", ret);
-               goto err_pd;
-       }
-
        if (ctx->has_smi) {
                ret = create_pv_sqp(ctx, IB_QPT_SMI, create_tun);
                if (ret) {
                        pr_err("Couldn't create %s QP0 (%d)\n",
                               create_tun ? "tunnel for" : "",  ret);
-                       goto err_mr;
+                       goto err_pd;
                }
        }
 
@@ -1876,10 +1869,6 @@ err_qp0:
                ib_destroy_qp(ctx->qp[0].qp);
        ctx->qp[0].qp = NULL;
 
-err_mr:
-       ib_dereg_mr(ctx->mr);
-       ctx->mr = NULL;
-
 err_pd:
        ib_dealloc_pd(ctx->pd);
        ctx->pd = NULL;
@@ -1916,8 +1905,6 @@ static void destroy_pv_resources(struct mlx4_ib_dev *dev, int slave, int port,
                ib_destroy_qp(ctx->qp[1].qp);
                ctx->qp[1].qp = NULL;
                mlx4_ib_free_pv_qp_bufs(ctx, IB_QPT_GSI, 1);
-               ib_dereg_mr(ctx->mr);
-               ctx->mr = NULL;
                ib_dealloc_pd(ctx->pd);
                ctx->pd = NULL;
                ib_destroy_cq(ctx->cq);
@@ -2050,8 +2037,6 @@ static void mlx4_ib_free_sqp_ctx(struct mlx4_ib_demux_pv_ctx *sqp_ctx)
                ib_destroy_qp(sqp_ctx->qp[1].qp);
                sqp_ctx->qp[1].qp = NULL;
                mlx4_ib_free_pv_qp_bufs(sqp_ctx, IB_QPT_GSI, 0);
-               ib_dereg_mr(sqp_ctx->mr);
-               sqp_ctx->mr = NULL;
                ib_dealloc_pd(sqp_ctx->pd);
                sqp_ctx->pd = NULL;
                ib_destroy_cq(sqp_ctx->cq);
index cb47c2cb84ca4aa1c4d41a3076303d88b9c1f2c1..fe52ead0ebda029f413cd9d2f75df245181ba7a3 100644 (file)
@@ -415,7 +415,6 @@ struct mlx4_ib_demux_pv_ctx {
        struct ib_device *ib_dev;
        struct ib_cq *cq;
        struct ib_pd *pd;
-       struct ib_mr *mr;
        struct work_struct work;
        struct workqueue_struct *wq;
        struct mlx4_ib_demux_pv_qp qp[2];