17 return "congestion_signal";
35 uint64_t packets_acked,
36 std::chrono::steady_clock::time_point sent_time)
47 if (counts.ect0 < state_.counts.ect0 ||
48 counts.ect1 < state_.counts.ect1 ||
49 counts.ecn_ce < state_.counts.ecn_ce)
53 state_.testing =
false;
54 state_.capable =
false;
61 if (!validate_ecn(counts, packets_acked))
64 state_.testing =
false;
65 state_.capable =
false;
70 uint64_t total_marks = counts.ect0 + counts.ect1 + counts.ecn_ce;
71 if (total_marks >= validation_state::kValidationThreshold)
73 state_.testing =
false;
74 state_.capable =
true;
81 if (counts.ecn_ce > state_.counts.ecn_ce)
85 state_.last_congestion_sent_time = sent_time;
89 state_.counts = counts;
95 uint64_t packets_acked) ->
bool
102 uint64_t total_increase =
103 (counts.ect0 - state_.counts.ect0) +
104 (counts.ect1 - state_.counts.ect1) +
105 (counts.ecn_ce - state_.counts.ecn_ce);
109 if (total_increase < packets_acked && state_.packets_sent_with_ect > 0)
123 state_.packets_sent_with_ect += packet_count;
auto validate_ecn(const ecn_counts &counts, uint64_t packets_acked) -> bool
Validate ECN capability based on received counts.
validation_state state_
ECN validation state.
auto reset() noexcept -> void
Reset ECN tracker to initial state.
auto process_ecn_counts(const ecn_counts &counts, uint64_t packets_acked, std::chrono::steady_clock::time_point sent_time) -> ecn_result
Process received ECN counts from an ACK_ECN frame.
auto on_packets_sent(uint64_t packet_count) noexcept -> void
Record packets sent with ECN marking.
ecn_tracker()
Default constructor.
auto disable() noexcept -> void
Disable ECN tracking.
auto ecn_result_to_string(ecn_result result) noexcept -> const char *
Convert ecn_result to string.
ecn_result
Result of ECN counts processing (RFC 9000 Section 13.4)
@ ecn_failure
ECN validation failed, should disable ECN.
@ none
No congestion signal.
@ congestion_signal
ECN-CE increased (congestion experienced)
ECN counts for ACK_ECN frames.
Internal ECN validation state.
bool failed
True if ECN validation has failed.
bool capable
True if ECN capability has been validated.
bool testing
True if still in testing phase.