[PATCH rdma-core 2/3] verbs: Fix implicit ODP MR support for 32 bit systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Moni Shoua <monis@xxxxxxxxxxxx>

One of the conditions to recognize an implicit ODP MR in kernel is
having length of UINT64_MAX. Since the type of the parameter 'length'
in ibv_reg_mr() is size_t which is 32 bit long, it is impossible for
an application that runs on a 32 bit system to pass this value to the
library.

To solve this, let ibv_cmd_reg_mr() replace SIZE_MAX with UINT64_MAX
when building the command to the kernel. On 64 bit systems this has no
effect. On 32 bit systems set a value that the kernel understands as a
request for implicit ODP MR.

Signed-off-by: Moni Shoua <monis@xxxxxxxxxxxx>
Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---
 libibverbs/cmd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index ec551e2..7bcaeea 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -336,6 +336,16 @@ int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 
 	cmd->start 	  = (uintptr_t) addr;
 	cmd->length 	  = length;
+	/* On demand access and entire address space means implicit.
+	 * In that case set the value in the command to what kernel expects.
+	 */
+	if (access & IBV_ACCESS_ON_DEMAND) {
+		if (length == SIZE_MAX && addr)
+			return EINVAL;
+		if (length == SIZE_MAX)
+			cmd->length = UINT64_MAX;
+	}
+
 	cmd->hca_va 	  = hca_va;
 	cmd->pd_handle 	  = pd->handle;
 	cmd->access_flags = access;
-- 
1.8.3.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux