aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-09-05 06:56:18 -0400
committerDoug Ledford <dledford@redhat.com>2016-09-23 13:47:44 -0400
commit8e61212d05963a3beecb8bf124b88a0b13a9600d (patch)
tree904c5382d561b5420d7ddf9912f30284e26b3bf6
parented082d36a7b2c27d1cda55fdfb28af18040c4a89 (diff)
IB/iser: use IB_PD_UNSAFE_GLOBAL_RKEY
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h1
-rw-r--r--drivers/infiniband/ulp/iser/iser_memory.c6
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c22
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 0351059783b1..0be6a7c5ddb5 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 {
374struct iser_device { 374struct iser_device {
375 struct ib_device *ib_device; 375 struct ib_device *ib_device;
376 struct ib_pd *pd; 376 struct ib_pd *pd;
377 struct ib_mr *mr;
378 struct ib_event_handler event_handler; 377 struct ib_event_handler event_handler;
379 struct list_head ig_list; 378 struct list_head ig_list;
380 int refcount; 379 int refcount;
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index 90be56893414..9c3e9ab53a41 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,
199 * FIXME: rework the registration code path to differentiate 199 * FIXME: rework the registration code path to differentiate
200 * rkey/lkey use cases 200 * rkey/lkey use cases
201 */ 201 */
202 reg->rkey = device->mr ? device->mr->rkey : 0; 202
203 if (device->pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY)
204 reg->rkey = device->pd->unsafe_global_rkey;
205 else
206 reg->rkey = 0;
203 reg->sge.addr = ib_sg_dma_address(device->ib_device, &sg[0]); 207 reg->sge.addr = ib_sg_dma_address(device->ib_device, &sg[0]);
204 reg->sge.length = ib_sg_dma_len(device->ib_device, &sg[0]); 208 reg->sge.length = ib_sg_dma_len(device->ib_device, &sg[0]);
205 209
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index e9de99219d74..a4b791dfaa1d 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)
88 device->comps_used, ib_dev->name, 88 device->comps_used, ib_dev->name,
89 ib_dev->num_comp_vectors, max_cqe); 89 ib_dev->num_comp_vectors, max_cqe);
90 90
91 device->pd = ib_alloc_pd(ib_dev, 0); 91 device->pd = ib_alloc_pd(ib_dev,
92 iser_always_reg ? 0 : IB_PD_UNSAFE_GLOBAL_RKEY);
92 if (IS_ERR(device->pd)) 93 if (IS_ERR(device->pd))
93 goto pd_err; 94 goto pd_err;
94 95
@@ -103,26 +104,13 @@ static int iser_create_device_ib_res(struct iser_device *device)
103 } 104 }
104 } 105 }
105 106
106 if (!iser_always_reg) {
107 int access = IB_ACCESS_LOCAL_WRITE |
108 IB_ACCESS_REMOTE_WRITE |
109 IB_ACCESS_REMOTE_READ;
110
111 device->mr = ib_get_dma_mr(device->pd, access);
112 if (IS_ERR(device->mr))
113 goto cq_err;
114 }
115
116 INIT_IB_EVENT_HANDLER(&device->event_handler, ib_dev, 107 INIT_IB_EVENT_HANDLER(&device->event_handler, ib_dev,
117 iser_event_handler); 108 iser_event_handler);
118 if (ib_register_event_handler(&device->event_handler)) 109 if (ib_register_event_handler(&device->event_handler))
119 goto handler_err; 110 goto cq_err;
120 111
121 return 0; 112 return 0;
122 113
123handler_err:
124 if (device->mr)
125 ib_dereg_mr(device->mr);
126cq_err: 114cq_err:
127 for (i = 0; i < device->comps_used; i++) { 115 for (i = 0; i < device->comps_used; i++) {
128 struct iser_comp *comp = &device->comps[i]; 116 struct iser_comp *comp = &device->comps[i];
@@ -154,14 +142,10 @@ static void iser_free_device_ib_res(struct iser_device *device)
154 } 142 }
155 143
156 (void)ib_unregister_event_handler(&device->event_handler); 144 (void)ib_unregister_event_handler(&device->event_handler);
157 if (device->mr)
158 (void)ib_dereg_mr(device->mr);
159 ib_dealloc_pd(device->pd); 145 ib_dealloc_pd(device->pd);
160 146
161 kfree(device->comps); 147 kfree(device->comps);
162 device->comps = NULL; 148 device->comps = NULL;
163
164 device->mr = NULL;
165 device->pd = NULL; 149 device->pd = NULL;
166} 150}
167 151