diff --git a/lib/nodes/infiniband.c b/lib/nodes/infiniband.c index 00d73605a..98ed39a35 100644 --- a/lib/nodes/infiniband.c +++ b/lib/nodes/infiniband.c @@ -116,6 +116,9 @@ static void ib_build_ibv(struct node *n) debug(LOG_IB | 3, "Created Queue Pair with %i receive and %i send elements", ib->qp_init.cap.max_recv_wr, ib->qp_init.cap.max_send_wr); + if (ib->conn.inline_mode) + info("Maximum inline size is set to %i byte", ib->qp_init.cap.max_inline_data); + // Allocate memory ib->mem.p_recv.state = STATE_DESTROYED; ib->mem.p_recv.queue.state = STATE_DESTROYED; @@ -409,6 +412,10 @@ int ib_check(struct node *n) if (ib->qp_init.cap.max_inline_data != 0) warn("You changed the default value of max_inline_data. This might influence the maximum number of outstanding Work Requests in the Queue Pair and can be a reason for the Queue Pair creation to fail"); + // Check if inline mode is set to a valid value + if (ib->conn.inline_mode != 0 && ib->conn.inline_mode != 1) + error("inline_mode has to be set to either 0 or 1! %i is not a valid value", ib->conn.inline_mode); + info("Finished check of node %s", node_name(n)); return 0; @@ -765,7 +772,7 @@ int ib_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rele // Check if data can be send inline int send_inline = (sge[sent].length < ib->qp_init.cap.max_inline_data) ? - (ib->conn.inline_mode > 0) : 0; + ib->conn.inline_mode : 0; debug(LOG_IB | 10, "Sample will be send inline [0/1]: %i", send_inline); @@ -773,19 +780,16 @@ int ib_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rele wr[sent].wr_id = send_inline ? 0 : (uintptr_t) smps[sent]; // This way the sample can be release in WC wr[sent].sg_list = &sge[sent]; wr[sent].num_sge = 1; - - if (sent == (cnt-1)) { - debug(LOG_IB | 10, "Prepared %i send Work Requests", (sent+1)); - wr[sent].next = NULL; - } - else - wr[sent].next = &wr[sent+1]; + wr[sent].next = &wr[sent+1]; wr[sent].send_flags = IBV_SEND_SIGNALED | (send_inline << 3); wr[sent].imm_data = htonl(0); //ToDo: set this to a useful value wr[sent].opcode = IBV_WR_SEND_WITH_IMM; } + debug(LOG_IB | 10, "Prepared %i send Work Requests", cnt); + wr[cnt-1].next = NULL; + // Send linked list of Work Requests ret = ibv_post_send(ib->ctx.id->qp, wr, &bad_wr); debug(LOG_IB | 4, "Posted send Work Requests");