[openib-general] [RFC] [PATCH 7/7] libamso library changes

Krishna Kumar krkumar2 at in.ibm.com
Mon Jul 10 03:31:06 PDT 2006


Changes the libamso user-mode library to use librdmaverbs
data types and API's.

Signed-of-by: Krishna Kumar <krkumar2 at in.ibm.com>

diff -ruNp ORG/libamso/Makefile.am NEW/libamso/Makefile.am
--- ORG/libamso/Makefile.am	2006-07-09 22:12:11.000000000 -0700
+++ NEW/libamso/Makefile.am	2006-07-10 18:07:44.000000000 -0700
@@ -1,6 +1,6 @@
 # $Id: $
 
-amsolibdir = $(libdir)/infiniband
+amsolibdir = $(libdir)/rdma
 
 amsolib_LTLIBRARIES = src/amso.la
 
diff -ruNp ORG/libamso/configure.in NEW/libamso/configure.in
--- ORG/libamso/configure.in	2006-07-09 22:12:11.000000000 -0700
+++ NEW/libamso/configure.in	2006-07-10 21:02:06.000000000 -0700
@@ -12,13 +12,13 @@ dnl Checks for programs
 AC_PROG_CC
 
 dnl Checks for libraries
-AC_CHECK_LIB(ibverbs, ibv_get_device_list, [],
-    AC_MSG_ERROR([ibv_get_device_list() not found.  libmthca requires libibverbs.]))
+AC_CHECK_LIB(rdmaverbs, rdma_get_device_list, [],
+    AC_MSG_ERROR([rdma_get_device_list() not found.  libamso requires librdmaverbs.]))
 
 dnl Checks for header files.
 AC_CHECK_HEADERS(sysfs/libsysfs.h)
-AC_CHECK_HEADER(infiniband/driver.h, [],
-    AC_MSG_ERROR([<infiniband/driver.h> not found.  Is libibverbs installed?]))
+AC_CHECK_HEADER(rdma/driver.h, [],
+    AC_MSG_ERROR([<rdma/driver.h> not found.  Is librdmaverbs installed?]))
 AC_HEADER_STDC
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -26,7 +26,7 @@ AC_C_CONST
 AC_CHECK_SIZEOF(long)
 
 dnl Checks for library functions
-AC_CHECK_FUNCS(ibv_read_sysfs_file)
+AC_CHECK_FUNCS(rdma_read_sysfs_file)
 
 AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
     if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
diff -ruNp ORG/libamso/libamso.spec.in NEW/libamso/libamso.spec.in
--- ORG/libamso/libamso.spec.in	2006-07-09 22:12:11.000000000 -0700
+++ NEW/libamso/libamso.spec.in	2006-07-10 18:07:44.000000000 -0700
@@ -39,18 +39,18 @@ make %{?_smp_mflags}
 rm -rf $RPM_BUILD_ROOT
 %makeinstall
 # remove unpackaged files from the buildroot
-rm -f $RPM_BUILD_ROOT%{_libdir}/infiniband/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/rdma/*.la
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root,-)
-%{_libdir}/infiniband/amso.so
+%{_libdir}/rdma/amso.so
 %doc AUTHORS COPYING ChangeLog README
 
 %files devel
 %defattr(-,root,root,-)
-%{_libdir}/infiniband/amso.a
+%{_libdir}/rdma/amso.a
 
 %changelog
diff -ruNp ORG/libamso/src/amso-abi.h NEW/libamso/src/amso-abi.h
--- ORG/libamso/src/amso-abi.h	2006-07-09 22:12:10.000000000 -0700
+++ NEW/libamso/src/amso-abi.h	2006-07-10 18:07:44.000000000 -0700
@@ -32,23 +32,23 @@
 #ifndef AMSO_ABI_H
 #define AMSO_ABI_H
 
-#include <infiniband/kern-abi.h>
+#include <rdma/kern-abi.h>
 
 struct amso_alloc_ucontext_resp {
-	struct ibv_get_context_resp ibv_resp;
+	struct rdma_get_context_resp rdma_resp;
 };
 
 struct amso_alloc_pd_resp {
-	struct ibv_alloc_pd_resp ibv_resp;
+	struct rdma_alloc_pd_resp rdma_resp;
 };
 
 struct amso_create_cq {
-	struct ibv_create_cq ibv_cmd;
+	struct rdma_create_cq rdma_cmd;
 };
 
 
 struct amso_create_cq_resp {
-	struct ibv_create_cq_resp ibv_resp;
+	struct rdma_create_cq_resp rdma_resp;
 	__u32 cqid;
 	__u32 entries;
 	__u64 physaddr;		/* library mmaps this to get addressability */
