public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: floaterions <floaterions-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: RDMA FETCH_AND_ADD and CMP_AND_SWAP fail
Date: Wed, 3 Dec 2014 21:56:26 +0000 (UTC)	[thread overview]
Message-ID: <loom.20141203T225347-18@post.gmane.org> (raw)

Hello All,

I can successfully send RDMA READ/WRITE,
but I can't get RDMA atomic operations to work.
I get an error when calling ibv_post_send function in the client,
and the errno will be set to "Invalid Arguments."
Below I pasted important parts of my code.
Could you please check my code and let me know if I'm missing anything?


*********** client side *****************:
-- Registering the memory regions --
mr = ibv_reg_mr(pd, buff, size, IBV_ACCESS_LOCAL_WRITE);
// and the size is 8

if (!mr){
   fprintf(stderr, "Error, memory registration failed\n");
   return -1;
}

-- Preparing RDMA ATOMIC FETCH AND 
struct ibv_send_wr wr, *bad_wr = NULL;
struct ibv_sge sge;
	
memset(&sge, 0, sizeof(sge));
sge.addr 		= buff;
sge.length 	= 8;
sge.lkey 		= mr->lkey;
	
memset(&wr, 0, sizeof(wr));
wr.wr_id     = 0;
wr.opcode  = IBV_WR_ATOMIC_FETCH_AND_ADD;
wr.sg_list 			= &sge;
wr.num_sge 		= 1;
wr.send_flags 		= IBV_SEND_SIGNALED;

wr.wr.atomic.remote_addr	= remote_buffer;
wr.wr.atomic.rkey        	= peer_mr->rkey;
wr.wr.atomic.compare_add	= 1ULL; 

if (ibv_post_send(qp, &wr, &bad_wr)) {
    fprintf(stderr, "Error, ibv_post_send() failed\n");
    return -1;
}
********* End of Client side *******

****** Server side ****************
-- Registering the memory regions --
mr = ibv_reg_mr(pd,  rdma_region_timestamp_oracle,
         sizeof(TimestampOracle), 
         IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE
         | IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_ATOMIC ));

if (!mr){
   fprintf(stderr, "Error, memory registration() failed\n");
   return -1;
}


NOTE: TimestampOracle is a class with two int members,
so its size is 8 bytes (satisfies 64-bit condition for RDMA ATOMIC operations)

Thank you for your helps

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2014-12-03 21:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20141203T225347-18@post.gmane.org \
    --to=floaterions-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox