From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/6] IB/core: rename pd->local_mr to pd->__internal_mr
Date: Mon, 5 Sep 2016 12:56:16 +0200 [thread overview]
Message-ID: <1473072981-2035-2-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1473072981-2035-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
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-jcswGhMUV9g@public.gmane.org>
Reviewed-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
drivers/infiniband/core/uverbs_cmd.c | 2 +-
drivers/infiniband/core/verbs.c | 12 ++++++------
include/rdma/ib_verbs.h | 6 +++++-
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index f664731..fe784a9 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,
pd->device = ib_dev;
pd->uobject = uobj;
- pd->local_mr = NULL;
+ pd->__internal_mr = NULL;
atomic_set(&pd->usecnt, 0);
uobj->object = pd;
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index f2b776e..9159ea5 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)
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)
@@ -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;
}
@@ -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
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 8e90dd2..38a08dae 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -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 {
--
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
next prev parent reply other threads:[~2016-09-05 10:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Christoph Hellwig [this message]
2016-09-05 10:56 ` [PATCH 2/6] IB/core: add support to create a unsafe global rkey to ib_create_pd Christoph Hellwig
2016-09-05 10:56 ` [PATCH 3/6] IB/iser: use IB_PD_UNSAFE_GLOBAL_RKEY Christoph Hellwig
2016-09-05 10:56 ` [PATCH 4/6] IB/srp: " Christoph Hellwig
[not found] ` <1473072981-2035-5-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-09-05 11:39 ` Max Gurtovoy
2016-09-05 10:56 ` [PATCH 5/6] nvme-rdma: " Christoph Hellwig
2016-09-05 10:56 ` [PATCH 6/6] IB/core: remove ib_get_dma_mr Christoph Hellwig
2016-09-19 15:54 ` move unsafe global rkey handling to the RDMA core V2 Christoph Hellwig
[not found] ` <20160919155459.GA5547-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-09-23 17:48 ` Doug Ledford
-- strict thread matches above, loose matches on Subject: below --
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
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=1473072981-2035-2-git-send-email-hch@lst.de \
--to=hch-jcswghmuv9g@public.gmane.org \
--cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@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).