Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions perf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ pub fn parse_byte_size(s: &str) -> Result<u64, ParseIntError> {
#[derive(Clone, Copy, ValueEnum)]
pub enum CongestionAlgorithm {
Cubic,
Bbr,
Bbr3,
NewReno,
}

impl CongestionAlgorithm {
pub fn build(self) -> Arc<dyn ControllerFactory + Send + Sync + 'static> {
match self {
Self::Cubic => Arc::new(congestion::CubicConfig::default()),
Self::Bbr => Arc::new(congestion::BbrConfig::default()),
Self::Bbr3 => Arc::new(congestion::Bbr3Config::default()),
Self::NewReno => Arc::new(congestion::NewRenoConfig::default()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion quinn-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ slab = { workspace = true }
thiserror = { workspace = true }
tinyvec = { workspace = true, features = ["alloc"] }
tracing = { workspace = true }
rand_pcg = "0.9"

# Feature flags & dependencies for wasm
# wasm-bindgen is assumed for a wasm*-*-unknown target
Expand All @@ -69,7 +70,6 @@ web-time = { workspace = true }
[dev-dependencies]
assert_matches = { workspace = true }
hex-literal = { workspace = true }
rand_pcg = "0.9"
rcgen = { workspace = true }
tracing-subscriber = { workspace = true }
wasm-bindgen-test = { workspace = true }
Expand Down
27 changes: 23 additions & 4 deletions quinn-proto/src/congestion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use crate::connection::RttEstimator;
use std::any::Any;
use std::sync::Arc;

mod bbr;
mod bbr3;
mod cubic;
mod new_reno;

pub use bbr::{Bbr, BbrConfig};
pub use bbr3::{Bbr3, Bbr3Config};
pub use cubic::{Cubic, CubicConfig};
pub use new_reno::{NewReno, NewRenoConfig};

Expand All @@ -19,6 +19,10 @@ pub trait Controller: Send + Sync {
#[allow(unused_variables)]
fn on_sent(&mut self, now: Instant, bytes: u64, last_packet_number: u64) {}

/// One packet was just sent
#[allow(unused_variables)]
fn on_packet_sent(&mut self, now: Instant, bytes: u16, packet_number: u64) {}

/// Packet deliveries were confirmed
///
/// `app_limited` indicates whether the connection was blocked on outgoing
Expand All @@ -29,6 +33,7 @@ pub trait Controller: Send + Sync {
now: Instant,
sent: Instant,
bytes: u64,
pn: u64,
app_limited: bool,
rtt: &RttEstimator,
) {
Expand All @@ -51,15 +56,22 @@ pub trait Controller: Send + Sync {
/// congestion threshold period ending when the most recent packet in this batch was sent were
/// lost.
/// `lost_bytes` indicates how many bytes were lost. This value will be 0 for ECN triggers.
/// `largest_lost` indicates the packet number of the packet with the highest packet number
/// in the congestion event.
fn on_congestion_event(
&mut self,
now: Instant,
sent: Instant,
is_persistent_congestion: bool,
is_ecn: bool,
lost_bytes: u64,
largest_lost: u64,
);

/// One packet was just lost
#[allow(unused_variables)]
fn on_packet_lost(&mut self, lost_bytes: u16, packet_number: u64, now: Instant) {}

/// Packets were incorrectly deemed lost
///
/// This function is called when all packets that were deemed lost (for instance because
Expand All @@ -73,11 +85,14 @@ pub trait Controller: Send + Sync {
fn window(&self) -> u64;

/// Retrieve implementation-specific metrics used to populate `qlog` traces when they are enabled
/// This is also used to alter the pacing of the connection with
/// `pacing_rate` and `send_quantum`
fn metrics(&self) -> ControllerMetrics {
ControllerMetrics {
congestion_window: self.window(),
ssthresh: None,
pacing_rate: None,
send_quantum: None,
}
}

Expand All @@ -91,16 +106,20 @@ pub trait Controller: Send + Sync {
fn into_any(self: Box<Self>) -> Box<dyn Any>;
}

/// Common congestion controller metrics
/// Common congestion controller metrics used both for logging purposes
/// but also to alter the pacing of the connection with
/// `pacing_rate` and `send_quantum`
#[derive(Default)]
#[non_exhaustive]
pub struct ControllerMetrics {
/// Congestion window (bytes)
pub congestion_window: u64,
/// Slow start threshold (bytes)
pub ssthresh: Option<u64>,
/// Pacing rate (bits/s)
/// Pacing rate (bytes/s)
pub pacing_rate: Option<u64>,
/// Send Quantum (bytes) used to control the size of packet bursts
pub send_quantum: Option<u64>,
}

/// Constructs controllers on demand
Expand Down
100 changes: 0 additions & 100 deletions quinn-proto/src/congestion/bbr/bw_estimation.rs

This file was deleted.

152 changes: 0 additions & 152 deletions quinn-proto/src/congestion/bbr/min_max.rs

This file was deleted.

Loading
Loading