]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
dapl scm: remove unecessary thread when using direct objects
authorArlin Davis <arlin.r.davis@intel.com>
Wed, 4 Mar 2009 18:04:13 +0000 (10:04 -0800)
committerArlin Davis <arlin.r.davis@intel.com>
Wed, 4 Mar 2009 18:04:13 +0000 (10:04 -0800)
A thread is created for processing events on devices without
direct event objecti support. Since all openfabrics devices support
direct events there is no need to start a thread. Move this under

Signed-off-by: Arlin Davis <ardavis@ichips.intel.com>
dapl/openib_scm/dapl_ib_util.c

index 7623529a74b3268197c1327f7ca69f4f628ddd50..fdbae3cfa29b83d997461b989963e34f915fb76b 100644 (file)
@@ -258,6 +258,7 @@ found:
        hca_ptr->ib_trans.mtu =
                dapl_ib_mtu(dapl_os_get_env_val("DAPL_IB_MTU", SCM_IB_MTU));
 
+#ifndef CQ_WAIT_OBJECT
        /* initialize cq_lock */
        dat_status = dapl_os_lock_init(&hca_ptr->ib_trans.cq_lock);
        if (dat_status != DAT_SUCCESS) {
@@ -265,7 +266,6 @@ found:
                         " open_hca: failed to init cq_lock\n");
                goto bail;
        }
-
        /* EVD events without direct CQ channels, non-blocking */
        hca_ptr->ib_trans.ib_cq = 
                ibv_create_comp_channel(hca_ptr->ib_hca_handle);
@@ -286,6 +286,7 @@ found:
                          ibv_get_device_name(hca_ptr->ib_trans.ib_dev));
                 goto bail;
         }
+#endif /* CQ_WAIT_OBJECT */
 
        /* initialize cr_list lock */
        dat_status = dapl_os_lock_init(&hca_ptr->ib_trans.lock);
@@ -357,14 +358,16 @@ DAT_RETURN dapls_ib_close_hca (   IN   DAPL_HCA   *hca_ptr )
 {
        dapl_dbg_log (DAPL_DBG_TYPE_UTIL," close_hca: %p\n",hca_ptr);
 
+#ifndef CQ_WAIT_OBJECT
        dapli_cq_thread_destroy(hca_ptr);
+       dapl_os_lock_destroy(&hca_ptr->ib_trans.cq_lock);
+#endif /* CQ_WAIT_OBJECT */
 
        if (hca_ptr->ib_hca_handle != IB_INVALID_HANDLE) {
                if (ibv_close_device(hca_ptr->ib_hca_handle)) 
                        return(dapl_convert_errno(errno,"ib_close_device"));
                hca_ptr->ib_hca_handle = IB_INVALID_HANDLE;
        }
-       dapl_os_lock_destroy(&hca_ptr->ib_trans.cq_lock);
 
        /* destroy cr_thread and lock */
        hca_ptr->ib_trans.cr_state = IB_THREAD_CANCEL;