Skip to content

Commit

Permalink
support global id attribute. should solve issue #10
Browse files Browse the repository at this point in the history
  • Loading branch information
drossetti committed Jun 20, 2017
1 parent 4da976c commit e1e2b6f
Showing 1 changed file with 6 additions and 45 deletions.
51 changes: 6 additions & 45 deletions tests/gds_kernel_latency.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,51 +149,6 @@ struct pingpong_dest {
union ibv_gid gid;
};

static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
int sl, struct pingpong_dest *dest, int sgid_idx)
{
struct ibv_ah_attr ah_attr = {
.is_global = 0,
.dlid = dest->lid,
.sl = sl,
.src_path_bits = 0,
.port_num = port
};
struct ibv_qp_attr attr = {
.qp_state = IBV_QPS_RTR
};

if (ibv_modify_qp(ctx->qp, &attr, IBV_QP_STATE)) {
fprintf(stderr, "Failed to modify QP to RTR\n");
return 1;
}

attr.qp_state = IBV_QPS_RTS;
attr.sq_psn = my_psn;

if (ibv_modify_qp(ctx->qp, &attr,
IBV_QP_STATE |
IBV_QP_SQ_PSN)) {
fprintf(stderr, "Failed to modify QP to RTS\n");
return 1;
}

if (dest->gid.global.interface_id) {
ah_attr.is_global = 1;
ah_attr.grh.hop_limit = 1;
ah_attr.grh.dgid = dest->gid;
ah_attr.grh.sgid_index = sgid_idx;
}

ctx->ah = ibv_create_ah(ctx->pd, &ah_attr);
if (!ctx->ah) {
fprintf(stderr, "Failed to create AH\n");
return 1;
}

return 0;
}

static inline unsigned long align_to(unsigned long val, unsigned long pow2)
{
return (val + pow2 - 1) & ~(pow2 - 1);
Expand Down Expand Up @@ -1025,6 +980,12 @@ int main(int argc, char *argv[])
.src_path_bits = 0,
.port_num = ib_port
};
if (rem_dest->gid.global.interface_id) {
ah_attr.is_global = 1;
ah_attr.grh.hop_limit = 1;
ah_attr.grh.dgid = rem_dest->gid;
ah_attr.grh.sgid_index = gidx;
}

ctx->ah = ibv_create_ah(ctx->pd, &ah_attr);
if (!ctx->ah) {
Expand Down

0 comments on commit e1e2b6f

Please sign in to comment.