static int psmx2_sep_close(fid_t fid) { struct psmx2_fid_sep *sep; struct psmx2_ep_name ep_name; int i; sep = container_of(fid, struct psmx2_fid_sep, ep.fid); if (ofi_atomic_get32(&sep->ref)) return -FI_EBUSY; for (i = 0; i < sep->ctxt_cnt; i++) { if (sep->ctxts[i].ep && ofi_atomic_get32(&sep->ctxts[i].ep->ref)) return -FI_EBUSY; } ep_name.epid = sep->ctxts[0].trx_ctxt->psm2_epid; ep_name.sep_id = sep->id; ep_name.type = sep->type; ofi_ns_del_local_name(&sep->domain->fabric->name_server, &sep->service, &ep_name); for (i = 0; i < sep->ctxt_cnt; i++) { psmx2_lock(&sep->domain->trx_ctxt_lock, 1); dlist_remove(&sep->ctxts[i].trx_ctxt->entry); psmx2_unlock(&sep->domain->trx_ctxt_lock, 1); if (sep->ctxts[i].ep) psmx2_ep_close_internal(sep->ctxts[i].ep); psmx2_trx_ctxt_free(sep->ctxts[i].trx_ctxt); } psmx2_lock(&sep->domain->sep_lock, 1); dlist_remove(&sep->entry); psmx2_unlock(&sep->domain->sep_lock, 1); psmx2_domain_release(sep->domain); free(sep); return 0; }
static int psmx_ep_close(fid_t fid) { struct psmx_fid_ep *ep; ep = container_of(fid, struct psmx_fid_ep, ep.fid); if (ep->base_ep) { ofi_atomic_dec32(&ep->base_ep->ref); return 0; } if (ofi_atomic_get32(&ep->ref)) return -FI_EBUSY; ofi_ns_del_local_name(&ep->domain->fabric->name_server, &ep->service, &ep->domain->psm_epid); psmx_domain_disable_ep(ep->domain, ep); psmx_domain_release(ep->domain); free(ep); return 0; }
static int psmx2_ep_close(fid_t fid) { struct psmx2_fid_ep *ep; struct psmx2_ep_name ep_name; struct psmx2_trx_ctxt *trx_ctxt; ep = container_of(fid, struct psmx2_fid_ep, ep.fid); if (ep->base_ep) { ofi_atomic_dec32(&ep->base_ep->ref); return 0; } if (ofi_atomic_get32(&ep->ref)) return -FI_EBUSY; if (ep->stx) ofi_atomic_dec32(&ep->stx->ref); if (ep->rx) { ep_name.epid = ep->rx->psm2_epid; ofi_ns_del_local_name(&ep->domain->fabric->name_server, &ep->service, &ep_name); } if (ep->rx) { psmx2_lock(&ep->domain->trx_ctxt_lock, 1); dlist_remove(&ep->rx->entry); psmx2_unlock(&ep->domain->trx_ctxt_lock, 1); } trx_ctxt = ep->rx; psmx2_ep_close_internal(ep); psmx2_trx_ctxt_free(trx_ctxt); return 0; }