***SPAM*** Re: [ofa-general] Re: [PATCH 3/3 v4] ib/ipoib: blocking multicast loopback ipoib packets

Jack Morgenstein jackm at dev.mellanox.co.il
Thu Jul 10 05:22:53 PDT 2008


On Thursday 10 July 2008 10:47, Ron Livne wrote:
> >can we do this so that the new verb lies after XRC in ib_context, since OFED 1.3 went out
> >with XRC in userspace (so we don't break binary compatibility):
> >
> >struct ibv_context {
> >      struct ibv_device      *device;
> >       struct ibv_context_ops  ops;
> >       int                     cmd_fd;
> >       int                     async_fd;
> >       int                     num_comp_vectors;
> >       pthread_mutex_t         mutex;
> >       void                   *abi_compat;
> >       struct ibv_xrc_ops     *xrc_ops;
> >       /* ==> new verb ops structure pointer here */
> >};
> 
> I'm going to release some patches, based on your XRC patches, in which
> I'm going to replace xrc_ops with more_ops.
> These patches will will be relative to your patches.
> I hope it's ok with you.
> 

Roland, I think we can do things something like I have below (only partial -- I've not changed
all usage of xrc_ops in ibv_context -- I'll do this in my patches).
Regarding undefining of HAVE_IBV_XRC_OPS, I've not figured out a way of conditionally
invoking AC_CHECK_HEADER if the MORE_OPS structure is not present.

Please note that using AC_CHECK_HEADER has the advantage of applying to the module being built
(I don't need to do anything special when configuring libibverbs).

If you can see a cleaner way than this to add extra ops (e.g., conditionally structuring the
AC_CHECK_HEADER calls), please let me know.

- Jack

*** IN LIBIBVERBS ***
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 036a0c5..2865d5c 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -645,7 +645,7 @@ struct ibv_device {
 	char			ibdev_path[IBV_SYSFS_PATH_MAX];
 };
 
-struct ibv_xrc_ops {
+struct ibv_more_ops {
 	struct ibv_srq *	(*create_xrc_srq)(struct ibv_pd *pd,
 						  struct ibv_xrc_domain *xrc_domain,
 						  struct ibv_cq *xrc_cq,
@@ -737,7 +737,7 @@ struct ibv_context {
 	int			num_comp_vectors;
 	pthread_mutex_t		mutex;
 	void		       *abi_compat;
-	struct ibv_xrc_ops     *xrc_ops;
+	struct ibv_more_ops    *more_ops;
 };

*** IN LIBMLX4 ***
diff --git a/configure.in b/configure.in
index 9304539..8db22ab 100644
--- a/configure.in
+++ b/configure.in
@@ -42,8 +42,14 @@ AC_CHECK_HEADER(valgrind/memcheck.h,
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_CHECK_SIZEOF(long)
-AC_CHECK_MEMBER(struct ibv_context.xrc_ops,
-    [AC_DEFINE([HAVE_IBV_XRC_OPS], 1, [Define to 1 if xrc_ops is a member of ibv_context])],,
+AC_CHECK_MEMBER(struct ibv_context.more_ops,
+    [AC_DEFINE([HAVE_IBV_MORE_OPS], 1, [Define to 1 if more_ops is a member of ibv_context])],,
+    [#include <infiniband/verbs.h>])
+AC_CHECK_MEMBER(struct ibv_more_ops.create_xrc_srq,
+    [AC_DEFINE([HAVE_IBV_XRC_OPS], 1, [Define to 1 if have xrc ops])],,
+    [#include <infiniband/verbs.h>])
+AC_CHECK_MEMBER(struct ibv_more_ops.create_qp_expanded,
+    [AC_DEFINE([HAVE_IBV_CREATE_QP_EX], 1, [Define to 1 if have create_qp_expanded])],,
     [#include <infiniband/verbs.h>])
 
 dnl Checks for library functions
diff --git a/src/mlx4.c b/src/mlx4.c
index 18333e7..b6970a0 100644
--- a/src/mlx4.c
+++ b/src/mlx4.c
@@ -68,8 +68,9 @@ struct {
 	HCA(MELLANOX, 0x673c),	/* MT25408 "Hermon" QDR PCIe gen2 */
 };
 
-#ifdef HAVE_IBV_XRC_OPS
+#ifdef HAVE_IBV_MORE_OPS
 static struct ibv_xrc_ops mlx4_xrc_ops = {
+#ifdef HAVE_IBV_XRC_OPS
 	.create_xrc_srq   = mlx4_create_xrc_srq,
 	.open_xrc_domain  = mlx4_open_xrc_domain,
 	.close_xrc_domain = mlx4_close_xrc_domain,
@@ -78,6 +79,10 @@ static struct ibv_xrc_ops mlx4_xrc_ops = {
 	.query_xrc_rcv_qp = mlx4_query_xrc_rcv_qp,
 	.reg_xrc_rcv_qp   = mlx4_reg_xrc_rcv_qp,
 	.unreg_xrc_rcv_qp = mlx4_unreg_xrc_rcv_qp,
+#endif
+#ifdef HAVE_IBV_CREATE_QP_EXP
+    **** Ron Livne's stuff here
+#endif
 };
 #endif
 
@@ -177,7 +182,7 @@ static struct ibv_context *mlx4_alloc_context(struct ibv_device *ibdev, int cmd_
 	pthread_spin_init(&context->uar_lock, PTHREAD_PROCESS_PRIVATE);
 
 	context->ibv_ctx.ops = mlx4_ctx_ops;
-#ifdef HAVE_IBV_XRC_OPS
+#if defined(HAVE_IBV_XRC_OPS) || defined(HAVE_IBV_CREATE_QP_EXP)
 	context->ibv_ctx.xrc_ops = &mlx4_xrc_ops;
 #endif
 
diff --git a/src/mlx4.h b/src/mlx4.h
index a791901..a2e3aec 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -79,6 +79,11 @@
 
 #endif
 
+#ifndef HAVE_IBV_MORE_OPS
+#undef HAVE_IBV_XRC_OPS
+#undef HAVE_IBV_CREATE_QP_EXP
+#endif
+
 #define HIDDEN		__attribute__((visibility ("hidden")))
 
 #define PFX		"mlx4: " 



More information about the general mailing list