From 6296d4217e6bb16b1d5b010d8f96165faede2955 Mon Sep 17 00:00:00 2001 From: Dennis Potter Date: Sat, 21 Jul 2018 13:11:46 +0200 Subject: [PATCH] Added a few corrections for sample size * Meta data was not included in the calculation which determines if sample should be send inline. This caused errors * Meta data was not substracted from sample->length on receive side --- lib/nodes/infiniband.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/nodes/infiniband.c b/lib/nodes/infiniband.c index 886b262dc..5020dc7cf 100644 --- a/lib/nodes/infiniband.c +++ b/lib/nodes/infiniband.c @@ -822,8 +822,10 @@ int ib_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *relea warn("Work Completion status was not IBV_WC_SUCCES in node %s: %i", node_name(n), wc[j].status); - // Lenght includes a 40 byte global routing header. Substract it - int correction = (ib->conn.port_space == RDMA_PS_UDP) ? 40 : 0; + // 32 byte of meta data is always transferred. We should substract it. + // Furthermore, in case of an unreliable connection, a 40 byte + // global routing header is transferred. This should be substracted as well. + int correction = (ib->conn.port_space == RDMA_PS_UDP) ? 72 : 32; smps[j] = (struct sample *) (wc[j].wr_id); smps[j]->length = (wc[j].byte_len - correction) / sizeof(double); @@ -896,7 +898,8 @@ 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][j-1].length < ib->qp_init.cap.max_inline_data) ? + // 32 byte meta data is always send. + int send_inline = ( (sge[sent][j-1].length + 32) < ib->qp_init.cap.max_inline_data) ? ib->conn.send_inline : 0;