[ofa-general] [PATCH librdmacm] rping: Transfer rkey/addr/len information in network byte order.

Steve Wise swise at opengridcomputing.com
Wed May 2 07:56:46 PDT 2007


On Tue, 2007-05-01 at 21:01 -0700, Sean Hefty wrote:
> > This patch regresses rping.  I failed to test it on AMD64<->AMD64 (ie
> > like endian systems).  I will provide another patch shortly, or we can
> > undo the broken rping patch for -rc3.  Whatever you think is best.
> 
> Let's fix it.  Please create a patch on top of this that fixes the problem.
> 
> Thanks
> 
> - Sean

Here is the fix.  Tested with:

ppc64 client, amd64 server
ppc64 server, amd64 client
amd64 client, amd64 server


---

Fix regression introduced by 88fc0cb21698dfb5d7660eecf7dddd0531fc8021.

From: Steve Wise <swise at opengridcomputing.com>

- swizzle memory info when sending it to peer.
- fixed printf format

Signed-off-by: Steve Wise <swise at opengridcomputing.com>
---

 examples/rping.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/examples/rping.c b/examples/rping.c
index 17b0000..bccabb0 100644
--- a/examples/rping.c
+++ b/examples/rping.c
@@ -243,7 +243,7 @@ static int server_recv(struct rping_cb *
 	cb->remote_rkey = ntohl(cb->recv_buf.rkey);
 	cb->remote_addr = ntohll(cb->recv_buf.buf);
 	cb->remote_len  = ntohl(cb->recv_buf.size);
-	DEBUG_LOG("Received rkey %x addr %" PRIx64 "len %d from peer\n",
+	DEBUG_LOG("Received rkey %x addr %" PRIx64 " len %d from peer\n",
 		  cb->remote_rkey, cb->remote_addr, cb->remote_len);
 
 	if (cb->state <= CONNECTED || cb->state == RDMA_WRITE_COMPLETE)
@@ -614,12 +614,12 @@ static void rping_format_send(struct rpi
 {
 	struct rping_rdma_info *info = &cb->send_buf;
 
-	info->buf = (uint64_t) (unsigned long) buf;
-	info->rkey = mr->rkey;
-	info->size = cb->size;
+	info->buf = htonll((uint64_t) (unsigned long) buf);
+	info->rkey = htonl(mr->rkey);
+	info->size = htonl(cb->size);
 
 	DEBUG_LOG("RDMA addr %" PRIx64" rkey %x len %d\n",
-		  info->buf, info->rkey, info->size);
+		  ntohll(info->buf), ntohl(info->rkey), ntohl(info->size));
 }
 
 static int rping_test_server(struct rping_cb *cb)





More information about the general mailing list