[openib-general] [PATCH] RFC libibverbs - support provider response data in reg_mr

Steve Wise swise at opengridcomputing.com
Thu Oct 5 10:37:35 PDT 2006


On Thu, 2006-10-05 at 10:11 -0700, Roland Dreier wrote:
>     Steve> Pass back provider-specific meta data for user mr
>     Steve> registration. The infrastructure is there to do this in the
>     Steve> kernel, but not in the libibverbs cmd interface.
> 
>     Steve> This is (hopefully) a short term requirement for the driver
>     Steve> I'm working on, but if it has utility for others, we should
>     Steve> add it.  I guess the downside is it impacts all the libs...
> 
> I guess this is OK if it's needed, but can you add a preprocessor
> define (a la what I did for ibv_cmd_resize_cq) so that low-level
> driver plugins can retain source-level compatibility with both old and
> new libibverbs?
> 
>  - R.

Like this?

-----

Pass back provider-specific meta data for user mr registration. The
infrastructure is there to do this in the kernel, but not in the
libibverbs cmd interface.

Signed-off-by: Steve Wise <swise at opengridcomputing.com>

Index: libibverbs/include/infiniband/driver.h
===================================================================
--- libibverbs/include/infiniband/driver.h	(revision 9727)
+++ libibverbs/include/infiniband/driver.h	(working copy)
@@ -82,10 +82,12 @@
 		     struct ibv_alloc_pd *cmd, size_t cmd_size,
 		     struct ibv_alloc_pd_resp *resp, size_t resp_size);
 int ibv_cmd_dealloc_pd(struct ibv_pd *pd);
+#define IBV_CMD_REG_MR_HAS_RESP_PARAMS
 int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 		   uint64_t hca_va, enum ibv_access_flags access,
 		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
-		   size_t cmd_size);
+		   size_t cmd_size,
+		   struct ibv_reg_mr_resp *resp, size_t resp_size);
 int ibv_cmd_dereg_mr(struct ibv_mr *mr);
 int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
 		      struct ibv_comp_channel *channel,
Index: libibverbs/src/cmd.c
===================================================================
--- libibverbs/src/cmd.c	(revision 9727)
+++ libibverbs/src/cmd.c	(working copy)
@@ -232,11 +232,11 @@
 int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 		   uint64_t hca_va, enum ibv_access_flags access,
 		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
-		   size_t cmd_size)
+		   size_t cmd_size,
+		   struct ibv_reg_mr_resp *resp, size_t resp_size)
 {
-	struct ibv_reg_mr_resp resp;
 
-	IBV_INIT_CMD_RESP(cmd, cmd_size, REG_MR, &resp, sizeof resp);
+	IBV_INIT_CMD_RESP(cmd, cmd_size, REG_MR, resp, resp_size);
 
 	cmd->start 	  = (uintptr_t) addr;
 	cmd->length 	  = length;
@@ -249,9 +249,9 @@
 
 	VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
 
-	mr->handle  = resp.mr_handle;
-	mr->lkey    = resp.lkey;
-	mr->rkey    = resp.rkey;
+	mr->handle  = resp->mr_handle;
+	mr->lkey    = resp->lkey;
+	mr->rkey    = resp->rkey;
 
 	return 0;
 }






More information about the general mailing list