Commit 74333f12 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

IB/srpt: Cache global L_Key

This patch is a micro-optimization for the hot path.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 7a01d05c
...@@ -766,7 +766,7 @@ static int srpt_post_recv(struct srpt_device *sdev, ...@@ -766,7 +766,7 @@ static int srpt_post_recv(struct srpt_device *sdev,
BUG_ON(!sdev); BUG_ON(!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->pd->local_dma_lkey; list.lkey = sdev->lkey;
ioctx->ioctx.cqe.done = srpt_recv_done; ioctx->ioctx.cqe.done = srpt_recv_done;
wr.wr_cqe = &ioctx->ioctx.cqe; wr.wr_cqe = &ioctx->ioctx.cqe;
...@@ -2343,7 +2343,7 @@ static void srpt_queue_response(struct se_cmd *cmd) ...@@ -2343,7 +2343,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
sge.addr = ioctx->ioctx.dma; sge.addr = ioctx->ioctx.dma;
sge.length = resp_len; sge.length = resp_len;
sge.lkey = sdev->pd->local_dma_lkey; sge.lkey = sdev->lkey;
ioctx->ioctx.cqe.done = srpt_send_done; ioctx->ioctx.cqe.done = srpt_send_done;
send_wr.next = NULL; send_wr.next = NULL;
...@@ -2491,6 +2491,8 @@ static void srpt_add_one(struct ib_device *device) ...@@ -2491,6 +2491,8 @@ 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->lkey = sdev->pd->local_dma_lkey;
sdev->srq_size = min(srpt_srq_size, sdev->device->attrs.max_srq_wr); sdev->srq_size = min(srpt_srq_size, sdev->device->attrs.max_srq_wr);
srq_attr.event_handler = srpt_srq_event; srq_attr.event_handler = srpt_srq_event;
......
...@@ -343,7 +343,7 @@ struct srpt_port { ...@@ -343,7 +343,7 @@ struct srpt_port {
* struct srpt_device - Information associated by SRPT with a single HCA. * struct srpt_device - Information associated by SRPT with a single HCA.
* @device: Backpointer to the struct ib_device managed by the IB core. * @device: Backpointer to the struct ib_device managed by the IB core.
* @pd: IB protection domain. * @pd: IB protection domain.
* @mr: L_Key (local key) 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). * @srq: Per-HCA SRQ (shared receive queue).
* @cm_id: Connection identifier. * @cm_id: Connection identifier.
* @srq_size: SRQ size. * @srq_size: SRQ size.
...@@ -358,6 +358,7 @@ struct srpt_port { ...@@ -358,6 +358,7 @@ 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;
u32 lkey;
struct ib_srq *srq; struct ib_srq *srq;
struct ib_cm_id *cm_id; struct ib_cm_id *cm_id;
int srq_size; int srq_size;
......
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