static inline void usdf_msg_process_ack(struct usdf_ep *ep, uint16_t seq) { struct usdf_cq_hard *hcq; struct usdf_msg_qe *wqe; struct usdf_tx *tx; uint16_t max_ack; unsigned credits; tx = ep->ep_tx; /* don't try to ACK what we don't think we've sent */ max_ack = ep->e.msg.ep_next_tx_seq - 1; if (RUDP_SEQ_GT(seq, max_ack)) { seq = max_ack; } hcq = tx->t.msg.tx_hcq; while (!TAILQ_EMPTY(&ep->e.msg.ep_sent_wqe)) { wqe = TAILQ_FIRST(&ep->e.msg.ep_sent_wqe); if (RUDP_SEQ_LE(wqe->ms_last_seq, seq)) { TAILQ_REMOVE(&ep->e.msg.ep_sent_wqe, wqe, ms_link); USDF_DBG_SYS(EP_DATA, "send complete, signal_comp=%u\n", wqe->ms_signal_comp); if (wqe->ms_signal_comp) hcq->cqh_post(hcq, wqe->ms_context, wqe->ms_length, FI_SUCCESS, FI_MSG | FI_SEND); usdf_msg_put_tx_wqe(tx, wqe); } else { break; } } credits = RUDP_SEQ_DIFF(seq, ep->e.msg.ep_last_rx_ack); if (ep->e.msg.ep_seq_credits == 0 && credits > 0 && !TAILQ_EMPTY(&ep->e.msg.ep_posted_wqe)) { usdf_msg_ep_ready(ep); } ep->e.msg.ep_seq_credits += credits; ep->e.msg.ep_last_rx_ack = seq; /* If all ACKed, cancel timer, else reset it */ if (seq == max_ack) { usdf_timer_cancel(ep->ep_domain->dom_fabric, ep->e.msg.ep_ack_timer); } else { usdf_timer_reset(ep->ep_domain->dom_fabric, ep->e.msg.ep_ack_timer, USDF_RUDP_ACK_TIMEOUT); } }
static inline void usdf_msg_process_ack(struct usdf_ep *ep, uint16_t seq) { struct usdf_cq_hard *hcq; struct usdf_msg_qe *wqe; uint16_t max_ack; unsigned credits; /* don't try to ACK what we don't think we've sent */ max_ack = ep->e.msg.ep_next_tx_seq - 1; if (RUDP_SEQ_GT(seq, max_ack)) { seq = max_ack; } hcq = ep->ep_tx->t.msg.tx_hcq; while (!TAILQ_EMPTY(&ep->e.msg.ep_sent_wqe)) { wqe = TAILQ_FIRST(&ep->e.msg.ep_sent_wqe); if (RUDP_SEQ_LE(wqe->ms_last_seq, seq)) { TAILQ_REMOVE(&ep->e.msg.ep_sent_wqe, wqe, ms_link); hcq->cqh_post(hcq, wqe->ms_context, wqe->ms_length); TAILQ_INSERT_HEAD(&ep->ep_tx->t.msg.tx_free_wqe, wqe, ms_link); } else { break; } } credits = RUDP_SEQ_DIFF(seq, ep->e.msg.ep_last_rx_ack); if (ep->e.msg.ep_seq_credits == 0 && credits > 0 && !TAILQ_EMPTY(&ep->e.msg.ep_posted_wqe)) { usdf_msg_ep_ready(ep); } ep->e.msg.ep_seq_credits += credits; ep->e.msg.ep_last_rx_ack = seq; /* If all ACKed, cancel timer, else reset it */ if (seq == max_ack) { usdf_timer_cancel(ep->ep_domain->dom_fabric, ep->e.msg.ep_ack_timer); } else { usdf_timer_reset(ep->ep_domain->dom_fabric, ep->e.msg.ep_ack_timer, USDF_RUDP_ACK_TIMEOUT); } }
static void usdf_dom_rdc_free_data(struct usdf_domain *udp) { struct usdf_rdm_connection *rdc; int i; if (udp->dom_rdc_hashtab != NULL) { pthread_spin_lock(&udp->dom_progress_lock); for (i = 0; i < USDF_RDM_HASH_SIZE; ++i) { rdc = udp->dom_rdc_hashtab[i]; while (rdc != NULL) { usdf_timer_reset(udp->dom_fabric, rdc->dc_timer, 0); rdc = rdc->dc_hash_next; } } pthread_spin_unlock(&udp->dom_progress_lock); /* XXX probably want a timeout here... */ while (ofi_atomic_get32(&udp->dom_rdc_free_cnt) < (int)udp->dom_rdc_total) { pthread_yield(); } free(udp->dom_rdc_hashtab); udp->dom_rdc_hashtab = NULL; } while (!SLIST_EMPTY(&udp->dom_rdc_free)) { rdc = SLIST_FIRST(&udp->dom_rdc_free); SLIST_REMOVE_HEAD(&udp->dom_rdc_free, dc_addr_link); usdf_timer_free(udp->dom_fabric, rdc->dc_timer); free(rdc); } }