I wasn't sure who I should email about this, but I recently got krping to work 
between an Opteron and a PPC G5.  However, in order for krping to work I had to 
make the following changes to krping.c to ensure the address, key, and length 
were being sent across the network as big endian, otherwise they were in 
machine dependent byte order.


static void krping_format_send(struct krping_cb *cb, u64 buf, 
                   struct ib_mr *mr)
{
    struct krping_rdma_info *info = &cb->send_buf;

-    info->buf = buf;
 -    info->rkey = mr->rkey;
 -    info->size = cb->size;
+    info->buf = cpu_to_be64(buf);
+    info->rkey = cpu_to_be32(mr->rkey);
+    info->size = cpu_to_be32(cb->size);

    DEBUG_LOG("RDMA addr %llx rkey %x len %d\n",
          info->buf, info->rkey, info->size);
}


static int server_recv(struct krping_cb *cb, struct ib_wc *wc)
{
    if (wc->byte_len != sizeof(cb->recv_buf)) {
        printk(KERN_ERR PFX "Received bogus data, size %d\n", 
               wc->byte_len);
        return -1;
    }
-     cb->remote_rkey = cb->recv_buf.rkey;
-     cb->remote_addr = cb->recv_buf.buf;
-     cb->remote_len  = cb->recv_buf.size;
+    cb->remote_rkey = be32_to_cpu(cb->recv_buf.rkey);
+    cb->remote_addr = be64_to_cpu(cb->recv_buf.buf);
+    cb->remote_len  = be32_to_cpu(cb->recv_buf.size);
    DEBUG_LOG("Received rkey %x addr %llx len %d from peer\n",
          cb->remote_rkey, cb->remote_addr, cb->remote_len);

    if (cb->state <= CONNECTED || cb->state == RDMA_WRITE_COMPLETE)
        cb->state = RDMA_READ_ADV;
    else
        cb->state = RDMA_WRITE_ADV;

    return 0;
}

Brett McMillian
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to