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);
}
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,
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());
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) {
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)