Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
62cab6a
add red (without unit tests)
Jun 6, 2026
6e536be
add red unit tests
Jun 6, 2026
e1bb737
add ared & fix red
Jun 6, 2026
876b841
add ared unit tests
Jun 6, 2026
bc934d6
add pie (without unit tests)
Jun 8, 2026
5f1e4e8
update pie
Jun 8, 2026
7dbc274
update pie unit tests
Jun 8, 2026
3632057
fix un-lock-able's review on ared
Jun 9, 2026
8732309
fix warnings from cargo clippy (in github actions) and run cargo fmt
Jun 9, 2026
dda180f
fix function update_avg of RED
Jun 9, 2026
abc195c
fix clippy warning & corresponding logic
Jun 9, 2026
61536ed
revert enqueue() by using early return
Jun 10, 2026
411a3db
add seeded rng & t_update field
Jun 17, 2026
21c791a
use logical timestamp of a packet
Jun 23, 2026
aa2b66b
estimate pkt_tx_time of ARED based on packets' timestamps
Jun 23, 2026
bc038dc
fix red & ared
Jun 23, 2026
bef3825
align the logic of update_avg_drate with RFC
Jun 23, 2026
c86ce52
modify red & ared unit test
Jun 23, 2026
673dfdb
ready to fix pie
Jun 23, 2026
7b995f8
fix pie & update unit tests
Jun 24, 2026
068aa4d
combine ared and red
Jun 24, 2026
60be851
initialize start_update with logical timestamp
Jun 25, 2026
3c77292
initialize latest_max_p_update with logical timestamp
Jun 25, 2026
fc6ab4f
fix(queue): replace Instant::now() with logical timestamp in dequeue …
Jun 26, 2026
3f4784c
refactor(queue): remove retain from red and pie
Jul 15, 2026
f997535
fix(queue): validate RED/PIE config in new() and configure()
Jul 15, 2026
a7bfb95
fix(queue): reset RED's count_packet to -1 on hard-limit drop
Jul 15, 2026
9dc5a56
fix(pie): add serde duration adapter and clamp burst_allowance on rec…
Jul 15, 2026
aea9ce3
refactor(queue): change RedQueue/PieQueue::new() to return Self, pani…
Jul 16, 2026
2ca8d6c
refactor(queue): unify all Queue::new() to return Result and register…
Jul 16, 2026
221747c
feat(queue): add configurable seed to RED's and PIE's config
Jul 16, 2026
b32e3c6
refactor(red pie): replace From with TryFrom and unify new()
Jul 21, 2026
a119703
fix(red pie): re-seed RNG on reconfigure, fix seed serde and correct …
Jul 21, 2026
37a954f
docs(red): add module-level documentation comparing RED/ARED implemen…
CepheusC Jul 22, 2026
73a498f
docs(pie): add module-level documentation comparing PIE implementatio…
CepheusC Jul 22, 2026
36d7b01
doc(red pie): update module-level documentation
CepheusC Jul 22, 2026
eda9b07
docs(red pie): add kernel field correspondence tables to Config structs
CepheusC Jul 22, 2026
ff0b9d4
docs(red pie): add user-facing field documentation to Config structs
CepheusC Jul 22, 2026
c946081
style: format code with cargo fmt
CepheusC Jul 22, 2026
9ffb8e4
refactor(red pie): keep queue submodules private, import via re-expor…
CepheusC Jul 22, 2026
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: 4 additions & 0 deletions rattan-core/src/cells/bandwidth/queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ mod codel;
mod drophead;
mod droptail;
mod infinite;
mod pie;
mod red;

pub use codel::*;
pub use drophead::*;
pub use droptail::*;
pub use infinite::*;
pub use pie::*;
pub use red::*;

#[cfg(feature = "serde")]
fn serde_default<T: Default + PartialEq>(t: &T) -> bool {
Expand Down
957 changes: 957 additions & 0 deletions rattan-core/src/cells/bandwidth/queue/pie.rs

Large diffs are not rendered by default.

960 changes: 960 additions & 0 deletions rattan-core/src/cells/bandwidth/queue/red.rs

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions rattan-core/src/config/bandwidth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub enum BwCellBuildConfig<P: Packet> {
DropTail(bandwidth::BwCellConfig<P, queue::DropTailQueue<P>>),
DropHead(bandwidth::BwCellConfig<P, queue::DropHeadQueue<P>>),
CoDel(bandwidth::BwCellConfig<P, queue::CoDelQueue<P>>),
Red(bandwidth::BwCellConfig<P, queue::RedQueue<P>>),
Pie(bandwidth::BwCellConfig<P, queue::PieQueue<P>>),
}

macro_rules! impl_bw_cell_into_factory {
Expand All @@ -56,7 +58,14 @@ macro_rules! impl_bw_cell_into_factory {
};
}

impl_bw_cell_into_factory!(InfiniteQueue, DropTailQueue, DropHeadQueue, CoDelQueue);
impl_bw_cell_into_factory!(
InfiniteQueue,
DropTailQueue,
DropHeadQueue,
CoDelQueue,
RedQueue,
PieQueue
);

#[cfg_attr(
feature = "serde",
Expand All @@ -69,6 +78,8 @@ pub enum BwReplayCellBuildConfig<P: Packet> {
DropTail(BwReplayQueueConfig<P, queue::DropTailQueue<P>>),
DropHead(BwReplayQueueConfig<P, queue::DropHeadQueue<P>>),
CoDel(BwReplayQueueConfig<P, queue::CoDelQueue<P>>),
Red(BwReplayQueueConfig<P, queue::RedQueue<P>>),
Pie(BwReplayQueueConfig<P, queue::PieQueue<P>>),
}

#[cfg_attr(
Expand Down Expand Up @@ -218,4 +229,11 @@ macro_rules! impl_bw_replay_cell_into_factory {
};
}

