[ofa-general] [PATCH] uDAPL v2: dtest: add flush EVD call after data transfer errors

Arlin Davis arlin.r.davis at intel.com
Thu Apr 30 01:10:36 PDT 2009


Flush and print entries on async, request, and receive
queues after any data transfer error. Will help
identify failing operation during operations
without completion events requested.
Fix -B0 so burst size of 0 works.

Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
 test/dtest/dtest.c |   61 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/test/dtest/dtest.c b/test/dtest/dtest.c
index d099c95..6ff7798 100755
--- a/test/dtest/dtest.c
+++ b/test/dtest/dtest.c
@@ -61,7 +61,7 @@
 #define ntohll _byteswap_uint64
 #define htonll _byteswap_uint64
 
-#else				// _WIN32 || _WIN64
+#else // _WIN32 || _WIN64
 
 #include <endian.h>
 #include <byteswap.h>
@@ -89,7 +89,7 @@
 #define ntohll(x)  bswap_64(x)
 #endif
 
-#endif				// _WIN32 || _WIN64
+#endif // _WIN32 || _WIN64
 
 /* Debug: 1 == connect & close only, otherwise full-meal deal */
 #define CONNECT_ONLY 0
@@ -229,6 +229,37 @@ DAT_RETURN do_ping_pong_msg(void);
 
 #define LOGPRINTF if (verbose) printf
 
+void flush_evds(void)
+{
+	DAT_EVENT event;
+
+	/* Flush async error queue */
+	printf("%d ERR: Checking ASYNC EVD...\n", getpid());
+	while (dat_evd_dequeue(h_async_evd, &event) == DAT_SUCCESS) {
+		printf(" ASYNC EVD ENTRY: handle=%p reason=%d\n",
+			event.event_data.asynch_error_event_data.dat_handle,
+			event.event_data.asynch_error_event_data.reason);
+	}
+	/* Flush receive queue */
+	printf("%d ERR: Checking RECEIVE EVD...\n", getpid());
+	while (dat_evd_dequeue(h_dto_rcv_evd, &event) == DAT_SUCCESS) {
+		printf(" RCV EVD ENTRY: op=%d stat=%d ln=%d ck="F64x"\n",
+			event.event_data.dto_completion_event_data.operation,
+			event.event_data.dto_completion_event_data.status,
+			event.event_data.dto_completion_event_data.transfered_length,
+			event.event_data.dto_completion_event_data.user_cookie.as_64);
+	}
+	/* Flush request queue */
+	printf("%d ERR: Checking REQUEST EVD...\n", getpid());
+	while (dat_evd_dequeue(h_dto_req_evd, &event) == DAT_SUCCESS) {
+		printf(" REQ EVD ENTRY: op=%d stat=%d ln=%d ck="F64x"\n",
+			event.event_data.dto_completion_event_data.operation,
+			event.event_data.dto_completion_event_data.status,
+			event.event_data.dto_completion_event_data.transfered_length,
+			event.event_data.dto_completion_event_data.user_cookie.as_64);
+	}
+}
+
 int main(int argc, char **argv)
 {
 	int i, c;
@@ -305,8 +336,8 @@ int main(int argc, char **argv)
 	fflush(stdout);
 
 	/* allocate send and receive buffers */
-	if (((rbuf = malloc(buf_len * burst)) == NULL) ||
-	    ((sbuf = malloc(buf_len * burst)) == NULL)) {
+	if (((rbuf = malloc(buf_len * (burst+1))) == NULL) ||
+	    ((sbuf = malloc(buf_len * (burst+1))) == NULL)) {
 		perror("malloc");
 		exit(1);
 	}
@@ -446,7 +477,7 @@ int main(int argc, char **argv)
 	goto cleanup;
 #endif
 
-    /*********** RDMA write data *************/
+	/*********** RDMA write data *************/
 	ret = do_rdma_write_with_msg();
 	if (ret != DAT_SUCCESS) {
 		fprintf(stderr, "%d Error do_rdma_write_with_msg: %s\n",
@@ -455,7 +486,7 @@ int main(int argc, char **argv)
 	} else
 		LOGPRINTF("%d do_rdma_write_with_msg complete\n", getpid());
 
-    /*********** RDMA read data *************/
+	/*********** RDMA read data *************/
 	ret = do_rdma_read_with_msg();
 	if (ret != DAT_SUCCESS) {
 		fprintf(stderr, "%d Error do_rdma_read_with_msg: %s\n",
@@ -464,7 +495,7 @@ int main(int argc, char **argv)
 	} else
 		LOGPRINTF("%d do_rdma_read_with_msg complete\n", getpid());
 
-    /*********** PING PING messages ************/
+	/*********** PING PING messages ************/
 	ret = do_ping_pong_msg();
 	if (ret != DAT_SUCCESS) {
 		fprintf(stderr, "%d Error do_ping_pong_msg: %s\n",
@@ -475,9 +506,10 @@ int main(int argc, char **argv)
 		goto complete;
 	}
 
-      cleanup:
+cleanup:
+	flush_evds();
 	failed++;
-      complete:
+complete:
 
 	/* disconnect and free EP resources */
 	if (h_ep != DAT_HANDLE_NULL) {
@@ -541,7 +573,6 @@ int main(int argc, char **argv)
 	if (ret != DAT_SUCCESS) {
 		fprintf(stderr, "%d: Error Adaptor close: %s\n",
 			getpid(), DT_RetToString(ret));
-		exit(1);
 	} else
 		LOGPRINTF("%d Closed Interface Adaptor\n", getpid());
 
@@ -552,6 +583,9 @@ int main(int argc, char **argv)
 	printf("\n%d: DAPL Test Complete. %s\n\n",
 	       getpid(), failed ? "FAILED" : "PASSED");
 
+	fflush(stderr);
+	fflush(stdout);
+
 	if (!performance_times)
 		exit(0);
 
@@ -1751,7 +1785,7 @@ DAT_RETURN register_rdma_memory(void)
 	ret = dat_lmr_create(h_ia,
 			     DAT_MEM_TYPE_VIRTUAL,
 			     region,
-			     buf_len * burst,
+			     buf_len * (burst+1),
 			     h_pz,
 			     DAT_MEM_PRIV_ALL_FLAG,
 			     DAT_VA_TYPE_VA,
@@ -1778,7 +1812,7 @@ DAT_RETURN register_rdma_memory(void)
 	ret = dat_lmr_create(h_ia,
 			     DAT_MEM_TYPE_VIRTUAL,
 			     region,
-			     buf_len * burst,
+			     buf_len * (burst + 1),
 			     h_pz,
 			     DAT_MEM_PRIV_ALL_FLAG,
 			     DAT_VA_TYPE_VA,
@@ -1917,7 +1951,7 @@ DAT_RETURN create_events(void)
 
 	/* create dto RCV EVD, with CNO if use_cno was set */
 	ret = dat_evd_create(h_ia,
-			     MSG_BUF_COUNT,
+			     MSG_BUF_COUNT + burst,
 			     h_dto_cno, DAT_EVD_DTO_FLAG, &h_dto_rcv_evd);
 	if (ret != DAT_SUCCESS) {
 		fprintf(stderr, "%d Error dat_evd_create RCV: %s\n",
@@ -2110,3 +2144,4 @@ void print_usage(void)
 	printf("P: provider name (default = OpenIB-cma)\n");
 	printf("\n");
 }
+
-- 
1.5.2.5





More information about the general mailing list