* [RFC PATCH] libmthca: Add support for I/O memory registration verbs
@ 2010-07-29 16:36 Tom Tucker
[not found] ` <20100729163624.15024.57249.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tucker @ 2010-07-29 16:36 UTC (permalink / raw)
To: rdreier-FYB4Gu1CFyUAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, brandt-4OHPYypu0djtX7QSmKvirg,
tom-/Yg/VP3ZvrM, swise-/Yg/VP3ZvrM
This patchset adds support for the new I/O memory registration verbs to
libmthca.
---
Tom Tucker (1):
libmthca: Add support for the reg_io_mr verb.
src/mthca-abi.h | 4 ++++
src/mthca.c | 2 ++
src/mthca.h | 4 ++++
src/verbs.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+), 0 deletions(-)
--
Signed-off-by: Tom Tucker <tom-/Yg/VP3ZvrM@public.gmane.org>
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [RFC PATCH] libmthca: Add support for the reg_io_mr verb.
[not found] ` <20100729163624.15024.57249.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
@ 2010-07-29 16:36 ` Tom Tucker
[not found] ` <20100729163650.15024.66012.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tucker @ 2010-07-29 16:36 UTC (permalink / raw)
To: rdreier-FYB4Gu1CFyUAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, brandt-4OHPYypu0djtX7QSmKvirg,
tom-/Yg/VP3ZvrM, swise-/Yg/VP3ZvrM
From: Tom Tucker <tom-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Added support for the ibv_reg_io_mr and ibv_unreg_io_mr
verbs to the mthca ilbrary.
Signed-off-by: Tom Tucker <tom-/Yg/VP3ZvrM@public.gmane.org>
---
src/mthca-abi.h | 4 ++++
src/mthca.c | 2 ++
src/mthca.h | 4 ++++
src/verbs.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/src/mthca-abi.h b/src/mthca-abi.h
index 4fbd98b..c0145d6 100644
--- a/src/mthca-abi.h
+++ b/src/mthca-abi.h
@@ -61,6 +61,10 @@ struct mthca_reg_mr {
__u32 reserved;
};
+struct mthca_reg_io_mr {
+ struct ibv_reg_io_mr ibv_cmd;
+};
+
struct mthca_create_cq {
struct ibv_create_cq ibv_cmd;
__u32 lkey;
diff --git a/src/mthca.c b/src/mthca.c
index e33bf7f..8892504 100644
--- a/src/mthca.c
+++ b/src/mthca.c
@@ -113,6 +113,8 @@ static struct ibv_context_ops mthca_ctx_ops = {
.dealloc_pd = mthca_free_pd,
.reg_mr = mthca_reg_mr,
.dereg_mr = mthca_dereg_mr,
+ .reg_io_mr = mthca_reg_io_mr,
+ .dereg_io_mr = mthca_dereg_io_mr,
.create_cq = mthca_create_cq,
.poll_cq = mthca_poll_cq,
.resize_cq = mthca_resize_cq,
diff --git a/src/mthca.h b/src/mthca.h
index bd1e7a2..92a8649 100644
--- a/src/mthca.h
+++ b/src/mthca.h
@@ -312,6 +312,10 @@ struct ibv_mr *mthca_reg_mr(struct ibv_pd *pd, void *addr,
size_t length, int access);
int mthca_dereg_mr(struct ibv_mr *mr);
+struct ibv_mr *mthca_reg_io_mr(struct ibv_pd *pd, void *addr,
+ size_t length, enum ibv_access_flags access);
+int mthca_dereg_io_mr(struct ibv_mr *mr);
+
struct ibv_cq *mthca_create_cq(struct ibv_context *context, int cqe,
struct ibv_comp_channel *channel,
int comp_vector);
diff --git a/src/verbs.c b/src/verbs.c
index b6782c9..3580ad2 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -174,6 +174,56 @@ int mthca_dereg_mr(struct ibv_mr *mr)
return 0;
}
+
+static struct ibv_mr *__mthca_reg_io_mr(struct ibv_pd *pd, void *addr,
+ size_t length, uint64_t hca_va,
+ enum ibv_access_flags access)
+{
+ struct ibv_mr *mr;
+ struct mthca_reg_io_mr cmd;
+ int ret;
+
+ mr = malloc(sizeof *mr);
+ if (!mr)
+ return NULL;
+
+#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
+ {
+ struct ibv_reg_io_mr_resp resp;
+
+ ret = ibv_cmd_reg_io_mr(pd, addr, length, hca_va, access, mr,
+ &cmd.ibv_cmd, sizeof cmd, &resp, sizeof resp);
+ }
+#else
+ ret = ibv_cmd_reg_io_mr(pd, addr, length, hca_va, access, mr,
+ &cmd.ibv_cmd, sizeof cmd);
+#endif
+ if (ret) {
+ free(mr);
+ return NULL;
+ }
+
+ return mr;
+}
+
+struct ibv_mr *mthca_reg_io_mr(struct ibv_pd *pd, void *addr,
+ size_t length, enum ibv_access_flags access)
+{
+ return __mthca_reg_io_mr(pd, addr, length, (uintptr_t) addr, access);
+}
+
+int mthca_dereg_io_mr(struct ibv_mr *mr)
+{
+ int ret;
+
+ ret = ibv_cmd_dereg_mr(mr);
+ if (ret)
+ return ret;
+
+ free(mr);
+ return 0;
+}
+
static int align_cq_size(int cqe)
{
int nent;
--
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [RFC PATCH] libmthca: Add support for the reg_io_mr verb.
[not found] ` <20100729163650.15024.66012.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
@ 2010-08-02 11:19 ` Tziporet Koren
[not found] ` <E113D394D7C5DB4F8FF691FA7EE9DB443B3910A85A-WQlSmcKwN8Te+A/uUDamNg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Tziporet Koren @ 2010-08-02 11:19 UTC (permalink / raw)
To: Tom Tucker, rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
brandt-4OHPYypu0djtX7QSmKvirg@public.gmane.org,
swise-/Yg/VP3ZvrM@public.gmane.org
Hi Tom,
What is the purpose of this?
Is there a reason you did it only for mthca and not mlx4?
Tziporet
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] libmthca: Add support for the reg_io_mr verb.
[not found] ` <E113D394D7C5DB4F8FF691FA7EE9DB443B3910A85A-WQlSmcKwN8Te+A/uUDamNg@public.gmane.org>
@ 2010-08-02 16:34 ` Tom Tucker
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tucker @ 2010-08-02 16:34 UTC (permalink / raw)
To: Tziporet Koren
Cc: Tom Tucker, rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
brandt-4OHPYypu0djtX7QSmKvirg@public.gmane.org,
swise-/Yg/VP3ZvrM@public.gmane.org
Tziporet Koren wrote:
> Hi Tom,
> What is the purpose of this?
> Is there a reason you did it only for mthca and not mlx4?
>
> Tziporet
>
Hi Tziporet,
I just picked mthca arbitrarily to demonstrate how to do it. If people
like the verb, then I'll do it for all the devices, but I didn't want to
do all that work when there are likely to be changes.
But the point is that this is certainly not a mthca only functionality.
Thanks,
Tom
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-02 16:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 16:36 [RFC PATCH] libmthca: Add support for I/O memory registration verbs Tom Tucker
[not found] ` <20100729163624.15024.57249.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2010-07-29 16:36 ` [RFC PATCH] libmthca: Add support for the reg_io_mr verb Tom Tucker
[not found] ` <20100729163650.15024.66012.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2010-08-02 11:19 ` Tziporet Koren
[not found] ` <E113D394D7C5DB4F8FF691FA7EE9DB443B3910A85A-WQlSmcKwN8Te+A/uUDamNg@public.gmane.org>
2010-08-02 16:34 ` Tom Tucker
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).