]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
r8565: Added errno reporting (message and return codes) during open to help diagnose...
authorArlin Davis <ardavis@ichips.intel.com>
Mon, 17 Jul 2006 22:59:17 +0000 (22:59 +0000)
committerArlin Davis <ardavis@ichips.intel.com>
Mon, 17 Jul 2006 22:59:17 +0000 (22:59 +0000)
dapl/openib_cma/dapl_ib_util.c
dapl/openib_cma/dapl_ib_util.h

index 8d1818eea336ca1f730673bfa75eeb9d8ad43768..22d67a837d92b8823ce341a0f6cb391e540f8c00 100644 (file)
@@ -212,6 +212,7 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name, IN DAPL_HCA *hca_ptr)
        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_NAME hca_name, IN DAPL_HCA *hca_ptr)
        }
        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(IN  DAPL_IA *ia_ptr,
        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 3e1f411ede5c8d2f6b981bf075a189eb1519dede..9c30a4426d94a1d6f44eab3b1636a9384715aa43 100644 (file)
@@ -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);