diff --git a/include/tquic.h b/include/tquic.h index abf927fa..89d8110c 100644 --- a/include/tquic.h +++ b/include/tquic.h @@ -597,6 +597,21 @@ void quic_config_set_bbr_rtprop_filter_len(struct quic_config_t *config, uint64_ */ void quic_config_set_bbr_probe_bw_cwnd_gain(struct quic_config_t *config, double v); +/** + * Set the delta in copa slow start state. + */ +void quic_config_set_copa_slow_start_delta(struct quic_config_t *config, double v); + +/** + * Set the delta in coap steady state. + */ +void quic_config_set_copa_steady_delta(struct quic_config_t *config, double v); + +/** + * Enable Using the rtt standing instead of the latest rtt to calculate queueing delay. + */ +void quic_config_enable_copa_use_standing_rtt(struct quic_config_t *config, bool v); + /** * Set the initial RTT in milliseconds. The default value is 333ms. * The configuration should be changed with caution. Setting a value less than the default diff --git a/src/congestion_control/congestion_control.rs b/src/congestion_control/congestion_control.rs index 20102fe7..69a46991 100644 --- a/src/congestion_control/congestion_control.rs +++ b/src/congestion_control/congestion_control.rs @@ -30,6 +30,7 @@ pub use bbr3::Bbr3; pub use bbr3::Bbr3Config; pub use copa::Copa; pub use copa::CopaConfig; +pub use copa::COPA_DELTA; pub use cubic::Cubic; pub use cubic::CubicConfig; pub use dummy::Dummy; diff --git a/src/congestion_control/copa.rs b/src/congestion_control/copa.rs index c3390df1..f4f31ee9 100644 --- a/src/congestion_control/copa.rs +++ b/src/congestion_control/copa.rs @@ -36,7 +36,7 @@ use crate::connection::space::SentPacket; use crate::RecoveryConfig; /// Delta: determines how much to weigh delay compared to throughput. -const COPA_DELTA: f64 = 0.04; +pub const COPA_DELTA: f64 = 0.04; /// Max count while cwnd grows with the same direction. Speed up if /// the count exceeds threshold. @@ -100,9 +100,9 @@ impl CopaConfig { initial_cwnd, initial_rtt, max_datagram_size, - slow_start_delta: COPA_DELTA, - steady_delta: COPA_DELTA, - use_standing_rtt: true, + slow_start_delta: conf.copa_slow_start_delta, + steady_delta: conf.copa_steady_delta, + use_standing_rtt: conf.copa_use_standing_rtt, } } } diff --git a/src/ffi.rs b/src/ffi.rs index e939143c..9c0c9c8b 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -342,6 +342,24 @@ pub extern "C" fn quic_config_set_bbr_probe_bw_cwnd_gain(config: &mut Config, v: config.set_bbr_probe_bw_cwnd_gain(v); } +/// Set the delta in copa slow start state. +#[no_mangle] +pub extern "C" fn quic_config_set_copa_slow_start_delta(config: &mut Config, v: f64) { + config.set_copa_slow_start_delta(v); +} + +/// Set the delta in coap steady state. +#[no_mangle] +pub extern "C" fn quic_config_set_copa_steady_delta(config: &mut Config, v: f64) { + config.set_copa_steady_delta(v); +} + +/// Enable Using the rtt standing instead of the latest rtt to calculate queueing delay. +#[no_mangle] +pub extern "C" fn quic_config_enable_copa_use_standing_rtt(config: &mut Config, v: bool) { + config.enable_copa_use_standing_rtt(v); +} + /// Set the initial RTT in milliseconds. The default value is 333ms. /// The configuration should be changed with caution. Setting a value less than the default /// will cause retransmission of handshake packets to be more aggressive. diff --git a/src/lib.rs b/src/lib.rs index e56ec988..ce3eb4f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -551,6 +551,21 @@ impl Config { self.recovery.bbr_probe_bw_cwnd_gain = v; } + /// Set the delta in copa slow start state. + pub fn set_copa_slow_start_delta(&mut self, v: f64) { + self.recovery.copa_slow_start_delta = v; + } + + /// Set the delta in coap steady state. + pub fn set_copa_steady_delta(&mut self, v: f64) { + self.recovery.copa_steady_delta = v; + } + + /// Enable Using the rtt standing instead of the latest rtt to calculate queueing delay. + pub fn enable_copa_use_standing_rtt(&mut self, v: bool) { + self.recovery.copa_use_standing_rtt = v; + } + /// Set the initial RTT in milliseconds. The default value is 333ms. /// /// The configuration should be changed with caution. Setting a value less than the default @@ -796,6 +811,15 @@ pub struct RecoveryConfig { /// The cwnd gain for ProbeBW state pub bbr_probe_bw_cwnd_gain: f64, + /// Delta in copa slow start state. + pub copa_slow_start_delta: f64, + + /// Delta in coap steady state. + pub copa_steady_delta: f64, + + /// Use rtt standing instead of latest rtt to calculate queueing delay + pub copa_use_standing_rtt: bool, + /// The initial rtt, used before real rtt is estimated. pub initial_rtt: Duration, @@ -827,6 +851,9 @@ impl Default for RecoveryConfig { bbr_probe_rtt_cwnd_gain: 0.75, bbr_rtprop_filter_len: Duration::from_secs(10), bbr_probe_bw_cwnd_gain: 2.0, + copa_slow_start_delta: congestion_control::COPA_DELTA, + copa_steady_delta: congestion_control::COPA_DELTA, + copa_use_standing_rtt: true, initial_rtt: INITIAL_RTT, enable_pacing: true, pacing_granularity: time::Duration::from_millis(1),