impl_bw_replay_cell_into_factory!(InfiniteQueue, DropTailQueue, DropHeadQueue, CoDelQueue);
impl_bw_replay_cell_into_factory!(
InfiniteQueue,
DropTailQueue,
DropHeadQueue,
CoDelQueue,
RedQueue,
PieQueue
);
12 changes: 12 additions & 0 deletions rattan-core/src/radix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ where
crate::config::BwCellBuildConfig::CoDel(config) => {
self.build_cell(id, config.into_factory())?;
}
crate::config::BwCellBuildConfig::Red(config) => {
self.build_cell(id, config.into_factory())?;
}
crate::config::BwCellBuildConfig::Pie(config) => {
self.build_cell(id, config.into_factory())?;
}
},
CellBuildConfig::BwReplay(bw_replay_config) => match bw_replay_config {
crate::config::BwReplayCellBuildConfig::Infinite(config) => {
Expand All @@ -362,6 +368,12 @@ where
crate::config::BwReplayCellBuildConfig::CoDel(config) => {
self.build_cell(id, config.into_factory())?;
}
crate::config::BwReplayCellBuildConfig::Red(config) => {
self.build_cell(id, config.into_factory())?;
}
crate::config::BwReplayCellBuildConfig::Pie(config) => {
self.build_cell(id, config.into_factory())?;
}
},
CellBuildConfig::Delay(config) => {
self.build_cell(id, config.into_factory())?;
Expand Down
31 changes: 30 additions & 1 deletion src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use netem_trace::{Bandwidth, Delay};
use paste::paste;
use rattan_core::{
cells::bandwidth::{
queue::{CoDelQueueConfig, DropHeadQueueConfig, DropTailQueueConfig, InfiniteQueueConfig},
queue::{
CoDelQueueConfig, DropHeadQueueConfig, DropTailQueueConfig, InfiniteQueueConfig,
PieQueueConfig, RedQueueConfig,
},
BwCellConfig,
},
config::{
Expand Down Expand Up @@ -92,6 +95,8 @@ enum QueueType {
DropTail,
DropHead,
CoDel,
Red,
Pie,
}

// Deserialize queue args and create BwCellBuildConfig
Expand Down Expand Up @@ -170,6 +175,12 @@ impl ChannelArgs {
Some(QueueType::CoDel) => {
bw_q_args_into_config!(CoDel, self.uplink_queue_args.clone(), bandwidth)
}
Some(QueueType::Red) => {
bw_q_args_into_config!(Red, self.uplink_queue_args.clone(), bandwidth)
}
Some(QueueType::Pie) => {
bw_q_args_into_config!(Pie, self.uplink_queue_args.clone(), bandwidth)
}
};
uplink_count += 1;
cells_config.insert(format!("up_{uplink_count}"), cell_config);
Expand Down Expand Up @@ -197,6 +208,12 @@ impl ChannelArgs {
Some(QueueType::CoDel) => {
bwreplay_q_args_into_config!(CoDel, self.uplink_queue_args.clone(), trace_file)
}
Some(QueueType::Red) => {
bwreplay_q_args_into_config!(Red, self.uplink_queue_args.clone(), trace_file)
}
Some(QueueType::Pie) => {
bwreplay_q_args_into_config!(Pie, self.uplink_queue_args.clone(), trace_file)
}
};
uplink_count += 1;
cells_config.insert(format!("up_{uplink_count}"), cell_config);
Expand All @@ -220,6 +237,12 @@ impl ChannelArgs {
Some(QueueType::CoDel) => {
bw_q_args_into_config!(CoDel, self.downlink_queue_args.clone(), bandwidth)
}
Some(QueueType::Red) => {
bw_q_args_into_config!(Red, self.downlink_queue_args.clone(), bandwidth)
}
Some(QueueType::Pie) => {
bw_q_args_into_config!(Pie, self.downlink_queue_args.clone(), bandwidth)
}
};
downlink_count += 1;
cells_config.insert(format!("down_{downlink_count}"), cell_config);
Expand Down Expand Up @@ -251,6 +274,12 @@ impl ChannelArgs {
trace_file
)
}
Some(QueueType::Red) => {
bwreplay_q_args_into_config!(Red, self.downlink_queue_args.clone(), trace_file)
}
Some(QueueType::Pie) => {
bwreplay_q_args_into_config!(Pie, self.downlink_queue_args.clone(), trace_file)
}
};
downlink_count += 1;
cells_config.insert(format!("down_{downlink_count}"), cell_config);
Expand Down
4 changes: 4 additions & 0 deletions src/visualize_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ pub fn write_visualize_trace<P: Packet>(
BwCellBuildConfig::Infinite(config) => config.bandwidth,
BwCellBuildConfig::DropHead(config) => config.bandwidth,
BwCellBuildConfig::DropTail(config) => config.bandwidth,
BwCellBuildConfig::Red(config) => config.bandwidth,
BwCellBuildConfig::Pie(config) => config.bandwidth,
}
.unwrap_or(Bandwidth::from_bps(u64::MAX));
trace_record.add_cell(
Expand Down Expand Up @@ -292,6 +294,8 @@ pub fn write_visualize_trace<P: Packet>(
BwReplayCellBuildConfig::DropHead(config) => config.get_trace(),
BwReplayCellBuildConfig::DropTail(config) => config.get_trace(),
BwReplayCellBuildConfig::Infinite(config) => config.get_trace(),
BwReplayCellBuildConfig::Red(config) => config.get_trace(),
BwReplayCellBuildConfig::Pie(config) => config.get_trace(),
}?;

let trace_points = expand_bw_trace(trace.as_mut(), start, end_time)
Expand Down
Loading