[ofa-general] [Patch 1 of 4] uDAPL v2: OFW changes for IBAL cm, init/fini, dat.conf, and dlerror

Arlin Davis arlin.r.davis at intel.com
Thu Jan 3 11:55:32 PST 2008


Windows specific - 
   Add dapl_ep fields ibal_cm_handle, recv_disc, sent_disc for IBAL provider
   Support for direct object on CQ
   INIT and FINI changes
   setup dat.conf default path, fix sr parsing
Common code -
   Add Stan as contributor
   O/S independent dat_os_library_error() 
 
Signed-off by: Stan Smith <stan.smith at intel.com>
Signed-off by: Arlin Davis <ardavis at ichips.intel.com>

diff --git a/AUTHORS b/AUTHORS
index 7c609ba..b2c6a58 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -12,5 +12,6 @@ DAPL project:
  Gil Rubin
  Steve Sears
  Randy Smith
+ Stan Smith
  Anthony Topper
  Steve Wise 
diff --git a/dapl/common/dapl_adapter_util.h b/dapl/common/dapl_adapter_util.h
index 0483839..37fb77b 100755
--- a/dapl/common/dapl_adapter_util.h
+++ b/dapl/common/dapl_adapter_util.h
@@ -290,6 +290,8 @@ dapls_cqe_to_event_extension(
 #include "dapl_dummy_dto.h"
 #elif OPENIB
 #include "dapl_ib_dto.h"
+#else
+#include "dapl_ibal_dto.h"
 #endif
 
 
diff --git a/dapl/common/dapl_ep_util.c b/dapl/common/dapl_ep_util.c
index 4518a2b..cf90d46 100644
--- a/dapl/common/dapl_ep_util.c
+++ b/dapl/common/dapl_ep_util.c
@@ -238,6 +238,14 @@ dapl_ep_dealloc (
 	dapl_os_free ( ep_ptr->cxn_timer, sizeof ( DAPL_OS_TIMER ) );
     }
 
+#if defined(_WIN32) || defined(_WIN64)
+    if ( ep_ptr->ibal_cm_handle )
+    {
+        dapl_os_free ( ep_ptr->ibal_cm_handle,
+                       sizeof ( *ep_ptr->ibal_cm_handle ) );
+        ep_ptr->ibal_cm_handle = NULL;
+    }
+#endif
     dapl_os_free (ep_ptr, sizeof (DAPL_EP) + sizeof (DAT_SOCK_ADDR) );
 }
 
diff --git a/dapl/common/dapl_sp_util.c b/dapl/common/dapl_sp_util.c
index 1ca1204..1e2ca14 100644
--- a/dapl/common/dapl_sp_util.c
+++ b/dapl/common/dapl_sp_util.c
@@ -39,6 +39,7 @@
 #include "dapl_sp_util.h"
 #include "dapl_cr_util.h"
 
+
 /*
  * Local definitions
  */
@@ -97,6 +98,9 @@ dapls_sp_alloc (
     dapl_llist_init_entry (&sp_ptr->header.ia_list_entry);
     dapl_os_lock_init (&sp_ptr->header.lock);
 
+#if defined(_WIN32) || defined(_WIN64)
+    dapl_os_wait_object_init( &sp_ptr->wait_object );
+#endif
     /*
      * Initialize the Body (set to NULL above)
      */
@@ -129,8 +133,11 @@ dapls_sp_free_sp (
 		    sp_ptr->header.magic == DAPL_MAGIC_RSP);
     dapl_os_assert (dapl_llist_is_empty (&sp_ptr->cr_list_head));
 
+#if defined(_WIN32) || defined(_WIN64)
+    dapl_os_wait_object_destroy( &sp_ptr->wait_object );
+#endif
     dapl_os_lock (&sp_ptr->header.lock);
-    sp_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */
+    sp_ptr->header.magic = DAPL_MAGIC_INVALID;/* reset magic to prevent reuse */
     dapl_os_unlock (&sp_ptr->header.lock);
     dapl_os_free (sp_ptr, sizeof (DAPL_SP));
 }
diff --git a/dapl/include/dapl.h b/dapl/include/dapl.h
index ade101b..d6c1a8c 100755
--- a/dapl/include/dapl.h
+++ b/dapl/include/dapl.h
@@ -64,6 +64,8 @@
 #include "dapl_dummy_util.h"
 #elif OPENIB
 #include "dapl_ib_util.h"
