From: Bart Van Assche <bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Bart Van Assche <bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
Subject: [PATCH v2 3/8] IB/srpt: Cache global L_Key
Date: Wed, 11 Oct 2017 10:27:24 -0700 [thread overview]
Message-ID: <20171011172729.16984-4-bart.vanassche@wdc.com> (raw)
In-Reply-To: <20171011172729.16984-1-bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
This patch is a micro-optimization for the hot path.
Signed-off-by: Bart Van Assche <bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 6 ++++--
drivers/infiniband/ulp/srpt/ib_srpt.h | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 76370e39857d..6cf95ad870cc 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -766,7 +766,7 @@ static int srpt_post_recv(struct srpt_device *sdev,
BUG_ON(!sdev);
list.addr = ioctx->ioctx.dma;
list.length = srp_max_req_size;
- list.lkey = sdev->pd->local_dma_lkey;
+ list.lkey = sdev->lkey;
ioctx->ioctx.cqe.done = srpt_recv_done;
wr.wr_cqe = &ioctx->ioctx.cqe;
@@ -2343,7 +2343,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
sge.addr = ioctx->ioctx.dma;
sge.length = resp_len;
- sge.lkey = sdev->pd->local_dma_lkey;
+ sge.lkey = sdev->lkey;
ioctx->ioctx.cqe.done = srpt_send_done;
send_wr.next = NULL;
@@ -2491,6 +2491,8 @@ static void srpt_add_one(struct ib_device *device)
if (IS_ERR(sdev->pd))
goto free_dev;
+ sdev->lkey = sdev->pd->local_dma_lkey;
+
sdev->srq_size = min(srpt_srq_size, sdev->device->attrs.max_srq_wr);
srq_attr.event_handler = srpt_srq_event;
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h
index 1b817e51b84b..976e924d7400 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -343,7 +343,7 @@ 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.
+ * @lkey: L_Key (local key) with write access to all local memory.
* @srq: Per-HCA SRQ (shared receive queue).
* @cm_id: Connection identifier.
* @srq_size: SRQ size.
@@ -358,6 +358,7 @@ struct srpt_port {
struct srpt_device {
struct ib_device *device;
struct ib_pd *pd;
+ u32 lkey;
struct ib_srq *srq;
struct ib_cm_id *cm_id;
int srq_size;
--
2.14.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-10-11 17:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 17:27 [PATCH v2 0/8] SRP patches for kernel v4.15 Bart Van Assche
2017-10-11 17:27 ` [PATCH v2 5/8] IB/srp: Avoid that a cable pull can trigger a kernel crash Bart Van Assche
[not found] ` <20171011172729.16984-1-bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
2017-10-11 17:27 ` [PATCH v2 1/8] IB/srpt: Do not accept invalid initiator port names Bart Van Assche
2017-10-11 17:27 ` [PATCH v2 2/8] IB/srpt: Limit the send and receive queue sizes to what the HCA supports Bart Van Assche
2017-10-11 17:27 ` Bart Van Assche [this message]
2017-10-11 17:27 ` [PATCH v2 4/8] IB/srpt: Change default behavior from using SRQ to using RC Bart Van Assche
[not found] ` <20171011172729.16984-5-bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
2017-11-02 18:30 ` Marciniszyn, Mike
[not found] ` <32E1700B9017364D9B60AED9960492BC6266931A-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-11-02 21:41 ` Bart Van Assche
[not found] ` <1509658914.2484.21.camel-Sjgp3cTcYWE@public.gmane.org>
2017-11-03 13:05 ` Marciniszyn, Mike
2017-11-03 15:46 ` Marciniszyn, Mike
2017-11-03 16:01 ` Marciniszyn, Mike
[not found] ` <32E1700B9017364D9B60AED9960492BC6266E41A-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-11-03 16:10 ` Bart Van Assche
[not found] ` <1509725458.2473.23.camel-Sjgp3cTcYWE@public.gmane.org>
2017-11-03 16:13 ` Marciniszyn, Mike
2017-11-03 19:53 ` Marciniszyn, Mike
[not found] ` <32E1700B9017364D9B60AED9960492BC626708EE-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-11-13 19:56 ` Doug Ledford
2017-10-11 17:27 ` [PATCH v2 6/8] IB/srp: Remove second argument of srp_destroy_qp() Bart Van Assche
2017-10-11 17:27 ` [PATCH v2 7/8] IB/srp: Cache global rkey Bart Van Assche
2017-10-11 17:27 ` [PATCH v2 8/8] IB/srp: Make CM timeout dependent on subnet timeout Bart Van Assche
2017-10-18 14:50 ` [PATCH v2 0/8] SRP patches for kernel v4.15 Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171011172729.16984-4-bart.vanassche@wdc.com \
--to=bart.vanassche-sjgp3ctcywe@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox