diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-05-25 20:18:32 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 11:35:56 -0800 |
commit | 9a78b5217717054e4e1cbb6fbdb293d25de467e3 (patch) | |
tree | e3184eec9e33965c57fd67ca6af92b466f3747e7 | |
parent | f3582f44b9618ef3e37160cef9036f7d16a91724 (diff) | |
download | libibverbs-9a78b5217717054e4e1cbb6fbdb293d25de467e3.tar.gz |
Fix uninitialized AH attributes in pingpong examples
Some address handle attributes (notably static rate flow control) were
uninitialized. Fix this by initializing all fields to 0 using
designated initializers.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <roland@topspin.com>
-rw-r--r-- | examples/pingpong.c | 28 | ||||
-rw-r--r-- | examples/ud-pingpong.c | 14 |
2 files changed, 22 insertions, 20 deletions
diff --git a/examples/pingpong.c b/examples/pingpong.c index f7f6bd1..0862d6e 100644 --- a/examples/pingpong.c +++ b/examples/pingpong.c @@ -360,19 +360,21 @@ static int pp_post_send(struct pingpong_context *ctx) 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, + .dlid = dest->lid, + .sl = 0, + .src_path_bits = 0, + .port_num = port + } + }; if (ibv_modify_qp(ctx->qp, &attr, IBV_QP_STATE | IBV_QP_AV | diff --git a/examples/ud-pingpong.c b/examples/ud-pingpong.c index 09c3295..4936d30 100644 --- a/examples/ud-pingpong.c +++ b/examples/ud-pingpong.c @@ -370,7 +370,13 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn, struct pingpong_dest *dest) { struct ibv_qp_attr attr; - struct ibv_ah_attr ah_attr; + struct ibv_ah_attr ah_attr = { + .is_global = 0, + .dlid = dest->lid, + .sl = 0, + .src_path_bits = 0, + .port_num = port + }; attr.qp_state = IBV_QPS_RTR; @@ -389,12 +395,6 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn, return 1; } - 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; - ctx->ah = ibv_create_ah(ctx->pd, &ah_attr); if (!ctx->ah) { fprintf(stderr, "Failed to create AH\n"); |