Commit 5a783956 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Doug Ledford

ib_srpt: Remove ib_get_dma_mr calls

The pd now has a local_dma_lkey member which completely replaces
ib_get_dma_mr, use it instead.
Signed-off-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent e6bf5f48
...@@ -783,7 +783,7 @@ static int srpt_post_recv(struct srpt_device *sdev, ...@@ -783,7 +783,7 @@ static int srpt_post_recv(struct srpt_device *sdev,
list.addr = ioctx->ioctx.dma; list.addr = ioctx->ioctx.dma;
list.length = srp_max_req_size; list.length = srp_max_req_size;
list.lkey = sdev->mr->lkey; list.lkey = sdev->pd->local_dma_lkey;
wr.next = NULL; wr.next = NULL;
wr.sg_list = &list; wr.sg_list = &list;
...@@ -818,7 +818,7 @@ static int srpt_post_send(struct srpt_rdma_ch *ch, ...@@ -818,7 +818,7 @@ static int srpt_post_send(struct srpt_rdma_ch *ch,
list.addr = ioctx->ioctx.dma; list.addr = ioctx->ioctx.dma;
list.length = len; list.length = len;
list.lkey = sdev->mr->lkey; list.lkey = sdev->pd->local_dma_lkey;
wr.next = NULL; wr.next = NULL;
wr.wr_id = encode_wr_id(SRPT_SEND, ioctx->ioctx.index); wr.wr_id = encode_wr_id(SRPT_SEND, ioctx->ioctx.index);
...@@ -1206,7 +1206,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, ...@@ -1206,7 +1206,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
while (rsize > 0 && tsize > 0) { while (rsize > 0 && tsize > 0) {
sge->addr = dma_addr; sge->addr = dma_addr;
sge->lkey = ch->sport->sdev->mr->lkey; sge->lkey = ch->sport->sdev->pd->local_dma_lkey;
if (rsize >= dma_len) { if (rsize >= dma_len) {
sge->length = sge->length =
...@@ -3211,10 +3211,6 @@ static void srpt_add_one(struct ib_device *device) ...@@ -3211,10 +3211,6 @@ static void srpt_add_one(struct ib_device *device)
if (IS_ERR(sdev->pd)) if (IS_ERR(sdev->pd))
goto free_dev; goto free_dev;
sdev->mr = ib_get_dma_mr(sdev->pd, IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(sdev->mr))
goto err_pd;
sdev->srq_size = min(srpt_srq_size, sdev->dev_attr.max_srq_wr); sdev->srq_size = min(srpt_srq_size, sdev->dev_attr.max_srq_wr);
srq_attr.event_handler = srpt_srq_event; srq_attr.event_handler = srpt_srq_event;
...@@ -3226,7 +3222,7 @@ static void srpt_add_one(struct ib_device *device) ...@@ -3226,7 +3222,7 @@ static void srpt_add_one(struct ib_device *device)
sdev->srq = ib_create_srq(sdev->pd, &srq_attr); sdev->srq = ib_create_srq(sdev->pd, &srq_attr);
if (IS_ERR(sdev->srq)) if (IS_ERR(sdev->srq))
goto err_mr; goto err_pd;
pr_debug("%s: create SRQ #wr= %d max_allow=%d dev= %s\n", pr_debug("%s: create SRQ #wr= %d max_allow=%d dev= %s\n",
__func__, sdev->srq_size, sdev->dev_attr.max_srq_wr, __func__, sdev->srq_size, sdev->dev_attr.max_srq_wr,
...@@ -3311,8 +3307,6 @@ static void srpt_add_one(struct ib_device *device) ...@@ -3311,8 +3307,6 @@ static void srpt_add_one(struct ib_device *device)
ib_destroy_cm_id(sdev->cm_id); ib_destroy_cm_id(sdev->cm_id);
err_srq: err_srq:
ib_destroy_srq(sdev->srq); ib_destroy_srq(sdev->srq);
err_mr:
ib_dereg_mr(sdev->mr);
err_pd: err_pd:
ib_dealloc_pd(sdev->pd); ib_dealloc_pd(sdev->pd);
free_dev: free_dev:
...@@ -3357,7 +3351,6 @@ static void srpt_remove_one(struct ib_device *device, void *client_data) ...@@ -3357,7 +3351,6 @@ static void srpt_remove_one(struct ib_device *device, void *client_data)
srpt_release_sdev(sdev); srpt_release_sdev(sdev);
ib_destroy_srq(sdev->srq); ib_destroy_srq(sdev->srq);
ib_dereg_mr(sdev->mr);
ib_dealloc_pd(sdev->pd); ib_dealloc_pd(sdev->pd);
srpt_free_ioctx_ring((struct srpt_ioctx **)sdev->ioctx_ring, sdev, srpt_free_ioctx_ring((struct srpt_ioctx **)sdev->ioctx_ring, sdev,
......
...@@ -393,7 +393,6 @@ struct srpt_port { ...@@ -393,7 +393,6 @@ struct srpt_port {
struct srpt_device { struct srpt_device {
struct ib_device *device; struct ib_device *device;
struct ib_pd *pd; struct ib_pd *pd;
struct ib_mr *mr;
struct ib_srq *srq; struct ib_srq *srq;
struct ib_cm_id *cm_id; struct ib_cm_id *cm_id;
struct ib_device_attr dev_attr; struct ib_device_attr dev_attr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment