diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 3e70ac758..608395170 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -958,7 +958,7 @@ static int srpt_post_recv(struct srpt_device *sdev, struct srpt_rdma_ch *ch, list.addr = ioctx->ioctx.dma + ioctx->ioctx.offset; list.length = srp_max_req_size; - list.lkey = sdev->mr->lkey; + list.lkey = sdev->lkey; wr.next = NULL; wr.sg_list = &list; @@ -1001,7 +1001,7 @@ static int srpt_post_send(struct srpt_rdma_ch *ch, list.addr = ioctx->ioctx.dma; list.length = len; - list.lkey = sdev->mr->lkey; + list.lkey = sdev->lkey; wr.next = NULL; wr.wr_id = encode_wr_id(SRPT_SEND, ioctx->ioctx.index); @@ -3299,7 +3299,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, while (rsize > 0 && tsize > 0) { sge->addr = dma_addr; - sge->lkey = ch->sport->sdev->mr->lkey; + sge->lkey = ch->sport->sdev->lkey; if (rsize >= dma_len) { sge->length = @@ -4357,6 +4357,7 @@ static void srpt_add_one(struct ib_device *device) pr_err("ib_get_dma_mr() failed: %ld\n", PTR_ERR(sdev->mr)); goto err_pd; } + sdev->lkey = sdev->mr->lkey; sdev->srq_size = min(max(srpt_srq_size, MIN_SRPT_SRQ_SIZE), sdev->dev_attr.max_srq_wr); diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 70c2c1c4c..03c0d5528 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -442,7 +442,8 @@ struct srpt_port { * struct srpt_device - Information associated by SRPT with a single HCA. * @device: Backpointer to the struct ib_device managed by the IB core. * @pd: IB protection domain. - * @mr: L_Key (local key) with write access to all local memory. + * @mr: MR with write access to all local memory. + * @lkey: L_Key (local key) with write access to all local memory. * @srq: Per-HCA SRQ (shared receive queue). * @cm_id: Connection identifier. * @dev_attr: Attributes of the InfiniBand device as obtained during the @@ -460,6 +461,7 @@ struct srpt_device { struct ib_srq *srq; struct ib_cm_id *cm_id; struct ib_device_attr dev_attr; + u32 lkey; int srq_size; bool use_srq; struct srpt_recv_ioctx **ioctx_ring;