blob: cdf502d81d7969339e9a216b3ce2ce4cae785c00 [file] [log] [blame]
Davide Pesaventobf1c0692017-01-15 19:15:09 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Chavoosh Ghasemi4d36ed52017-10-31 22:26:25 +00002/*
Chavoosh Ghasemi3dae1092017-12-21 12:39:08 -07003 * Copyright (c) 2016-2018, Regents of the University of California,
Davide Pesaventocd65c2c2017-01-15 16:10:38 -05004 * Colorado State University,
5 * University Pierre & Marie Curie, Sorbonne University.
Weiwei Liu245d7912016-07-28 00:04:25 -07006 *
7 * This file is part of ndn-tools (Named Data Networking Essential Tools).
8 * See AUTHORS.md for complete list of ndn-tools authors and contributors.
9 *
10 * ndn-tools is free software: you can redistribute it and/or modify it under the terms
11 * of the GNU General Public License as published by the Free Software Foundation,
12 * either version 3 of the License, or (at your option) any later version.
13 *
14 * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20 *
21 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
22 *
23 * @author Shuo Yang
24 * @author Weiwei Liu
Chavoosh Ghasemi4d36ed52017-10-31 22:26:25 +000025 * @author Chavoosh Ghasemi
Weiwei Liu245d7912016-07-28 00:04:25 -070026 */
27
28#include "pipeline-interests-aimd.hpp"
Davide Pesavento44b3b232017-12-23 16:58:25 -050029#include "data-fetcher.hpp"
Weiwei Liu245d7912016-07-28 00:04:25 -070030
31#include <cmath>
Chavoosh Ghasemi3dae1092017-12-21 12:39:08 -070032#include <iomanip>
Weiwei Liu245d7912016-07-28 00:04:25 -070033
34namespace ndn {
35namespace chunks {
36namespace aimd {
37
Chavoosh Ghasemi641f5932017-11-06 22:45:11 +000038constexpr double PipelineInterestsAimd::MIN_SSTHRESH;
39
Weiwei Liu245d7912016-07-28 00:04:25 -070040PipelineInterestsAimd::PipelineInterestsAimd(Face& face, RttEstimator& rttEstimator,
41 const Options& options)
42 : PipelineInterests(face)
43 , m_options(options)
44 , m_rttEstimator(rttEstimator)
45 , m_scheduler(m_face.getIoService())
Davide Pesaventocd65c2c2017-01-15 16:10:38 -050046 , m_checkRtoEvent(m_scheduler)
Weiwei Liu245d7912016-07-28 00:04:25 -070047 , m_highData(0)
48 , m_highInterest(0)
49 , m_recPoint(0)
50 , m_nInFlight(0)
Weiwei Liu245d7912016-07-28 00:04:25 -070051 , m_nLossEvents(0)
52 , m_nRetransmitted(0)
Chavoosh Ghasemi641f5932017-11-06 22:45:11 +000053 , m_nCongMarks(0)
Chavoosh Ghasemi75309ae2018-03-26 14:46:24 -040054 , m_nSent(0)
Weiwei Liu245d7912016-07-28 00:04:25 -070055 , m_cwnd(m_options.initCwnd)
56 , m_ssthresh(m_options.initSsthresh)
57 , m_hasFailure(false)
58 , m_failedSegNo(0)
59{
60 if (m_options.isVerbose) {
61 std::cerr << m_options;
62 }
63}
64
65PipelineInterestsAimd::~PipelineInterestsAimd()
66{
67 cancel();
68}
69
70void
71PipelineInterestsAimd::doRun()
72{
Weiwei Liu245d7912016-07-28 00:04:25 -070073 // schedule the event to check retransmission timer
Davide Pesaventocd65c2c2017-01-15 16:10:38 -050074 m_checkRtoEvent = m_scheduler.scheduleEvent(m_options.rtoCheckInterval, [this] { checkRto(); });
Weiwei Liu245d7912016-07-28 00:04:25 -070075
Davide Pesavento958896e2017-01-19 00:52:04 -050076 schedulePackets();
Weiwei Liu245d7912016-07-28 00:04:25 -070077}
78
79void
80PipelineInterestsAimd::doCancel()
81{
82 for (const auto& entry : m_segmentInfo) {
Davide Pesaventocd65c2c2017-01-15 16:10:38 -050083 m_face.removePendingInterest(entry.second.interestId);
Weiwei Liu245d7912016-07-28 00:04:25 -070084 }
Davide Pesaventocd65c2c2017-01-15 16:10:38 -050085 m_checkRtoEvent.cancel();
Weiwei Liu245d7912016-07-28 00:04:25 -070086 m_segmentInfo.clear();
Weiwei Liu245d7912016-07-28 00:04:25 -070087}
88
89void
90PipelineInterestsAimd::checkRto()
91{
92 if (isStopping())
93 return;
94
Davide Pesavento958896e2017-01-19 00:52:04 -050095 bool hasTimeout = false;
Weiwei Liu245d7912016-07-28 00:04:25 -070096
97 for (auto& entry : m_segmentInfo) {
98 SegmentInfo& segInfo = entry.second;
99 if (segInfo.state != SegmentState::InRetxQueue && // do not check segments currently in the retx queue
100 segInfo.state != SegmentState::RetxReceived) { // or already-received retransmitted segments
101 Milliseconds timeElapsed = time::steady_clock::now() - segInfo.timeSent;
102 if (timeElapsed.count() > segInfo.rto.count()) { // timer expired?
Davide Pesavento958896e2017-01-19 00:52:04 -0500103 hasTimeout = true;
104 enqueueForRetransmission(entry.first);
Weiwei Liu245d7912016-07-28 00:04:25 -0700105 }
106 }
107 }
108
Davide Pesavento958896e2017-01-19 00:52:04 -0500109 if (hasTimeout) {
110 recordTimeout();
111 schedulePackets();
Weiwei Liu245d7912016-07-28 00:04:25 -0700112 }
113
114 // schedule the next check after predefined interval
Davide Pesaventocd65c2c2017-01-15 16:10:38 -0500115 m_checkRtoEvent = m_scheduler.scheduleEvent(m_options.rtoCheckInterval, [this] { checkRto(); });
Weiwei Liu245d7912016-07-28 00:04:25 -0700116}
117
118void
119PipelineInterestsAimd::sendInterest(uint64_t segNo, bool isRetransmission)
120{
121 if (isStopping())
122 return;
123
124 if (m_hasFinalBlockId && segNo > m_lastSegmentNo && !isRetransmission)
125 return;
126
127 if (!isRetransmission && m_hasFailure)
128 return;
129
130 if (m_options.isVerbose) {
Davide Pesavento958896e2017-01-19 00:52:04 -0500131 std::cerr << (isRetransmission ? "Retransmitting" : "Requesting")
132 << " segment #" << segNo << std::endl;
Weiwei Liu245d7912016-07-28 00:04:25 -0700133 }
134
135 if (isRetransmission) {
Davide Pesavento958896e2017-01-19 00:52:04 -0500136 // keep track of retx count for this segment
137 auto ret = m_retxCount.emplace(segNo, 1);
Weiwei Liu245d7912016-07-28 00:04:25 -0700138 if (ret.second == false) { // not the first retransmission
139 m_retxCount[segNo] += 1;
Davide Pesavento44b3b232017-12-23 16:58:25 -0500140 if (m_options.maxRetriesOnTimeoutOrNack != DataFetcher::MAX_RETRIES_INFINITE &&
141 m_retxCount[segNo] > m_options.maxRetriesOnTimeoutOrNack) {
Weiwei Liu245d7912016-07-28 00:04:25 -0700142 return handleFail(segNo, "Reached the maximum number of retries (" +
143 to_string(m_options.maxRetriesOnTimeoutOrNack) +
144 ") while retrieving segment #" + to_string(segNo));
145 }
146
147 if (m_options.isVerbose) {
148 std::cerr << "# of retries for segment #" << segNo
149 << " is " << m_retxCount[segNo] << std::endl;
150 }
151 }
152
153 m_face.removePendingInterest(m_segmentInfo[segNo].interestId);
154 }
155
156 Interest interest(Name(m_prefix).appendSegment(segNo));
157 interest.setInterestLifetime(m_options.interestLifetime);
158 interest.setMustBeFresh(m_options.mustBeFresh);
159 interest.setMaxSuffixComponents(1);
160
161 auto interestId = m_face.expressInterest(interest,
162 bind(&PipelineInterestsAimd::handleData, this, _1, _2),
163 bind(&PipelineInterestsAimd::handleNack, this, _1, _2),
Davide Pesaventoe9c69852017-11-04 18:08:37 -0400164 bind(&PipelineInterestsAimd::handleLifetimeExpiration, this, _1));
Weiwei Liu245d7912016-07-28 00:04:25 -0700165 m_nInFlight++;
Chavoosh Ghasemi75309ae2018-03-26 14:46:24 -0400166 m_nSent++;
Weiwei Liu245d7912016-07-28 00:04:25 -0700167
168 if (isRetransmission) {
169 SegmentInfo& segInfo = m_segmentInfo[segNo];
Weiwei Liu245d7912016-07-28 00:04:25 -0700170 segInfo.timeSent = time::steady_clock::now();
Davide Pesavento958896e2017-01-19 00:52:04 -0500171 segInfo.rto = m_rttEstimator.getEstimatedRto();
172 segInfo.state = SegmentState::Retransmitted;
Weiwei Liu245d7912016-07-28 00:04:25 -0700173 m_nRetransmitted++;
174 }
175 else {
176 m_highInterest = segNo;
Davide Pesavento958896e2017-01-19 00:52:04 -0500177 m_segmentInfo[segNo] = {interestId,
178 time::steady_clock::now(),
179 m_rttEstimator.getEstimatedRto(),
180 SegmentState::FirstTimeSent};
Weiwei Liu245d7912016-07-28 00:04:25 -0700181 }
182}
183
184void
185PipelineInterestsAimd::schedulePackets()
186{
Davide Pesaventobf1c0692017-01-15 19:15:09 -0500187 BOOST_ASSERT(m_nInFlight >= 0);
188 auto availableWindowSize = static_cast<int64_t>(m_cwnd) - m_nInFlight;
189
Weiwei Liu245d7912016-07-28 00:04:25 -0700190 while (availableWindowSize > 0) {
191 if (!m_retxQueue.empty()) { // do retransmission first
192 uint64_t retxSegNo = m_retxQueue.front();
193 m_retxQueue.pop();
194
195 auto it = m_segmentInfo.find(retxSegNo);
196 if (it == m_segmentInfo.end()) {
197 continue;
198 }
199 // the segment is still in the map, it means that it needs to be retransmitted
200 sendInterest(retxSegNo, true);
201 }
202 else { // send next segment
203 sendInterest(getNextSegmentNo(), false);
204 }
205 availableWindowSize--;
206 }
207}
208
209void
210PipelineInterestsAimd::handleData(const Interest& interest, const Data& data)
211{
212 if (isStopping())
213 return;
214
215 // Data name will not have extra components because MaxSuffixComponents is set to 1
216 BOOST_ASSERT(data.getName().equals(interest.getName()));
217
218 if (!m_hasFinalBlockId && !data.getFinalBlockId().empty()) {
219 m_lastSegmentNo = data.getFinalBlockId().toSegment();
220 m_hasFinalBlockId = true;
221 cancelInFlightSegmentsGreaterThan(m_lastSegmentNo);
222 if (m_hasFailure && m_lastSegmentNo >= m_failedSegNo) {
223 // previously failed segment is part of the content
224 return onFailure(m_failureReason);
Chavoosh Ghasemi4d36ed52017-10-31 22:26:25 +0000225 }
226 else {
Weiwei Liu245d7912016-07-28 00:04:25 -0700227 m_hasFailure = false;
228 }
229 }
230
Davide Pesaventobf1c0692017-01-15 19:15:09 -0500231 uint64_t recvSegNo = getSegmentFromPacket(data);
Weiwei Liu245d7912016-07-28 00:04:25 -0700232 SegmentInfo& segInfo = m_segmentInfo[recvSegNo];
233 if (segInfo.state == SegmentState::RetxReceived) {
234 m_segmentInfo.erase(recvSegNo);
235 return; // ignore already-received segment
236 }
237
238 Milliseconds rtt = time::steady_clock::now() - segInfo.timeSent;
Weiwei Liu245d7912016-07-28 00:04:25 -0700239 if (m_options.isVerbose) {
240 std::cerr << "Received segment #" << recvSegNo
241 << ", rtt=" << rtt.count() << "ms"
242 << ", rto=" << segInfo.rto.count() << "ms" << std::endl;
243 }
244
Davide Pesavento958896e2017-01-19 00:52:04 -0500245 if (m_highData < recvSegNo) {
246 m_highData = recvSegNo;
247 }
248
249 // for segments in retx queue, we must not decrement m_nInFlight
250 // because it was already decremented when the segment timed out
251 if (segInfo.state != SegmentState::InRetxQueue) {
Weiwei Liu245d7912016-07-28 00:04:25 -0700252 m_nInFlight--;
253 }
254
Chavoosh Ghasemi641f5932017-11-06 22:45:11 +0000255 // upon finding congestion mark, decrease the window size
256 // without retransmitting any packet
257 if (data.getCongestionMark() > 0) {
258 m_nCongMarks++;
259 if (!m_options.ignoreCongMarks) {
260 if (m_options.disableCwa || m_highData > m_recPoint) {
261 m_recPoint = m_highInterest; // react to only one congestion event (timeout or congestion mark)
262 // per RTT (conservative window adaptation)
263 decreaseWindow();
264
265 if (m_options.isVerbose) {
266 std::cerr << "Received congestion mark, value = " << data.getCongestionMark()
267 << ", new cwnd = " << m_cwnd << std::endl;
268 }
269 }
270 }
271 else {
272 increaseWindow();
273 }
274 }
275 else {
276 increaseWindow();
277 }
278
Davide Pesaventoe9c69852017-11-04 18:08:37 -0400279 onData(data);
Weiwei Liu245d7912016-07-28 00:04:25 -0700280
281 if (segInfo.state == SegmentState::FirstTimeSent ||
282 segInfo.state == SegmentState::InRetxQueue) { // do not sample RTT for retransmitted segments
Davide Pesaventobf1c0692017-01-15 19:15:09 -0500283 auto nExpectedSamples = std::max<int64_t>((m_nInFlight + 1) >> 1, 1);
284 BOOST_ASSERT(nExpectedSamples > 0);
285 m_rttEstimator.addMeasurement(recvSegNo, rtt, static_cast<size_t>(nExpectedSamples));
Weiwei Liu245d7912016-07-28 00:04:25 -0700286 m_segmentInfo.erase(recvSegNo); // remove the entry associated with the received segment
287 }
288 else { // retransmission
Davide Pesavento958896e2017-01-19 00:52:04 -0500289 BOOST_ASSERT(segInfo.state == SegmentState::Retransmitted);
Weiwei Liu245d7912016-07-28 00:04:25 -0700290 segInfo.state = SegmentState::RetxReceived;
291 }
292
293 BOOST_ASSERT(m_nReceived > 0);
Davide Pesaventobf1c0692017-01-15 19:15:09 -0500294 if (m_hasFinalBlockId &&
295 static_cast<uint64_t>(m_nReceived - 1) >= m_lastSegmentNo) { // all segments have been received
Weiwei Liu245d7912016-07-28 00:04:25 -0700296 cancel();
Davide Pesaventof6991e12018-01-08 20:58:50 -0500297 if (!m_options.isQuiet) {
Weiwei Liu245d7912016-07-28 00:04:25 -0700298 printSummary();
299 }
300 }
301 else {
302 schedulePackets();
303 }
304}
305
306void
307PipelineInterestsAimd::handleNack(const Interest& interest, const lp::Nack& nack)
308{
309 if (isStopping())
310 return;
311
312 if (m_options.isVerbose)
313 std::cerr << "Received Nack with reason " << nack.getReason()
314 << " for Interest " << interest << std::endl;
315
Davide Pesaventobf1c0692017-01-15 19:15:09 -0500316 uint64_t segNo = getSegmentFromPacket(interest);
Weiwei Liu245d7912016-07-28 00:04:25 -0700317
318 switch (nack.getReason()) {
Davide Pesavento958896e2017-01-19 00:52:04 -0500319 case lp::NackReason::DUPLICATE:
320 // ignore duplicates
Weiwei Liu245d7912016-07-28 00:04:25 -0700321 break;
Davide Pesavento958896e2017-01-19 00:52:04 -0500322 case lp::NackReason::CONGESTION:
323 // treated the same as timeout for now
324 enqueueForRetransmission(segNo);
325 recordTimeout();
326 schedulePackets();
327 break;
328 default:
Weiwei Liu245d7912016-07-28 00:04:25 -0700329 handleFail(segNo, "Could not retrieve data for " + interest.getName().toUri() +
330 ", reason: " + boost::lexical_cast<std::string>(nack.getReason()));
331 break;
Weiwei Liu245d7912016-07-28 00:04:25 -0700332 }
333}
334
335void
336PipelineInterestsAimd::handleLifetimeExpiration(const Interest& interest)
337{
338 if (isStopping())
339 return;
340
Davide Pesavento958896e2017-01-19 00:52:04 -0500341 enqueueForRetransmission(getSegmentFromPacket(interest));
342 recordTimeout();
343 schedulePackets();
Weiwei Liu245d7912016-07-28 00:04:25 -0700344}
345
346void
Davide Pesavento958896e2017-01-19 00:52:04 -0500347PipelineInterestsAimd::recordTimeout()
Weiwei Liu245d7912016-07-28 00:04:25 -0700348{
Weiwei Liu245d7912016-07-28 00:04:25 -0700349 if (m_options.disableCwa || m_highData > m_recPoint) {
350 // react to only one timeout per RTT (conservative window adaptation)
351 m_recPoint = m_highInterest;
352
353 decreaseWindow();
354 m_rttEstimator.backoffRto();
355 m_nLossEvents++;
356
357 if (m_options.isVerbose) {
Chavoosh Ghasemi641f5932017-11-06 22:45:11 +0000358 std::cerr << "Packet loss event, new cwnd = " << m_cwnd
Weiwei Liu245d7912016-07-28 00:04:25 -0700359 << ", ssthresh = " << m_ssthresh << std::endl;
360 }
361 }
Davide Pesavento958896e2017-01-19 00:52:04 -0500362}
Weiwei Liu245d7912016-07-28 00:04:25 -0700363
Davide Pesavento958896e2017-01-19 00:52:04 -0500364void
365PipelineInterestsAimd::enqueueForRetransmission(uint64_t segNo)
366{
367 BOOST_ASSERT(m_nInFlight > 0);
368 m_nInFlight--;
369 m_retxQueue.push(segNo);
370 m_segmentInfo.at(segNo).state = SegmentState::InRetxQueue;
Weiwei Liu245d7912016-07-28 00:04:25 -0700371}
372
373void
374PipelineInterestsAimd::handleFail(uint64_t segNo, const std::string& reason)
375{
376 if (isStopping())
377 return;
378
379 // if the failed segment is definitely part of the content, raise a fatal error
380 if (m_hasFinalBlockId && segNo <= m_lastSegmentNo)
381 return onFailure(reason);
382
383 if (!m_hasFinalBlockId) {
384 m_segmentInfo.erase(segNo);
Davide Pesavento958896e2017-01-19 00:52:04 -0500385 m_nInFlight--;
Weiwei Liu245d7912016-07-28 00:04:25 -0700386
387 if (m_segmentInfo.empty()) {
388 onFailure("Fetching terminated but no final segment number has been found");
389 }
390 else {
391 cancelInFlightSegmentsGreaterThan(segNo);
392 m_hasFailure = true;
393 m_failedSegNo = segNo;
394 m_failureReason = reason;
395 }
396 }
397}
398
399void
400PipelineInterestsAimd::increaseWindow()
401{
402 if (m_cwnd < m_ssthresh) {
403 m_cwnd += m_options.aiStep; // additive increase
Chavoosh Ghasemi4d36ed52017-10-31 22:26:25 +0000404 }
405 else {
Weiwei Liu245d7912016-07-28 00:04:25 -0700406 m_cwnd += m_options.aiStep / std::floor(m_cwnd); // congestion avoidance
407 }
Davide Pesavento958896e2017-01-19 00:52:04 -0500408
Davide Pesaventobf1c0692017-01-15 19:15:09 -0500409 afterCwndChange(time::steady_clock::now() - getStartTime(), m_cwnd);
Weiwei Liu245d7912016-07-28 00:04:25 -0700410}
411
412void
413PipelineInterestsAimd::decreaseWindow()
414{
415 // please refer to RFC 5681, Section 3.1 for the rationale behind it
Chavoosh Ghasemi641f5932017-11-06 22:45:11 +0000416 m_ssthresh = std::max(MIN_SSTHRESH, m_cwnd * m_options.mdCoef); // multiplicative decrease
Weiwei Liu245d7912016-07-28 00:04:25 -0700417 m_cwnd = m_options.resetCwndToInit ? m_options.initCwnd : m_ssthresh;
Davide Pesavento958896e2017-01-19 00:52:04 -0500418
Davide Pesaventobf1c0692017-01-15 19:15:09 -0500419 afterCwndChange(time::steady_clock::now() - getStartTime(), m_cwnd);
Weiwei Liu245d7912016-07-28 00:04:25 -0700420}
421
Weiwei Liu245d7912016-07-28 00:04:25 -0700422void
Davide Pesavento958896e2017-01-19 00:52:04 -0500423PipelineInterestsAimd::cancelInFlightSegmentsGreaterThan(uint64_t segNo)
Weiwei Liu245d7912016-07-28 00:04:25 -0700424{
425 for (auto it = m_segmentInfo.begin(); it != m_segmentInfo.end();) {
426 // cancel fetching all segments that follow
Davide Pesavento958896e2017-01-19 00:52:04 -0500427 if (it->first > segNo) {
Weiwei Liu245d7912016-07-28 00:04:25 -0700428 m_face.removePendingInterest(it->second.interestId);
429 it = m_segmentInfo.erase(it);
Davide Pesavento958896e2017-01-19 00:52:04 -0500430 m_nInFlight--;
Weiwei Liu245d7912016-07-28 00:04:25 -0700431 }
432 else {
433 ++it;
434 }
435 }
436}
437
438void
439PipelineInterestsAimd::printSummary() const
440{
Chavoosh Ghasemi4d36ed52017-10-31 22:26:25 +0000441 PipelineInterests::printSummary();
Chavoosh Ghasemi75309ae2018-03-26 14:46:24 -0400442 std::cerr << "Total # of lost/retransmitted segments: " << m_nRetransmitted
443 << " (caused " << m_nLossEvents << " window decreases)\n"
Weiwei Liu245d7912016-07-28 00:04:25 -0700444 << "Packet loss rate: "
Chavoosh Ghasemi75309ae2018-03-26 14:46:24 -0400445 << (static_cast<double>(m_nRetransmitted) / static_cast<double>(m_nSent)) * 100 << "%\n"
Chavoosh Ghasemi3dae1092017-12-21 12:39:08 -0700446 << "Total # of received congestion marks: " << m_nCongMarks << "\n"
Chavoosh Ghasemi75309ae2018-03-26 14:46:24 -0400447 << "RTT ";
448
449 if (m_rttEstimator.getMinRtt() == std::numeric_limits<double>::max() ||
450 m_rttEstimator.getMaxRtt() == std::numeric_limits<double>::min()) {
451 std::cerr << "stats unavailable\n";
452 }
453 else {
454 std::cerr << "min/avg/max = " << std::fixed << std::setprecision(3)
455 << m_rttEstimator.getMinRtt() << "/"
456 << m_rttEstimator.getAvgRtt() << "/"
457 << m_rttEstimator.getMaxRtt() << " ms\n";
458 }
Weiwei Liu245d7912016-07-28 00:04:25 -0700459}
460
461std::ostream&
462operator<<(std::ostream& os, SegmentState state)
463{
464 switch (state) {
465 case SegmentState::FirstTimeSent:
466 os << "FirstTimeSent";
467 break;
468 case SegmentState::InRetxQueue:
469 os << "InRetxQueue";
470 break;
471 case SegmentState::Retransmitted:
472 os << "Retransmitted";
473 break;
474 case SegmentState::RetxReceived:
475 os << "RetxReceived";
476 break;
477 }
Weiwei Liu245d7912016-07-28 00:04:25 -0700478 return os;
479}
480
481std::ostream&
482operator<<(std::ostream& os, const PipelineInterestsAimdOptions& options)
483{
Davide Pesavento44b3b232017-12-23 16:58:25 -0500484 os << "AIMD pipeline parameters:\n"
Weiwei Liu245d7912016-07-28 00:04:25 -0700485 << "\tInitial congestion window size = " << options.initCwnd << "\n"
486 << "\tInitial slow start threshold = " << options.initSsthresh << "\n"
Weiwei Liu245d7912016-07-28 00:04:25 -0700487 << "\tAdditive increase step = " << options.aiStep << "\n"
Davide Pesavento958896e2017-01-19 00:52:04 -0500488 << "\tMultiplicative decrease factor = " << options.mdCoef << "\n"
Weiwei Liu245d7912016-07-28 00:04:25 -0700489 << "\tRTO check interval = " << options.rtoCheckInterval << "\n"
Davide Pesavento44b3b232017-12-23 16:58:25 -0500490 << "\tMax retries on timeout or Nack = " << (options.maxRetriesOnTimeoutOrNack == DataFetcher::MAX_RETRIES_INFINITE ?
491 "infinite" : to_string(options.maxRetriesOnTimeoutOrNack)) << "\n"
Chavoosh Ghasemi641f5932017-11-06 22:45:11 +0000492 << "\tReaction to congestion marks " << (options.ignoreCongMarks ? "disabled" : "enabled") << "\n"
Davide Pesavento44b3b232017-12-23 16:58:25 -0500493 << "\tConservative window adaptation " << (options.disableCwa ? "disabled" : "enabled") << "\n"
Davide Pesavento958896e2017-01-19 00:52:04 -0500494 << "\tResetting cwnd to " << (options.resetCwndToInit ? "initCwnd" : "ssthresh") << " upon loss event\n";
Weiwei Liu245d7912016-07-28 00:04:25 -0700495 return os;
496}
497
498} // namespace aimd
499} // namespace chunks
500} // namespace ndn