Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0f954a5
Port the work done by Junho Choi (commit: b3e2bb4f7); Parsing ACK_FRE…
mactul Aug 12, 2025
9c5f932
Fix ack frequency wire_len()
mactul Aug 11, 2025
52b93b6
ack send condition now depends of the rtt
mactul Aug 7, 2025
2adcfa8
Send AckFrequency frame when appropriate
mactul Aug 8, 2025
31ae900
Add a way to enable the extension in the app example
mactul Aug 18, 2025
2bddeb7
change the max_ack_delay transport parameter from u64 to Duration
mactul Aug 11, 2025
5743b17
wait for the first AckFrequency frame to delay packet and use the upd…
mactul Aug 11, 2025
7544470
Change the ignore_order parameter from the first draft (00) to reorde…
mactul Aug 11, 2025
e940900
Add support for ImmediateAck frames
mactul Aug 11, 2025
86450ef
make sure AckFrequency and ImmediateAck can not be sent on 0-RTT packets
mactul Aug 18, 2025
d388377
Change min_ack_delay id to fit with the draft
mactul Aug 11, 2025
44805d8
retransmit lost AckFrequency frames
mactul Aug 14, 2025
38a275e
process out of order packets
mactul Aug 14, 2025
0935a1c
add qlog for ImmediateAck and AckFrequency frames
mactul Aug 18, 2025
f483b16
use packet tolerance instead of arbitrary value
mactul Aug 18, 2025
57e5de5
refactor: recv_ack_frequency is now an option so we can get read of i…
mactul Aug 18, 2025
7c21ef9
Remove magic numbers in the code by adding a way to set them in the c…
mactul Aug 18, 2025
a9990e2
Add comments referencing the draft
mactul Aug 18, 2025
0d8fa53
Only delay ack when on Application epoch
mactul Aug 20, 2025
6313b1b
Add min-ack-delay option in tokio-quiche example and h3i
mactul Aug 21, 2025
f415455
min_ack_delay > max_ack_delay is a transport error
mactul Aug 22, 2025
afff962
Add tests
mactul Aug 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove magic numbers in the code by adding a way to set them in the c…
…onfig
  • Loading branch information
mactul committed Aug 22, 2025
commit 7c21ef908055b253394588e204a7239a809a6480
6 changes: 6 additions & 0 deletions quiche/include/quiche.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ void quiche_config_set_max_ack_delay(quiche_config *config, uint64_t v);
// Extension: Sets the `min_ack_delay` transport parameter.
void quiche_config_ext_set_min_ack_delay(quiche_config *config, uint64_t v);

// Extension: Set the reordering threshold value that will be requested in AckFrequency frames
void quiche_config_ext_set_ack_freq_reordering_threshold(quiche_config *config, uint64_t v);

// Extension: Set the packet tolerance value that will be requested in AckFrequency frames
void quiche_config_ext_set_ack_freq_packet_tolerance(quiche_config *config, uint64_t v);

// Sets the `disable_active_migration` transport parameter.
void quiche_config_set_disable_active_migration(quiche_config *config, bool v);

Expand Down
14 changes: 14 additions & 0 deletions quiche/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,20 @@ pub extern "C" fn quiche_config_ext_set_min_ack_delay(
config.ext_set_min_ack_delay(v);
}

#[no_mangle]
pub extern "C" fn quiche_config_ext_set_ack_freq_reordering_threshold(
config: &mut Config, v: u64,
) {
config.ext_set_ack_freq_reordering_threshold(v);
}

#[no_mangle]
pub extern "C" fn quiche_config_ext_set_ack_freq_packet_tolerance(
config: &mut Config, v: u64,
) {
config.ext_set_ack_freq_packet_tolerance(v);
}

#[no_mangle]
pub extern "C" fn quiche_config_set_disable_active_migration(
config: &mut Config, v: bool,
Expand Down
56 changes: 46 additions & 10 deletions quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,16 @@ const MAX_CRYPTO_STREAM_OFFSET: u64 = 1 << 16;
// The send capacity factor.
const TX_CAP_FACTOR: f64 = 1.0;

// The default reordering threshold that will be sent to the peer on
// AckFrequency frame
// It can be set the same as recovery::INITIAL_PACKET_THRESHOLD (3)
// https://datatracker.ietf.org/doc/html/draft-ietf-quic-ack-frequency-11#name-setting-the-reordering-thre
const DEFAULT_ACK_FREQ_REORDERING_THRESHOLD: u64 = 3;

// The default packet tolerance that will be sent to the peer on AckFrequency
// frame
const DEFAULT_ACK_FREQ_PACKET_TOLERANCE: u64 = 5;

/// A specialized [`Result`] type for quiche operations.
///
/// This type is used throughout quiche's public API for any operation that
Expand Down Expand Up @@ -850,6 +860,9 @@ pub struct Config {
track_unknown_transport_params: Option<usize>,

initial_rtt: Duration,

ack_freq_reordering_threshold: u64,
ack_freq_packet_tolerance: u64,
}

// See https://quicwg.org/base-drafts/rfc9000.html#section-15
Expand Down Expand Up @@ -923,7 +936,11 @@ impl Config {
disable_dcid_reuse: false,

track_unknown_transport_params: None,

initial_rtt: DEFAULT_INITIAL_RTT,

ack_freq_reordering_threshold: DEFAULT_ACK_FREQ_REORDERING_THRESHOLD,
ack_freq_packet_tolerance: DEFAULT_ACK_FREQ_PACKET_TOLERANCE,
})
}

Expand Down Expand Up @@ -1301,6 +1318,18 @@ impl Config {
self.local_transport_params.min_ack_delay = Some(v);
}

/// Set the reordering threshold value that will be requested in
/// AckFrequency frames
pub fn ext_set_ack_freq_reordering_threshold(&mut self, v: u64) {
self.ack_freq_reordering_threshold = v;
}

/// Set the packet tolerance value that will be requested in AckFrequency
/// frames
pub fn ext_set_ack_freq_packet_tolerance(&mut self, v: u64) {
self.ack_freq_packet_tolerance = v;
}

/// Sets the `disable_active_migration` transport parameter.
///
/// The default value is `false`.
Expand Down Expand Up @@ -1702,9 +1731,10 @@ where
/// Received ACK Frequency config
recv_ack_frequency: Option<AckFrequency>,

last_send_ack_instant: Instant,
// ACK Frequency config to send to the peer
to_send_ack_frequency: AckFrequency,

ack_freq_seq_num: u64,
last_send_ack_instant: Instant,

immediate_ack_pending: bool,

Expand Down Expand Up @@ -2213,9 +2243,13 @@ impl<F: BufFactory> Connection<F> {

recv_ack_frequency: None,

last_send_ack_instant: Instant::now(),
to_send_ack_frequency: AckFrequency {
sequence_number: 0,
packet_tolerance: config.ack_freq_packet_tolerance,
reordering_threshold: config.ack_freq_reordering_threshold,
},

ack_freq_seq_num: 0,
last_send_ack_instant: Instant::now(),

immediate_ack_pending: false,

Expand Down Expand Up @@ -4367,7 +4401,7 @@ impl<F: BufFactory> Connection<F> {
{
let rtt = path.recovery.rtt();

let seq_num = self.ack_freq_seq_num + 1;
let seq_num = self.to_send_ack_frequency.sequence_number + 1;

// We use 3/4 of the smoothed_rtt, it's an arbitrary value but it's
// less than the smoothed_rtt on purpose. Like this, we can sure that
Expand All @@ -4379,23 +4413,25 @@ impl<F: BufFactory> Connection<F> {

let frame = frame::Frame::AckFrequency {
sequence_number: seq_num,
packet_tolerance: 5,
packet_tolerance: self.to_send_ack_frequency.packet_tolerance,
update_max_ack_delay,
reordering_threshold: 100,
reordering_threshold: self
.to_send_ack_frequency
.reordering_threshold,
};

trace!(
"{} sending ack frequency seq_num={}, pkt_tol={}, max_ack_delay={}, reordering_threshold={}",
self.trace_id,
seq_num,
5,
self.to_send_ack_frequency.packet_tolerance,
update_max_ack_delay,
100,
self.to_send_ack_frequency.reordering_threshold,
);

if push_frame_to_pkt!(b, frames, frame, left) {
path.recovery.set_ack_freq_send(rtt);
self.ack_freq_seq_num = seq_num;
self.to_send_ack_frequency.sequence_number = seq_num;

ack_eliciting = true;
in_flight = true;
Expand Down