Writing RDMA applications on Linux

From
Gaetano Mendola <hidden>
Date
2012-08-24 15:01:58
Hi,
as told you on twitter I wrote using ib berbs and rdma a communication
channel between a server and a client
.
I used your "paper" to understand the IBV/RDMA however I'm getting
only around 650 MBps when I should reach on my hardware 1500 MB
(at least ib_write_bw test is reporting me 1500MBps).

Basicaly this is what I do (pseudocode):

Active Side:

post a message receive
rdma connection
wait for rdma connection event
<<at this point transfer tx flow starts>>
start:
   register memory containing bytes to transfer
   wait remote memory region addr/key ( I wait for a ibv_wc)
   send data with ibv_post_send (IBV_WR_RDMA_WRITE)
   post a message receive
   wait for ibv_post_send event ( I wait for a ibv_wc) (this lasts
13.3 ms transfering 8MB)
   send message "DONE"
   unregister memory
goto start


Passive side:

post a message receive
rdma accept
wait for rdma connection event
<<at this point transfer rx flow starts>>
start:
   register memory that has to receive the bytes
   send addr/key of memory registered
   wait "DONE" message
   unregister memory
   post a message receive
goto start

This is the code I use to send the data:

ibv_sge sge;
sge.addr = (uintptr_t)memory_to_transfer;
sge.length = memory_to_transfer_size;
sge.lkey = memory_to_transfer_mr->lkey;

ibv_send_wr wr;
memset(&wr, 0, sizeof(wr));
wr.wr_id = 0;
wr.opcode = IBV_WR_RDMA_WRITE;
wr.sg_list = &sge;
wr.num_sge = 1;
wr.send_flags = IBV_SEND_SIGNALED;
wr.wr.rdma.remote_addr = (uintptr_t)thePeerMemoryRegion.addr;
wr.wr.rdma.rkey = thePeerMemoryRegion.rkey;

ibv_send_wr *bad_wr = NULL;
if (ibv_post_send(theCommunicationIdentifier->qp, &wr, &bad_wr) != 0) {
  notifyError("Unable to ibv post receive");
}

and this is how I was that data has been sent:

//Wait for completation
ibv_cq *cq;
void* cq_context;
if (ibv_get_cq_event(theCompletionEventChannel, &cq, &cq_context) != 0) {
  notifyError("Unable to get a ibv cq event");
}

ibv_ack_cq_events(cq, 1);

if (ibv_req_notify_cq(cq, 0) != 0) {
  notifyError("Unable to get a req notify");
}

ibv_wc wc;
int myRet = ibv_poll_cq(cq, 1, &wc);
if (myRet > 1) {
  LOG(WARNING) << "Got more than a single ibv_wc, expecting one";
}

I did modify your example code to transfer a chunk of 8MB instead of
the 2 bytes and it reports the same bandwith transfer of around
650MBps, I'm attaching the code.

I hope you can help me.

Regards
Gaetano
-- 
cpp-today.blogspot.com

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help