goto failed;
}
+ if (flipped) {
+ __swab32(msg->ibm_u.rdma.rd_key);
+ }
+
for(i = 0; i < msg->ibm_u.rdma.ibrm_num_descs; i++) {
kib_rdma_desc_t *desc = &msg->ibm_u.rdma.ibrm_desc[i];
if (flipped) {
- __swab32(desc->rd_key);
__swab32(desc->rd_nob);
__swab64(desc->rd_addr);
}
CDEBUG(D_NET, " key %x, " "addr "LPX64", nob %u\n",
- desc->rd_key, desc->rd_addr, desc->rd_nob);
+ msg->ibm_u.rdma.rd_key, desc->rd_addr, desc->rd_nob);
}
break;
desc = &ibrm->ibrm_desc[ibrm->ibrm_num_descs];
if (active)
- desc->rd_key = kibnal_data.kib_md.md_lkey;
+ ibrm->rd_key = kibnal_data.kib_md.md_lkey;
else
- desc->rd_key = kibnal_data.kib_md.md_rkey;
+ ibrm->rd_key = kibnal_data.kib_md.md_rkey;
desc->rd_nob = len; /*PAGE_SIZE - kiov->kiov_offset; */
desc->rd_addr = kibnal_page2phys(page) + page_offset +
kibnal_data.kib_md.md_addr;
tx->tx_mapped = KIB_TX_MAPPED;
#endif
} else {
- CERROR ("Can't map phys: %d\n", rc);
+ CERROR ("Can't map phys: %d\n", frc);
rc = -EFAULT;
}
for(;;) {
while (iibt_cq_poll(cq, &wc) == FSUCCESS) {
+
+ /* We will need to rearm the CQ to avoid a potential race. */
+ armed = 0;
+
if (kibnal_wreqid_is_rx(wc.WorkReqId))
kibnal_rx_callback(&wc);
else
ibmsg->ibm_u.rdma.ibrm_cookie = tx->tx_passive_rdma_cookie;
/* map_kiov alrady filled the rdma descs for the whole_mem case */
if (!kibnal_whole_mem()) {
- ibmsg->ibm_u.rdma.ibrm_desc[0].rd_key = tx->tx_md.md_rkey;
+ ibmsg->ibm_u.rdma.rd_key = tx->tx_md.md_rkey;
ibmsg->ibm_u.rdma.ibrm_desc[0].rd_addr = tx->tx_md.md_addr;
ibmsg->ibm_u.rdma.ibrm_desc[0].rd_nob = nob;
ibmsg->ibm_u.rdma.ibrm_num_descs = 1;
}
if (!kibnal_whole_mem()) {
- tx->tx_msg->ibm_u.rdma.ibrm_desc[0].rd_key = tx->tx_md.md_lkey;
+ tx->tx_msg->ibm_u.rdma.rd_key = tx->tx_md.md_lkey;
tx->tx_msg->ibm_u.rdma.ibrm_desc[0].rd_addr = tx->tx_md.md_addr;
tx->tx_msg->ibm_u.rdma.ibrm_desc[0].rd_nob = nob;
tx->tx_msg->ibm_u.rdma.ibrm_num_descs = 1;
ds->Address = ldesc->rd_addr;
ds->Length = ldesc->rd_nob;
- ds->Lkey = ldesc->rd_key;
+ ds->Lkey = tx->tx_msg->ibm_u.rdma.rd_key;
memset(wrq, 0, sizeof(*wrq));
wrq->WorkReqId = kibnal_ptr2wreqid(tx, 0);
wrq->Req.SendRC.Options.s.ImmediateData = 0;
wrq->Req.SendRC.Options.s.Fence = 0;
wrq->Req.SendRC.RemoteDS.Address = rdesc->rd_addr;
- wrq->Req.SendRC.RemoteDS.Rkey = rdesc->rd_key;
+ wrq->Req.SendRC.RemoteDS.Rkey = rxmsg->ibm_u.rdma.rd_key;
/* only the last rdma post triggers tx completion */
if (i == rxmsg->ibm_u.rdma.ibrm_num_descs - 1)
PORTAL_ALLOC(rep, sizeof(*rep));
PORTAL_ALLOC(rcv, sizeof(*rcv));
if (rep == NULL || rcv == NULL) {
- CERROR ("can't reply and receive buffers\n");
+ if (rep) PORTAL_FREE(rep, sizeof(*rep));
+ if (rcv) PORTAL_FREE(rcv, sizeof(*rcv));
+ CERROR ("can't allocate reply and receive buffers\n");
GOTO(out, reason = RC_INSUFFICIENT_RESP_RES);
}