+#else /* windows - IBAL and/or IBAL+Sock_CM */
+#include "dapl_ibal_util.h"
 #endif
 
 /*********************************************************************
@@ -448,19 +450,24 @@ struct dapl_ep
     DAPL_ATOMIC			req_count;
     DAPL_ATOMIC			recv_count;
 
-    DAPL_COOKIE_BUFFER		req_buffer;
-    DAPL_COOKIE_BUFFER		recv_buffer;
+    DAPL_COOKIE_BUFFER	req_buffer;
+    DAPL_COOKIE_BUFFER	recv_buffer;
 
-    ib_data_segment_t 		*recv_iov;
+    ib_data_segment_t 	*recv_iov;
     DAT_COUNT			recv_iov_num;
 
-    ib_data_segment_t 		*send_iov;
+    ib_data_segment_t 	*send_iov;
     DAT_COUNT			send_iov_num;
 #ifdef DAPL_DBG_IO_TRC
     int			ibt_dumped;
     struct io_buf_track *ibt_base;
     DAPL_RING_BUFFER	ibt_queue;
 #endif /* DAPL_DBG_IO_TRC */
+#if defined(_WIN32) || defined(_WIN64)
+    DAT_BOOLEAN         recv_discreq;
+    DAT_BOOLEAN         sent_discreq;
+    dp_ib_cm_handle_t   ibal_cm_handle;
+#endif
 };
 
 /* DAPL_SRQ maps to DAT_SRQ_HANDLE */
diff --git a/dapl/udapl/dapl_init.c b/dapl/udapl/dapl_init.c
index cdd90d8..2c45956 100644
--- a/dapl/udapl/dapl_init.c
+++ b/dapl/udapl/dapl_init.c
@@ -184,6 +184,13 @@ DAT_PROVIDER_INIT_FUNC_NAME (
     provider = NULL;
     hca_ptr = NULL;
 
+#if defined(_WIN32) || defined(_WIN64)
+    /* initialize DAPL library here as when called from DLL context in DLLmain()
+     * the IB (ibal) call hangs.
+     */
+    dapl_init();
+#endif
+
     dat_status = dapl_provider_list_insert(provider_info->ia_name, &provider);
     if ( DAT_SUCCESS != dat_status ) 
     {
@@ -289,6 +296,13 @@ DAT_PROVIDER_FINI_FUNC_NAME (
     dapl_hca_free (provider->extension);
 
     (void) dapl_provider_list_remove(provider_info->ia_name);
+
+#if defined(_WIN32) || defined(_WIN64)
+    /* cleanup DAPL library - relocated here from OSD DLL context as the IBAL
+     * calls hung in the DLL context?
+     */
+    dapl_fini();
+#endif
 }
 
 
diff --git a/dat/common/dat_sr.c b/dat/common/dat_sr.c
index ee50375..76991a8 100755
--- a/dat/common/dat_sr.c
+++ b/dat/common/dat_sr.c
@@ -388,7 +388,7 @@ dat_sr_provider_open (
 		    fncptr = dat_os_library_sym(data->lib_handle,
                                                 "dapl_extensions");
 
-                    if ((dlerror() != NULL) || (fncptr == NULL)) 
+                    if ((dat_os_library_error() != NULL) || (fncptr == NULL)) 
 		    {
                             dat_os_dbg_print(DAT_OS_DBG_TYPE_SR,
 				  "DAT Registry: WARNING: library %s, "
diff --git a/dat/udat/udat_sr_parser.c b/dat/udat/udat_sr_parser.c
index 64c4114..84b5b9d 100644
--- a/dat/udat/udat_sr_parser.c
+++ b/dat/udat/udat_sr_parser.c
@@ -49,7 +49,11 @@
  *********************************************************************/
 
 #define DAT_SR_CONF_ENV 		"DAT_OVERRIDE"
+#if defined(_WIN32) || defined(_WIN64)
+#define DAT_SR_CONF_DEFAULT 		"C:\\DAT\\dat.conf"
+#else
 #define DAT_SR_CONF_DEFAULT 		"/etc/dat.conf"
+#endif
 
 #define DAT_SR_TOKEN_THREADSAFE 	"threadsafe"
 #define DAT_SR_TOKEN_NONTHREADSAFE 	"nonthreadsafe"
@@ -1474,7 +1478,7 @@ dat_sr_read_quoted_str (
 	}
 	else
 	{
-	    token->value[j] = c;
+	    token->value[j] = (char)c;
 	    j++;
 
 	    is_prev_char_backslash = DAT_FALSE;
@@ -1521,5 +1525,5 @@ dat_sr_read_comment (
     } while ( (DAT_SR_CHAR_NEWLINE != c) && (EOF != c) );
 
     /* put back the newline */
-    dat_os_fputc (file, c);
+    dat_os_ungetc (file, c);
 }

 




More information about the general mailing list