[ofa-general] [PATCH 1/4][v2.0] dtest: fix 32-bit build issues in dtest and dtestx examples.

Arlin Davis arlin.r.davis at intel.com
Fri Oct 3 11:09:05 PDT 2008


Patch set for v2.0 to fix some minor issues found at the OFA interop event. 

Signed-off-by: Arlin Davis <ardavis at ichips.intel.com>
---
 test/dtest/dtest.c  |   24 ++++++++++++------------
 test/dtest/dtestx.c |   28 ++++++++++++++--------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/test/dtest/dtest.c b/test/dtest/dtest.c
index 00d14e3..55f325b 100755
--- a/test/dtest/dtest.c
+++ b/test/dtest/dtest.c
@@ -92,14 +92,14 @@
         (((uint32_t)(x) & 0xFF000000) >> 24))
 #define hton32(x) ntoh32(x)
 #define ntoh64(x) (uint64_t)( \
-        (((uint64_t)x & 0x00000000000000FF) << 56) | \
-        (((uint64_t)x & 0x000000000000FF00) << 40) | \
-        (((uint64_t)x & 0x0000000000FF0000) << 24) | \
-        (((uint64_t)x & 0x00000000FF000000) << 8 ) | \
-        (((uint64_t)x & 0x000000FF00000000) >> 8 ) | \
-        (((uint64_t)x & 0x0000FF0000000000) >> 24) | \
-        (((uint64_t)x & 0x00FF000000000000) >> 40) | \
-        (((uint64_t)x & 0xFF00000000000000) >> 56))
+        (((uint64_t)x & 0x00000000000000FFULL) << 56) | \
+        (((uint64_t)x & 0x000000000000FF00ULL) << 40) | \
+        (((uint64_t)x & 0x0000000000FF0000ULL) << 24) | \
+        (((uint64_t)x & 0x00000000FF000000ULL) << 8 ) | \
+        (((uint64_t)x & 0x000000FF00000000ULL) >> 8 ) | \
+        (((uint64_t)x & 0x0000FF0000000000ULL) >> 24) | \
+        (((uint64_t)x & 0x00FF000000000000ULL) >> 40) | \
+        (((uint64_t)x & 0xFF00000000000000ULL) >> 56))
 #define hton64(x) ntoh64(x)
 #elif __BYTE_ORDER == __BIG_ENDIAN
 #define hton16(x) (x)
@@ -1029,7 +1029,7 @@ connect_ep( char *hostname, DAT_CONN_QUAL conn_id )
     /*
      *  Setup our remote memory and tell the other side about it
      */
-    rmr_send_msg.virtual_address = hton64((DAT_VADDR)rbuf);
+    rmr_send_msg.virtual_address = hton64((DAT_VADDR)(uintptr_t)rbuf);
     rmr_send_msg.segment_length  = hton32(RDMA_BUFFER_SIZE);
     rmr_send_msg.rmr_context     = hton32(rmr_context_recv);
 
@@ -1230,7 +1230,7 @@ do_rdma_write_with_msg( void )
        for (i=0;i<MSG_IOV_COUNT;i++) {
 	   l_iov[i].lmr_context     = lmr_context_send;
 	   l_iov[i].segment_length  = buf_len/MSG_IOV_COUNT;
-	   l_iov[i].virtual_address = (DAT_VADDR)
+	   l_iov[i].virtual_address = (DAT_VADDR)(uintptr_t)
 					(&sbuf[l_iov[i].segment_length*i]);
 
 	   LOGPRINTF("%d rdma_write iov[%d] buf=%p,len=%d\n", 
@@ -1381,7 +1381,7 @@ do_rdma_read_with_msg( void )
            strcpy((char*)rbuf, "client RDMA read data...");
 
        l_iov.lmr_context     = lmr_context_send;
-       l_iov.virtual_address = (DAT_VADDR)sbuf;
+       l_iov.virtual_address = (DAT_VADDR)(uintptr_t)sbuf;
        l_iov.segment_length  = buf_len;
  	
        for (i=0;i<MAX_RDMA_RD;i++) {
@@ -1568,7 +1568,7 @@ do_ping_pong_msg( )
        burst_msg_posted++;
        cookie.as_64          = i;
        l_iov.lmr_context     = lmr_context_recv;
-       l_iov.virtual_address = (DAT_VADDR)rcv_buf;
+       l_iov.virtual_address = (DAT_VADDR)(uintptr_t)rcv_buf;
        l_iov.segment_length  = buf_len;
 
        LOGPRINTF("%d Pre-posting Receive Message Buffers %p\n",
diff --git a/test/dtest/dtestx.c b/test/dtest/dtestx.c
index cfe00cd..24536a1 100755
--- a/test/dtest/dtestx.c
+++ b/test/dtest/dtestx.c
@@ -105,14 +105,14 @@ int disconnect_ep(void);
         (((uint32_t)(x) & 0xFF000000) >> 24))
 #define hton32(x) ntoh32(x)
 #define ntoh64(x) (uint64_t)( \
-        (((uint64_t)x & 0x00000000000000FF) << 56) | \
-        (((uint64_t)x & 0x000000000000FF00) << 40) | \
-        (((uint64_t)x & 0x0000000000FF0000) << 24) | \
-        (((uint64_t)x & 0x00000000FF000000) << 8 ) | \
-        (((uint64_t)x & 0x000000FF00000000) >> 8 ) | \
-        (((uint64_t)x & 0x0000FF0000000000) >> 24) | \
-        (((uint64_t)x & 0x00FF000000000000) >> 40) | \
-        (((uint64_t)x & 0xFF00000000000000) >> 56))
+        (((uint64_t)x & 0x00000000000000FFULL) << 56) | \
+        (((uint64_t)x & 0x000000000000FF00ULL) << 40) | \
+        (((uint64_t)x & 0x0000000000FF0000ULL) << 24) | \
+        (((uint64_t)x & 0x00000000FF000000ULL) << 8 ) | \
+        (((uint64_t)x & 0x000000FF00000000ULL) >> 8 ) | \
+        (((uint64_t)x & 0x0000FF0000000000ULL) >> 24) | \
+        (((uint64_t)x & 0x00FF000000000000ULL) >> 40) | \
+        (((uint64_t)x & 0xFF00000000000000ULL) >> 56))
 #define hton64(x) ntoh64(x)
 #elif __BYTE_ORDER == __BIG_ENDIAN
 #define hton16(x) (x)
@@ -216,7 +216,7 @@ send_msg(
 		&event.event_data.dto_completion_event_data;
 
 	iov.lmr_context     = context;
-	iov.virtual_address = (DAT_VADDR)data;
+	iov.virtual_address = (DAT_VADDR)(uintptr_t)data;
 	iov.segment_length  = (DAT_VLEN)size;
 
 	for (i=0;i<eps;i++) {
@@ -508,7 +508,7 @@ connect_ep(char *hostname)
 			cookie.as_64 = (ii*REG_MEM_COUNT)+i;
 			iov.lmr_context = lmr_context[(ii*REG_MEM_COUNT)+i];
 			iov.virtual_address = 
-				(DAT_VADDR)buf[(ii*REG_MEM_COUNT)+i];
+				(DAT_VADDR)(uintptr_t)buf[(ii*REG_MEM_COUNT)+i];
 			iov.segment_length  = buf_size;
 			LOGPRINTF(" post_recv (%p) on ep[%d]=%p\n",
 				  buf[(ii*REG_MEM_COUNT)+i],ii,ep[ii]);
@@ -618,7 +618,7 @@ connect_ep(char *hostname)
 	 */
 	r_iov = (DAT_RMR_TRIPLET*)buf[SEND_BUF_INDEX];
         r_iov->rmr_context = hton32(rmr_context[RCV_RDMA_BUF_INDEX]);
-	r_iov->virtual_address = hton64((DAT_VADDR)buf[RCV_RDMA_BUF_INDEX]);
+	r_iov->virtual_address = hton64((DAT_VADDR)(uintptr_t)buf[RCV_RDMA_BUF_INDEX]);
 	r_iov->segment_length = hton32(buf_size);
 
         printf("Send RMR message: r_key_ctx=0x%x,va="F64x",len=0x%x\n",
@@ -781,7 +781,7 @@ do_immediate()
 	r_iov = *buf[RECV_BUF_INDEX];
 
 	iov.lmr_context     = lmr_context[SND_RDMA_BUF_INDEX];
-	iov.virtual_address = (DAT_VADDR) buf[SND_RDMA_BUF_INDEX];
+	iov.virtual_address = (DAT_VADDR)(uintptr_t)buf[SND_RDMA_BUF_INDEX];
 	iov.segment_length  = buf_size;
 
 	cookie.as_64 = 0x9999;
@@ -939,7 +939,7 @@ do_cmp_swap()
 	r_iov = *buf[ RECV_BUF_INDEX ];
 	
 	l_iov.lmr_context     = lmr_atomic_context;
-	l_iov.virtual_address = (DAT_UINT64)atomic_buf;
+	l_iov.virtual_address = (DAT_UINT64)(uintptr_t)atomic_buf;
 	l_iov.segment_length  = BUF_SIZE_ATOMIC;
 
 	cookie.as_64 = 3333;
@@ -1040,7 +1040,7 @@ do_fetch_add()
 	r_iov = *buf[ RECV_BUF_INDEX ];
 	
 	l_iov.lmr_context     = lmr_atomic_context;
-	l_iov.virtual_address = (DAT_UINT64)atomic_buf;
+	l_iov.virtual_address = (DAT_UINT64)(uintptr_t)atomic_buf;
 	l_iov.segment_length  = BUF_SIZE_ATOMIC;
 
 	cookie.as_64 = 0x7777;
-- 
1.5.2.5





More information about the general mailing list