Lines Matching +full:un +full:- +full:padded

2  * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
46 * list non-monotonically, so packet numbers must be greater than or equal
64 return (unsigned long)pkt->pkt_num; in tx_pkt_info_hash()
70 if (a->pkt_num < b->pkt_num) in tx_pkt_info_compare()
71 return -1; in tx_pkt_info_compare()
72 if (a->pkt_num > b->pkt_num) in tx_pkt_info_compare()
80 ossl_list_tx_history_init(&h->packets); in tx_pkt_history_init()
81 h->watermark = 0; in tx_pkt_history_init()
82 h->highest_sent = 0; in tx_pkt_history_init()
84 h->map = lh_OSSL_ACKM_TX_PKT_new(tx_pkt_info_hash, tx_pkt_info_compare); in tx_pkt_history_init()
85 if (h->map == NULL) in tx_pkt_history_init()
94 lh_OSSL_ACKM_TX_PKT_free(h->map); in tx_pkt_history_destroy()
95 h->map = NULL; in tx_pkt_history_destroy()
96 ossl_list_tx_history_init(&h->packets); in tx_pkt_history_destroy()
109 existing = lh_OSSL_ACKM_TX_PKT_retrieve(h->map, pkt); in tx_pkt_history_add_actual()
118 lh_OSSL_ACKM_TX_PKT_insert(h->map, pkt); in tx_pkt_history_add_actual()
120 ossl_list_tx_history_insert_tail(&h->packets, pkt); in tx_pkt_history_add_actual()
129 if (!ossl_assert(pkt->pkt_num >= h->watermark)) in tx_pkt_history_add()
135 h->watermark = pkt->pkt_num + 1; in tx_pkt_history_add()
136 h->highest_sent = pkt->pkt_num; in tx_pkt_history_add()
148 return lh_OSSL_ACKM_TX_PKT_retrieve(h->map, &key); in tx_pkt_history_by_pkt_num()
162 ossl_list_tx_history_remove(&h->packets, pkt); in tx_pkt_history_remove()
163 lh_OSSL_ACKM_TX_PKT_delete(h->map, &key); in tx_pkt_history_remove()
219 * - We have never processed this PN before
222 * - We have processed this PN but it has not yet been provably ACKed
226 * - We have processed this PN and it has been provably ACKed
264 * - (A) The PN is above the watermark but we have not yet received it.
269 * - (B) The PN is above the watermark and we have received it.
274 * - (C) The PN is below the watermark.
284 * for the PNs in this state is because the provably ACKed and never-received
313 * purposes of duplicate detection) when a higher-numbered PN becomes provably
347 * - State (A) can transition to state (B) or (C)
348 * - State (B) can transition to state (C) only
349 * - State (C) is the terminal state
404 ossl_uint_set_init(&h->set); in rx_pkt_history_init()
405 h->watermark = 0; in rx_pkt_history_init()
410 ossl_uint_set_destroy(&h->set); in rx_pkt_history_destroy()
423 while (ossl_list_uint_set_num(&h->set) > MAX_RX_ACK_RANGES) { in rx_pkt_history_trim_range_count()
424 UINT_RANGE r = ossl_list_uint_set_head(&h->set)->range; in rx_pkt_history_trim_range_count()
429 ossl_uint_set_remove(&h->set, &r); in rx_pkt_history_trim_range_count()
448 if (pn < h->watermark) in rx_pkt_history_add_pn()
451 if (ossl_uint_set_insert(&h->set, &r) != 1) in rx_pkt_history_add_pn()
463 if (watermark <= h->watermark) in rx_pkt_history_bump_watermark()
468 r.end = watermark - 1; in rx_pkt_history_bump_watermark()
469 if (ossl_uint_set_remove(&h->set, &r) != 1) in rx_pkt_history_bump_watermark()
472 h->watermark = watermark; in rx_pkt_history_bump_watermark()
491 /* Default maximum amount of time to leave an ACK-eliciting packet un-ACK'd. */
529 * ack-eliciting, and removed again once ack'd/lost/discarded.
533 /* Count of ECN-CE events. */
574 * Number of ACK-eliciting packets since last ACK. We use this to defer
575 * emitting ACK frames until a threshold number of ACK-eliciting packets
588 * wait to send us an ACK after receiving an ACK-eliciting packet).
594 * to wait before generating an ACK after receiving an ACK-eliciting
618 assert(!ackm->discarded[pkt_space]); in get_tx_history()
620 return &ackm->tx_history[pkt_space]; in get_tx_history()
629 assert(!ackm->discarded[pkt_space]); in get_rx_history()
631 return &ackm->rx_history[pkt_space]; in get_rx_history()
634 /* Does the newly-acknowledged list contain any ack-eliciting packet? */
637 for (; pkt != NULL; pkt = pkt->anext) in ack_includes_ack_eliciting()
638 if (pkt->is_ack_eliciting) in ack_includes_ack_eliciting()
644 /* Return number of ACK-eliciting bytes in flight across all PN spaces. */
651 total += ackm->ack_eliciting_bytes_in_flight[i]; in ackm_ack_eliciting_bytes_in_flight()
659 return pn >= range->start && pn <= range->end; in range_contains()
663 * Given a logical representation of an ACK frame 'ack', create a singly-linked
677 assert(ack->num_ack_ranges > 0); in ackm_detect_and_remove_newly_acked_pkts()
683 * ack->ack_ranges is a list of packet number ranges in descending order. in ackm_detect_and_remove_newly_acked_pkts()
692 pkt = tx_pkt_history_by_pkt_num(h, ack->ack_ranges[0].end); in ackm_detect_and_remove_newly_acked_pkts()
694 pkt = ossl_list_tx_history_tail(&h->packets); in ackm_detect_and_remove_newly_acked_pkts()
704 if (ridx >= ack->num_ack_ranges) { in ackm_detect_and_remove_newly_acked_pkts()
712 if (range_contains(&ack->ack_ranges[ridx], pkt->pkt_num)) { in ackm_detect_and_remove_newly_acked_pkts()
714 tx_pkt_history_remove(h, pkt->pkt_num); in ackm_detect_and_remove_newly_acked_pkts()
717 fixup = &pkt->anext; in ackm_detect_and_remove_newly_acked_pkts()
720 } else if (pkt->pkt_num > ack->ack_ranges[ridx].end) { in ackm_detect_and_remove_newly_acked_pkts()
731 assert(pkt->pkt_num < ack->ack_ranges[ridx].start); in ackm_detect_and_remove_newly_acked_pkts()
742 * Create a singly-linked list of newly detected-lost packets in the given
754 assert(ackm->largest_acked_pkt[pkt_space] != QUIC_PN_INVALID); in ackm_detect_and_remove_lost_pkts()
756 ossl_statm_get_rtt_info(ackm->statm, &rtt); in ackm_detect_and_remove_lost_pkts()
758 ackm->loss_time[pkt_space] = ossl_time_zero(); in ackm_detect_and_remove_lost_pkts()
769 now = ackm->now(ackm->now_arg); in ackm_detect_and_remove_lost_pkts()
773 pkt = ossl_list_tx_history_head(&h->packets); in ackm_detect_and_remove_lost_pkts()
776 assert(pkt_space == pkt->pkt_space); in ackm_detect_and_remove_lost_pkts()
784 if (pkt->pkt_num > ackm->largest_acked_pkt[pkt_space]) in ackm_detect_and_remove_lost_pkts()
790 if (ossl_time_compare(pkt->time, lost_send_time) <= 0 in ackm_detect_and_remove_lost_pkts()
791 || ackm->largest_acked_pkt[pkt_space] in ackm_detect_and_remove_lost_pkts()
792 >= pkt->pkt_num + K_PKT_THRESHOLD) { in ackm_detect_and_remove_lost_pkts()
793 tx_pkt_history_remove(h, pkt->pkt_num); in ackm_detect_and_remove_lost_pkts()
796 fixup = &pkt->lnext; in ackm_detect_and_remove_lost_pkts()
799 if (ossl_time_is_zero(ackm->loss_time[pkt_space])) in ackm_detect_and_remove_lost_pkts()
800 ackm->loss_time[pkt_space] = in ackm_detect_and_remove_lost_pkts()
801 ossl_time_add(pkt->time, loss_delay); in ackm_detect_and_remove_lost_pkts()
803 ackm->loss_time[pkt_space] = in ackm_detect_and_remove_lost_pkts()
804 ossl_time_min(ackm->loss_time[pkt_space], in ackm_detect_and_remove_lost_pkts()
805 ossl_time_add(pkt->time, loss_delay)); in ackm_detect_and_remove_lost_pkts()
814 OSSL_TIME time = ackm->loss_time[QUIC_PN_SPACE_INITIAL]; in ackm_get_loss_time_and_space()
819 || ossl_time_compare(ackm->loss_time[i], time) == -1) { in ackm_get_loss_time_and_space()
820 time = ackm->loss_time[i]; in ackm_get_loss_time_and_space()
835 ossl_statm_get_rtt_info(ackm->statm, &rtt); in ackm_get_pto_time_and_space()
844 (uint64_t)1 << min_u32(ackm->pto_count, in ackm_get_pto_time_and_space()
847 /* Anti-deadlock PTO starts from the current time. */ in ackm_get_pto_time_and_space()
849 assert(!ackm->peer_completed_addr_validation); in ackm_get_pto_time_and_space()
851 *space = ackm->discarded[QUIC_PN_SPACE_INITIAL] in ackm_get_pto_time_and_space()
854 return ossl_time_add(ackm->now(ackm->now_arg), duration); in ackm_get_pto_time_and_space()
858 if (ackm->ack_eliciting_bytes_in_flight[i] == 0) in ackm_get_pto_time_and_space()
863 if (!ackm->handshake_confirmed) in ackm_get_pto_time_and_space()
867 if (!ossl_time_is_infinite(ackm->rx_max_ack_delay)) { in ackm_get_pto_time_and_space()
869 = (uint64_t)1 << min_u32(ackm->pto_count, MAX_PTO_COUNT); in ackm_get_pto_time_and_space()
873 ossl_time_multiply(ackm->rx_max_ack_delay, in ackm_get_pto_time_and_space()
878 t = ossl_time_add(ackm->time_of_last_ack_eliciting_pkt[i], duration); in ackm_get_pto_time_and_space()
892 ackm->loss_detection_deadline = deadline; in ackm_set_loss_detection_timer_actual()
894 if (ackm->loss_detection_deadline_cb != NULL) in ackm_set_loss_detection_timer_actual()
895 ackm->loss_detection_deadline_cb(deadline, in ackm_set_loss_detection_timer_actual()
896 ackm->loss_detection_deadline_cb_arg); in ackm_set_loss_detection_timer_actual()
912 && ackm->peer_completed_addr_validation) { in ackm_set_loss_detection_timer()
916 * anti-amplification limit. in ackm_set_loss_detection_timer()
944 pnext = p->lnext; in ackm_on_pkts_lost()
946 if (p->is_inflight) { in ackm_on_pkts_lost()
947 ackm->bytes_in_flight -= p->num_bytes; in ackm_on_pkts_lost()
948 if (p->is_ack_eliciting) in ackm_on_pkts_lost()
949 ackm->ack_eliciting_bytes_in_flight[p->pkt_space] in ackm_on_pkts_lost()
950 -= p->num_bytes; in ackm_on_pkts_lost()
952 if (p->pkt_num > largest_pn_lost) in ackm_on_pkts_lost()
953 largest_pn_lost = p->pkt_num; in ackm_on_pkts_lost()
957 * If this is pseudo-loss (e.g. during connection retry) we do not in ackm_on_pkts_lost()
961 loss_info.tx_time = p->time; in ackm_on_pkts_lost()
962 loss_info.tx_size = p->num_bytes; in ackm_on_pkts_lost()
964 ackm->cc_method->on_data_lost(ackm->cc_data, &loss_info); in ackm_on_pkts_lost()
968 p->on_lost(p->cb_arg); in ackm_on_pkts_lost()
975 ossl_statm_get_rtt_info(ackm->statm, &rtt); in ackm_on_pkts_lost()
976 if (!ossl_time_is_zero(ackm->first_rtt_sample) in ackm_on_pkts_lost()
980 ackm->cc_method->on_data_lost_finished(ackm->cc_data, flags); in ackm_on_pkts_lost()
990 if (apkt->is_inflight) { in ackm_on_pkts_acked()
991 ackm->bytes_in_flight -= apkt->num_bytes; in ackm_on_pkts_acked()
992 if (apkt->is_ack_eliciting) in ackm_on_pkts_acked()
993 ackm->ack_eliciting_bytes_in_flight[apkt->pkt_space] in ackm_on_pkts_acked()
994 -= apkt->num_bytes; in ackm_on_pkts_acked()
996 if (apkt->pkt_num > last_pn_acked) in ackm_on_pkts_acked()
997 last_pn_acked = apkt->pkt_num; in ackm_on_pkts_acked()
999 if (apkt->largest_acked != QUIC_PN_INVALID) in ackm_on_pkts_acked()
1005 apkt->pkt_space), in ackm_on_pkts_acked()
1006 apkt->largest_acked + 1); in ackm_on_pkts_acked()
1009 ainfo.tx_time = apkt->time; in ackm_on_pkts_acked()
1010 ainfo.tx_size = apkt->num_bytes; in ackm_on_pkts_acked()
1012 anext = apkt->anext; in ackm_on_pkts_acked()
1013 apkt->on_acked(apkt->cb_arg); /* may free apkt */ in ackm_on_pkts_acked()
1015 if (apkt->is_inflight) in ackm_on_pkts_acked()
1016 ackm->cc_method->on_data_acked(ackm->cc_data, &ainfo); in ackm_on_pkts_acked()
1033 for (i = 0; i < (int)OSSL_NELEM(ackm->tx_history); ++i) { in ossl_ackm_new()
1034 ackm->largest_acked_pkt[i] = QUIC_PN_INVALID; in ossl_ackm_new()
1035 ackm->rx_ack_flush_deadline[i] = ossl_time_infinite(); in ossl_ackm_new()
1036 if (tx_pkt_history_init(&ackm->tx_history[i]) < 1) in ossl_ackm_new()
1040 for (i = 0; i < (int)OSSL_NELEM(ackm->rx_history); ++i) in ossl_ackm_new()
1041 rx_pkt_history_init(&ackm->rx_history[i]); in ossl_ackm_new()
1043 ackm->now = now; in ossl_ackm_new()
1044 ackm->now_arg = now_arg; in ossl_ackm_new()
1045 ackm->statm = statm; in ossl_ackm_new()
1046 ackm->cc_method = cc_method; in ossl_ackm_new()
1047 ackm->cc_data = cc_data; in ossl_ackm_new()
1049 ackm->rx_max_ack_delay = ossl_ms2time(QUIC_DEFAULT_MAX_ACK_DELAY); in ossl_ackm_new()
1050 ackm->tx_max_ack_delay = DEFAULT_TX_MAX_ACK_DELAY; in ossl_ackm_new()
1055 while (--i >= 0) in ossl_ackm_new()
1056 tx_pkt_history_destroy(&ackm->tx_history[i]); in ossl_ackm_new()
1069 for (i = 0; i < OSSL_NELEM(ackm->tx_history); ++i) in ossl_ackm_free()
1070 if (!ackm->discarded[i]) { in ossl_ackm_free()
1071 tx_pkt_history_destroy(&ackm->tx_history[i]); in ossl_ackm_free()
1072 rx_pkt_history_destroy(&ackm->rx_history[i]); in ossl_ackm_free()
1080 struct tx_pkt_history_st *h = get_tx_history(ackm, pkt->pkt_space); in ossl_ackm_on_tx_packet()
1083 if (ossl_time_is_zero(pkt->time) in ossl_ackm_on_tx_packet()
1084 || ossl_time_compare(ackm->time_of_last_ack_eliciting_pkt[pkt->pkt_space], in ossl_ackm_on_tx_packet()
1085 pkt->time) > 0) in ossl_ackm_on_tx_packet()
1088 /* Must have non-zero number of bytes. */ in ossl_ackm_on_tx_packet()
1089 if (pkt->num_bytes == 0) in ossl_ackm_on_tx_packet()
1092 /* Does not make any sense for a non-in-flight packet to be ACK-eliciting. */ in ossl_ackm_on_tx_packet()
1093 if (!pkt->is_inflight && pkt->is_ack_eliciting) in ossl_ackm_on_tx_packet()
1099 if (pkt->is_inflight) { in ossl_ackm_on_tx_packet()
1100 if (pkt->is_ack_eliciting) { in ossl_ackm_on_tx_packet()
1101 ackm->time_of_last_ack_eliciting_pkt[pkt->pkt_space] = pkt->time; in ossl_ackm_on_tx_packet()
1102 ackm->ack_eliciting_bytes_in_flight[pkt->pkt_space] in ossl_ackm_on_tx_packet()
1103 += pkt->num_bytes; in ossl_ackm_on_tx_packet()
1106 ackm->bytes_in_flight += pkt->num_bytes; in ossl_ackm_on_tx_packet()
1109 ackm->cc_method->on_data_sent(ackm->cc_data, pkt->num_bytes); in ossl_ackm_on_tx_packet()
1117 /* No-op on the client. */ in ossl_ackm_on_rx_datagram()
1129 * If the ECN-CE counter reported by the peer has increased, this could in ackm_process_ecn()
1132 if (ack->ecnce > ackm->peer_ecnce[pkt_space]) { in ackm_process_ecn()
1133 ackm->peer_ecnce[pkt_space] = ack->ecnce; in ackm_process_ecn()
1136 pkt = tx_pkt_history_by_pkt_num(h, ack->ack_ranges[0].end); in ackm_process_ecn()
1140 ecn_info.largest_acked_time = pkt->time; in ackm_process_ecn()
1141 ackm->cc_method->on_ecn(ackm->cc_data, &ecn_info); in ackm_process_ecn()
1151 if (ackm->largest_acked_pkt[pkt_space] == QUIC_PN_INVALID) in ossl_ackm_on_rx_ack_frame()
1152 ackm->largest_acked_pkt[pkt_space] = ack->ack_ranges[0].end; in ossl_ackm_on_rx_ack_frame()
1154 ackm->largest_acked_pkt[pkt_space] in ossl_ackm_on_rx_ack_frame()
1155 = ossl_quic_pn_max(ackm->largest_acked_pkt[pkt_space], in ossl_ackm_on_rx_ack_frame()
1156 ack->ack_ranges[0].end); in ossl_ackm_on_rx_ack_frame()
1162 if (!ackm->peer_completed_addr_validation in ossl_ackm_on_rx_ack_frame()
1164 ackm->peer_completed_addr_validation = 1; in ossl_ackm_on_rx_ack_frame()
1181 * one ACK-eliciting packet was newly acked. in ossl_ackm_on_rx_ack_frame()
1185 if (na_pkts->pkt_num == ack->ack_ranges[0].end && in ossl_ackm_on_rx_ack_frame()
1187 OSSL_TIME now = ackm->now(ackm->now_arg), ack_delay; in ossl_ackm_on_rx_ack_frame()
1188 if (ossl_time_is_zero(ackm->first_rtt_sample)) in ossl_ackm_on_rx_ack_frame()
1189 ackm->first_rtt_sample = now; in ossl_ackm_on_rx_ack_frame()
1192 ack_delay = ack->delay_time; in ossl_ackm_on_rx_ack_frame()
1193 if (ackm->handshake_confirmed) in ossl_ackm_on_rx_ack_frame()
1194 ack_delay = ossl_time_min(ack_delay, ackm->rx_max_ack_delay); in ossl_ackm_on_rx_ack_frame()
1196 ossl_statm_update_rtt(ackm->statm, ack_delay, in ossl_ackm_on_rx_ack_frame()
1197 ossl_time_subtract(now, na_pkts->time)); in ossl_ackm_on_rx_ack_frame()
1207 if (ack->ecn_present) in ossl_ackm_on_rx_ack_frame()
1221 if (ackm->peer_completed_addr_validation) in ossl_ackm_on_rx_ack_frame()
1222 ackm->pto_count = 0; in ossl_ackm_on_rx_ack_frame()
1233 if (ackm->discarded[pkt_space]) in ossl_ackm_on_pkt_space_discarded()
1237 ackm->peer_completed_addr_validation = 1; in ossl_ackm_on_pkt_space_discarded()
1239 for (pkt = ossl_list_tx_history_head(&get_tx_history(ackm, pkt_space)->packets); in ossl_ackm_on_pkt_space_discarded()
1242 if (pkt->is_inflight) { in ossl_ackm_on_pkt_space_discarded()
1243 ackm->bytes_in_flight -= pkt->num_bytes; in ossl_ackm_on_pkt_space_discarded()
1244 num_bytes_invalidated += pkt->num_bytes; in ossl_ackm_on_pkt_space_discarded()
1247 pkt->on_discarded(pkt->cb_arg); /* may free pkt */ in ossl_ackm_on_pkt_space_discarded()
1250 tx_pkt_history_destroy(&ackm->tx_history[pkt_space]); in ossl_ackm_on_pkt_space_discarded()
1251 rx_pkt_history_destroy(&ackm->rx_history[pkt_space]); in ossl_ackm_on_pkt_space_discarded()
1254 ackm->cc_method->on_data_invalidated(ackm->cc_data, in ossl_ackm_on_pkt_space_discarded()
1257 ackm->time_of_last_ack_eliciting_pkt[pkt_space] = ossl_time_zero(); in ossl_ackm_on_pkt_space_discarded()
1258 ackm->loss_time[pkt_space] = ossl_time_zero(); in ossl_ackm_on_pkt_space_discarded()
1259 ackm->pto_count = 0; in ossl_ackm_on_pkt_space_discarded()
1260 ackm->discarded[pkt_space] = 1; in ossl_ackm_on_pkt_space_discarded()
1261 ackm->ack_eliciting_bytes_in_flight[pkt_space] = 0; in ossl_ackm_on_pkt_space_discarded()
1268 ackm->handshake_confirmed = 1; in ossl_ackm_on_handshake_confirmed()
1269 ackm->peer_completed_addr_validation = 1; in ossl_ackm_on_handshake_confirmed()
1276 ++ackm->pending_probe.anti_deadlock_handshake; in ackm_queue_probe_anti_deadlock_handshake()
1281 ++ackm->pending_probe.anti_deadlock_initial; in ackm_queue_probe_anti_deadlock_initial()
1291 ++ackm->pending_probe.pto[pkt_space]; in ackm_queue_probe()
1311 assert(!ackm->peer_completed_addr_validation); in ossl_ackm_on_timeout()
1313 * Client sends an anti-deadlock packet: Initial is padded to earn more in ossl_ackm_on_timeout()
1314 * anti-amplification credit. A handshake packet proves address in ossl_ackm_on_timeout()
1317 if (ackm->discarded[QUIC_PN_SPACE_INITIAL]) in ossl_ackm_on_timeout()
1331 ++ackm->pto_count; in ossl_ackm_on_timeout()
1338 return ackm->loss_detection_deadline; in ossl_ackm_get_loss_detection_deadline()
1343 return &ackm->pending_probe; in ossl_ackm_get0_probe_request()
1352 p = ossl_list_tx_history_tail(&h->packets); in ossl_ackm_get_largest_unacked()
1354 *pn = p->pkt_num; in ossl_ackm_get_largest_unacked()
1361 /* Number of ACK-eliciting packets RX'd before we always emit an ACK. */
1369 * - We have flagged that we want to send an ACK frame
1372 * - We have exceeded the ACK flush deadline, meaning that
1373 * we have received at least one ACK-eliciting packet, but held off on
1374 * sending an ACK frame immediately in the hope that more ACK-eliciting
1381 return ackm->rx_ack_desired[pkt_space] in ossl_ackm_is_ack_desired()
1382 || (!ossl_time_is_infinite(ackm->rx_ack_flush_deadline[pkt_space]) in ossl_ackm_is_ack_desired()
1383 && ossl_time_compare(ackm->now(ackm->now_arg), in ossl_ackm_is_ack_desired()
1384 ackm->rx_ack_flush_deadline[pkt_space]) >= 0); in ossl_ackm_is_ack_desired()
1394 for (i = 0; i < ack->num_ack_ranges; ++i) in ack_contains()
1395 if (range_contains(&ack->ack_ranges[i], pkt_num)) in ack_contains()
1411 return ackm->ack[pkt_space].num_ack_ranges > 0 in ackm_is_missing()
1412 && pkt_num <= ackm->ack[pkt_space].ack_ranges[0].end in ackm_is_missing()
1413 && !ack_contains(&ackm->ack[pkt_space], pkt_num); in ackm_is_missing()
1426 if (ossl_list_uint_set_is_empty(&h->set)) in ackm_has_newly_missing()
1441 return ackm->ack[pkt_space].num_ack_ranges > 0 in ackm_has_newly_missing()
1442 && ossl_list_uint_set_tail(&h->set)->range.start in ackm_has_newly_missing()
1443 == ossl_list_uint_set_tail(&h->set)->range.end in ackm_has_newly_missing()
1444 && ossl_list_uint_set_tail(&h->set)->range.start in ackm_has_newly_missing()
1445 > ackm->ack[pkt_space].ack_ranges[0].end + 1; in ackm_has_newly_missing()
1451 ackm->rx_ack_flush_deadline[pkt_space] = deadline; in ackm_set_flush_deadline()
1453 if (ackm->ack_deadline_cb != NULL) in ackm_set_flush_deadline()
1454 ackm->ack_deadline_cb(ossl_ackm_get_ack_deadline(ackm, pkt_space), in ackm_set_flush_deadline()
1455 pkt_space, ackm->ack_deadline_cb_arg); in ackm_set_flush_deadline()
1461 ackm->rx_ack_desired[pkt_space] = 1; in ackm_queue_ack()
1473 if (ackm->rx_ack_desired[pkt_space]) in ackm_on_rx_ack_eliciting()
1477 ++ackm->rx_ack_eliciting_pkts_since_last_ack[pkt_space]; in ackm_on_rx_ack_eliciting()
1479 if (!ackm->rx_ack_generated[pkt_space] in ackm_on_rx_ack_eliciting()
1481 || ackm->rx_ack_eliciting_pkts_since_last_ack[pkt_space] in ackm_on_rx_ack_eliciting()
1487 * - We have never yet generated an ACK frame, meaning that this in ackm_on_rx_ack_eliciting()
1491 * - We previously reported the PN that we have just received as in ackm_on_rx_ack_eliciting()
1495 * - We have exceeded the ACK-eliciting packet threshold count in ackm_on_rx_ack_eliciting()
1499 * - The PN we just received and added to our PN RX history in ackm_on_rx_ack_eliciting()
1515 * RFC 9000 s. 13.2.1: "An endpoint MUST acknowledge all ack-eliciting in ackm_on_rx_ack_eliciting()
1519 tx_max_ack_delay = ackm->tx_max_ack_delay; in ackm_on_rx_ack_eliciting()
1524 if (ossl_time_is_infinite(ackm->rx_ack_flush_deadline[pkt_space])) in ackm_on_rx_ack_eliciting()
1529 ossl_time_min(ackm->rx_ack_flush_deadline[pkt_space], in ackm_on_rx_ack_eliciting()
1536 struct rx_pkt_history_st *h = get_rx_history(ackm, pkt->pkt_space); in ossl_ackm_on_rx_packet()
1539 if (ossl_ackm_is_rx_pn_processable(ackm, pkt->pkt_num, pkt->pkt_space) != 1) in ossl_ackm_on_rx_packet()
1540 /* PN has already been processed or written off, no-op. */ in ossl_ackm_on_rx_packet()
1547 if (pkt->pkt_num > ackm->rx_largest_pn[pkt->pkt_space]) { in ossl_ackm_on_rx_packet()
1548 ackm->rx_largest_pn[pkt->pkt_space] = pkt->pkt_num; in ossl_ackm_on_rx_packet()
1549 ackm->rx_largest_time[pkt->pkt_space] = pkt->time; in ossl_ackm_on_rx_packet()
1558 was_missing = ackm_is_missing(ackm, pkt->pkt_space, pkt->pkt_num); in ossl_ackm_on_rx_packet()
1564 if (rx_pkt_history_add_pn(h, pkt->pkt_num) != 1) in ossl_ackm_on_rx_packet()
1572 if (pkt->is_ack_eliciting) in ossl_ackm_on_rx_packet()
1573 ackm_on_rx_ack_eliciting(ackm, pkt->time, pkt->pkt_space, was_missing); in ossl_ackm_on_rx_packet()
1576 switch (pkt->ecn) { in ossl_ackm_on_rx_packet()
1578 ++ackm->rx_ect0[pkt->pkt_space]; in ossl_ackm_on_rx_packet()
1581 ++ackm->rx_ect1[pkt->pkt_space]; in ossl_ackm_on_rx_packet()
1584 ++ackm->rx_ecnce[pkt->pkt_space]; in ossl_ackm_on_rx_packet()
1604 for (x = ossl_list_uint_set_tail(&h->set); in ackm_fill_rx_ack_ranges()
1605 x != NULL && i < OSSL_NELEM(ackm->ack_ranges); in ackm_fill_rx_ack_ranges()
1607 ackm->ack_ranges[pkt_space][i].start = x->range.start; in ackm_fill_rx_ack_ranges()
1608 ackm->ack_ranges[pkt_space][i].end = x->range.end; in ackm_fill_rx_ack_ranges()
1611 ack->ack_ranges = ackm->ack_ranges[pkt_space]; in ackm_fill_rx_ack_ranges()
1612 ack->num_ack_ranges = i; in ackm_fill_rx_ack_ranges()
1618 OSSL_QUIC_FRAME_ACK *ack = &ackm->ack[pkt_space]; in ossl_ackm_get_ack_frame()
1619 OSSL_TIME now = ackm->now(ackm->now_arg); in ossl_ackm_get_ack_frame()
1623 if (!ossl_time_is_zero(ackm->rx_largest_time[pkt_space]) in ossl_ackm_get_ack_frame()
1624 && ossl_time_compare(now, ackm->rx_largest_time[pkt_space]) > 0 in ossl_ackm_get_ack_frame()
1626 ack->delay_time = in ossl_ackm_get_ack_frame()
1627 ossl_time_subtract(now, ackm->rx_largest_time[pkt_space]); in ossl_ackm_get_ack_frame()
1629 ack->delay_time = ossl_time_zero(); in ossl_ackm_get_ack_frame()
1631 ack->ect0 = ackm->rx_ect0[pkt_space]; in ossl_ackm_get_ack_frame()
1632 ack->ect1 = ackm->rx_ect1[pkt_space]; in ossl_ackm_get_ack_frame()
1633 ack->ecnce = ackm->rx_ecnce[pkt_space]; in ossl_ackm_get_ack_frame()
1634 ack->ecn_present = 1; in ossl_ackm_get_ack_frame()
1636 ackm->rx_ack_eliciting_pkts_since_last_ack[pkt_space] = 0; in ossl_ackm_get_ack_frame()
1638 ackm->rx_ack_generated[pkt_space] = 1; in ossl_ackm_get_ack_frame()
1639 ackm->rx_ack_desired[pkt_space] = 0; in ossl_ackm_get_ack_frame()
1647 if (ackm->rx_ack_desired[pkt_space]) in ossl_ackm_get_ack_deadline()
1651 return ackm->rx_ack_flush_deadline[pkt_space]; in ossl_ackm_get_ack_deadline()
1658 return pn >= h->watermark && ossl_uint_set_query(&h->set, pn) == 0; in ossl_ackm_is_rx_pn_processable()
1666 ackm->loss_detection_deadline_cb = fn; in ossl_ackm_set_loss_detection_deadline_callback()
1667 ackm->loss_detection_deadline_cb_arg = arg; in ossl_ackm_set_loss_detection_deadline_callback()
1676 ackm->ack_deadline_cb = fn; in ossl_ackm_set_ack_deadline_callback()
1677 ackm->ack_deadline_cb_arg = arg; in ossl_ackm_set_ack_deadline_callback()
1690 tx_pkt_history_remove(h, pkt->pkt_num); in ossl_ackm_mark_packet_pseudo_lost()
1691 pkt->lnext = NULL; in ossl_ackm_mark_packet_pseudo_lost()
1701 ossl_statm_get_rtt_info(ackm->statm, &rtt); in ossl_ackm_get_pto_duration()
1706 if (!ossl_time_is_infinite(ackm->rx_max_ack_delay)) in ossl_ackm_get_pto_duration()
1707 duration = ossl_time_add(duration, ackm->rx_max_ack_delay); in ossl_ackm_get_pto_duration()
1714 return ackm->largest_acked_pkt[pkt_space]; in ossl_ackm_get_largest_acked()
1719 ackm->rx_max_ack_delay = rx_max_ack_delay; in ossl_ackm_set_rx_max_ack_delay()
1724 ackm->tx_max_ack_delay = tx_max_ack_delay; in ossl_ackm_set_tx_max_ack_delay()