[ofa-general] [PATCH 09/11] uDAPL dtestcm: add UD type QP option to test

Davis, Arlin R arlin.r.davis at intel.com
Mon Jul 6 12:52:25 PDT 2009


Add -u for UD type QP's during connection setup.
Will setup UD QPs and provide remote AH
in connect establishment event. Measures
setup/exchange rates.

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

diff --git a/test/dtest/dtestcm.c b/test/dtest/dtestcm.c
index 62af6a1..932beac 100644
--- a/test/dtest/dtestcm.c
+++ b/test/dtest/dtestcm.c
@@ -97,6 +97,7 @@
 
 /* Header files needed for DAT/uDAPL */
 #include    "dat2/udat.h"
+#include    "dat2/dat_ib_extensions.h"
 
 /* definitions */
 #define SERVER_CONN_QUAL  45248
@@ -149,6 +150,7 @@ struct dt_time time;
 /* defaults */
 static int connected = 0;
 static int multi_listens = 0;
+static int ud_test = 0;
 static int server = 1;
 static int waiting = 0;
 static int verbose = 0;
@@ -191,7 +193,7 @@ int main(int argc, char **argv)
 	DAT_RETURN ret;
 	
 	/* parse arguments */
-	while ((c = getopt(argc, argv, "smwvb:c:d:h:P:p:")) != -1) {
+	while ((c = getopt(argc, argv, "smwvub:c:d:h:P:p:")) != -1) {
 		switch (c) {
 		case 's':
 			server = 1;
@@ -202,6 +204,9 @@ int main(int argc, char **argv)
 		case 'w':
 			waiting = 1;
 			break;
+		case 'u':
+			ud_test = 1;
+			break;
 		case 'c':
 			connections = atoi(optarg);
 			break;
@@ -246,11 +251,11 @@ int main(int argc, char **argv)
 #endif
 
 	if (!server) {
-		printf(" Running client on %s with %d connections\n", 
-			provider, connections);
+		printf(" Running client on %s with %d %s connections\n", 
+			provider, connections, ud_test ? "UD" : "RC");
 	} else {
-		printf(" Running server on %s with %d connections\n", 
-			provider, connections);
+		printf(" Running server on %s with %d %s connections\n", 
+			provider, connections, ud_test ? "UD" : "RC");
 	}
 	fflush(stdout);
 	
@@ -318,8 +323,15 @@ int main(int argc, char **argv)
 
 	/* create EP */
 	memset(&ep_attr, 0, sizeof(ep_attr));
-	ep_attr.service_type = DAT_SERVICE_TYPE_RC;
-	ep_attr.max_rdma_size = 0x10000;
+	if (ud_test) {
+		ep_attr.service_type = DAT_IB_SERVICE_TYPE_UD;
+		ep_attr.max_message_size = 2048;
+	} else {
+		ep_attr.service_type = DAT_SERVICE_TYPE_RC;
+		ep_attr.max_rdma_size = 0x10000;
+		ep_attr.max_rdma_read_in = 4;
+		ep_attr.max_rdma_read_out = 4;
+	}
 	ep_attr.max_recv_dtos = 1;
 	ep_attr.max_request_dtos = 1;
 	ep_attr.max_recv_iov = 1;
@@ -515,10 +527,10 @@ DAT_RETURN conn_server()
 	DAT_RETURN ret;
 	DAT_EVENT event;
 	DAT_COUNT nmore;
-	DAT_CR_ARRIVAL_EVENT_DATA *cr_event =
-		&event.event_data.cr_arrival_event_data;
 	int i,bi;
 	unsigned char *buf;
+	DAT_CR_ARRIVAL_EVENT_DATA *cr_event =
+		&event.event_data.cr_arrival_event_data;
 	DAT_CR_PARAM cr_param = { 0 };
 	
 	printf(" Accepting...\n");
@@ -541,24 +553,26 @@ DAT_RETURN conn_server()
 			}
 		}
 	
-		if (event.event_number != DAT_CONNECTION_REQUEST_EVENT) {
-			fprintf(stderr, " Error unexpected CR event : %s\n",
-				DT_EventToSTr(event.event_number));
-			return (DAT_ABORT);
+		if ((event.event_number != DAT_CONNECTION_REQUEST_EVENT) &&
+		    (ud_test && event.event_number != 
+		     DAT_IB_UD_CONNECTION_REQUEST_EVENT)) {
+				fprintf(stderr, " Error unexpected CR event : %s\n",
+					DT_EventToSTr(event.event_number));
+				return (DAT_ABORT);
 		}
 
-
+		
 		/* use to test rdma_cma timeout logic */
 #if defined(_WIN32) || defined(_WIN64)
-		    if (delay) {
+		if (delay) {
 			printf(" Accept delayed by %d seconds...\n", delay);
 			Sleep(delay * 1000);
-		    }
+		}
 #else
-		    if (delay) {
+		if (delay) {
 			printf(" Accept delayed by %d seconds...\n", delay);
 			sleep(delay);
-		    }
+		}
 #endif
 		/* accept connect request from client */
 		h_cr = cr_event->cr_handle;
@@ -622,8 +636,10 @@ DAT_RETURN conn_server()
 				return ret;
 			}
 		}
