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

Steve Wise swise at opengridcomputing.com
Thu Oct 5 07:56:59 PDT 2006


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.

This is (hopefully) a short term requirement for the driver I'm working
on, but if it has utility for others, we should add it.  I guess the
downside is it impacts all the libs...

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



Index: libibverbs/include/infiniband/driver.h
===================================================================
--- libibverbs/include/infiniband/driver.h	(revision 9349)
+++ libibverbs/include/infiniband/driver.h	(working copy)
@@ -85,7 +85,8 @@
 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 9349)
+++ libibverbs/src/cmd.c	(working copy)
@@ -221,11 +221,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;
@@ -236,9 +236,9 @@
 	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
 		return errno;
 
-	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