A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-bbr.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 NITK Surathkal
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Vivek Jain <jain.vivek.anand@gmail.com>
18 * Viyom Mittal <viyommittal@gmail.com>
19 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
20 */
21
22#include "tcp-bbr.h"
23
24#include "ns3/log.h"
25#include "ns3/simulator.h"
26
27namespace ns3
28{
29
32
33const double TcpBbr::PACING_GAIN_CYCLE[] = {5.0 / 4, 3.0 / 4, 1, 1, 1, 1, 1, 1};
34
35TypeId
37{
38 static TypeId tid =
39 TypeId("ns3::TcpBbr")
41 .AddConstructor<TcpBbr>()
42 .SetGroupName("Internet")
43 .AddAttribute("Stream",
44 "Random number stream (default is set to 4 to align with Linux results)",
47 MakeUintegerChecker<uint32_t>())
48 .AddAttribute("HighGain",
49 "Value of high gain",
50 DoubleValue(2.89),
52 MakeDoubleChecker<double>())
53 .AddAttribute("BwWindowLength",
54 "Length of bandwidth windowed filter",
55 UintegerValue(10),
57 MakeUintegerChecker<uint32_t>())
58 .AddAttribute("RttWindowLength",
59 "Length of RTT windowed filter",
60 TimeValue(Seconds(10)),
63 .AddAttribute("ProbeRttDuration",
64 "Time to be spent in PROBE_RTT phase",
68 .AddAttribute("ExtraAckedRttWindowLength",
69 "Window length of extra acked window",
72 MakeUintegerChecker<uint32_t>())
73 .AddAttribute(
74 "AckEpochAckedResetThresh",
75 "Max allowed val for m_ackEpochAcked, after which sampling epoch is reset",
76 UintegerValue(1 << 12),
78 MakeUintegerChecker<uint32_t>());
79 return tid;
80}
81
84{
85 NS_LOG_FUNCTION(this);
86 m_uv = CreateObject<UniformRandomVariable>();
87}
88
90 : TcpCongestionOps(sock),
91 m_bandwidthWindowLength(sock.m_bandwidthWindowLength),
92 m_pacingGain(sock.m_pacingGain),
93 m_cWndGain(sock.m_cWndGain),
94 m_highGain(sock.m_highGain),
95 m_isPipeFilled(sock.m_isPipeFilled),
96 m_minPipeCwnd(sock.m_minPipeCwnd),
97 m_roundCount(sock.m_roundCount),
98 m_roundStart(sock.m_roundStart),
99 m_nextRoundDelivered(sock.m_nextRoundDelivered),
100 m_probeRttDuration(sock.m_probeRttDuration),
101 m_probeRtPropStamp(sock.m_probeRtPropStamp),
102 m_probeRttDoneStamp(sock.m_probeRttDoneStamp),
103 m_probeRttRoundDone(sock.m_probeRttRoundDone),
104 m_packetConservation(sock.m_packetConservation),
105 m_priorCwnd(sock.m_priorCwnd),
106 m_idleRestart(sock.m_idleRestart),
107 m_targetCWnd(sock.m_targetCWnd),
108 m_fullBandwidth(sock.m_fullBandwidth),
109 m_fullBandwidthCount(sock.m_fullBandwidthCount),
110 m_rtProp(Time::Max()),
111 m_sendQuantum(sock.m_sendQuantum),
112 m_cycleStamp(sock.m_cycleStamp),
113 m_cycleIndex(sock.m_cycleIndex),
114 m_rtPropExpired(sock.m_rtPropExpired),
115 m_rtPropFilterLen(sock.m_rtPropFilterLen),
116 m_rtPropStamp(sock.m_rtPropStamp),
117 m_isInitialized(sock.m_isInitialized),
118 m_uv(sock.m_uv),
119 m_delivered(sock.m_delivered),
120 m_appLimited(sock.m_appLimited),
121 m_txItemDelivered(sock.m_txItemDelivered),
122 m_extraAckedGain(sock.m_extraAckedGain),
123 m_extraAckedWinRtt(sock.m_extraAckedWinRtt),
124 m_extraAckedWinRttLength(sock.m_extraAckedWinRttLength),
125 m_ackEpochAckedResetThresh(sock.m_ackEpochAckedResetThresh),
126 m_extraAckedIdx(sock.m_extraAckedIdx),
127 m_ackEpochTime(sock.m_ackEpochTime),
128 m_ackEpochAcked(sock.m_ackEpochAcked),
129 m_hasSeenRtt(sock.m_hasSeenRtt)
130{
131 NS_LOG_FUNCTION(this);
132}
133
134const char* const TcpBbr::BbrModeName[BBR_PROBE_RTT + 1] = {
135 "BBR_STARTUP",
136 "BBR_DRAIN",
137 "BBR_PROBE_BW",
138 "BBR_PROBE_RTT",
139};
140
141void
143{
144 NS_LOG_FUNCTION(this << stream);
145 m_uv->SetStream(stream);
146}
147
148void
150{
151 NS_LOG_FUNCTION(this);
153 m_roundStart = false;
154 m_roundCount = 0;
155}
156
157void
159{
160 NS_LOG_FUNCTION(this);
161 m_isPipeFilled = false;
162 m_fullBandwidth = 0;
164}
165
166void
168{
169 NS_LOG_FUNCTION(this << tcb);
170
171 if (!tcb->m_pacing)
172 {
173 NS_LOG_WARN("BBR must use pacing");
174 tcb->m_pacing = true;
175 }
176
177 Time rtt;
178 if (tcb->m_minRtt != Time::Max())
179 {
180 rtt = MilliSeconds(std::max<long int>(tcb->m_minRtt.GetMilliSeconds(), 1));
181 m_hasSeenRtt = true;
182 }
183 else
184 {
185 rtt = MilliSeconds(1);
186 }
187
188 DataRate nominalBandwidth(tcb->m_cWnd * 8 / rtt.GetSeconds());
189 tcb->m_pacingRate = DataRate(m_pacingGain * nominalBandwidth.GetBitRate());
191 DataRate(tcb->m_cWnd * 8 / rtt.GetSeconds()),
192 0);
193}
194
195void
197{
198 NS_LOG_FUNCTION(this);
202}
203
204void
206{
207 NS_LOG_FUNCTION(this << tcb << rs);
208 if (tcb->m_bytesInFlight.Get() == 0U && rs.m_isAppLimited)
209 {
210 m_idleRestart = true;
212 {
213 SetPacingRate(tcb, 1);
214 }
215 }
216}
217
218void
220{
221 NS_LOG_FUNCTION(this << tcb << gain);
222 DataRate rate(gain * m_maxBwFilter.GetBest().GetBitRate());
223 rate = std::min(rate, tcb->m_maxPacingRate);
224
225 if (!m_hasSeenRtt && tcb->m_minRtt != Time::Max())
226 {
227 InitPacingRate(tcb);
228 }
229
230 if (m_isPipeFilled || rate > tcb->m_pacingRate)
231 {
232 tcb->m_pacingRate = rate;
233 }
234}
235
238{
239 NS_LOG_FUNCTION(this << tcb << gain);
240 if (m_rtProp == Time::Max())
241 {
242 return tcb->m_initialCWnd * tcb->m_segmentSize;
243 }
244 double quanta = 3 * m_sendQuantum;
245 double estimatedBdp = m_maxBwFilter.GetBest() * m_rtProp / 8.0;
246
248 {
249 return (gain * estimatedBdp) + quanta + (2 * tcb->m_segmentSize);
250 }
251 return (gain * estimatedBdp) + quanta;
252}
253
254void
256{
257 NS_LOG_FUNCTION(this);
261}
262
263bool
265{
266 NS_LOG_FUNCTION(this << tcb << rs);
267 bool isFullLength = (Simulator::Now() - m_cycleStamp) > m_rtProp;
268 if (m_pacingGain == 1)
269 {
270 return isFullLength;
271 }
272 else if (m_pacingGain > 1)
273 {
274 return isFullLength &&
275 (rs.m_bytesLoss > 0 || rs.m_priorInFlight >= InFlight(tcb, m_pacingGain));
276 }
277 else
278 {
279 return isFullLength || rs.m_priorInFlight <= InFlight(tcb, 1);
280 }
281}
282
283void
285{
286 NS_LOG_FUNCTION(this << tcb << rs);
288 {
290 }
291}
292
293void
295{
296 NS_LOG_FUNCTION(this << rs);
298 {
299 return;
300 }
301
302 /* Check if Bottleneck bandwidth is still growing*/
304 {
307 return;
308 }
309
311 if (m_fullBandwidthCount >= 3)
312 {
313 NS_LOG_DEBUG("Pipe filled");
314 m_isPipeFilled = true;
315 }
316}
317
318void
320{
321 NS_LOG_FUNCTION(this);
323 m_pacingGain = 1.0 / m_highGain;
325}
326
327void
329{
330 NS_LOG_FUNCTION(this);
332 m_pacingGain = 1;
333 m_cWndGain = 2;
334 m_cycleIndex = GAIN_CYCLE_LENGTH - 1 - (int)m_uv->GetValue(0, 6);
336}
337
338void
340{
341 NS_LOG_FUNCTION(this << tcb);
343 {
344 EnterDrain();
345 tcb->m_ssThresh = InFlight(tcb, 1);
346 }
347
348 if (m_state == BbrMode_t::BBR_DRAIN && tcb->m_bytesInFlight <= InFlight(tcb, 1))
349 {
350 EnterProbeBW();
351 }
352}
353
354void
356{
357 NS_LOG_FUNCTION(this << tcb);
359 if (tcb->m_lastRtt >= Seconds(0) && (tcb->m_lastRtt <= m_rtProp || m_rtPropExpired))
360 {
361 m_rtProp = tcb->m_lastRtt;
363 }
364}
365
366void
368{
369 NS_LOG_FUNCTION(this);
371 m_pacingGain = 1;
372 m_cWndGain = 1;
373}
374
375void
377{
378 NS_LOG_FUNCTION(this << tcb);
380 {
381 m_priorCwnd = tcb->m_cWnd;
382 }
383 else
384 {
385 m_priorCwnd = std::max(m_priorCwnd, tcb->m_cWnd.Get());
386 }
387}
388
389void
391{
392 NS_LOG_FUNCTION(this << tcb);
393 tcb->m_cWnd = std::max(m_priorCwnd, tcb->m_cWnd.Get());
394}
395
396void
398{
399 NS_LOG_FUNCTION(this);
400 if (m_isPipeFilled)
401 {
402 EnterProbeBW();
403 }
404 else
405 {
406 EnterStartup();
407 }
408}
409
410void
412{
413 NS_LOG_FUNCTION(this << tcb);
414
415 uint32_t totalBytes = m_delivered + tcb->m_bytesInFlight.Get();
416 m_appLimited = (totalBytes > 0 ? totalBytes : 1);
417
418 if (m_probeRttDoneStamp == Seconds(0) && tcb->m_bytesInFlight <= m_minPipeCwnd)
419 {
421 m_probeRttRoundDone = false;
423 }
424 else if (m_probeRttDoneStamp != Seconds(0))
425 {
426 if (m_roundStart)
427 {
428 m_probeRttRoundDone = true;
429 }
431 {
433 RestoreCwnd(tcb);
434 ExitProbeRTT();
435 }
436 }
437}
438
439void
441{
442 NS_LOG_FUNCTION(this << tcb);
444 {
446 SaveCwnd(tcb);
448 }
449
451 {
452 HandleProbeRTT(tcb);
453 }
454
455 if (rs.m_delivered)
456 {
457 m_idleRestart = false;
458 }
459}
460
461void
463{
464 NS_LOG_FUNCTION(this << tcb);
465 m_sendQuantum = 1 * tcb->m_segmentSize;
466}
467
468void
470{
471 NS_LOG_FUNCTION(this << tcb);
473}
474
477{
478 uint32_t maxAggrBytes; // MaxBW * 0.1 secs
479 uint32_t aggrCwndBytes = 0;
480
482 {
483 maxAggrBytes = m_maxBwFilter.GetBest().GetBitRate() / (10 * 8);
484 aggrCwndBytes = m_extraAckedGain * std::max(m_extraAcked[0], m_extraAcked[1]);
485 aggrCwndBytes = std::min(aggrCwndBytes, maxAggrBytes);
486 }
487 return aggrCwndBytes;
488}
489
490void
492{
493 uint32_t expectedAcked;
494 uint32_t extraAck;
495 uint32_t epochProp;
496
497 if (!m_extraAckedGain || rs.m_ackedSacked <= 0 || rs.m_delivered < 0)
498 {
499 return;
500 }
501
502 if (m_roundStart)
503 {
504 m_extraAckedWinRtt = std::min<uint32_t>(31, m_extraAckedWinRtt + 1);
506 {
510 }
511 }
512
514 expectedAcked = m_maxBwFilter.GetBest().GetBitRate() * epochProp / 8;
515
516 if (m_ackEpochAcked <= expectedAcked ||
518 {
519 m_ackEpochAcked = 0;
521 expectedAcked = 0;
522 }
523
525 extraAck = m_ackEpochAcked - expectedAcked;
526 extraAck = std::min(extraAck, tcb->m_cWnd.Get());
527
528 if (extraAck > m_extraAcked[m_extraAckedIdx])
529 {
530 m_extraAcked[m_extraAckedIdx] = extraAck;
531 }
532}
533
534bool
536{
537 NS_LOG_FUNCTION(this << tcb << rs);
538 if (rs.m_bytesLoss > 0)
539 {
540 tcb->m_cWnd =
541 std::max((int)tcb->m_cWnd.Get() - (int)rs.m_bytesLoss, (int)tcb->m_segmentSize);
542 }
543
545 {
546 tcb->m_cWnd = std::max(tcb->m_cWnd.Get(), tcb->m_bytesInFlight.Get() + rs.m_ackedSacked);
547 return true;
548 }
549 return false;
550}
551
552void
554{
555 NS_LOG_FUNCTION(this << tcb);
557 {
558 tcb->m_cWnd = std::min(tcb->m_cWnd.Get(), m_minPipeCwnd);
559 }
560}
561
562void
564{
565 NS_LOG_FUNCTION(this << tcb << rs);
566
567 if (!rs.m_ackedSacked)
568 {
569 goto done;
570 }
571
572 if (tcb->m_congState == TcpSocketState::CA_RECOVERY)
573 {
574 if (ModulateCwndForRecovery(tcb, rs))
575 {
576 goto done;
577 }
578 }
579
580 UpdateTargetCwnd(tcb);
581
582 if (m_isPipeFilled)
583 {
584 tcb->m_cWnd = std::min(tcb->m_cWnd.Get() + (uint32_t)rs.m_ackedSacked, m_targetCWnd);
585 }
586 else if (tcb->m_cWnd < m_targetCWnd || m_delivered < tcb->m_initialCWnd * tcb->m_segmentSize)
587 {
588 tcb->m_cWnd = tcb->m_cWnd.Get() + rs.m_ackedSacked;
589 }
590 tcb->m_cWnd = std::max(tcb->m_cWnd.Get(), m_minPipeCwnd);
591
592done:
594}
595
596void
598{
599 NS_LOG_FUNCTION(this << tcb << rs);
601 {
603 m_roundCount++;
604 m_roundStart = true;
605 m_packetConservation = false;
606 }
607 else
608 {
609 m_roundStart = false;
610 }
611}
612
613void
615{
616 NS_LOG_FUNCTION(this << tcb << rs);
617
618 if (rs.m_deliveryRate == 0)
619 {
620 return;
621 }
622
623 UpdateRound(tcb, rs);
624
626 {
628 }
629}
630
631void
633{
634 NS_LOG_FUNCTION(this << tcb << rs);
635 UpdateBtlBw(tcb, rs);
636 UpdateAckAggregation(tcb, rs);
637 CheckCyclePhase(tcb, rs);
638 CheckFullPipe(rs);
639 CheckDrain(tcb);
640 UpdateRTprop(tcb);
641 CheckProbeRTT(tcb, rs);
642}
643
644void
646{
647 NS_LOG_FUNCTION(this << tcb << rs);
649 SetSendQuantum(tcb);
650 SetCwnd(tcb, rs);
651}
652
653void
655{
656 NS_LOG_FUNCTION(this << mode);
657 NS_LOG_DEBUG(Simulator::Now() << " Changing from " << BbrModeName[m_state] << " to "
658 << BbrModeName[mode]);
659 m_state = mode;
660}
661
664{
665 NS_LOG_FUNCTION(this);
666 return m_state;
667}
668
669double
671{
672 NS_LOG_FUNCTION(this);
673 return m_cWndGain;
674}
675
676double
678{
679 NS_LOG_FUNCTION(this);
680 return m_pacingGain;
681}
682
683std::string
685{
686 return "TcpBbr";
687}
688
689bool
691{
692 NS_LOG_FUNCTION(this);
693 return true;
694}
695
696void
700{
701 NS_LOG_FUNCTION(this << tcb << rs);
702 m_delivered = rc.m_delivered;
703 m_txItemDelivered = rc.m_txItemDelivered;
704 UpdateModelAndState(tcb, rs);
706}
707
708void
710{
711 NS_LOG_FUNCTION(this << tcb << newState);
712 if (newState == TcpSocketState::CA_OPEN && !m_isInitialized)
713 {
714 NS_LOG_DEBUG("CongestionStateSet triggered to CA_OPEN :: " << newState);
715 m_rtProp = tcb->m_lastRtt.Get() != Time::Max() ? tcb->m_lastRtt.Get() : Time::Max();
717 m_priorCwnd = tcb->m_cWnd;
718 tcb->m_ssThresh = tcb->m_initialSsThresh;
719 m_targetCWnd = tcb->m_cWnd;
720 m_minPipeCwnd = 4 * tcb->m_segmentSize;
721 m_sendQuantum = 1 * tcb->m_segmentSize;
722
724 InitFullPipe();
725 EnterStartup();
726 InitPacingRate(tcb);
729 m_extraAckedIdx = 0;
730 m_ackEpochAcked = 0;
731 m_extraAcked[0] = 0;
732 m_extraAcked[1] = 0;
733 m_isInitialized = true;
734 }
735 else if (newState == TcpSocketState::CA_LOSS)
736 {
737 NS_LOG_DEBUG("CongestionStateSet triggered to CA_LOSS :: " << newState);
738 SaveCwnd(tcb);
739 m_roundStart = true;
740 }
741 else if (newState == TcpSocketState::CA_RECOVERY)
742 {
743 NS_LOG_DEBUG("CongestionStateSet triggered to CA_RECOVERY :: " << newState);
744 SaveCwnd(tcb);
745 tcb->m_cWnd =
746 tcb->m_bytesInFlight.Get() + std::max(tcb->m_lastAckedSackedBytes, tcb->m_segmentSize);
748 }
749}
750
751void
753{
754 NS_LOG_FUNCTION(this << tcb << event);
756 {
757 NS_LOG_DEBUG("CwndEvent triggered to CA_EVENT_COMPLETE_CWR :: " << event);
758 m_packetConservation = false;
759 RestoreCwnd(tcb);
760 }
762 {
763 NS_LOG_DEBUG("CwndEvent triggered to CA_EVENT_TX_START :: " << event);
764 m_idleRestart = true;
766 m_ackEpochAcked = 0;
768 {
769 SetPacingRate(tcb, 1);
770 }
772 {
774 {
776 RestoreCwnd(tcb);
777 ExitProbeRTT();
778 }
779 }
780 }
781}
782
785{
786 NS_LOG_FUNCTION(this << tcb << bytesInFlight);
787 SaveCwnd(tcb);
788 return tcb->m_ssThresh;
789}
790
793{
794 return CopyObject<TcpBbr>(this);
795}
796
797} // namespace ns3
#define Max(a, b)
Class for representing data rates.
Definition: data-rate.h:89
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:305
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
BBR congestion control algorithm.
Definition: tcp-bbr.h:46
MaxBandwidthFilter_t m_maxBwFilter
Maximum bandwidth filter.
Definition: tcp-bbr.h:352
bool m_hasSeenRtt
Have we seen RTT sample yet?
Definition: tcp-bbr.h:404
double m_cWndGain
The dynamic congestion window gain factor.
Definition: tcp-bbr.h:356
void ModulateCwndForProbeRTT(Ptr< TcpSocketState > tcb)
Modulates congestion window in BBR_PROBE_RTT.
Definition: tcp-bbr.cc:553
uint32_t m_nextRoundDelivered
Denotes the end of a packet-timed round trip.
Definition: tcp-bbr.h:363
BbrMode_t
BBR has the following 4 modes for deciding how fast to send:
Definition: tcp-bbr.h:79
@ BBR_PROBE_RTT
Cut inflight to min to probe min_rtt.
Definition: tcp-bbr.h:83
@ BBR_DRAIN
Drain any queue created during startup.
Definition: tcp-bbr.h:81
@ BBR_STARTUP
Ramp up sending rate rapidly to fill pipe.
Definition: tcp-bbr.h:80
@ BBR_PROBE_BW
Discover, share bw: pace around estimated bw.
Definition: tcp-bbr.h:82
uint32_t m_roundCount
Count of packet-timed round trips.
Definition: tcp-bbr.h:361
uint32_t m_priorCwnd
The last-known good congestion window.
Definition: tcp-bbr.h:371
uint32_t m_extraAckedWinRttLength
Window length of extra acked window.
Definition: tcp-bbr.h:398
virtual void SetStream(uint32_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: tcp-bbr.cc:142
TcpBbr()
Constructor.
Definition: tcp-bbr.cc:82
uint32_t m_extraAckedIdx
Current index in extra acked array.
Definition: tcp-bbr.h:401
std::string GetName() const override
Get the name of the congestion control algorithm.
Definition: tcp-bbr.cc:684
void CongControl(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateConnection &rc, const TcpRateOps::TcpRateSample &rs) override
Called when packets are delivered to update cwnd and pacing rate.
Definition: tcp-bbr.cc:697
bool m_rtPropExpired
A boolean recording whether the BBR.RTprop has expired.
Definition: tcp-bbr.h:383
void CwndEvent(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) override
Trigger events/calculations on occurrence of congestion window event.
Definition: tcp-bbr.cc:752
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
Definition: tcp-bbr.cc:784
uint32_t m_bandwidthWindowLength
A constant specifying the length of the BBR.BtlBw max filter window, default 10 packet-timed round tr...
Definition: tcp-bbr.h:353
double m_highGain
A constant specifying highest gain factor, default is 2.89.
Definition: tcp-bbr.h:357
Time m_probeRttDuration
A constant specifying the minimum duration for which ProbeRTT state, default 200 millisecs.
Definition: tcp-bbr.h:364
void CheckCyclePhase(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Checks whether to advance pacing gain in BBR_PROBE_BW state, and if allowed calls AdvanceCyclePhase (...
Definition: tcp-bbr.cc:284
uint32_t AckAggregationCwnd()
Find Cwnd increment based on ack aggregation.
Definition: tcp-bbr.cc:476
bool m_idleRestart
When restarting from idle, set it true.
Definition: tcp-bbr.h:372
Ptr< UniformRandomVariable > m_uv
Uniform Random Variable.
Definition: tcp-bbr.h:389
Time m_rtPropStamp
The wall clock time at which the current BBR.RTProp sample was obtained.
Definition: tcp-bbr.h:386
void UpdateBtlBw(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Updates maximum bottleneck.
Definition: tcp-bbr.cc:614
static TypeId GetTypeId()
Get the type ID.
Definition: tcp-bbr.cc:36
uint32_t m_minPipeCwnd
The minimal congestion window value BBR tries to target, default 4 Segment size.
Definition: tcp-bbr.h:359
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Definition: tcp-bbr.cc:792
uint32_t GetBbrState()
Gets BBR state.
Definition: tcp-bbr.cc:663
bool HasCongControl() const override
Returns true when Congestion Control Algorithm implements CongControl.
Definition: tcp-bbr.cc:690
double GetCwndGain()
Gets current cwnd gain.
Definition: tcp-bbr.cc:670
void UpdateRound(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Updates round counting related variables.
Definition: tcp-bbr.cc:597
BbrMode_t m_state
Current state of BBR state machine.
Definition: tcp-bbr.h:351
bool m_roundStart
A boolean that BBR sets to true once per packet-timed round trip.
Definition: tcp-bbr.h:362
void AdvanceCyclePhase()
Advances pacing gain using cycle gain algorithm, while in BBR_PROBE_BW state.
Definition: tcp-bbr.cc:255
void EnterProbeBW()
Updates variables specific to BBR_PROBE_BW state.
Definition: tcp-bbr.cc:328
double GetPacingGain()
Gets current pacing gain.
Definition: tcp-bbr.cc:677
uint64_t m_delivered
The total amount of data in bytes delivered so far.
Definition: tcp-bbr.h:390
void InitPacingRate(Ptr< TcpSocketState > tcb)
Initializes the pacing rate.
Definition: tcp-bbr.cc:167
bool IsNextCyclePhase(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Checks whether to move to next value of pacing gain while in BBR_PROBE_BW.
Definition: tcp-bbr.cc:264
bool m_isInitialized
Set to true after first time initializtion variables.
Definition: tcp-bbr.h:388
void RestoreCwnd(Ptr< TcpSocketState > tcb)
Helper to restore the last-known good congestion window.
Definition: tcp-bbr.cc:390
bool ModulateCwndForRecovery(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Modulates congestion window in CA_RECOVERY.
Definition: tcp-bbr.cc:535
double m_pacingGain
The dynamic pacing gain factor.
Definition: tcp-bbr.h:355
static const char *const BbrModeName[BBR_PROBE_RTT+1]
Literal names of BBR mode for use in log messages.
Definition: tcp-bbr.h:95
void UpdateRTprop(Ptr< TcpSocketState > tcb)
Updates minimum RTT.
Definition: tcp-bbr.cc:355
void CheckDrain(Ptr< TcpSocketState > tcb)
Checks whether its time to enter BBR_DRAIN or BBR_PROBE_BW state.
Definition: tcp-bbr.cc:339
void SetBbrState(BbrMode_t state)
Sets BBR state.
Definition: tcp-bbr.cc:654
void HandleRestartFromIdle(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Updates pacing rate if socket is restarting from idle state.
Definition: tcp-bbr.cc:205
static const double PACING_GAIN_CYCLE[]
BBR uses an eight-phase cycle with the given pacing_gain value in the BBR ProbeBW gain cycle.
Definition: tcp-bbr.h:57
WindowedFilter< DataRate, MaxFilter< DataRate >, uint32_t, uint32_t > MaxBandwidthFilter_t
Definition of max bandwidth filter.
Definition: tcp-bbr.h:90
bool m_isPipeFilled
A boolean that records whether BBR has filled the pipe.
Definition: tcp-bbr.h:358
void EnterStartup()
Updates variables specific to BBR_STARTUP state.
Definition: tcp-bbr.cc:196
void InitRoundCounting()
Initializes the round counting related variables.
Definition: tcp-bbr.cc:149
void InitFullPipe()
Initializes the full pipe estimator.
Definition: tcp-bbr.cc:158
void UpdateAckAggregation(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Estimates max degree of aggregation.
Definition: tcp-bbr.cc:491
uint32_t m_txItemDelivered
The number of bytes already delivered at the time of new packet transmission.
Definition: tcp-bbr.h:393
bool m_packetConservation
Enable/Disable packet conservation mode.
Definition: tcp-bbr.h:370
uint32_t InFlight(Ptr< TcpSocketState > tcb, double gain)
Estimates the target value for congestion window.
Definition: tcp-bbr.cc:237
uint32_t m_extraAckedWinRtt
Age of extra acked in rtt.
Definition: tcp-bbr.h:397
void SetPacingRate(Ptr< TcpSocketState > tcb, double gain)
Updates pacing rate based on network model.
Definition: tcp-bbr.cc:219
void SaveCwnd(Ptr< const TcpSocketState > tcb)
Helper to remember the last-known good congestion window or the latest congestion window unmodulated ...
Definition: tcp-bbr.cc:376
void EnterDrain()
Updates variables specific to BBR_DRAIN state.
Definition: tcp-bbr.cc:319
void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override
Trigger events/calculations specific to a congestion state.
Definition: tcp-bbr.cc:709
Time m_probeRttDoneStamp
Time to exit from BBR_PROBE_RTT state.
Definition: tcp-bbr.h:368
uint32_t m_extraAcked[2]
Maximum excess data acked in epoch.
Definition: tcp-bbr.h:396
Time m_rtProp
Estimated two-way round-trip propagation delay of the path, estimated from the windowed minimum recen...
Definition: tcp-bbr.h:376
uint32_t m_appLimited
The index of the last transmitted packet marked as application-limited.
Definition: tcp-bbr.h:391
void UpdateModelAndState(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Updates BBR network model (Maximum bandwidth and minimum RTT).
Definition: tcp-bbr.cc:632
void UpdateControlParameters(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Updates control parameters congestion windowm, pacing rate, send quantum.
Definition: tcp-bbr.cc:645
Time m_ackEpochTime
Starting of ACK sampling epoch time.
Definition: tcp-bbr.h:402
Time m_cycleStamp
Last time gain cycle updated.
Definition: tcp-bbr.h:381
void CheckFullPipe(const TcpRateOps::TcpRateSample &rs)
Identifies whether pipe or BDP is already full.
Definition: tcp-bbr.cc:294
void EnterProbeRTT()
Updates variables specific to BBR_PROBE_RTT state.
Definition: tcp-bbr.cc:367
DataRate m_fullBandwidth
Value of full bandwidth recorded.
Definition: tcp-bbr.h:374
void HandleProbeRTT(Ptr< TcpSocketState > tcb)
Handles the steps for BBR_PROBE_RTT state.
Definition: tcp-bbr.cc:411
Time m_rtPropFilterLen
A constant specifying the length of the RTProp min filter window, default 10 secs.
Definition: tcp-bbr.h:384
uint32_t m_targetCWnd
Target value for congestion window, adapted to the estimated BDP.
Definition: tcp-bbr.h:373
uint32_t m_sendQuantum
The maximum size of a data aggregate scheduled and transmitted together.
Definition: tcp-bbr.h:379
void SetSendQuantum(Ptr< TcpSocketState > tcb)
Updates send quantum based on the network model.
Definition: tcp-bbr.cc:462
uint32_t m_ackEpochAckedResetThresh
Max allowed val for m_ackEpochAcked, after which sampling epoch is reset.
Definition: tcp-bbr.h:399
void ExitProbeRTT()
Called on exiting from BBR_PROBE_RTT state, it eithers invoke EnterProbeBW () or EnterStartup ()
Definition: tcp-bbr.cc:397
bool m_probeRttRoundDone
True when it is time to exit BBR_PROBE_RTT.
Definition: tcp-bbr.h:369
uint32_t m_fullBandwidthCount
Count of full bandwidth recorded consistently.
Definition: tcp-bbr.h:375
void UpdateTargetCwnd(Ptr< TcpSocketState > tcb)
Updates target congestion window.
Definition: tcp-bbr.cc:469
uint32_t m_cycleIndex
Current index of gain cycle.
Definition: tcp-bbr.h:382
uint32_t m_extraAckedGain
Gain factor for adding extra ack to cwnd.
Definition: tcp-bbr.h:395
void CheckProbeRTT(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
This method handles the steps related to the ProbeRTT state.
Definition: tcp-bbr.cc:440
static const uint8_t GAIN_CYCLE_LENGTH
The number of phases in the BBR ProbeBW gain cycle.
Definition: tcp-bbr.h:51
void SetCwnd(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs)
Updates congestion window based on the network model.
Definition: tcp-bbr.cc:563
uint32_t m_ackEpochAcked
Bytes ACked in sampling epoch.
Definition: tcp-bbr.h:403
Congestion control abstract class.
TcpCAEvent_t
Congestion avoidance events.
@ CA_EVENT_COMPLETE_CWR
end of congestion recovery
@ CA_EVENT_TX_START
first transmit when no packets in flight
TcpCongState_t
Definition of the Congestion state machine.
@ CA_RECOVERY
CWND was reduced, we are fast-retransmitting.
@ CA_LOSS
CWND was reduced due to RTO timeout or SACK reneging.
@ CA_OPEN
Normal state, no dubious events.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:403
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
Definition: nstime.h:297
AttributeValue implementation for Time.
Definition: nstime.h:1406
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Hold an unsigned integer type.
Definition: uinteger.h:45
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
void Update(T new_sample, TimeT new_time)
Updates best estimates with |sample|, and expires and updates best estimates as necessary.
T GetBest() const
Returns Max/Min value so far among the windowed samples.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1427
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1407
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1319
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1331
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Information about the connection rate.
Definition: tcp-rate-ops.h:174
Rate Sample structure.
Definition: tcp-rate-ops.h:140
bool m_isAppLimited
Indicates whether the rate sample is application-limited.
Definition: tcp-rate-ops.h:142
uint32_t m_ackedSacked
The amount of data acked and sacked in the last received ack.
Definition: tcp-rate-ops.h:155
DataRate m_deliveryRate
The delivery rate sample.
Definition: tcp-rate-ops.h:141
uint32_t m_priorInFlight
The value if bytes in flight prior to last received ack.
Definition: tcp-rate-ops.h:154
uint32_t m_priorDelivered
The delivered count of the most recent packet delivered.
Definition: tcp-rate-ops.h:146
int32_t m_delivered
The amount of data marked as delivered over the sampling interval.
Definition: tcp-rate-ops.h:144
uint32_t m_bytesLoss
The amount of data marked as lost from the most recent ack received.
Definition: tcp-rate-ops.h:152