diff mbox series

[rdma-core,1/3] verbs: Introduce implicit ODP support flag

Message ID 1551113128-16917-2-git-send-email-yishaih@mellanox.com (mailing list archive)
State Not Applicable
Headers show
Series verbs: Implicit ODP support | expand

Commit Message

Yishai Hadas Feb. 25, 2019, 4:45 p.m. UTC
From: Moni Shoua <monis@mellanox.com>

Implicit ODP is a special form of ODP where the entire process memory
space is registered on demand. This may simplify an application's memory
registration scheme.

The kernel may or may not support implicit ODP memory registration and
the application needs to query the device before using it.

Running 'ibv_devinfo -v' will show this capability when it is supported.

Relevant manual pages were updated accordingly.

Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
---
 libibverbs/examples/devinfo.c        | 5 ++++-
 libibverbs/man/ibv_query_device_ex.3 | 1 +
 libibverbs/man/ibv_reg_mr.3          | 2 ++
 libibverbs/verbs.h                   | 1 +
 4 files changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c
index e928b05..07b4af5 100644
--- a/libibverbs/examples/devinfo.c
+++ b/libibverbs/examples/devinfo.c
@@ -314,13 +314,16 @@  static void print_odp_trans_caps(uint32_t trans)
 
 static void print_odp_caps(const struct ibv_device_attr_ex *device_attr)
 {
-	uint64_t unknown_general_caps = ~(IBV_ODP_SUPPORT);
+	uint64_t unknown_general_caps = ~(IBV_ODP_SUPPORT |
+					  IBV_ODP_SUPPORT_IMPLICIT);
 	const struct ibv_odp_caps *caps = &device_attr->odp_caps;
 
 	/* general odp caps */
 	printf("\tgeneral_odp_caps:\n");
 	if (caps->general_caps & IBV_ODP_SUPPORT)
 		printf("\t\t\t\t\tODP_SUPPORT\n");
+	if (caps->general_caps & IBV_ODP_SUPPORT_IMPLICIT)
+		printf("\t\t\t\t\tODP_SUPPORT_IMPLICIT\n");
 	if (caps->general_caps & unknown_general_caps)
 		printf("\t\t\t\t\tUnknown flags: 0x%" PRIX64 "\n",
 		       caps->general_caps & unknown_general_caps);
diff --git a/libibverbs/man/ibv_query_device_ex.3 b/libibverbs/man/ibv_query_device_ex.3
index f99f818..b652884 100644
--- a/libibverbs/man/ibv_query_device_ex.3
+++ b/libibverbs/man/ibv_query_device_ex.3
@@ -52,6 +52,7 @@  struct ibv_odp_caps {
 
 enum ibv_odp_general_cap_bits {
         IBV_ODP_SUPPORT = 1 << 0, /* On demand paging is supported */
+        IBV_ODP_SUPPORT_IMPLICIT = 1 << 1, /* Implicit on demand paging is supported */
 };
 
 enum ibv_odp_transport_cap_bits {
diff --git a/libibverbs/man/ibv_reg_mr.3 b/libibverbs/man/ibv_reg_mr.3
index d9053b1..631e5fe 100644
--- a/libibverbs/man/ibv_reg_mr.3
+++ b/libibverbs/man/ibv_reg_mr.3
@@ -50,6 +50,8 @@  must be set too.
 .PP
 Local read access is always enabled for the MR.
 .PP
+To create an implicit ODP MR, IBV_ACCESS_ON_DEMAND should be set, addr should be 0 and length should be SIZE_MAX.
+.PP
 .B ibv_dereg_mr()
 deregisters the MR
 .I mr\fR.
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 9561e39..243cd8c 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -218,6 +218,7 @@  struct ibv_odp_caps {
 
 enum ibv_odp_general_caps {
 	IBV_ODP_SUPPORT = 1 << 0,
+	IBV_ODP_SUPPORT_IMPLICIT = 1 << 1,
 };
 
 struct ibv_tso_caps {