linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Erez Alfasi <ereza@mellanox.com>
Subject: [PATCH rdma-next 2/6] RDMA/umem: Add ODP type indicator within ib_umem_odp
Date: Wed,  7 Aug 2019 13:33:59 +0300	[thread overview]
Message-ID: <20190807103403.8102-3-leon@kernel.org> (raw)
In-Reply-To: <20190807103403.8102-1-leon@kernel.org>

From: Erez Alfasi <ereza@mellanox.com>

ODP type can be divided into 2 subclasses:
Explicit and Implicit ODP.

Adding a type enums and an odp type flag within
ib_umem_odp will give us an indication whether a
given MR is ODP implicit/explicit registered.

Signed-off-by: Erez Alfasi <ereza@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/umem.c    |  1 +
 include/rdma/ib_umem_odp.h        | 14 ++++++++++++++
 include/uapi/rdma/ib_user_verbs.h |  5 +++++
 3 files changed, 20 insertions(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 08da840ed7ee..04b737739b74 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -236,6 +236,7 @@ struct ib_umem *ib_umem_get(struct ib_udata *udata, unsigned long addr,
 		if (!umem)
 			return ERR_PTR(-ENOMEM);
 		umem->is_odp = 1;
+		ib_umem_odp_set_type(to_ib_umem_odp(umem), addr, size);
 	} else {
 		umem = kzalloc(sizeof(*umem), GFP_KERNEL);
 		if (!umem)
diff --git a/include/rdma/ib_umem_odp.h b/include/rdma/ib_umem_odp.h
index 479db5c98ff6..81dc53a2848c 100644
--- a/include/rdma/ib_umem_odp.h
+++ b/include/rdma/ib_umem_odp.h
@@ -67,6 +67,11 @@ struct ib_umem_odp {
 	struct mutex		umem_mutex;
 	void			*private; /* for the HW driver to use. */
 
+	/*
+	 * ODP type indicator e.g. implicit/explicit.
+	 */
+	u8			type;
+
 	int notifiers_seq;
 	int notifiers_count;
 	int npages;
@@ -104,6 +109,15 @@ static inline size_t ib_umem_odp_num_pages(struct ib_umem_odp *umem_odp)
 	       umem_odp->page_shift;
 }
 
+static inline void ib_umem_odp_set_type(struct ib_umem_odp *umem_odp,
+					unsigned long start, size_t end)
+{
+	if (!start && !end)
+		umem_odp->type = IB_ODP_TYPE_IMPLICIT;
+	else
+		umem_odp->type = IB_ODP_TYPE_EXPLICIT;
+}
+
 /*
  * The lower 2 bits of the DMA address signal the R/W permissions for
  * the entry. To upgrade the permissions, provide the appropriate
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 0474c7400268..42c9bda21f16 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -46,6 +46,11 @@
 #define IB_USER_VERBS_ABI_VERSION	6
 #define IB_USER_VERBS_CMD_THRESHOLD    50
 
+enum ib_odp_type {
+	IB_ODP_TYPE_IMPLICIT,
+	IB_ODP_TYPE_EXPLICIT,
+};
+
 enum ib_uverbs_write_cmds {
 	IB_USER_VERBS_CMD_GET_CONTEXT,
 	IB_USER_VERBS_CMD_QUERY_DEVICE,
-- 
2.20.1


  parent reply	other threads:[~2019-08-07 10:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 10:33 [PATCH rdma-next 0/6] ODP information and statistics Leon Romanovsky
2019-08-07 10:33 ` [PATCH rdma-next 1/6] RDMA: Embed umem within core MR Leon Romanovsky
2019-08-14  9:33   ` Devesh Sharma
2019-08-07 10:33 ` Leon Romanovsky [this message]
2019-08-07 11:23   ` [PATCH rdma-next 2/6] RDMA/umem: Add ODP type indicator within ib_umem_odp Gal Pressman
2019-08-07 11:44     ` Jason Gunthorpe
2019-08-07 11:49       ` Gal Pressman
2019-08-07 11:44   ` Jason Gunthorpe
2019-08-07 12:13     ` Leon Romanovsky
2019-08-07 12:35       ` Jason Gunthorpe
2019-08-07 13:12         ` Leon Romanovsky
2019-08-12 10:53           ` Leon Romanovsky
2019-08-12 12:11             ` Jason Gunthorpe
2019-08-12 13:32               ` Leon Romanovsky
2019-08-07 10:34 ` [PATCH rdma-next 3/6] RDMA/nldev: Return ODP type per MR Leon Romanovsky
2019-08-07 10:34 ` [PATCH rdma-next 4/6] IB/mlx5: Introduce ODP diagnostic counters Leon Romanovsky
2019-08-07 10:34 ` [PATCH rdma-next 5/6] RDMA/nldev: Allow different fill function per resource Leon Romanovsky
2019-08-07 10:34 ` [PATCH rdma-next 6/6] RDMA/nldev: Provide MR statistics Leon Romanovsky

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=20190807103403.8102-3-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=ereza@mellanox.com \
    --cc=jgg@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.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).