[ofa-general] [PATCH] libibverbs: move fields in ibv_srq, ibv_qp, and ibv_cq to preserve binary compatibility

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Feb 19 07:15:01 PST 2008


move  pthread_cond_t fields to the end of structs, because
their size changed from RHAS4 to RHAS5. In all the cases,
the intervening entries were not accessed outside libibverbs
(in non-XRC applications).
    
The structs modified are: ibv_cq, ibv_srq, and ibv_qp.
    
Pointed out by:  Changqing Tang <changquing.tang at hp.com>
    
Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>

---

Roland,
I checked the following patch into ofed 1.3 libibverbs.  I also included
the ibv_qp and ibv_cq structures in the change.

The xxx_events_completed fields are fortunately not used outside libibverbs
at this point, but at some point, some user app may wish to read them.

Additionally, for struct ibv_qp, some XRC user app may just decide to access
the xrc_domain field in this struct.

For now, they are only used for syncing in the ibv_destroy_xxx functions.

I would rather do the change now, and not kick ourselves later.

Jack

diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index a032a67..7ce5e65 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -564,13 +564,14 @@ struct ibv_srq {
 	struct ibv_pd	       *pd;
 	uint32_t		handle;
 
-	pthread_mutex_t		mutex;
-	pthread_cond_t		cond;
 	uint32_t		events_completed;
 
 	uint32_t		xrc_srq_num;
 	struct ibv_xrc_domain  *xrc_domain;
 	struct ibv_cq	       *xrc_cq;
+
+	pthread_mutex_t		mutex;
+	pthread_cond_t		cond;
 };
 
 struct ibv_qp {
@@ -585,11 +586,12 @@ struct ibv_qp {
 	enum ibv_qp_state       state;
 	enum ibv_qp_type	qp_type;
 
-	pthread_mutex_t		mutex;
-	pthread_cond_t		cond;
 	uint32_t		events_completed;
 
 	struct ibv_xrc_domain  *xrc_domain;
+
+	pthread_mutex_t		mutex;
+	pthread_cond_t		cond;
 };
 
 struct ibv_comp_channel {
@@ -605,10 +607,11 @@ struct ibv_cq {
 	uint32_t		handle;
 	int			cqe;
 
-	pthread_mutex_t		mutex;
-	pthread_cond_t		cond;
 	uint32_t		comp_events_completed;
 	uint32_t		async_events_completed;
+
+	pthread_mutex_t		mutex;
+	pthread_cond_t		cond;
 };
 
 struct ibv_ah {



More information about the general mailing list