int rxd_handle_ack(struct rxd_ep *ep, struct ofi_ctrl_hdr *ctrl, struct rxd_rx_buf *rx_buf) { int ret = 0; uint64_t idx; struct rxd_tx_entry *tx_entry; struct dlist_entry *item; struct rxd_pkt_meta *pkt; rxd_ep_lock_if_required(ep); FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "got ack: msg: %p - %d\n", ctrl->msg_id, ctrl->seg_no); idx = ctrl->msg_id & RXD_TX_IDX_BITS; tx_entry = &ep->tx_entry_fs->buf[idx]; if (tx_entry->msg_id != ctrl->msg_id) goto out; item = dlist_find_first_match(&tx_entry->pkt_list, rxd_tx_pkt_match, ctrl); if (!item) goto out; pkt = container_of(item, struct rxd_pkt_meta, entry); switch (pkt->type) { case RXD_PKT_STRT: case RXD_PKT_DATA: ret = rxd_tx_entry_progress(ep, tx_entry, ctrl); break; case RXD_PKT_LAST: rxd_ep_free_acked_pkts(ep, tx_entry, ctrl->seg_no); FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "reporting TX completion : %p\n", tx_entry); if (tx_entry->op_type != RXD_TX_READ_REQ) { rxd_cq_report_tx_comp(ep->tx_cq, tx_entry); rxd_tx_entry_done(ep, tx_entry); } break; default: FI_WARN(&rxd_prov, FI_LOG_EP_CTRL, "invalid pkt type\n"); break; } out: rxd_ep_repost_buff(rx_buf); rxd_ep_unlock_if_required(ep); return ret; }
static void rxd_handle_ack(struct rxd_ep *ep, struct ofi_ctrl_hdr *ctrl, struct rxd_rx_buf *rx_buf) { struct rxd_tx_entry *tx_entry; uint64_t idx; FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "ack- msg_id: %" PRIu64 ", segno: %d, segsz: %d, buf: %p\n", ctrl->msg_id, ctrl->seg_no, ctrl->seg_size, rx_buf); idx = ctrl->msg_id & RXD_TX_IDX_BITS; tx_entry = &ep->tx_entry_fs->buf[idx]; if (tx_entry->msg_id != ctrl->msg_id) goto out; rxd_ep_free_acked_pkts(ep, tx_entry, ctrl->seg_no); if ((tx_entry->bytes_sent == tx_entry->op_hdr.size) && dlist_empty(&tx_entry->pkt_list)) { FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "reporting TX completion : %p\n", tx_entry); if (tx_entry->op_type != RXD_TX_READ_REQ) { rxd_cq_report_tx_comp(rxd_ep_tx_cq(ep), tx_entry); rxd_cntr_report_tx_comp(ep, tx_entry); rxd_tx_entry_free(ep, tx_entry); } } else { tx_entry->rx_key = ctrl->rx_key; /* do not allow reduce window size (on duplicate acks) */ tx_entry->window = MAX(tx_entry->window, ctrl->seg_no + ctrl->seg_size); FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "ack- msg_id: %" PRIu64 ", window: %d\n", ctrl->msg_id, tx_entry->window); } out: rxd_ep_repost_buff(rx_buf); }