#include "dapl_cookie.h"
#include "dapl_adapter_util.h"
#include "dapl_evd_util.h"
+#include "dapl_cr_util.h" /* for callback routine */
/*
* Local definitions
}
#endif /* DAPL_DBG_IO_TRC */
+/*
+ * Generate a disconnect event on abruct close for older verbs providers
+ * that do not do it automatically.
+ */
+
+void
+dapl_ep_legacy_post_disconnect(
+ DAPL_EP *ep_ptr,
+ DAT_CLOSE_FLAGS disconnect_flags)
+{
+ ib_cm_events_t ib_cm_event;
+ DAPL_CR *cr_ptr;
+
+ /*
+ * Acquire the lock and make sure we didn't get a callback
+ * that cleaned up.
+ */
+ dapl_os_lock ( &ep_ptr->header.lock );
+ if (disconnect_flags == DAT_CLOSE_ABRUPT_FLAG &&
+ ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECT_PENDING )
+ {
+ /*
+ * If this is an ABRUPT close, the provider will not generate
+ * a disconnect message so we do it manually here. Just invoke
+ * the CM callback as it will clean up the appropriate
+ * data structures, reset the state, and generate the event
+ * on the way out. Obtain the provider dependent cm_event to
+ * pass into the callback for a disconnect.
+ */
+ ib_cm_event = dapls_ib_get_cm_event (DAT_CONNECTION_EVENT_DISCONNECTED);
+
+ cr_ptr = ep_ptr->cr_ptr;
+ dapl_os_unlock ( &ep_ptr->header.lock );
+
+ if (cr_ptr != NULL)
+ {
+ dapl_dbg_log (DAPL_DBG_TYPE_API | DAPL_DBG_TYPE_CM,
+ " dapl_ep_disconnect force callback on EP %p CM handle %x\n",
+ ep_ptr, cr_ptr->ib_cm_handle);
+
+ dapls_cr_callback (cr_ptr->ib_cm_handle,
+ ib_cm_event,
+ NULL,
+ cr_ptr->sp_ptr);
+ }
+ else
+ {
+ dapl_evd_connection_callback (ep_ptr->cm_handle,
+ ib_cm_event,
+ NULL,
+ (void *) ep_ptr);
+ }
+ }
+ else
+ {
+ dapl_os_unlock ( &ep_ptr->header.lock );
+ }
+}
+
/*
* Local variables:
* c-indent-level: 4
#include "dapl.h"
#include "dapl_adapter_util.h"
+#include "dapl_ep_util.h"
#include "dapl_evd_util.h"
#include "dapl_cr_util.h"
#include "dapl_name_service.h"
ep_ptr->cm_handle, status);
}
+ dapl_ep_legacy_post_disconnect(ep_ptr, close_flags)
+
return DAT_SUCCESS;
}