]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
Windows patch to fix IB_INVALID_HANDLE name collision
authorArlin Davis <arlin.r.davis@intel.com>
Fri, 19 Feb 2010 22:52:01 +0000 (14:52 -0800)
committerArlin Davis <arlin.r.davis@intel.com>
Fri, 19 Feb 2010 22:52:01 +0000 (14:52 -0800)
signed-off-by: stan smith <stan.smith@intel.com>

dapl/ibal/dapl_ibal_cm.c

index af164a9f04050ef57065671497680c3a184042d1..c51faf84500892eeee046aeed5b1f4abdc7a8400 100644 (file)
 #define  DAPL_ATS_NAME              ATS_NAME
 #define  HCA_IPV6_ADDRESS_LENGTH    16
 
+/* until dapl_ibal_util.h define of IB_INVALID_HANDLE which overlaps the
+ * Windows ib_types.h typedef enu ib_api_status_t IB_INVALID_HANDLE is fixed.
+ */
+#undef IB_INVALID_HANDLE
+#define DAPL_IB_INVALID_HANDLE NULL
+
 int g_dapl_loopback_connection = 0;
 extern dapl_ibal_root_t        dapl_ibal_root;
 
@@ -268,7 +274,7 @@ dapli_ib_cm_drep_cb (
         return;
     }
 
-    if (ep_ptr->cm_handle == IB_INVALID_HANDLE )
+    if (ep_ptr->cm_handle == DAPL_IB_INVALID_HANDLE )
     {
          dapl_dbg_log (DAPL_DBG_TYPE_CM,
                   "--> %s: Invalid EP->CM handle?\n", __FUNCTION__); 
@@ -1013,9 +1019,10 @@ dapls_ib_disconnect ( IN   DAPL_EP           *ep_ptr,
     {
          dapl_dbg_log (DAPL_DBG_TYPE_CM,
                   "--> %s: BAD EP Magic EP=%lx\n", __FUNCTION__,ep_ptr); 
+        return DAT_SUCCESS;
     }
 
-    if (ep_ptr->cm_handle == IB_INVALID_HANDLE )
+    if (ep_ptr->cm_handle == DAPL_IB_INVALID_HANDLE )
     {
          dapl_dbg_log (DAPL_DBG_TYPE_CM,
                   "--> %s: Invalid EP->CM handle, OK.\n", __FUNCTION__); 
@@ -1064,21 +1071,24 @@ dapls_ib_disconnect ( IN   DAPL_EP           *ep_ptr,
     {
         ep_ptr->sent_discreq = DAT_TRUE;
         ib_status = ib_cm_dreq ( &cm_dreq );
+
+       if ( ib_status == IB_SUCCESS )
+           dapl_dbg_log (DAPL_DBG_TYPE_CM,
+                       "--> DsD: EP %p  DREQ SENT\n", ep_ptr);
+
        /* tolerate INVALID_STATE error as the other side can race ahead and
         * generate a DREQ before we do.
         */
-       if ( ib_status == IB_INVALID_STATE )
+       if ( ib_status == IB_INVALID_STATE || ib_status == IB_INVALID_HANDLE )
+       {
            ib_status = IB_SUCCESS;
-
-       if (ib_status)
+       }
+       else if (ib_status)
        {
            dapl_dbg_log(DAPL_DBG_TYPE_ERR,
                        "%s() EP %p ib_cm_dreq() status %s\n",
                        __FUNCTION__,ep_ptr,ib_get_err_str(ib_status));
        }
-       if ( ib_status == IB_SUCCESS )
-        dapl_dbg_log (DAPL_DBG_TYPE_CM,
-                               "--> DsD: EP %p  DREQ SENT\n", ep_ptr);
     }
     return ib_status;
 }
@@ -1650,7 +1660,7 @@ dapls_ib_cr_handoff (
         return DAT_INVALID_PARAMETER;
     }
 
-    if (cr_ptr->sp_ptr == IB_INVALID_HANDLE)
+    if (cr_ptr->sp_ptr == DAPL_IB_INVALID_HANDLE)
     {
         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,
                        "--> DsCH: CR = %lx invalid psp handle\n", cr_ptr);