[openib-general] [PATCH] uDAPL cma provider, errno reporting on create thread during open

Arlin Davis arlin.r.davis at intel.com
Mon Jul 17 13:31:13 PDT 2006


Added errno reporting (message and return codes) during open to help diagnose create thread issues.

Signed-off by: Arlin Davis ardavis at ichips.intel.com

Index: openib_cma/dapl_ib_util.c
===================================================================
--- openib_cma/dapl_ib_util.c	(revision 8559)
+++ openib_cma/dapl_ib_util.c	(working copy)
@@ -212,6 +212,7 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_N
 	struct rdma_cm_id *cm_id;
 	union ibv_gid *gid;
 	int ret;
+	DAT_RETURN dat_status;
 
 	dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
 		     " open_hca: %s - %p\n", hca_name, hca_ptr);
@@ -225,8 +226,9 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_N
 	}
 	dapl_os_unlock(&g_hca_lock);
 
-	if (dapli_ib_thread_init()) 
-		return DAT_INTERNAL_ERROR;
+	dat_status = dapli_ib_thread_init();
+	if (dat_status != DAT_SUCCESS)
+		return dat_status;
 
 	/* HCA name will be hostname or IP address */
 	if (getipaddr((char*)hca_name,
@@ -557,10 +559,10 @@ DAT_RETURN dapls_ib_setup_async_callback
 	return DAT_SUCCESS;
 }
 
-int dapli_ib_thread_init(void)
+DAT_RETURN dapli_ib_thread_init(void)
 {
 	long opts;
-	DAT_RETURN ret;
+	DAT_RETURN dat_status;
 
 	dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
 		     " ib_thread_init(%d)\n", getpid());
@@ -568,31 +570,27 @@ int dapli_ib_thread_init(void)
 	dapl_os_lock(&g_hca_lock);
 	if (g_ib_thread_state != IB_THREAD_INIT) {
 		dapl_os_unlock(&g_hca_lock);
-		return 0;
+		return DAT_SUCCESS;
 	}
 		
 	/* uCMA events non-blocking */
 	opts = fcntl(g_cm_events->fd, F_GETFL); /* uCMA */
 	if (opts < 0 || fcntl(g_cm_events->fd, 
 			      F_SETFL, opts | O_NONBLOCK) < 0) {
-		dapl_dbg_log (DAPL_DBG_TYPE_ERR, 
-			      " dapl_ib_init: ERR with uCMA FD\n" );
 		dapl_os_unlock(&g_hca_lock);
-		return 1;
+		return(dapl_convert_errno(errno, "create_thread ERR: cm_fd"));
 	}
 
 	g_ib_thread_state = IB_THREAD_CREATE;
 	dapl_os_unlock(&g_hca_lock);
 
 	/* create thread to process inbound connect request */
-	ret = dapl_os_thread_create(dapli_thread, NULL, &g_ib_thread);
-	if (ret != DAT_SUCCESS)
-	{
-		dapl_dbg_log(DAPL_DBG_TYPE_ERR, 
-			     " ib_thread_init: failed to create thread\n");
-		return 1;
-	}
-
+	dat_status = dapl_os_thread_create(dapli_thread, NULL, &g_ib_thread);
+	if (dat_status != DAT_SUCCESS)
+		return(dapl_convert_errno(errno,
+					  "create_thread ERR:"
+					  " check resource limits"));
+	
 	/* wait for thread to start */
 	dapl_os_lock(&g_hca_lock);
 	while (g_ib_thread_state != IB_THREAD_RUN) {
@@ -609,7 +607,8 @@ int dapli_ib_thread_init(void)
 	
 	dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
 		     " ib_thread_init(%d) exit\n",getpid());
- 	return 0;
+
+ 	return DAT_SUCCESS;
 }
 
 void dapli_ib_thread_destroy(void)
Index: openib_cma/dapl_ib_util.h
===================================================================
--- openib_cma/dapl_ib_util.h	(revision 8559)
+++ openib_cma/dapl_ib_util.h	(working copy)
@@ -265,7 +265,7 @@ typedef uint32_t ib_shm_transport_t;
 int32_t	dapls_ib_init (void);
 int32_t	dapls_ib_release (void);
 void dapli_thread(void *arg);
-int  dapli_ib_thread_init(void);
+DAT_RETURN  dapli_ib_thread_init(void);
 void dapli_ib_thread_destroy(void);
 void dapli_cma_event_cb(void);
 void dapli_cq_event_cb(struct _ib_hca_transport *hca);





More information about the general mailing list