static void psdapl_destroy_ep(psdapl_con_info_t *ci) { if (ci->ep_handle) { dat_ep_disconnect(ci->ep_handle, DAT_CLOSE_ABRUPT_FLAG); if (!psdapl_wait4event(ci, DAT_CONNECTION_EVENT_DISCONNECTED, "DAT_CONNECTION_EVENT_DISCONNECTED")) { /* Got the DAT_CONNECTION_EVENT_DISCONNECTED event */ dat_ep_free(ci->ep_handle); ci->ep_handle = 0; } else { /* ToDo: What to do here? */ } } if (ci->recv_evd_handle) { dat_evd_free(ci->recv_evd_handle); ci->recv_evd_handle = 0; } if (ci->connect_evd_handle) { dat_evd_free(ci->connect_evd_handle); ci->connect_evd_handle = 0; } }
int disconnect_ep(void) { DAT_RETURN status; DAT_EVENT event; DAT_COUNT nmore; int i; if (counters) { /* examples of query and print */ int ii; DAT_UINT64 ia_cntrs[DCNT_IA_ALL_COUNTERS]; dat_query_counters(ia, DCNT_IA_ALL_COUNTERS, ia_cntrs, 0); printf(" IA Cntrs:"); for (ii = 0; ii < DCNT_IA_ALL_COUNTERS; ii++) printf(" " F64u "", ia_cntrs[ii]); printf("\n"); dat_print_counters(ia, DCNT_IA_ALL_COUNTERS, 0); } if (!ud_test) { status = dat_ep_disconnect(ep[0], DAT_CLOSE_DEFAULT); _OK2(status, "dat_ep_disconnect"); status = dat_evd_wait(con_evd, DAT_TIMEOUT_INFINITE, 1, &event, &nmore); _OK(status, "dat_evd_wait"); } if (psp) { status = dat_psp_free(psp); _OK2(status, "dat_psp_free"); } for (i = 0; i < REG_MEM_COUNT * eps; i++) { status = dat_lmr_free(lmr[i]); _OK2(status, "dat_lmr_free"); } if (lmr_atomic) { status = dat_lmr_free(lmr_atomic); _OK2(status, "dat_lmr_free_atomic"); } for (i = 0; i < eps; i++) { if (counters) { /* examples of query and print */ int ii; DAT_UINT64 ep_cntrs[DCNT_EP_ALL_COUNTERS]; dat_query_counters(ep[i], DCNT_EP_ALL_COUNTERS, ep_cntrs, 0); printf(" EP[%d] Cntrs:", i); for (ii = 0; ii < DCNT_EP_ALL_COUNTERS; ii++) printf(" " F64u "", ep_cntrs[ii]); printf("\n"); dat_print_counters(ep[i], DCNT_EP_ALL_COUNTERS, 0); } status = dat_ep_free(ep[i]); _OK2(status, "dat_ep_free"); } if (counters) { /* examples of query and print */ int ii; DAT_UINT64 evd_cntrs[DCNT_EVD_ALL_COUNTERS]; dat_query_counters(dto_evd, DCNT_EVD_ALL_COUNTERS, evd_cntrs, 0); printf(" DTO_EVD Cntrs:"); for (ii = 0; ii < DCNT_EVD_ALL_COUNTERS; ii++) printf(" " F64u "", evd_cntrs[ii]); printf("\n"); dat_print_counters(dto_evd, DCNT_EVD_ALL_COUNTERS, 0); dat_query_counters(con_evd, DCNT_EVD_ALL_COUNTERS, evd_cntrs, 0); printf(" CONN_EVD Cntrs:"); for (ii = 0; ii < DCNT_EVD_ALL_COUNTERS; ii++) printf(" " F64u "", evd_cntrs[ii]); printf("\n"); dat_print_counters(con_evd, DCNT_EVD_ALL_COUNTERS, 0); dat_query_counters(cr_evd, DCNT_EVD_ALL_COUNTERS, evd_cntrs, 0); printf(" CR_EVD Cntrs:"); for (ii = 0; ii < DCNT_EVD_ALL_COUNTERS; ii++) printf(" " F64u "", evd_cntrs[ii]); printf("\n"); dat_print_counters(cr_evd, DCNT_EVD_ALL_COUNTERS, 0); } status = dat_evd_free(dto_evd); _OK2(status, "dat_evd_free DTO"); status = dat_evd_free(con_evd); _OK2(status, "dat_evd_free CON"); status = dat_evd_free(cr_evd); _OK2(status, "dat_evd_free CR"); status = dat_pz_free(pz); _OK2(status, "dat_pz_free"); status = dat_ia_close(ia, DAT_CLOSE_DEFAULT); _OK2(status, "dat_ia_close"); return (0); }