]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
Enable building with CQ_WAIT_OBJECTS support to directly wait on CQ
authorSean Hefty <sean.hefty@intel.com>
Fri, 10 Apr 2009 15:07:49 +0000 (08:07 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Fri, 10 Apr 2009 15:07:49 +0000 (08:07 -0700)
completion channels in the Windows version of the openib_scm provider.
Also minor fixup to use DAPL_DBG_TYPE_UTIL for debug log messages
instead of DAPL_DBG_TYPE_CM.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
dapl/common/dapl_adapter_util.h
dapl/openib_scm/dapl_ib_cq.c

index e3069f8bdcf2448555fd4b39fd2d12f1a172ec94..1a8b7ccb4a6d60c41e57b5e895e7c72487911764 100755 (executable)
@@ -266,7 +266,7 @@ dapls_ib_wait_object_wakeup (
 DAT_RETURN
 dapls_ib_wait_object_wait (
        IN ib_wait_obj_handle_t         cq_wait_obj_handle,
-       IN u_int32_t                    timeout);
+       IN uint32_t                     timeout);
 #endif
 
 #ifdef DAT_EXTENSIONS
index 8469285a1abfa42f5e25edf957b566553cd0c7f3..365dd679a092796a5eff556b198eb5da4d4d1c5b 100644 (file)
@@ -572,7 +572,7 @@ dapls_ib_wait_object_create (
                IN DAPL_EVD             *evd_ptr,
                IN ib_wait_obj_handle_t *p_cq_wait_obj_handle )
 {
-       dapl_dbg_log (  DAPL_DBG_TYPE_CM
+       dapl_dbg_log (  DAPL_DBG_TYPE_UTIL
                        " cq_object_create: (%p,%p)\n", 
                        evd_ptr, p_cq_wait_obj_handle );
 
@@ -608,10 +608,41 @@ dapls_ib_wait_object_wakeup (
        return DAT_SUCCESS;
 }
 
+#if defined(_WIN32) || defined(_WIN64)
+DAT_RETURN
+dapls_ib_wait_object_wait (
+       IN ib_wait_obj_handle_t p_cq_wait_obj_handle,
+       IN uint32_t timeout)
+{
+       struct dapl_evd *evd_ptr;
+       struct ibv_cq *ibv_cq = NULL;
+       int status = 0;
+
+       dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
+                       " cq_object_wait: CQ channel %p time %d\n", 
+                       p_cq_wait_obj_handle, timeout);
+       
+       /* uDAPL timeout values in usecs */
+       p_cq_wait_obj_handle->comp_channel.Milliseconds = timeout / 1000;
+
+       /* returned event */
+       status = ibv_get_cq_event(p_cq_wait_obj_handle, &ibv_cq,
+                               (void *) &evd_ptr);
+       if (status == 0) {
+               ibv_ack_cq_events(ibv_cq, 1);
+       }
+       
+       dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
+                     " cq_object_wait: RET evd %p ibv_cq %p %s\n",
+                     evd_ptr, ibv_cq,strerror(errno));
+       
+       return(dapl_convert_errno(status,"cq_wait_object_wait"));
+}
+#else //_WIN32 || _WIN64
 DAT_RETURN
 dapls_ib_wait_object_wait (
        IN ib_wait_obj_handle_t     p_cq_wait_obj_handle,
-       IN u_int32_t                timeout)
+       IN uint32_t                 timeout)
 {
        struct dapl_evd *evd_ptr;
        struct ibv_cq   *ibv_cq = NULL;
@@ -623,7 +654,7 @@ dapls_ib_wait_object_wait (
                        .revents = 0
                };
 
-       dapl_dbg_log ( DAPL_DBG_TYPE_CM
+       dapl_dbg_log ( DAPL_DBG_TYPE_UTIL
                        " cq_object_wait: CQ channel %p time %d\n", 
                        p_cq_wait_obj_handle, timeout );
        
@@ -645,14 +676,15 @@ dapls_ib_wait_object_wait (
        } else if (status == 0) 
                status = ETIMEDOUT;
        
-       dapl_dbg_log (DAPL_DBG_TYPE_CM
+       dapl_dbg_log (DAPL_DBG_TYPE_UTIL
                      " cq_object_wait: RET evd %p ibv_cq %p %s\n",
                      evd_ptr, ibv_cq,strerror(errno));
        
        return(dapl_convert_errno(status,"cq_wait_object_wait"));
        
 }
-#endif
+#endif //_WIN32 || _WIN64
+#endif // CQ_WAIT_OBJECT
 
 /*
  * Local variables: