[ofa-general] [Patch 4 of 4] uDAPL v2: OFW changes - return status checking in evd processing, add function dapl_event_str, IB extension build

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


Windows specific - 
   IBAL support in evd_create
   Build IB extensions by default 
Common code -
   check return status, evd_free, evd_wait
   add dapl_event_str function 
   definitions for dat_os_library_error, dat_os_ungetc
 
Signed-off by: Stan Smith <stan.smith at intel.com>
Signed-off by: Arlin Davis <ardavis at ichips.intel.com>

diff --git a/dapl/common/dapl_evd_free.c b/dapl/common/dapl_evd_free.c
index 407dbc8..cacb84a 100755
--- a/dapl/common/dapl_evd_free.c
+++ b/dapl/common/dapl_evd_free.c
@@ -125,9 +125,11 @@ DAT_RETURN DAT_API dapl_evd_free (
 #endif	/* defined(__KDAPL__) */
 
 bail:
-    dapl_dbg_log (DAPL_DBG_TYPE_RTN,
-		  "dapl_evd_free () returns 0x%x\n",
-		  dat_status);
+    if ( dat_status )
+    {
+	dapl_dbg_log (DAPL_DBG_TYPE_RTN,
+			"dapl_evd_free () returns 0x%x\n", dat_status);
+    }
 
     return dat_status;
 }
diff --git a/dapl/common/dapl_evd_util.c b/dapl/common/dapl_evd_util.c
index 1f55ea3..c2888f3 100755
--- a/dapl/common/dapl_evd_util.c
+++ b/dapl/common/dapl_evd_util.c
@@ -53,6 +53,52 @@ DAT_RETURN dapli_evd_event_alloc (
 	IN  DAT_COUNT		qlen);
 
 
+char *dapl_event_str( IN DAT_EVENT_NUMBER  event_num )
+{
+#if defined(DAPL_DBG)
+    struct dat_event_str { char *str; DAT_EVENT_NUMBER num;};
+    static struct dat_event_str events[] = {
+    {"DAT_DTO_COMPLETION_EVENT", DAT_DTO_COMPLETION_EVENT},
+    {"DAT_RMR_BIND_COMPLETION_EVENT", DAT_RMR_BIND_COMPLETION_EVENT},
+    {"DAT_CONNECTION_REQUEST_EVENT", DAT_CONNECTION_REQUEST_EVENT},
+    {"DAT_CONNECTION_EVENT_ESTABLISHED", DAT_CONNECTION_EVENT_ESTABLISHED},
+    {"DAT_CONNECTION_EVENT_PEER_REJECTED", DAT_CONNECTION_EVENT_PEER_REJECTED},
+    {"DAT_CONNECTION_EVENT_NON_PEER_REJECTED", DAT_CONNECTION_EVENT_NON_PEER_REJECTED},
+    {"DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR", DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR},
+    {"DAT_CONNECTION_EVENT_DISCONNECTED", DAT_CONNECTION_EVENT_DISCONNECTED},
+    {"DAT_CONNECTION_EVENT_BROKEN", DAT_CONNECTION_EVENT_BROKEN},
+    {"DAT_CONNECTION_EVENT_TIMED_OUT", DAT_CONNECTION_EVENT_TIMED_OUT},
+    {"DAT_CONNECTION_EVENT_UNREACHABLE", DAT_CONNECTION_EVENT_UNREACHABLE},
+    {"DAT_ASYNC_ERROR_EVD_OVERFLOW", DAT_ASYNC_ERROR_EVD_OVERFLOW},
+    {"DAT_ASYNC_ERROR_IA_CATASTROPHIC", DAT_ASYNC_ERROR_IA_CATASTROPHIC},
+    {"DAT_ASYNC_ERROR_EP_BROKEN", DAT_ASYNC_ERROR_EP_BROKEN},
+    {"DAT_ASYNC_ERROR_TIMED_OUT", DAT_ASYNC_ERROR_TIMED_OUT},
+    {"DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR", DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR},
+    {"DAT_HA_DOWN_TO_1", DAT_HA_DOWN_TO_1},
+    {"DAT_HA_UP_TO_MULTI_PATH", DAT_HA_UP_TO_MULTI_PATH},
+    {"DAT_SOFTWARE_EVENT", DAT_SOFTWARE_EVENT},
+#ifdef DAT_EXTENSIONS
+    {"DAT_EXTENSION_EVENT", DAT_EXTENSION_EVENT},
+    {"DAT_IB_EXTENSION_RANGE_BASE", DAT_IB_EXTENSION_RANGE_BASE},
+    {"DAT_IW_EXTENSION_RANGE_BASE", DAT_IW_EXTENSION_RANGE_BASE},
+#endif /* DAT_EXTENSIONS */
+    {NULL,0},
+    };
+    int i;
+
+    for(i=0; events[i].str; i++)
+    {
+        if (events[i].num == event_num)
+            return events[i].str;
+    }
+    return "Unknown DAT event?";
+#else
+    static char str[16];
+    sprintf(str,"%x",event_num);
+    return str;
+#endif
+}
+
 /*
  * dapls_evd_internal_create
  *
@@ -122,7 +168,15 @@ dapls_evd_internal_create (
 				   | DAT_EVD_CONNECTION_FLAG
 				   | DAT_EVD_CR_FLAG) ) )
     {
-
+#if defined(_VENDOR_IBAL_)
+	/* 
+	 * The creation of CQ required a PD (PZ) associated with it and
+	 * we do not have a PD here; therefore, the work-around is that we
+	 * will postpone the creation of the cq till the creation of QP which
+	 * this cq will associate with.
+	 */
+	evd_ptr->ib_cq_handle = IB_INVALID_HANDLE;
+#else
 	dat_status = dapls_ib_cq_alloc (ia_ptr,
 					evd_ptr,
 					&cq_len);
