diff --git a/lib/nodes/infiniband.c b/lib/nodes/infiniband.c index 4a063a017..aee81da3c 100644 --- a/lib/nodes/infiniband.c +++ b/lib/nodes/infiniband.c @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -40,12 +39,11 @@ static int ib_disconnect(struct node *n) rdma_disconnect(ib->ctx.id); - // Give the Completion Queues a chance to fill after rdma_disconnect - usleep(50000); - // If there is anything in the Completion Queue, it should be given back to the framework // Receive Queue - while ((wcs = ibv_poll_cq(ib->ctx.recv_cq, ib->recv_cq_size, wc))) { + while (ib->conn.available_recv_wrs) { + wcs = ibv_poll_cq(ib->ctx.recv_cq, ib->recv_cq_size, wc); + ib->conn.available_recv_wrs -= wcs; for (int j = 0; j < wcs; j++) @@ -64,9 +62,6 @@ static int ib_disconnect(struct node *n) sample_put((struct sample *) ib->conn.send_wc_stack.array[ib->conn.send_wc_stack.top]); } - if (ib->conn.available_recv_wrs != 0) - warn("Was not able to return all samples! %i samples are still blocked ", ib->conn.available_recv_wrs); - // Destroy QP rdma_destroy_qp(ib->ctx.id); debug(LOG_IB | 3, "Destroyed QP");