@@ -56,11 +56,11 @@ struct amso_create_cq_resp {
 };
 
 struct amso_create_qp {
-	struct ibv_create_qp ibv_cmd;
+	struct rdma_create_qp rdma_cmd;
 };
 
 struct amso_create_qp_resp {
-	struct ibv_create_qp_resp ibv_resp;
+	struct rdma_create_qp_resp rdma_resp;
 	__u32 qpid;
 	__u32 entries;		/* actual number of entries after creation */
 	__u64 physaddr;		/* library mmaps this to get addressability */
diff -ruNp ORG/libamso/src/amso.c NEW/libamso/src/amso.c
--- ORG/libamso/src/amso.c	2006-07-09 22:12:10.000000000 -0700
+++ NEW/libamso/src/amso.c	2006-07-10 18:07:44.000000000 -0700
@@ -44,7 +44,7 @@
 #include <sysfs/libsysfs.h>
 #endif
 
-#ifndef HAVE_IBV_READ_SYSFS_FILE
+#ifndef HAVE_RDMA_READ_SYSFS_FILE
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -69,7 +69,7 @@ struct {
 	HCA(AMSO, 1100, 1100),
 };
 
-static struct ibv_context_ops amso_ctx_ops = {
+static struct rdma_context_ops amso_ctx_ops = {
 	.query_device = amso_query_device,
 	.query_port = amso_query_port,
 	.alloc_pd = amso_alloc_pd,
@@ -92,50 +92,50 @@ static struct ibv_context_ops amso_ctx_o
 	.detach_mcast = amso_detach_mcast
 };
 
-static struct ibv_context *amso_alloc_context(struct ibv_device *ibdev,
+static struct rdma_context *amso_alloc_context(struct rdma_device *ibdev,
 					      int cmd_fd)
 {
 	struct amso_context *context;
-	struct ibv_get_context cmd;
+	struct rdma_get_context cmd;
 	struct amso_alloc_ucontext_resp resp;
 
 	context = malloc(sizeof *context);
 	if (!context)
 		return NULL;
 
-	context->ibv_ctx.cmd_fd = cmd_fd;
+	context->rdma_ctx.cmd_fd = cmd_fd;
 
-	if (ibv_cmd_get_context(&context->ibv_ctx, &cmd, sizeof cmd,
-				&resp.ibv_resp, sizeof resp))
+	if (rdma_cmd_get_context(&context->rdma_ctx, &cmd, sizeof cmd,
+				&resp.rdma_resp, sizeof resp))
 		goto err_free;
 
-	context->ibv_ctx.device = ibdev;
-	context->ibv_ctx.ops = amso_ctx_ops;
-	context->ibv_ctx.ops.req_notify_cq = amso_arm_cq;
-	context->ibv_ctx.ops.cq_event = NULL;
-	context->ibv_ctx.ops.post_send = amso_post_send;
-	context->ibv_ctx.ops.post_recv = amso_post_recv;
-	context->ibv_ctx.ops.post_srq_recv = amso_post_srq_recv;
+	context->rdma_ctx.device = ibdev;
+	context->rdma_ctx.ops = amso_ctx_ops;
+	context->rdma_ctx.ops.req_notify_cq = amso_arm_cq;
+	context->rdma_ctx.ops.cq_event = NULL;
+	context->rdma_ctx.ops.post_send = amso_post_send;
+	context->rdma_ctx.ops.post_recv = amso_post_recv;
+	context->rdma_ctx.ops.post_srq_recv = amso_post_srq_recv;
 
-	return &context->ibv_ctx;
+	return &context->rdma_ctx;
 err_free:
 	free(context);
 	return NULL;
 }
 
-static void amso_free_context(struct ibv_context *ibctx)
+static void amso_free_context(struct rdma_context *ibctx)
 {
 	struct amso_context *context = to_amso_ctx(ibctx);
 
 	free(context);
 }
 
-static struct ibv_device_ops amso_dev_ops = {
+static struct rdma_device_ops amso_dev_ops = {
 	.alloc_context = amso_alloc_context,
 	.free_context = amso_free_context
 };
 
-struct ibv_device *ibv_driver_init(const char *uverbs_sys_path,
+struct rdma_device *rdma_driver_init(const char *uverbs_sys_path,
 				   int abi_version)
 {
 	char value[8];
@@ -143,12 +143,12 @@ struct ibv_device *ibv_driver_init(const
 	unsigned vendor, device;
 	int i;
 
-	if (ibv_read_sysfs_file(uverbs_sys_path, "device/vendor",
+	if (rdma_read_sysfs_file(uverbs_sys_path, "device/vendor",
 				value, sizeof value) < 0)
 		return NULL;
 	sscanf(value, "%i", &vendor);
 
-	if (ibv_read_sysfs_file(uverbs_sys_path, "device/device",
+	if (rdma_read_sysfs_file(uverbs_sys_path, "device/device",
 				value, sizeof value) < 0)
 		return NULL;
 	sscanf(value, "%i", &device);
@@ -167,23 +167,23 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = amso_dev_ops;
+	dev->rdma_dev.ops = amso_dev_ops;
 	dev->hca_type = hca_table[i].type;
 	dev->page_size = sysconf(_SC_PAGESIZE);
 
-	return &dev->ibv_dev;
+	return &dev->rdma_dev;
 }
 
 #ifdef HAVE_SYSFS_LIBSYSFS_H
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
+struct rdma_device *openib_driver_init(struct sysfs_class_device *sysdev)
 {
 	int abi_ver = 0;
 	char value[8];
 
-	if (ibv_read_sysfs_file(sysdev->path, "abi_version",
+	if (rdma_read_sysfs_file(sysdev->path, "abi_version",
 				value, sizeof value) > 0)
 		abi_ver = strtol(value, NULL, 10);
 
-	return ibv_driver_init(sysdev->path, abi_ver);
+	return rdma_driver_init(sysdev->path, abi_ver);
 }
 #endif /* HAVE_SYSFS_LIBSYSFS_H */
diff -ruNp ORG/libamso/src/amso.h NEW/libamso/src/amso.h
--- ORG/libamso/src/amso.h	2006-07-09 22:12:10.000000000 -0700
+++ NEW/libamso/src/amso.h	2006-07-10 18:07:44.000000000 -0700
@@ -32,8 +32,8 @@
 #ifndef AMSO_H
 #define AMSO_H
 
-#include <infiniband/driver.h>
-#include <infiniband/arch.h>
+#include <rdma/driver.h>
+#include <rdma/arch.h>
 
 #define HIDDEN		__attribute__((visibility ("hidden")))
 
@@ -44,21 +44,21 @@ enum amso_hca_type {
 };
 
 struct amso_device {
-	struct ibv_device ibv_dev;
+	struct rdma_device rdma_dev;
 	enum amso_hca_type hca_type;
 	int page_size;
 };
 
 struct amso_context {
-	struct ibv_context ibv_ctx;
+	struct rdma_context rdma_ctx;
 };
 
 struct amso_pd {
-	struct ibv_pd ibv_pd;
+	struct rdma_pd rdma_pd;
 };
 
 struct amso_cq {
-	struct ibv_cq ibv_cq;
+	struct rdma_cq rdma_cq;
 	__u32 cqid;
 	__u32 entries;
 	__u64 physaddr;
@@ -66,7 +66,7 @@ struct amso_cq {
 };
 
 struct amso_qp {
-	struct ibv_qp ibv_qp;
+	struct rdma_qp rdma_qp;
 	__u32 qpid;
 	__u32 entries;
 	__u64 physaddr;
@@ -76,81 +76,81 @@ struct amso_qp {
 
 #define to_amso_xxx(xxx, type)						\
 	((struct amso_##type *)					\
-	 ((void *) ib##xxx - offsetof(struct amso_##type, ibv_##xxx)))
+	 ((void *) ib##xxx - offsetof(struct amso_##type, rdma_##xxx)))
 
-static inline struct amso_device *to_amso_dev(struct ibv_device *ibdev)
+static inline struct amso_device *to_amso_dev(struct rdma_device *ibdev)
 {
 	return to_amso_xxx(dev, device);
 }
 
-static inline struct amso_context *to_amso_ctx(struct ibv_context *ibctx)
+static inline struct amso_context *to_amso_ctx(struct rdma_context *ibctx)
 {
 	return to_amso_xxx(ctx, context);
 }
 
-static inline struct amso_pd *to_amso_pd(struct ibv_pd *ibpd)
+static inline struct amso_pd *to_amso_pd(struct rdma_pd *ibpd)
 {
 	return to_amso_xxx(pd, pd);
 }
 
-static inline struct amso_cq *to_amso_cq(struct ibv_cq *ibcq)
+static inline struct amso_cq *to_amso_cq(struct rdma_cq *ibcq)
 {
 	return to_amso_xxx(cq, cq);
 }
 
-static inline struct amso_qp *to_amso_qp(struct ibv_qp *ibqp)
+static inline struct amso_qp *to_amso_qp(struct rdma_qp *ibqp)
 {
 	return to_amso_xxx(qp, qp);
 }
 
 
-extern int amso_query_device(struct ibv_context *context,
-			     struct ibv_device_attr *attr);
-extern int amso_query_port(struct ibv_context *context, uint8_t port,
-			   struct ibv_port_attr *attr);
-
-extern struct ibv_pd *amso_alloc_pd(struct ibv_context *context);
-extern int amso_free_pd(struct ibv_pd *pd);
-
-extern struct ibv_mr *amso_reg_mr(struct ibv_pd *pd, void *addr,
-				  size_t length, enum ibv_access_flags access);
-extern int amso_dereg_mr(struct ibv_mr *mr);
+extern int amso_query_device(struct rdma_context *context,
+			     struct rdma_device_attr *attr);
+extern int amso_query_port(struct rdma_context *context, uint8_t port,
+			   struct rdma_port_attr *attr);
+
+extern struct rdma_pd *amso_alloc_pd(struct rdma_context *context);
+extern int amso_free_pd(struct rdma_pd *pd);
+
+extern struct rdma_mr *amso_reg_mr(struct rdma_pd *pd, void *addr,
+				  size_t length, enum rdma_access_flags access);
+extern int amso_dereg_mr(struct rdma_mr *mr);
 
-struct ibv_cq *amso_create_cq(struct ibv_context *context, int cqe,
-			      struct ibv_comp_channel *channel,
+struct rdma_cq *amso_create_cq(struct rdma_context *context, int cqe,
+			      struct rdma_comp_channel *channel,
 			      int comp_vector);
-extern int amso_resize_cq(struct ibv_cq *cq, int cqe);
-extern int amso_destroy_cq(struct ibv_cq *cq);
-extern int amso_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc);
-extern int amso_arm_cq(struct ibv_cq *cq, int solicited);
-extern void amso_cq_event(struct ibv_cq *cq);
+extern int amso_resize_cq(struct rdma_cq *cq, int cqe);
+extern int amso_destroy_cq(struct rdma_cq *cq);
+extern int amso_poll_cq(struct rdma_cq *cq, int ne, struct rdma_wc *wc);
+extern int amso_arm_cq(struct rdma_cq *cq, int solicited);
+extern void amso_cq_event(struct rdma_cq *cq);
 extern void amso_init_cq_buf(struct amso_cq *cq, int nent);
 
-extern struct ibv_srq *amso_create_srq(struct ibv_pd *pd,
-				       struct ibv_srq_init_attr *attr);
-extern int amso_modify_srq(struct ibv_srq *srq,
-			   struct ibv_srq_attr *attr,
-			   enum ibv_srq_attr_mask mask);
-extern int amso_destroy_srq(struct ibv_srq *srq);
-extern int amso_post_srq_recv(struct ibv_srq *ibsrq,
-			      struct ibv_recv_wr *wr,
-			      struct ibv_recv_wr **bad_wr);
-
-extern struct ibv_qp *amso_create_qp(struct ibv_pd *pd,
-				     struct ibv_qp_init_attr *attr);
-extern int amso_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-			  enum ibv_qp_attr_mask attr_mask);
-extern int amso_destroy_qp(struct ibv_qp *qp);
-extern int amso_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
-			  struct ibv_send_wr **bad_wr);
-extern int amso_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
-			  struct ibv_recv_wr **bad_wr);
-extern struct ibv_ah *amso_create_ah(struct ibv_pd *pd,
-			     struct ibv_ah_attr *ah_attr);
-extern int amso_destroy_ah(struct ibv_ah *ah);
-extern int amso_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
+extern struct rdma_srq *amso_create_srq(struct rdma_pd *pd,
+				       struct rdma_srq_init_attr *attr);
+extern int amso_modify_srq(struct rdma_srq *srq,
+			   struct rdma_srq_attr *attr,
+			   enum rdma_srq_attr_mask mask);
+extern int amso_destroy_srq(struct rdma_srq *srq);
+extern int amso_post_srq_recv(struct rdma_srq *ibsrq,
+			      struct rdma_recv_wr *wr,
+			      struct rdma_recv_wr **bad_wr);
+
+extern struct rdma_qp *amso_create_qp(struct rdma_pd *pd,
+				     struct rdma_qp_init_attr *attr);
+extern int amso_modify_qp(struct rdma_qp *qp, struct rdma_qp_attr *attr,
+			  enum rdma_qp_attr_mask attr_mask);
+extern int amso_destroy_qp(struct rdma_qp *qp);
+extern int amso_post_send(struct rdma_qp *ibqp, struct rdma_send_wr *wr,
+			  struct rdma_send_wr **bad_wr);
+extern int amso_post_recv(struct rdma_qp *ibqp, struct rdma_recv_wr *wr,
+			  struct rdma_recv_wr **bad_wr);
+extern struct rdma_ah *amso_create_ah(struct rdma_pd *pd,
+			     struct rdma_ah_attr *ah_attr);
+extern int amso_destroy_ah(struct rdma_ah *ah);
+extern int amso_attach_mcast(struct rdma_qp *qp, union rdma_gid *gid,
 			     uint16_t lid);
-extern int amso_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
+extern int amso_detach_mcast(struct rdma_qp *qp, union rdma_gid *gid,
 			     uint16_t lid);
 
 #endif				/* AMSO_H */
diff -ruNp ORG/libamso/src/amso.map NEW/libamso/src/amso.map
--- ORG/libamso/src/amso.map	2006-07-09 22:12:10.000000000 -0700
+++ NEW/libamso/src/amso.map	2006-07-10 18:07:44.000000000 -0700
@@ -1,6 +1,6 @@
 {
 	global:
-		ibv_driver_init;
+		rdma_driver_init;
 		openib_driver_init;
 	local: *;
 };
diff -ruNp ORG/libamso/src/cq.c NEW/libamso/src/cq.c
--- ORG/libamso/src/cq.c	2006-07-09 22:12:10.000000000 -0700
+++ NEW/libamso/src/cq.c	2006-07-10 18:07:45.000000000 -0700
@@ -37,21 +37,21 @@
 #include <netinet/in.h>
 #include <pthread.h>
 
-#include <infiniband/opcode.h>
+#include <rdma/opcode.h>
 
 #include "amso.h"
 #include "amso-abi.h"
 
 
-int amso_poll_cq(struct ibv_cq *ibcq, int ne, struct ibv_wc *wc)
+int amso_poll_cq(struct rdma_cq *ibcq, int ne, struct rdma_wc *wc)
 {
-	return ibv_cmd_poll_cq(ibcq, ne, wc);
+	return rdma_cmd_poll_cq(ibcq, ne, wc);
 }
 
 
-int amso_arm_cq(struct ibv_cq *cq, int solicited)
+int amso_arm_cq(struct rdma_cq *cq, int solicited)
 {
-	return ibv_cmd_req_notify_cq(cq, solicited);
+	return rdma_cmd_req_notify_cq(cq, solicited);
 }
 
 
diff -ruNp ORG/libamso/src/qp.c NEW/libamso/src/qp.c
--- ORG/libamso/src/qp.c	2006-07-09 22:12:10.000000000 -0700
+++ NEW/libamso/src/qp.c	2006-07-10 18:07:45.000000000 -0700
@@ -41,15 +41,15 @@
 #include "amso.h"
 #include <stdio.h>
 
-int amso_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
-		   struct ibv_send_wr **bad_wr)
+int amso_post_send(struct rdma_qp *ibqp, struct rdma_send_wr *wr,
+		   struct rdma_send_wr **bad_wr)
 {
-	return ibv_cmd_post_send(ibqp, wr, bad_wr);
+	return rdma_cmd_post_send(ibqp, wr, bad_wr);
 }
 
-int amso_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
-		   struct ibv_recv_wr **bad_wr)
+int amso_post_recv(struct rdma_qp *ibqp, struct rdma_recv_wr *wr,
+		   struct rdma_recv_wr **bad_wr)
 {
-	return ibv_cmd_post_recv(ibqp, wr, bad_wr);
+	return rdma_cmd_post_recv(ibqp, wr, bad_wr);
 }
 
diff -ruNp ORG/libamso/src/verbs.c NEW/libamso/src/verbs.c
--- ORG/libamso/src/verbs.c	2006-07-09 22:12:10.000000000 -0700
+++ NEW/libamso/src/verbs.c	2006-07-10 18:07:45.000000000 -0700
@@ -46,15 +46,15 @@
 #include "amso-abi.h"
 
 
-int amso_query_device(struct ibv_context *context, struct ibv_device_attr *attr)
+int amso_query_device(struct rdma_context *context, struct rdma_device_attr *attr)
 {
-	struct ibv_query_device cmd;
+	struct rdma_query_device cmd;
 	uint64_t raw_fw_ver;
 	unsigned major, minor, sub_minor;
 	int ret;
 
 	ret =
-	    ibv_cmd_query_device(context, attr, &raw_fw_ver, &cmd, sizeof cmd);
+	    rdma_cmd_query_device(context, attr, &raw_fw_ver, &cmd, sizeof cmd);
 	if (ret)
 		return ret;
 
@@ -68,17 +68,17 @@ int amso_query_device(struct ibv_context
 	return 0;
 }
 
-int amso_query_port(struct ibv_context *context, uint8_t port,
-		    struct ibv_port_attr *attr)
+int amso_query_port(struct rdma_context *context, uint8_t port,
+		    struct rdma_port_attr *attr)
 {
-	struct ibv_query_port cmd;
+	struct rdma_query_port cmd;
 
-	return ibv_cmd_query_port(context, port, attr, &cmd, sizeof cmd);
+	return rdma_cmd_query_port(context, port, attr, &cmd, sizeof cmd);
 }
 
-struct ibv_pd *amso_alloc_pd(struct ibv_context *context)
+struct rdma_pd *amso_alloc_pd(struct rdma_context *context)
 {
-	struct ibv_alloc_pd cmd;
+	struct rdma_alloc_pd cmd;
 	struct amso_alloc_pd_resp resp;
 	struct amso_pd *pd;
 
@@ -86,20 +86,20 @@ struct ibv_pd *amso_alloc_pd(struct ibv_
 	if (!pd)
 		return NULL;
 
-	if (ibv_cmd_alloc_pd(context, &pd->ibv_pd, &cmd, sizeof cmd,
-			     &resp.ibv_resp, sizeof resp)) {
+	if (rdma_cmd_alloc_pd(context, &pd->rdma_pd, &cmd, sizeof cmd,
+			     &resp.rdma_resp, sizeof resp)) {
 		free(pd);
 		return NULL;
 	}
 
-	return &pd->ibv_pd;
+	return &pd->rdma_pd;
 }
 
-int amso_free_pd(struct ibv_pd *pd)
+int amso_free_pd(struct rdma_pd *pd)
 {
 	int ret;
 
-	ret = ibv_cmd_dealloc_pd(pd);
+	ret = rdma_cmd_dealloc_pd(pd);
 	if (ret)
 		return ret;
 
@@ -107,18 +107,18 @@ int amso_free_pd(struct ibv_pd *pd)
 	return 0;
 }
 
-static struct ibv_mr *__amso_reg_mr(struct ibv_pd *pd, void *addr,
+static struct rdma_mr *__amso_reg_mr(struct rdma_pd *pd, void *addr,
 				    size_t length, uint64_t hca_va,
-				    enum ibv_access_flags access)
+				    enum rdma_access_flags access)
 {
-	struct ibv_mr *mr;
-	struct ibv_reg_mr cmd;
+	struct rdma_mr *mr;
+	struct rdma_reg_mr cmd;
 
 	mr = malloc(sizeof *mr);
 	if (!mr)
 		return NULL;
 
-	if (ibv_cmd_reg_mr(pd, addr, length, hca_va,
+	if (rdma_cmd_reg_mr(pd, addr, length, hca_va,
 			   access, mr, &cmd, sizeof cmd)) {
 		free(mr);
 		return NULL;
@@ -127,17 +127,17 @@ static struct ibv_mr *__amso_reg_mr(stru
 	return mr;
 }
 
-struct ibv_mr *amso_reg_mr(struct ibv_pd *pd, void *addr,
-			   size_t length, enum ibv_access_flags access)
+struct rdma_mr *amso_reg_mr(struct rdma_pd *pd, void *addr,
+			   size_t length, enum rdma_access_flags access)
 {
 	return __amso_reg_mr(pd, addr, length, (uintptr_t) addr, access);
 }
 
-int amso_dereg_mr(struct ibv_mr *mr)
+int amso_dereg_mr(struct rdma_mr *mr)
 {
 	int ret;
 
-	ret = ibv_cmd_dereg_mr(mr);
+	ret = rdma_cmd_dereg_mr(mr);
 	if (ret)
 		return ret;
 
@@ -145,8 +145,8 @@ int amso_dereg_mr(struct ibv_mr *mr)
 	return 0;
 }
 
-struct ibv_cq *amso_create_cq(struct ibv_context *context, int cqe,
-			      struct ibv_comp_channel *channel, int comp_vector)
+struct rdma_cq *amso_create_cq(struct rdma_context *context, int cqe,
+			      struct rdma_comp_channel *channel, int comp_vector)
 {
 	struct amso_create_cq cmd;
 	struct amso_create_cq_resp resp;
@@ -157,9 +157,9 @@ struct ibv_cq *amso_create_cq(struct ibv
 	if (!cq) 
 		return NULL;
 
-	ret = ibv_cmd_create_cq(context, cqe, channel, comp_vector,
-				&cq->ibv_cq, &cmd.ibv_cmd, sizeof cmd,
-				&resp.ibv_resp, sizeof resp);
+	ret = rdma_cmd_create_cq(context, cqe, channel, comp_vector,
+				&cq->rdma_cq, &cmd.rdma_cmd, sizeof cmd,
+				&resp.rdma_resp, sizeof resp);
 	if (ret)
 		goto err;
 
@@ -170,7 +170,7 @@ struct ibv_cq *amso_create_cq(struct ibv
 				 MAP_SHARED, context->cmd_fd, cq->physaddr);
 #endif
 
-	return &cq->ibv_cq;
+	return &cq->rdma_cq;
 
 
 err:
@@ -179,12 +179,12 @@ err:
 	return NULL;
 }
 
-int amso_resize_cq(struct ibv_cq *cq, int cqe)
+int amso_resize_cq(struct rdma_cq *cq, int cqe)
 {
 	int ret;
-	struct ibv_resize_cq cmd;
+	struct rdma_resize_cq cmd;
 
-	ret = ibv_cmd_resize_cq(cq, cqe, &cmd, sizeof cmd);
+	ret = rdma_cmd_resize_cq(cq, cqe, &cmd, sizeof cmd);
 	if (ret)
 		return ret;
 	/* We will need to unmap and remap when we implement user mode */
@@ -192,41 +192,41 @@ int amso_resize_cq(struct ibv_cq *cq, in
 	return 0;
 }
 
-int amso_destroy_cq(struct ibv_cq *cq)
+int amso_destroy_cq(struct rdma_cq *cq)
 {
 	int ret;
 
-	ret = ibv_cmd_destroy_cq(cq);
+	ret = rdma_cmd_destroy_cq(cq);
 	if (ret)
 		return ret;
 
 	return 0;
 }
 
-struct ibv_srq *amso_create_srq(struct ibv_pd *pd,
-				struct ibv_srq_init_attr *attr)
+struct rdma_srq *amso_create_srq(struct rdma_pd *pd,
+				struct rdma_srq_init_attr *attr)
 {
 	return (void *) -ENOSYS;
 }
 
-int amso_modify_srq(struct ibv_srq *srq,
-		    struct ibv_srq_attr *attr, enum ibv_srq_attr_mask attr_mask)
+int amso_modify_srq(struct rdma_srq *srq,
+		    struct rdma_srq_attr *attr, enum rdma_srq_attr_mask attr_mask)
 {
 	return -ENOSYS;
 }
 
-int amso_destroy_srq(struct ibv_srq *srq)
+int amso_destroy_srq(struct rdma_srq *srq)
 {
 	return -ENOSYS;
 }
 
-int amso_post_srq_recv(struct ibv_srq *ibsrq,
-                       struct ibv_recv_wr *wr, struct ibv_recv_wr **bad_wr)
+int amso_post_srq_recv(struct rdma_srq *ibsrq,
+                       struct rdma_recv_wr *wr, struct rdma_recv_wr **bad_wr)
 {
 	return -ENOSYS;
 }
 
-struct ibv_qp *amso_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
+struct rdma_qp *amso_create_qp(struct rdma_pd *pd, struct rdma_qp_init_attr *attr)
 {
 	struct amso_create_qp cmd;
 	struct amso_create_qp_resp resp;
@@ -244,8 +244,8 @@ struct ibv_qp *amso_create_qp(struct ibv
 	if (!qp)
 		return NULL;
 
-	ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd.ibv_cmd, sizeof cmd,
-				&resp.ibv_resp, sizeof resp);
+	ret = rdma_cmd_create_qp(pd, &qp->rdma_qp, attr, &cmd.rdma_cmd, sizeof cmd,
+				&resp.rdma_resp, sizeof resp);
 	if (ret)
 		goto err;
 
@@ -253,26 +253,26 @@ struct ibv_qp *amso_create_qp(struct ibv
 	qp->physaddr = resp.physaddr;
 #endif
 
-	return &qp->ibv_qp;
+	return &qp->rdma_qp;
 err:
 	free(qp);
 
 	return NULL;
 }
 
-int amso_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-		   enum ibv_qp_attr_mask attr_mask)
+int amso_modify_qp(struct rdma_qp *qp, struct rdma_qp_attr *attr,
+		   enum rdma_qp_attr_mask attr_mask)
 {
-	struct ibv_modify_qp cmd;
+	struct rdma_modify_qp cmd;
 
-	return ibv_cmd_modify_qp(qp, attr, attr_mask, &cmd, sizeof cmd);
+	return rdma_cmd_modify_qp(qp, attr, attr_mask, &cmd, sizeof cmd);
 }
 
-int amso_destroy_qp(struct ibv_qp *qp)
+int amso_destroy_qp(struct rdma_qp *qp)
 {
 	int ret;
 
-	ret = ibv_cmd_destroy_qp(qp);
+	ret = rdma_cmd_destroy_qp(qp);
 	if (ret)
 		return ret;
 
@@ -281,22 +281,22 @@ int amso_destroy_qp(struct ibv_qp *qp)
 	return 0;
 }
 
-struct ibv_ah *amso_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
+struct rdma_ah *amso_create_ah(struct rdma_pd *pd, struct rdma_ah_attr *attr)
 {
 	return (void *) -ENOSYS;
 }
 
-int amso_destroy_ah(struct ibv_ah *ah)
+int amso_destroy_ah(struct rdma_ah *ah)
 {
 	return -ENOSYS;
 }
 
-int amso_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid)
+int amso_attach_mcast(struct rdma_qp *qp, union rdma_gid *gid, uint16_t lid)
 {
 	return -ENOSYS;
 }
 
-int amso_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid)
+int amso_detach_mcast(struct rdma_qp *qp, union rdma_gid *gid, uint16_t lid)
 {
 	return -ENOSYS;
 }







More information about the general mailing list