[openib-general] [PATCH] pingpong test: zero-initialize all attributes

Michael S. Tsirkin mst at mellanox.co.il
Wed May 25 06:49:34 PDT 2005


Some address handle attributes (notably static rate flow control)
were uninitialized. Fix this by initializing all fields to 0.

(Other examples may need fixing, too).

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: pingpong.c
===================================================================
--- pingpong.c	(revision 2437)
+++ pingpong.c	(working copy)
@@ -360,19 +360,19 @@ static int pp_post_send(struct pingpong_
 static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 			  struct pingpong_dest *dest)
 {
-	struct ibv_qp_attr attr;
-
-	attr.qp_state 		= IBV_QPS_RTR;
-	attr.path_mtu 		= IBV_MTU_1024;
-	attr.dest_qp_num 	= dest->qpn;
-	attr.rq_psn 		= dest->psn;
-	attr.max_dest_rd_atomic = 1;
-	attr.min_rnr_timer 	= 12;
-	attr.ah_attr.is_global  = 0;
-	attr.ah_attr.dlid       = dest->lid;
-	attr.ah_attr.sl         = 0;
-	attr.ah_attr.src_path_bits = 0;
-	attr.ah_attr.port_num   = port;
+	struct ibv_qp_attr attr = {
+		.qp_state		= IBV_QPS_RTR;
+		.path_mtu		= IBV_MTU_1024;
+		.dest_qp_num		= dest->qpn;
+		.rq_psn 		= dest->psn;
+		.max_dest_rd_atomic	= 1;
+		.min_rnr_timer		= 12;
+		.ah_attr.is_global	= 0;
+		.ah_attr.dlid		= dest->lid;
+		.ah_attr.sl		= 0;
+		.ah_attr.src_path_bits	= 0;
+		.ah_attr.port_num	= port;
+	};
 	if (ibv_modify_qp(ctx->qp, &attr,
 			  IBV_QP_STATE              |
 			  IBV_QP_AV                 |

-- 
MST - Michael S. Tsirkin



More information about the general mailing list