mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Replace sleep by a better check
Prior to this commit, we called rdma_disconnect() and waited for a fixed amount of time. This check was kind of arbitrary. Now, we keep polling the receive Completion Queue until ib->conn.available_recv_wrs is zero and all receive samples are thus given back to the framework.
This commit is contained in:
parent
3df5d37b15
commit
a5068e28ea
1 changed files with 3 additions and 8 deletions
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <villas/nodes/infiniband.h>
|
||||
#include <villas/plugin.h>
|
||||
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue