[ofa-general] [PATCH, RFC] libibverbs: Add hooks for rereg_mr, memory windows

Roland Dreier rdreier at cisco.com
Thu Mar 1 13:38:21 PST 2007


Here's a patch that I came up with that I would like to add to the
libibverbs 1.1 branch.  This would give us the opportunity to add
reregister MR and memory window operations to libibverbs 1.1 after the
1.1.0 release without breaking any ABI (beyond adding the actual entry
points, which are easy for apps to deal with by using compile-time
checks).  If we mess up and forget something, it's not that big a
deal, but we'll have to wait until the next ABI break (ie libibverbs
1.2) to add the extra functions, so I'd like to try and do a good job.

So does anyone see anything obviously missing or wrong here?

Thanks...

diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 49cd581..a9c5fde 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2004 Intel Corporation.  All rights reserved.
- * Copyright (c) 2005, 2006 Cisco Systems, Inc.  All rights reserved.
+ * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc.  All rights reserved.
  * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -288,6 +288,13 @@ struct ibv_pd {
 	uint32_t		handle;
 };
 
+enum ibv_rereg_mr_flags {
+	IBV_REREG_MR_CHANGE_TRANSLATION	= (1 << 0),
+	IBV_REREG_MR_CHANGE_PD		= (1 << 1),
+	IBV_REREG_MR_CHANGE_ACCESS	= (1 << 2),
+	IBV_REREG_MR_KEEP_VALID		= (1 << 3)
+};
+
 struct ibv_mr {
 	struct ibv_context     *context;
 	struct ibv_pd	       *pd;
@@ -298,6 +305,17 @@ struct ibv_mr {
 	uint32_t		rkey;
 };
 
+enum ibv_mw_type {
+	IBV_MW_TYPE_1			= 1,
+	IBV_MW_TYPE_2			= 2
+};
+
+struct ibv_mw {
+	struct ibv_context     *context;
+	struct ibv_pd	       *pd;
+	uint32_t		rkey;
+};
+
 struct ibv_global_route {
 	union ibv_gid		dgid;
 	uint32_t		flow_label;
@@ -517,6 +535,15 @@ struct ibv_recv_wr {
 	int			num_sge;
 };
 
+struct ibv_mw_bind {
+	struct ibv_mr	       *mr;
+	uint64_t		wr_id;
+	uint64_t		addr;
+	uint64_t		length;
+	enum ibv_send_flags	send_flags;
+	enum ibv_access_flags	mw_access_flags;
+};
+
 struct ibv_srq {
 	struct ibv_context     *context;
 	void		       *srq_context;
@@ -603,7 +630,16 @@ struct ibv_context_ops {
 	int			(*dealloc_pd)(struct ibv_pd *pd);
 	struct ibv_mr *		(*reg_mr)(struct ibv_pd *pd, void *addr, size_t length,
 					  enum ibv_access_flags access);
+	struct ibv_mr *		(*rereg_mr)(struct ibv_mr *mr,
+					    enum ibv_rereg_mr_flags flags,
+					    struct ibv_pd *pd, void *addr,
+					    size_t length,
+					    enum ibv_access_flags access);
 	int			(*dereg_mr)(struct ibv_mr *mr);
+	struct ibv_mw *		(*alloc_mw)(struct ibv_pd *pd, enum ibv_mw_type type);
+	int			(*bind_mw)(struct ibv_qp *qp, struct ibv_mw *mw,
+					   struct ibv_mw_bind *mw_bind);
+	int			(*dealloc_mw)(struct ibv_mw *mw);
 	struct ibv_cq *		(*create_cq)(struct ibv_context *context, int cqe,
 					     struct ibv_comp_channel *channel,
 					     int comp_vector);



More information about the general mailing list