Skip to content

Commit

Permalink
IB/core: rename pd->local_mr to pd->__internal_mr
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Steve Wise <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
Christoph Hellwig authored and dledford committed Sep 23, 2016
1 parent 64278fe commit 50d4633
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/core/uverbs_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file,

pd->device = ib_dev;
pd->uobject = uobj;
pd->local_mr = NULL;
pd->__internal_mr = NULL;
atomic_set(&pd->usecnt, 0);

uobj->object = pd;
Expand Down
12 changes: 6 additions & 6 deletions drivers/infiniband/core/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct ib_pd *ib_alloc_pd(struct ib_device *device)

pd->device = device;
pd->uobject = NULL;
pd->local_mr = NULL;
pd->__internal_mr = NULL;
atomic_set(&pd->usecnt, 0);

if (device->attrs.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY)
Expand All @@ -251,8 +251,8 @@ struct ib_pd *ib_alloc_pd(struct ib_device *device)
return (struct ib_pd *)mr;
}

pd->local_mr = mr;
pd->local_dma_lkey = pd->local_mr->lkey;
pd->__internal_mr = mr;
pd->local_dma_lkey = pd->__internal_mr->lkey;
}
return pd;
}
Expand All @@ -270,10 +270,10 @@ void ib_dealloc_pd(struct ib_pd *pd)
{
int ret;

if (pd->local_mr) {
ret = ib_dereg_mr(pd->local_mr);
if (pd->__internal_mr) {
ret = ib_dereg_mr(pd->__internal_mr);
WARN_ON(ret);
pd->local_mr = NULL;
pd->__internal_mr = NULL;
}

/* uverbs manipulates usecnt with proper locking, while the kabi
Expand Down
6 changes: 5 additions & 1 deletion include/rdma/ib_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,11 @@ struct ib_pd {
struct ib_device *device;
struct ib_uobject *uobject;
atomic_t usecnt; /* count all resources */
struct ib_mr *local_mr;

/*
* Implementation details of the RDMA core, don't use in drivers:
*/
struct ib_mr *__internal_mr;
};

struct ib_xrcd {
Expand Down

0 comments on commit 50d4633

Please sign in to comment.