[ofa-general] Help with atomic operations

Bharath Ramesh bramesh at vt.edu
Thu Feb 24 23:26:37 PST 2011


Hi,
	I am trying to use IB atomic operations, specifically fetch and add.
I tried a small example but I am unable to get it to work. The WC status is
REM_INV_REQ_ERR. My sample code is as follows:

sge.addr = (uintptr_t) &data;
sge.length = sizeof (uint64_t);
sge.lkey = ib_mr->lkey;
wr.opcode = IBV_WR_ATOMIC_FETCH_AND_ADD;
wr.send_flags = IBV_SEND_SIGNALED;
wr.next = NULL;
wr.num_sge = 1;
wr.sg_list = &sge;
wr.wr.atomic.remote_addr = vaddr;
wr.wr.atomic.compare_add = 1;
//wr.wr.atomic.swap = 0;
wr.wr.atomic.rkey = rkey;
wr.wr_id = 1;
ret = ibv_post_send (ib_qp, &wr, &wr_bad);
do {
	c = ibv_poll_cq (ib_cq, 1, &wc);
} while (c == 0);

if (c < 0) {
	printf ("ERROR: ibv_poll_cq failed.\n");
      return -1;
}

if (wc.status != IBV_WC_SUCCESS) {
	// print wc info.
	// print qp status.
}

Any help on this appreciated.

Regards,

Bharath
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4985 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20110225/0484fd7f/attachment.bin>


More information about the general mailing list