Skip to content

Commit a88c106

Browse files
authored
FEAT: Packet idle time (#558)
1 parent e73f92f commit a88c106

9 files changed

Lines changed: 40 additions & 19 deletions

File tree

configs/incast/network.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ presets:
77
type: single-cc
88
packet-size: 1500B
99
cc:
10-
type: tahoe
10+
type: swift
11+
base_target: 5300ns
1112
path-chooser:
1213
type: round-robin
1314
flows:
1415
flow-1:
1516
type: tcp
16-
flow-2:
17-
type: tcp
18-
flow-3:
19-
type: tcp
2017

2118
type: custom
2219

configs/incast/scenario.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ scenario:
44
- action: send_data
55
id: send-1
66
when: 0ns
7-
size: 50KB
7+
size: 500KB
88
repeat_count: 1
99
connections: ^connection.*
1010
repeat_interval: 500000ns

configs/incast/topology.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
type: incast
22

33
links:
4-
latency: 0ns
5-
throughput: 100Gbps
6-
ingress_buffer_size: 1024000B
7-
egress_buffer_size: 1024000B
4+
latency: 1000ns
5+
throughput: 10Gbps
6+
ingress_buffer_size: 64KB
7+
egress_buffer_size: 64KB
88

99
bottleneck-link:
10-
latency: 0ns
10+
latency: 1000ns
1111
throughput: 100Gbps
12-
ingress_buffer_size: 1024000B
13-
egress_buffer_size: 1024000B
12+
ingress_buffer_size: 64KB
13+
egress_buffer_size: 64KB
1414

1515
packet-spraying:
1616
type: ecmp
@@ -20,8 +20,8 @@ senders:
2020

2121
switch:
2222
ecn:
23-
min: 0.1
24-
max: 0.3
23+
min: 0.4
24+
max: 0.8
2525
probability: 0.5
2626

2727
receiver:

configs/simple/network.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ connections:
1010
type: single-cc
1111
packet-size: 1500B
1212
cc:
13-
type: tahoe
13+
type: swift
14+
base_target: 8800ns
1415
path-chooser:
1516
type: round-robin
1617
flows:

configs/simple/scenario.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ scenario:
44
- action: send_data
55
id: send
66
when: 0ns
7-
size: 50KB
7+
size: 500KB
88
connections: connection

source/network/connection/flow/packet.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ struct Packet : FourTuple {
3737
TimeNs generated_time; // Note: ACK's generated time is the data packet
3838
// generated time
3939
TimeNs sent_time; // Note: ACK's sent time is the data packet sent time
40+
TimeNs idle_time = TimeNs(0);
41+
TimeNs last_idle_start_time = TimeNs(0);
4042
SizeByte delivered_data_size_at_origin; // For ACK this is inherited from
4143
// data packet
4244
TTL ttl = std::numeric_limits<TTL>::max();

source/network/connection/flow/tcp/tcp_flow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ void TcpFlow::process_ack(const Packet& ack, SizeByte data_packet_size,
164164
// here ack.sent_time is the time when corresponding DATA packet was sent
165165
// (see process_data_packet)
166166
TimeNs rtt = now - ack.sent_time;
167+
167168
m_context.rtt_statistics.add_record(rtt);
168169

169170
m_metrics.rtt->add_record(now, rtt.value());

source/topology/device/host.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ bool Host::notify_about_arrival() {
2121

2222
void Host::enqueue_packet(const Packet& packet) {
2323
LOG_INFO(fmt::format("Packet {} arrived to host", packet.to_string()));
24+
TimeNs now = Scheduler::get_instance().get_current_time();
2425
m_nic_buffer.push(packet);
26+
27+
Packet& pckt = m_nic_buffer.back();
28+
pckt.last_idle_start_time = now;
2529
if (m_nic_buffer.size() == 1) {
2630
// first packet in queue => start sending it
2731
send_packet();
@@ -95,8 +99,15 @@ void Host::send_packet() {
9599
get_id()));
96100
return;
97101
}
102+
Scheduler& sched = Scheduler::get_instance();
103+
TimeNs now = sched.get_current_time();
98104
{
99105
Packet& data_packet = m_nic_buffer.front();
106+
107+
// increase idle time
108+
TimeNs idle_time_gain = now - data_packet.last_idle_start_time;
109+
data_packet.idle_time += idle_time_gain;
110+
100111
utils::Defer defer{[this] { m_nic_buffer.pop(); }};
101112

102113
LOG_INFO(fmt::format("Taken new data packet on host {}. Packet: {}",
@@ -124,7 +135,6 @@ void Host::send_packet() {
124135
}
125136

126137
if (!m_nic_buffer.empty()) {
127-
Scheduler& sched = Scheduler::get_instance();
128138
sched.add(sched.get_current_time() + PACKET_PROCESSING_TIME,
129139
[host = shared_from_this()]() { host->send_packet(); });
130140
}

source/topology/link/link.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ std::shared_ptr<Link> Link::create_shared(
2323

2424
void Link::schedule_arrival(Packet& packet) {
2525
bool empty_before_push = m_from_egress.empty();
26+
TimeNs now = Scheduler::get_instance().get_current_time();
27+
packet.last_idle_start_time = now;
2628

2729
if (!m_from_egress.push(packet)) {
2830
LOG_ERROR(
2931
fmt::format("Link {}: from egress buffer overflow; packet {} lost",
3032
m_id, packet.to_string()));
3133
return;
3234
}
35+
3336
record_activity();
3437

3538
if (empty_before_push) {
@@ -175,8 +178,15 @@ void Link::arrive(const Packet& packet) {
175178

176179
void Link::start_head_packet_sending() {
177180
TimeNs current_time = Scheduler::get_instance().get_current_time();
181+
182+
// increase idle time
183+
Packet& packet = m_from_egress.front();
184+
TimeNs idle_time_gain = current_time - packet.last_idle_start_time;
185+
packet.idle_time += idle_time_gain;
186+
TimeNs transmition_time = get_transmission_delay(packet);
187+
178188
Scheduler::get_instance().add(
179-
current_time + get_transmission_delay(m_from_egress.front()),
189+
current_time + transmition_time,
180190
[link = shared_from_this()]() { link->transmit(); });
181191
}
182192

0 commit comments

Comments
 (0)