[ewg] [PATCH 2/3][2.0] dapl: Fix long delays with the cma provider open call when DNS is not configure on server.

Davis, Arlin R arlin.r.davis at intel.com
Wed May 21 15:07:26 PDT 2008


Open call should default to netdev names when resolving local IP address
for cma binding to match dat.conf settings. The open code attempts to
resolve with IP or Hostname first and if there is no DNS services setup
the failover to netdev name resolution is delayed for as much as 20
seconds.

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/openib_cma/dapl_ib_util.c |   68
+++++++++++++++++++---------------------
 1 files changed, 32 insertions(+), 36 deletions(-)

diff --git a/dapl/openib_cma/dapl_ib_util.c
b/dapl/openib_cma/dapl_ib_util.c
index 41986a3..e3a3b29 100755
--- a/dapl/openib_cma/dapl_ib_util.c
+++ b/dapl/openib_cma/dapl_ib_util.c
@@ -105,41 +105,37 @@ bail:
 /* Get IP address using network name, address, or device name */
 static int getipaddr(char *name, char *addr, int len)
 {
-	struct addrinfo *res;
-	int ret;
-	
-	/* Assume network name and address type for first attempt */
-	if (getaddrinfo(name, NULL, NULL, &res)) {
-		/* retry using network device name */
-		ret = getipaddr_netdev(name,addr,len);
-		if (ret) {
-			dapl_log(DAPL_DBG_TYPE_ERR, 
-				 " open_hca: getaddr_netdev ERROR:"
-				 " %s. Is %s configured?\n", 
-				 strerror(errno), name);
-			return ret;
-		}
-	} else {
-		if (len >= res->ai_addrlen)
-			memcpy(addr, res->ai_addr, res->ai_addrlen);
-		else {
-			freeaddrinfo(res);
-			return EINVAL;
-		}
-		
-		freeaddrinfo(res);
-	}
+        struct addrinfo *res;
+
+        /* assume netdev for first attempt, then network and address
type */
+        if (getipaddr_netdev(name,addr,len)) {
+                if (getaddrinfo(name, NULL, NULL, &res)) {
+                        dapl_log(DAPL_DBG_TYPE_ERR,
+                                " open_hca: getaddr_netdev ERROR:"
+                                " %s. Is %s configured?\n",
+                                strerror(errno), name);
+                        return 1;
+                } else {
+                        if (len >= res->ai_addrlen)
+                                memcpy(addr, res->ai_addr,
res->ai_addrlen);
+                        else {
+                                freeaddrinfo(res);
+                                return 1;
+                        }
+                        freeaddrinfo(res);
+                }
+        }
 
-	dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
-		" getipaddr: family %d port %d addr %d.%d.%d.%d\n", 
-		((struct sockaddr_in *)addr)->sin_family,
-		((struct sockaddr_in *)addr)->sin_port,
-		((struct sockaddr_in *)addr)->sin_addr.s_addr >> 0 &
0xff,
-		((struct sockaddr_in *)addr)->sin_addr.s_addr >> 8 &
0xff,
-		((struct sockaddr_in *)addr)->sin_addr.s_addr >> 16 &
0xff,
-		((struct sockaddr_in *)addr)->sin_addr.s_addr >> 24 &
0xff);
-	
-	return 0;
+        dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
+                " getipaddr: family %d port %d addr %d.%d.%d.%d\n",
+                ((struct sockaddr_in *)addr)->sin_family,
+                ((struct sockaddr_in *)addr)->sin_port,
+                ((struct sockaddr_in *)addr)->sin_addr.s_addr >> 0 &
0xff,
+                ((struct sockaddr_in *)addr)->sin_addr.s_addr >> 8 &
0xff,
+                ((struct sockaddr_in *)addr)->sin_addr.s_addr >> 16 &
0xff,
+                ((struct sockaddr_in *)addr)->sin_addr.s_addr >> 24 &
0xff);
+
+        return 0;
 }
 
 /*
@@ -640,7 +636,7 @@ DAT_RETURN dapli_ib_thread_init(void)
 	while (g_ib_thread_state != IB_THREAD_RUN) {
                 struct timespec sleep, remain;
                 sleep.tv_sec = 0;
-                sleep.tv_nsec = 20000000; /* 20 ms */
+                sleep.tv_nsec = 2000000; /* 2 ms */
                 dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
                              " ib_thread_init: waiting for
ib_thread\n");
 		dapl_os_unlock(&g_hca_lock);
@@ -677,7 +673,7 @@ void dapli_ib_thread_destroy(void)
 	while ((g_ib_thread_state != IB_THREAD_EXIT) && (retries--)) {
 		struct timespec	sleep, remain;
 		sleep.tv_sec = 0;
-		sleep.tv_nsec = 20000000; /* 20 ms */
+		sleep.tv_nsec = 2000000; /* 2 ms */
 		dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
 			" ib_thread_destroy: waiting for ib_thread\n");
 		write(g_ib_pipe[1], "w", sizeof "w");
-- 
1.5.2.5




More information about the ewg mailing list