@@ -153,6 +207,7 @@ dapls_evd_internal_create (
 	    goto bail;
 	}
 
+#endif /* _VENDOR_IBAL_ */
     }
 
     /* We now have an accurate count of events, so allocate them into
diff --git a/dapl/common/dapl_ia_query.c b/dapl/common/dapl_ia_query.c
index 7596daf..593f356 100755
--- a/dapl/common/dapl_ia_query.c
+++ b/dapl/common/dapl_ia_query.c
@@ -222,9 +222,10 @@ dapl_ia_query (
     }
 
 bail:
-    dapl_dbg_log (DAPL_DBG_TYPE_RTN,
-		  "dapl_ia_query () returns 0x%x\n", 
-		  dat_status);
+    if (dat_status != DAT_SUCCESS) {
+	dapl_dbg_log (DAPL_DBG_TYPE_RTN,
+			"dapl_ia_query () returns 0x%x\n", dat_status);
+    }
 
     return dat_status;
 }
diff --git a/dapl/udapl/dapl_evd_wait.c b/dapl/udapl/dapl_evd_wait.c
index e4e5b37..7cfece7 100644
--- a/dapl/udapl/dapl_evd_wait.c
+++ b/dapl/udapl/dapl_evd_wait.c
@@ -273,9 +273,9 @@ DAT_RETURN DAT_API dapl_evd_wait (
     *nmore = dapls_rbuf_count(&evd_ptr->pending_event_queue);
 
  bail:
-    dapl_dbg_log (DAPL_DBG_TYPE_RTN,
-		  "dapl_evd_wait () returns 0x%x\n", 
-		  dat_status);
-
+    if ( dat_status ) {
+	dapl_dbg_log (DAPL_DBG_TYPE_RTN,
+			"dapl_evd_wait () returns 0x%x\n", dat_status);
+    }
     return dat_status;
 }
diff --git a/dat/include/dat/udat_config.h b/dat/include/dat/udat_config.h
index 674f579..a720376 100644
--- a/dat/include/dat/udat_config.h
+++ b/dat/include/dat/udat_config.h
@@ -79,4 +79,11 @@
 #define DAT_THREADSAFE DAT_TRUE
 #endif /* DAT_THREADSAFE */
 
+/*
+ * Enable DAT Extensions
+ */
+#ifndef DAT_EXTENSIONS
+#define DAT_EXTENSIONS 1
+#endif
+
 #endif /* _UDAT_CONFIG_H_ */
diff --git a/dat/udat/linux/dat_osd.h b/dat/udat/linux/dat_osd.h
index c2ecc16..4a96ab5 100644
--- a/dat/udat/linux/dat_osd.h
+++ b/dat/udat/linux/dat_osd.h
@@ -114,6 +114,7 @@ dat_os_dbg_print (
  *********************************************************************/
 
 #define DAT_ERROR(Type, SubType) ((DAT_RETURN)(DAT_CLASS_ERROR | Type | SubType))
+#define dat_os_library_error() dlerror()
 
 typedef size_t 			DAT_OS_SIZE;
 typedef void * 			DAT_OS_LIBRARY_HANDLE;
@@ -296,6 +297,16 @@ dat_os_fgetc (
     return fgetc (file);
 }
 
+/* dat_os_ungetc() returns EOF on error or char 'c'.
+ * Push char 'c' back into specified stream for subsequent read.
+ */
+STATIC INLINE int
+dat_os_ungetc (
+    DAT_OS_FILE *file, int c)
+{
+    return ungetc(c, file);
+}
+
 /* dat_os_fgetc() returns EOF on error or end of file. */
 STATIC INLINE int
 dat_os_fputc (




More information about the general mailing list