aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-09-05 06:56:16 -0400
committerDoug Ledford <dledford@redhat.com>2016-09-23 13:47:44 -0400
commit50d46335b03baa9767e79a6f4757df7bd31eba21 (patch)
tree95a0a3c0926d3fd944045075573a38f08728142e
parent64278fe89b729dddb8dbe5ea52220685f6103d1b (diff)
IB/core: rename pd->local_mr to pd->__internal_mr
This has two reasons: a) to clearly mark that drivers don't have any business using it, and b) because we're going to use it for the (dangerous) global rkey soon, so that drivers don't create on themselves. 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/core/uverbs_cmd.c2
-rw-r--r--drivers/infiniband/core/verbs.c12
-rw-r--r--include/rdma/ib_verbs.h6
3 files changed, 12 insertions, 8 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index f6647318138d..fe784a908817 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -571,7 +571,7 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file,
571 571
572 pd->device = ib_dev; 572 pd->device = ib_dev;
573 pd->uobject = uobj; 573 pd->uobject = uobj;
574 pd->local_mr = NULL; 574 pd->__internal_mr = NULL;
575 atomic_set(&pd->usecnt, 0); 575 atomic_set(&pd->usecnt, 0);
576 576
577 uobj->object = pd; 577 uobj->object = pd;
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index f2b776efab3a..9159ea5ad821 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -237,7 +237,7 @@ struct ib_pd *ib_alloc_pd(struct ib_device *device)
237 237
238 pd->device = device; 238 pd->device = device;
239 pd->uobject = NULL; 239 pd->uobject = NULL;
240 pd->local_mr = NULL; 240 pd->__internal_mr = NULL;
241 atomic_set(&pd->usecnt, 0); 241 atomic_set(&pd->usecnt, 0);
242 242
243 if (device->attrs.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) 243 if (device->attrs.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY)
@@ -251,8 +251,8 @@ struct ib_pd *ib_alloc_pd(struct ib_device *device)
251 return (struct ib_pd *)mr; 251 return (struct ib_pd *)mr;
252 } 252 }
253 253
254 pd->local_mr = mr; 254 pd->__internal_mr = mr;
255 pd->local_dma_lkey = pd->local_mr->lkey; 255 pd->local_dma_lkey = pd->__internal_mr->lkey;
256 } 256 }
257 return pd; 257 return pd;
258} 258}
@@ -270,10 +270,10 @@ void ib_dealloc_pd(struct ib_pd *pd)
270{ 270{
271 int ret; 271 int ret;
272 272
273 if (pd->local_mr) { 273 if (pd->__internal_mr) {
274 ret = ib_dereg_mr(pd->local_mr); 274 ret = ib_dereg_mr(pd->__internal_mr);
275 WARN_ON(ret); 275 WARN_ON(ret);
276 pd->local_mr = NULL; 276 pd->__internal_mr = NULL;
277 } 277 }
278 278
279 /* uverbs manipulates usecnt with proper locking, while the kabi 279 /* uverbs manipulates usecnt with proper locking, while the kabi
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 8e90dd28bb75..38a08dae49c4 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1373,7 +1373,11 @@ struct ib_pd {
1373 struct ib_device *device; 1373 struct ib_device *device;
1374 struct ib_uobject *uobject; 1374 struct ib_uobject *uobject;
1375 atomic_t usecnt; /* count all resources */ 1375 atomic_t usecnt; /* count all resources */
1376 struct ib_mr *local_mr; 1376
1377 /*
1378 * Implementation details of the RDMA core, don't use in drivers:
1379 */
1380 struct ib_mr *__internal_mr;
1377}; 1381};
1378 1382
1379struct ib_xrcd { 1383struct ib_xrcd {