linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 3/6] IB/iser: use IB_PD_UNSAFE_GLOBAL_RKEY
Date: Mon, 29 Aug 2016 12:02:20 +0200	[thread overview]
Message-ID: <1472464943-29450-4-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1472464943-29450-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 drivers/infiniband/ulp/iser/iscsi_iser.h  |  1 -
 drivers/infiniband/ulp/iser/iser_memory.c |  6 +++++-
 drivers/infiniband/ulp/iser/iser_verbs.c  | 22 +++-------------------
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index 0351059..0be6a7c 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -374,7 +374,6 @@ struct iser_reg_ops {
 struct iser_device {
 	struct ib_device             *ib_device;
 	struct ib_pd	             *pd;
-	struct ib_mr	             *mr;
 	struct ib_event_handler      event_handler;
 	struct list_head             ig_list;
 	int                          refcount;
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index 90be568..9c3e9ab 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -199,7 +199,11 @@ iser_reg_dma(struct iser_device *device, struct iser_data_buf *mem,
 	 * FIXME: rework the registration code path to differentiate
 	 * rkey/lkey use cases
 	 */
-	reg->rkey = device->mr ? device->mr->rkey : 0;
+
+	if (device->pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY)
+		reg->rkey = device->pd->unsafe_global_rkey;
+	else
+		reg->rkey = 0;
 	reg->sge.addr = ib_sg_dma_address(device->ib_device, &sg[0]);
 	reg->sge.length = ib_sg_dma_len(device->ib_device, &sg[0]);
 
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index e9de992..a4b791d 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -88,7 +88,8 @@ static int iser_create_device_ib_res(struct iser_device *device)
 		  device->comps_used, ib_dev->name,
 		  ib_dev->num_comp_vectors, max_cqe);
 
-	device->pd = ib_alloc_pd(ib_dev, 0);
+	device->pd = ib_alloc_pd(ib_dev,
+		iser_always_reg ? 0 : IB_PD_UNSAFE_GLOBAL_RKEY);
 	if (IS_ERR(device->pd))
 		goto pd_err;
 
@@ -103,26 +104,13 @@ static int iser_create_device_ib_res(struct iser_device *device)
 		}
 	}
 
-	if (!iser_always_reg) {
-		int access = IB_ACCESS_LOCAL_WRITE |
-			     IB_ACCESS_REMOTE_WRITE |
-			     IB_ACCESS_REMOTE_READ;
-
-		device->mr = ib_get_dma_mr(device->pd, access);
-		if (IS_ERR(device->mr))
-			goto cq_err;
-	}
-
 	INIT_IB_EVENT_HANDLER(&device->event_handler, ib_dev,
 			      iser_event_handler);
 	if (ib_register_event_handler(&device->event_handler))
-		goto handler_err;
+		goto cq_err;
 
 	return 0;
 
-handler_err:
-	if (device->mr)
-		ib_dereg_mr(device->mr);
 cq_err:
 	for (i = 0; i < device->comps_used; i++) {
 		struct iser_comp *comp = &device->comps[i];
@@ -154,14 +142,10 @@ static void iser_free_device_ib_res(struct iser_device *device)
 	}
 
 	(void)ib_unregister_event_handler(&device->event_handler);
-	if (device->mr)
-		(void)ib_dereg_mr(device->mr);
 	ib_dealloc_pd(device->pd);
 
 	kfree(device->comps);
 	device->comps = NULL;
-
-	device->mr = NULL;
 	device->pd = NULL;
 }
 
-- 
2.1.4

--
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

  parent reply	other threads:[~2016-08-29 10:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 10:02 move unsafe global rkey handling to the RDMA core Christoph Hellwig
     [not found] ` <1472464943-29450-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-08-29 10:02   ` [PATCH 1/6] IB/core: rename pd->local_mr to pd->__internal_mr Christoph Hellwig
     [not found]     ` <1472464943-29450-2-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-08-29 15:26       ` Steve Wise
2016-08-29 15:32         ` Steve Wise
2016-08-30 15:32       ` Sagi Grimberg
2016-08-29 10:02   ` [PATCH 2/6] IB/core: add support to create a unsafe global rkey to ib_create_pd Christoph Hellwig
     [not found]     ` <1472464943-29450-3-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-08-29 15:27       ` Steve Wise
2016-08-29 15:32         ` Steve Wise
2016-08-30 15:32       ` Sagi Grimberg
2016-08-29 10:02   ` Christoph Hellwig [this message]
     [not found]     ` <1472464943-29450-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-08-29 15:28       ` [PATCH 3/6] IB/iser: use IB_PD_UNSAFE_GLOBAL_RKEY Steve Wise
2016-08-30 15:33       ` Sagi Grimberg
2016-08-29 10:02   ` [PATCH 4/6] IB/srp: " Christoph Hellwig
     [not found]     ` <1472464943-29450-5-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-08-29 15:29       ` Steve Wise
2016-08-29 17:00       ` Bart Van Assche
     [not found]         ` <df613e79-7c01-5fa6-5586-6f567254224b-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-08-30 12:47           ` Christoph Hellwig
     [not found]             ` <20160830124705.GA7585-jcswGhMUV9g@public.gmane.org>
2016-08-30 15:35               ` Sagi Grimberg
2016-08-31  9:32       ` Max Gurtovoy
     [not found]         ` <bb2a15be-8a22-d889-5eb6-c0f315465507-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-09-05 10:24           ` Christoph Hellwig
2016-08-29 10:02   ` [PATCH 5/6] nvme-rdma: " Christoph Hellwig
     [not found]     ` <1472464943-29450-6-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-08-29 15:30       ` Steve Wise
2016-08-30 15:35       ` Sagi Grimberg
     [not found]         ` <148fd046-c239-a416-8409-202661e19876-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-09-05 10:34           ` Christoph Hellwig
2016-08-29 10:02   ` [PATCH 6/6] IB/core: remove ib_get_dma_mr Christoph Hellwig
     [not found]     ` <1472464943-29450-7-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-08-29 15:32       ` Steve Wise
2016-08-30 15:36       ` Sagi Grimberg
2016-08-29 16:42   ` move unsafe global rkey handling to the RDMA core Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2016-09-05 10:56 move unsafe global rkey handling to the RDMA core V2 Christoph Hellwig
     [not found] ` <1473072981-2035-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-09-05 10:56   ` [PATCH 3/6] IB/iser: use IB_PD_UNSAFE_GLOBAL_RKEY Christoph Hellwig

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=1472464943-29450-4-git-send-email-hch@lst.de \
    --to=hch-jcswghmuv9g@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;
as well as URLs for NNTP newsgroup(s).