1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00

Fixed way of iterating scatter/gather list

This commit is contained in:
Dennis Potter 2018-07-20 22:55:33 +02:00
parent afb8b57156
commit be87846a5a

View file

@ -611,7 +611,7 @@ int ib_start(struct node *n)
debug(LOG_IB | 3, "Allocated Protection Domain"); debug(LOG_IB | 3, "Allocated Protection Domain");
//ToDo: This is a temporary solution since we don't use the GRH at this moment // Allocate space for 40 Byte GHR. We don't use this.
if (ib->conn.port_space == RDMA_PS_UDP) { if (ib->conn.port_space == RDMA_PS_UDP) {
ib->conn.grh_ptr = alloc(40); ib->conn.grh_ptr = alloc(40);
ib->conn.grh_mr = ibv_reg_mr(ib->ctx.pd, ib->conn.grh_ptr, 40, IBV_ACCESS_LOCAL_WRITE); ib->conn.grh_mr = ibv_reg_mr(ib->ctx.pd, ib->conn.grh_ptr, 40, IBV_ACCESS_LOCAL_WRITE);
@ -730,23 +730,27 @@ int ib_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *relea
for (int i = 0; i < max_wr_post; i++) { for (int i = 0; i < max_wr_post; i++) {
// Prepare receive Scatter/Gather element // Prepare receive Scatter/Gather element
int j = 0;
if (ib->conn.port_space == RDMA_PS_UDP) { if (ib->conn.port_space == RDMA_PS_UDP) {
sge[i][0].addr = (uint64_t) ib->conn.grh_ptr; sge[i][j].addr = (uint64_t) ib->conn.grh_ptr;
sge[i][0].length = 40; sge[i][j].length = 40;
sge[i][0].lkey = ib->conn.grh_mr->lkey; sge[i][j].lkey = ib->conn.grh_mr->lkey;
j++;
} }
// [0] if it is TCP, otherwise [1] sge[i][j].addr = (uint64_t) &smps[i]->data;
sge[i][(ib->conn.port_space == RDMA_PS_UDP)].addr = (uint64_t) &smps[i]->data; sge[i][j].length = SAMPLE_DATA_LEN(DEFAULT_SAMPLELEN);
sge[i][(ib->conn.port_space == RDMA_PS_UDP)].length = SAMPLE_DATA_LEN(DEFAULT_SAMPLELEN); sge[i][j].lkey = mr->lkey;
sge[i][(ib->conn.port_space == RDMA_PS_UDP)].lkey = mr->lkey;
j++;
// Prepare a receive Work Request // Prepare a receive Work Request
wr[i].wr_id = (uintptr_t) smps[i]; wr[i].wr_id = (uintptr_t) smps[i];
wr[i].next = &wr[i+1]; wr[i].next = &wr[i+1];
wr[i].sg_list = sge[i]; wr[i].sg_list = sge[i];
wr[i].num_sge = (ib->conn.port_space == RDMA_PS_UDP) ? 2 : 1; wr[i].num_sge = j;
} }
wr[max_wr_post-1].next = NULL; wr[max_wr_post-1].next = NULL;