ucs_status_t uct_ugni_ep_pending_add(uct_ep_h tl_ep, uct_pending_req_t *n){ uct_ugni_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_ugni_iface_t); uct_ugni_ep_t *ep = ucs_derived_of(tl_ep, uct_ugni_ep_t); UCS_STATIC_ASSERT(sizeof(ucs_arbiter_elem_t) <= UCT_PENDING_REQ_PRIV_LEN); ucs_arbiter_elem_init((ucs_arbiter_elem_t *)n->priv); ucs_arbiter_group_push_elem(&ep->arb_group, (ucs_arbiter_elem_t*) n->priv); ucs_arbiter_group_schedule(&iface->arbiter, &ep->arb_group); return UCS_OK; }
ucs_status_t uct_mm_ep_pending_add(uct_ep_h tl_ep, uct_pending_req_t *n) { uct_mm_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_mm_iface_t); uct_mm_ep_t *ep = ucs_derived_of(tl_ep, uct_mm_ep_t); /* check if resources became available */ if (uct_mm_ep_has_tx_resources(ep)) { return UCS_ERR_BUSY; } UCS_STATIC_ASSERT(sizeof(ucs_arbiter_elem_t) <= UCT_PENDING_REQ_PRIV_LEN); ucs_arbiter_elem_init((ucs_arbiter_elem_t *)n->priv); /* add the request to the ep's arbiter_group (pending queue) */ ucs_arbiter_group_push_elem(&ep->arb_group, (ucs_arbiter_elem_t*) n->priv); /* add the ep's group to the arbiter */ ucs_arbiter_group_schedule(&iface->arbiter, &ep->arb_group); return UCS_OK; }
/* TODO: currently pending code supports only dcs policy support hash/random policies */ ucs_status_t uct_dc_ep_pending_add(uct_ep_h tl_ep, uct_pending_req_t *r) { uct_dc_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_dc_iface_t); uct_dc_ep_t *ep = ucs_derived_of(tl_ep, uct_dc_ep_t); /* ep can tx iff * - iface has resources: cqe and tx skb * - dci is either assigned or can be assigned * - dci has resources */ if (uct_rc_iface_has_tx_resources(&iface->super)) { if (ep->dci == UCT_DC_EP_NO_DCI) { if (uct_dc_iface_dci_can_alloc(iface) && (ep->fc.fc_wnd > 0)) { return UCS_ERR_BUSY; } } else { if (uct_dc_iface_dci_ep_can_send(ep)) { return UCS_ERR_BUSY; } } } UCS_STATIC_ASSERT(sizeof(ucs_arbiter_elem_t) <= UCT_PENDING_REQ_PRIV_LEN); ucs_arbiter_elem_init((ucs_arbiter_elem_t *)r->priv); /* no dci: * Do not grab dci here. Instead put the group on dci allocation arbiter. * This way we can assure fairness between all eps waiting for * dci allocation. */ if (ep->dci == UCT_DC_EP_NO_DCI) { ucs_arbiter_group_push_elem(&ep->arb_group, (ucs_arbiter_elem_t*)r->priv); uct_dc_iface_schedule_dci_alloc(iface, ep); return UCS_OK; } ucs_arbiter_group_push_elem(&ep->arb_group, (ucs_arbiter_elem_t*)r->priv); uct_dc_iface_dci_sched_tx(iface, ep); return UCS_OK; }