+		if ((event.event_number != DAT_CONNECTION_EVENT_ESTABLISHED) &&
+		    (ud_test && event.event_number != 
+		     DAT_IB_UD_CONNECTION_EVENT_ESTABLISHED)) {
 
-		if (event.event_number != DAT_CONNECTION_EVENT_ESTABLISHED) {
 			fprintf(stderr, " Error unexpected CR EST "
 				"event : 0x%x %s\n",
 				 event.event_number,
@@ -748,8 +764,10 @@ DAT_RETURN conn_client()
 			printf("\n Rej Test Done. PASSED\n\n");
 			exit(0);
 #endif
-			if (event.event_number != 
-				DAT_CONNECTION_EVENT_ESTABLISHED) {
+			if ((event.event_number != 
+			    DAT_CONNECTION_EVENT_ESTABLISHED) &&
+			    (ud_test && event.event_number != 
+			    DAT_IB_UD_CONNECTION_EVENT_ESTABLISHED)) {
 				fprintf(stderr, " Error unexpected conn "
 					"event : 0x%x %s\n",
 					 event.event_number,
@@ -802,8 +820,28 @@ DAT_RETURN disconnect_eps(void)
 	DAT_CONNECTION_EVENT_DATA *conn_event =
 		&event.event_data.connect_event_data;
 
-	if (!connected) 
+	if (!connected)
 		return DAT_SUCCESS;
+
+	/* UD, no connection to disconnect, just free EP's */
+	if (ud_test) {
+		for (i = 0; i < connections; i++) {
+			ret = dat_ep_free(h_ep[i]);
+			if (ret != DAT_SUCCESS) {
+				fprintf(stderr, 
+					" ERR free EP[%d] %p: %s\n",
+					i, h_ep[i], DT_RetToString(ret));
+			} else {
+				LOGPRINTF(" Freed EP[%d] %p\n", 
+					  i, h_ep[i]);
+				h_ep[i] = DAT_HANDLE_NULL;
+			}
+		}
+		stop = get_time();
+		time.epf += ((stop - start) * 1.0e6);
+		time.total += time.epf;
+		return DAT_SUCCESS;
+	}
 	
 	/* 
 	 * Only the client needs to call disconnect. The server _should_ be able
@@ -811,6 +849,7 @@ DAT_RETURN disconnect_eps(void)
 	 * disconnect request and then exit.
 	 */
 	if (!server) {
+		start = get_time();
 		for (i = 0; i < connections; i++) {
 			LOGPRINTF(" dat_ep_disconnect\n");
 			ret = dat_ep_disconnect(h_ep[i], 
-- 
1.5.2.5




More information about the general mailing list