BBR congestion control algorithm. More...
#include "tcp-bbr.h"
Public Types | |
enum | BbrMode_t { BBR_STARTUP , BBR_DRAIN , BBR_PROBE_BW , BBR_PROBE_RTT } |
BBR has the following 4 modes for deciding how fast to send: More... | |
typedef WindowedFilter< DataRate, MaxFilter< DataRate >, uint32_t, uint32_t > | MaxBandwidthFilter_t |
Definition of max bandwidth filter. | |
Public Member Functions | |
TcpBbr () | |
Constructor. | |
TcpBbr (const TcpBbr &sock) | |
Copy constructor. | |
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. | |
void | CongestionStateSet (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override |
Trigger events/calculations specific to a congestion state. | |
void | CwndEvent (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) override |
Trigger events/calculations on occurrence of congestion window event. | |
Ptr< TcpCongestionOps > | Fork () override |
Copy the congestion control algorithm across sockets. | |
std::string | GetName () const override |
Get the name of the congestion control algorithm. | |
uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override |
Get the slow start threshold after a loss event. | |
bool | HasCongControl () const override |
Returns true when Congestion Control Algorithm implements CongControl. | |
virtual void | SetStream (uint32_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. | |
Public Member Functions inherited from ns3::TcpCongestionOps | |
TcpCongestionOps () | |
TcpCongestionOps (const TcpCongestionOps &other) | |
Copy constructor. | |
~TcpCongestionOps () override | |
virtual void | CongControl (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateConnection &rc, const TcpRateOps::TcpRateSample &rs) |
Called when packets are delivered to update cwnd and pacing rate. | |
virtual void | CongestionStateSet (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) |
Trigger events/calculations specific to a congestion state. | |
virtual void | CwndEvent (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) |
Trigger events/calculations on occurrence of congestion window event. | |
virtual Ptr< TcpCongestionOps > | Fork ()=0 |
Copy the congestion control algorithm across sockets. | |
virtual std::string | GetName () const =0 |
Get the name of the congestion control algorithm. | |
virtual uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)=0 |
Get the slow start threshold after a loss event. | |
virtual bool | HasCongControl () const |
Returns true when Congestion Control Algorithm implements CongControl. | |
virtual void | IncreaseWindow (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
Congestion avoidance algorithm implementation. | |
virtual void | Init (Ptr< TcpSocketState > tcb) |
Set configuration required by congestion control algorithm. | |
virtual void | PktsAcked (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) |
Timing information on received ACK. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
virtual TypeId | GetInstanceTypeId () const =0 |
Get the most derived TypeId for this Object. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::TcpCongestionOps | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Attributes | |
static const char *const | BbrModeName [BBR_PROBE_RTT+1] |
Literal names of BBR mode for use in log messages. | |
static const uint8_t | GAIN_CYCLE_LENGTH = 8 |
The number of phases in the BBR ProbeBW gain cycle. | |
static const double | PACING_GAIN_CYCLE [] = {5.0 / 4, 3.0 / 4, 1, 1, 1, 1, 1, 1} |
BBR uses an eight-phase cycle with the given pacing_gain value in the BBR ProbeBW gain cycle. | |
Protected Member Functions | |
uint32_t | AckAggregationCwnd () |
Find Cwnd increment based on ack aggregation. | |
void | AdvanceCyclePhase () |
Advances pacing gain using cycle gain algorithm, while in BBR_PROBE_BW state. | |
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 () | |
void | CheckDrain (Ptr< TcpSocketState > tcb) |
Checks whether its time to enter BBR_DRAIN or BBR_PROBE_BW state. | |
void | CheckFullPipe (const TcpRateOps::TcpRateSample &rs) |
Identifies whether pipe or BDP is already full. | |
void | CheckProbeRTT (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
This method handles the steps related to the ProbeRTT state. | |
void | EnterDrain () |
Updates variables specific to BBR_DRAIN state. | |
void | EnterProbeBW () |
Updates variables specific to BBR_PROBE_BW state. | |
void | EnterProbeRTT () |
Updates variables specific to BBR_PROBE_RTT state. | |
void | EnterStartup () |
Updates variables specific to BBR_STARTUP state. | |
void | ExitProbeRTT () |
Called on exiting from BBR_PROBE_RTT state, it eithers invoke EnterProbeBW () or EnterStartup () | |
uint32_t | GetBbrState () |
Gets BBR state. | |
double | GetCwndGain () |
Gets current cwnd gain. | |
double | GetPacingGain () |
Gets current pacing gain. | |
void | HandleProbeRTT (Ptr< TcpSocketState > tcb) |
Handles the steps for BBR_PROBE_RTT state. | |
void | HandleRestartFromIdle (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Updates pacing rate if socket is restarting from idle state. | |
uint32_t | InFlight (Ptr< TcpSocketState > tcb, double gain) |
Estimates the target value for congestion window. | |
void | InitFullPipe () |
Initializes the full pipe estimator. | |
void | InitPacingRate (Ptr< TcpSocketState > tcb) |
Initializes the pacing rate. | |
void | InitRoundCounting () |
Initializes the round counting related variables. | |
bool | IsNextCyclePhase (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Checks whether to move to next value of pacing gain while in BBR_PROBE_BW. | |
void | ModulateCwndForProbeRTT (Ptr< TcpSocketState > tcb) |
Modulates congestion window in BBR_PROBE_RTT. | |
bool | ModulateCwndForRecovery (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Modulates congestion window in CA_RECOVERY. | |
void | RestoreCwnd (Ptr< TcpSocketState > tcb) |
Helper to restore the last-known good congestion window. | |
void | SaveCwnd (Ptr< const TcpSocketState > tcb) |
Helper to remember the last-known good congestion window or the latest congestion window unmodulated by loss recovery or ProbeRTT. | |
void | SetBbrState (BbrMode_t state) |
Sets BBR state. | |
void | SetCwnd (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Updates congestion window based on the network model. | |
void | SetPacingRate (Ptr< TcpSocketState > tcb, double gain) |
Updates pacing rate based on network model. | |
void | SetSendQuantum (Ptr< TcpSocketState > tcb) |
Updates send quantum based on the network model. | |
void | UpdateAckAggregation (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Estimates max degree of aggregation. | |
void | UpdateBtlBw (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Updates maximum bottleneck. | |
void | UpdateControlParameters (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Updates control parameters congestion windowm, pacing rate, send quantum. | |
void | UpdateModelAndState (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Updates BBR network model (Maximum bandwidth and minimum RTT). | |
void | UpdateRound (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateSample &rs) |
Updates round counting related variables. | |
void | UpdateRTprop (Ptr< TcpSocketState > tcb) |
Updates minimum RTT. | |
void | UpdateTargetCwnd (Ptr< TcpSocketState > tcb) |
Updates target congestion window. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Private Attributes | |
uint32_t | m_ackEpochAcked {0} |
Bytes ACked in sampling epoch. | |
uint32_t | m_ackEpochAckedResetThresh |
Max allowed val for m_ackEpochAcked, after which sampling epoch is reset. | |
Time | m_ackEpochTime {Seconds(0)} |
Starting of ACK sampling epoch time. | |
uint32_t | m_appLimited |
The index of the last transmitted packet marked as application-limited. | |
uint32_t | m_bandwidthWindowLength {0} |
A constant specifying the length of the BBR.BtlBw max filter window, default 10 packet-timed round trips. | |
double | m_cWndGain {0} |
The dynamic congestion window gain factor. | |
uint32_t | m_cycleIndex {0} |
Current index of gain cycle. | |
Time | m_cycleStamp {Seconds(0)} |
Last time gain cycle updated. | |
uint64_t | m_delivered {0} |
The total amount of data in bytes delivered so far. | |
uint32_t | m_extraAcked [2] {0, 0} |
Maximum excess data acked in epoch. | |
uint32_t | m_extraAckedGain {1} |
Gain factor for adding extra ack to cwnd. | |
uint32_t | m_extraAckedIdx {0} |
Current index in extra acked array. | |
uint32_t | m_extraAckedWinRtt {0} |
Age of extra acked in rtt. | |
uint32_t | m_extraAckedWinRttLength {5} |
Window length of extra acked window. | |
DataRate | m_fullBandwidth {0} |
Value of full bandwidth recorded. | |
uint32_t | m_fullBandwidthCount {0} |
Count of full bandwidth recorded consistently. | |
bool | m_hasSeenRtt {false} |
Have we seen RTT sample yet? | |
double | m_highGain {0} |
A constant specifying highest gain factor, default is 2.89. | |
bool | m_idleRestart {false} |
When restarting from idle, set it true. | |
bool | m_isInitialized {false} |
Set to true after first time initializtion variables. | |
bool | m_isPipeFilled {false} |
A boolean that records whether BBR has filled the pipe. | |
MaxBandwidthFilter_t | m_maxBwFilter |
Maximum bandwidth filter. | |
uint32_t | m_minPipeCwnd |
The minimal congestion window value BBR tries to target, default 4 Segment size. | |
uint32_t | m_nextRoundDelivered {0} |
Denotes the end of a packet-timed round trip. | |
double | m_pacingGain {0} |
The dynamic pacing gain factor. | |
bool | m_packetConservation {false} |
Enable/Disable packet conservation mode. | |
uint32_t | m_priorCwnd {0} |
The last-known good congestion window. | |
Time | m_probeRtPropStamp |
The wall clock time at which the current BBR.RTProp sample was obtained. | |
Time | m_probeRttDoneStamp {Seconds(0)} |
Time to exit from BBR_PROBE_RTT state. | |
Time | m_probeRttDuration {MilliSeconds(200)} |
A constant specifying the minimum duration for which ProbeRTT state, default 200 millisecs. | |
bool | m_probeRttRoundDone {false} |
True when it is time to exit BBR_PROBE_RTT. | |
uint32_t | m_roundCount {0} |
Count of packet-timed round trips. | |
bool | m_roundStart {false} |
A boolean that BBR sets to true once per packet-timed round trip. | |
Time | m_rtProp |
Estimated two-way round-trip propagation delay of the path, estimated from the windowed minimum recent round-trip delay sample. | |
bool | m_rtPropExpired {false} |
A boolean recording whether the BBR.RTprop has expired. | |
Time | m_rtPropFilterLen {Seconds(10)} |
A constant specifying the length of the RTProp min filter window, default 10 secs. | |
Time | m_rtPropStamp |
The wall clock time at which the current BBR.RTProp sample was obtained. | |
uint32_t | m_sendQuantum |
The maximum size of a data aggregate scheduled and transmitted together. | |
BbrMode_t | m_state {BbrMode_t::BBR_STARTUP} |
Current state of BBR state machine. | |
uint32_t | m_targetCWnd {0} |
Target value for congestion window, adapted to the estimated BDP. | |
uint32_t | m_txItemDelivered |
The number of bytes already delivered at the time of new packet transmission. | |
Ptr< UniformRandomVariable > | m_uv {nullptr} |
Uniform Random Variable. | |
Related Functions | |
(Note that these are not member functions.) | |
class | TcpBbrCheckGainValuesTest |
TcpBbrCheckGainValuesTest friend class (for tests). | |
Additional Inherited Members | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
BBR congestion control algorithm.
This class implement the BBR (Bottleneck Bandwidth and Round-trip propagation time) congestion control type.
ns3::TcpBbr is accessible through the following paths with Config::Set and Config::Connect:
Time
+9.22337e+18ns:+9.22337e+18ns Time
+9.22337e+18ns:+9.22337e+18ns No TraceSources are defined for this type.
Size of this type is 336 bytes (on a 64-bit architecture).
ns3::TcpBbr::TcpBbr | ( | ) |
ns3::TcpBbr::TcpBbr | ( | const TcpBbr & | sock | ) |
Copy constructor.
sock | The socket to copy from. |
Definition at line 89 of file tcp-bbr.cc.
References NS_LOG_FUNCTION.
|
protected |
Find Cwnd increment based on ack aggregation.
Definition at line 476 of file tcp-bbr.cc.
References ns3::WindowedFilter< T, Compare, TimeT, TimeDeltaT >::GetBest(), ns3::DataRate::GetBitRate(), m_extraAcked, m_extraAckedGain, m_isPipeFilled, and m_maxBwFilter.
Referenced by UpdateTargetCwnd().
|
protected |
Advances pacing gain using cycle gain algorithm, while in BBR_PROBE_BW state.
Definition at line 255 of file tcp-bbr.cc.
References GAIN_CYCLE_LENGTH, m_cycleIndex, m_cycleStamp, m_pacingGain, ns3::Simulator::Now(), NS_LOG_FUNCTION, and PACING_GAIN_CYCLE.
Referenced by CheckCyclePhase(), and EnterProbeBW().
|
protected |
Checks whether to advance pacing gain in BBR_PROBE_BW state, and if allowed calls AdvanceCyclePhase ()
tcb | the socket state. |
rs | rate sample. |
Definition at line 284 of file tcp-bbr.cc.
References AdvanceCyclePhase(), BBR_PROBE_BW, IsNextCyclePhase(), m_state, and NS_LOG_FUNCTION.
Referenced by UpdateModelAndState().
|
protected |
Checks whether its time to enter BBR_DRAIN or BBR_PROBE_BW state.
tcb | the socket state. |
Definition at line 339 of file tcp-bbr.cc.
References BBR_DRAIN, BBR_STARTUP, EnterDrain(), EnterProbeBW(), InFlight(), m_isPipeFilled, m_state, and NS_LOG_FUNCTION.
Referenced by UpdateModelAndState().
|
protected |
Identifies whether pipe or BDP is already full.
rs | rate sample. |
Definition at line 294 of file tcp-bbr.cc.
References ns3::WindowedFilter< T, Compare, TimeT, TimeDeltaT >::GetBest(), ns3::DataRate::GetBitRate(), m_fullBandwidth, m_fullBandwidthCount, ns3::TcpRateOps::TcpRateSample::m_isAppLimited, m_isPipeFilled, m_maxBwFilter, m_roundStart, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by UpdateModelAndState().
|
protected |
This method handles the steps related to the ProbeRTT state.
tcb | the socket state. |
rs | rate sample. |
Definition at line 440 of file tcp-bbr.cc.
References BBR_PROBE_RTT, EnterProbeRTT(), HandleProbeRTT(), ns3::TcpRateOps::TcpRateSample::m_delivered, m_idleRestart, m_probeRttDoneStamp, m_rtPropExpired, m_state, NS_LOG_FUNCTION, SaveCwnd(), and ns3::Seconds().
Referenced by UpdateModelAndState().
|
overridevirtual |
Called when packets are delivered to update cwnd and pacing rate.
This function mimics the function cong_control in Linux. It is allowed to change directly cWnd and pacing rate.
tcb | internal congestion state |
rc | Rate information for the connection |
rs | Rate sample (over a period of time) information |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 697 of file tcp-bbr.cc.
References m_delivered, m_txItemDelivered, NS_LOG_FUNCTION, UpdateControlParameters(), and UpdateModelAndState().
|
overridevirtual |
Trigger events/calculations specific to a congestion state.
This function mimics the notification function set_state in Linux. The function does not change the congestion state in the tcb; it notifies the congestion control algorithm that this state is about to be changed. The tcb->m_congState variable must be separately set; for example:
tcb | internal congestion state |
newState | new congestion state to which the TCP is going to switch |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 709 of file tcp-bbr.cc.
References ns3::TcpSocketState::CA_LOSS, ns3::TcpSocketState::CA_OPEN, ns3::TcpSocketState::CA_RECOVERY, EnterStartup(), InitFullPipe(), InitPacingRate(), InitRoundCounting(), m_ackEpochAcked, m_ackEpochTime, m_extraAcked, m_extraAckedIdx, m_extraAckedWinRtt, m_isInitialized, m_minPipeCwnd, m_packetConservation, m_priorCwnd, m_roundStart, m_rtProp, m_rtPropStamp, m_sendQuantum, m_targetCWnd, ns3::Time::Max(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and SaveCwnd().
|
overridevirtual |
Trigger events/calculations on occurrence of congestion window event.
This function mimics the function cwnd_event in Linux. The function is called in case of congestion window events.
tcb | internal congestion state |
event | the event which triggered this function |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 752 of file tcp-bbr.cc.
References BBR_PROBE_BW, BBR_PROBE_RTT, ns3::TcpSocketState::CA_EVENT_COMPLETE_CWR, ns3::TcpSocketState::CA_EVENT_TX_START, ExitProbeRTT(), m_ackEpochAcked, m_ackEpochTime, m_appLimited, m_idleRestart, m_packetConservation, m_probeRttDoneStamp, m_probeRttRoundDone, m_rtPropStamp, m_state, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, RestoreCwnd(), and SetPacingRate().
|
protected |
Updates variables specific to BBR_DRAIN state.
Definition at line 319 of file tcp-bbr.cc.
References BBR_DRAIN, m_cWndGain, m_highGain, m_pacingGain, NS_LOG_FUNCTION, and SetBbrState().
Referenced by CheckDrain().
|
protected |
Updates variables specific to BBR_PROBE_BW state.
Definition at line 328 of file tcp-bbr.cc.
References AdvanceCyclePhase(), BBR_PROBE_BW, GAIN_CYCLE_LENGTH, ns3::UniformRandomVariable::GetValue(), m_cWndGain, m_cycleIndex, m_pacingGain, m_uv, NS_LOG_FUNCTION, and SetBbrState().
Referenced by CheckDrain(), and ExitProbeRTT().
|
protected |
Updates variables specific to BBR_PROBE_RTT state.
Definition at line 367 of file tcp-bbr.cc.
References BBR_PROBE_RTT, m_cWndGain, m_pacingGain, NS_LOG_FUNCTION, and SetBbrState().
Referenced by CheckProbeRTT().
|
protected |
Updates variables specific to BBR_STARTUP state.
Definition at line 196 of file tcp-bbr.cc.
References BBR_STARTUP, m_cWndGain, m_highGain, m_pacingGain, NS_LOG_FUNCTION, and SetBbrState().
Referenced by CongestionStateSet(), and ExitProbeRTT().
|
protected |
Called on exiting from BBR_PROBE_RTT state, it eithers invoke EnterProbeBW () or EnterStartup ()
Definition at line 397 of file tcp-bbr.cc.
References EnterProbeBW(), EnterStartup(), m_isPipeFilled, and NS_LOG_FUNCTION.
Referenced by CwndEvent(), and HandleProbeRTT().
|
overridevirtual |
Copy the congestion control algorithm across sockets.
Implements ns3::TcpCongestionOps.
Definition at line 792 of file tcp-bbr.cc.
|
protected |
Gets BBR state.
Definition at line 663 of file tcp-bbr.cc.
References m_state, and NS_LOG_FUNCTION.
|
protected |
Gets current cwnd gain.
Definition at line 670 of file tcp-bbr.cc.
References m_cWndGain, and NS_LOG_FUNCTION.
|
overridevirtual |
Get the name of the congestion control algorithm.
Implements ns3::TcpCongestionOps.
Definition at line 684 of file tcp-bbr.cc.
|
protected |
Gets current pacing gain.
Definition at line 677 of file tcp-bbr.cc.
References m_pacingGain, and NS_LOG_FUNCTION.
|
overridevirtual |
Get the slow start threshold after a loss event.
Is guaranteed that the congestion control state (TcpAckState_t
) is changed BEFORE the invocation of this method. The implementer should return the slow start threshold (and not change it directly) because, in the future, the TCP implementation may require to instantly recover from a loss event (e.g. when there is a network with an high reordering factor).
tcb | internal congestion state |
bytesInFlight | total bytes in flight |
Implements ns3::TcpCongestionOps.
Definition at line 784 of file tcp-bbr.cc.
References NS_LOG_FUNCTION, and SaveCwnd().
|
static |
Get the type ID.
Definition at line 36 of file tcp-bbr.cc.
References m_ackEpochAckedResetThresh, m_bandwidthWindowLength, m_extraAckedWinRttLength, m_highGain, m_probeRttDuration, m_rtPropFilterLen, ns3::MakeDoubleAccessor(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeUintegerAccessor(), ns3::MilliSeconds(), ns3::Seconds(), ns3::TypeId::SetParent(), and SetStream().
|
protected |
Handles the steps for BBR_PROBE_RTT state.
tcb | the socket state. |
Definition at line 411 of file tcp-bbr.cc.
References ExitProbeRTT(), m_appLimited, m_delivered, m_minPipeCwnd, m_nextRoundDelivered, m_probeRttDoneStamp, m_probeRttDuration, m_probeRttRoundDone, m_roundStart, m_rtPropStamp, ns3::Simulator::Now(), NS_LOG_FUNCTION, RestoreCwnd(), and ns3::Seconds().
Referenced by CheckProbeRTT().
|
protected |
Updates pacing rate if socket is restarting from idle state.
tcb | the socket state. |
rs | rate sample. |
Definition at line 205 of file tcp-bbr.cc.
References BBR_PROBE_BW, m_idleRestart, ns3::TcpRateOps::TcpRateSample::m_isAppLimited, m_state, NS_LOG_FUNCTION, and SetPacingRate().
|
overridevirtual |
Returns true when Congestion Control Algorithm implements CongControl.
This function is the equivalent in C++ of the C checks that are used in the Linux kernel to see if an optional function has been defined. Since CongControl is optional, not all congestion controls have it. But, from the perspective of TcpSocketBase, the behavior is different if CongControl is present. Therefore, this check should return true for any congestion controls that implements the CongControl optional function.
Reimplemented from ns3::TcpCongestionOps.
Definition at line 690 of file tcp-bbr.cc.
References NS_LOG_FUNCTION.
|
protected |
Estimates the target value for congestion window.
tcb | the socket state. |
gain | cwnd gain. |
Definition at line 237 of file tcp-bbr.cc.
References BBR_PROBE_BW, ns3::WindowedFilter< T, Compare, TimeT, TimeDeltaT >::GetBest(), m_cycleIndex, m_maxBwFilter, m_rtProp, m_sendQuantum, m_state, ns3::Time::Max(), and NS_LOG_FUNCTION.
Referenced by CheckDrain(), IsNextCyclePhase(), and UpdateTargetCwnd().
|
protected |
Initializes the full pipe estimator.
Definition at line 158 of file tcp-bbr.cc.
References m_fullBandwidth, m_fullBandwidthCount, m_isPipeFilled, and NS_LOG_FUNCTION.
Referenced by CongestionStateSet().
|
protected |
Initializes the pacing rate.
tcb | the socket state. |
Definition at line 167 of file tcp-bbr.cc.
References ns3::DataRate::GetBitRate(), ns3::Time::GetSeconds(), m_bandwidthWindowLength, m_hasSeenRtt, m_maxBwFilter, m_pacingGain, ns3::Time::Max(), ns3::MilliSeconds(), NS_LOG_FUNCTION, and NS_LOG_WARN.
Referenced by CongestionStateSet(), and SetPacingRate().
|
protected |
Initializes the round counting related variables.
Definition at line 149 of file tcp-bbr.cc.
References m_nextRoundDelivered, m_roundCount, m_roundStart, and NS_LOG_FUNCTION.
Referenced by CongestionStateSet().
|
protected |
Checks whether to move to next value of pacing gain while in BBR_PROBE_BW.
tcb | the socket state. |
rs | rate sample. |
Definition at line 264 of file tcp-bbr.cc.
References InFlight(), ns3::TcpRateOps::TcpRateSample::m_bytesLoss, m_cycleStamp, m_pacingGain, ns3::TcpRateOps::TcpRateSample::m_priorInFlight, m_rtProp, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by CheckCyclePhase().
|
protected |
Modulates congestion window in BBR_PROBE_RTT.
tcb | the socket state. |
Definition at line 553 of file tcp-bbr.cc.
References BBR_PROBE_RTT, m_minPipeCwnd, m_state, and NS_LOG_FUNCTION.
Referenced by SetCwnd().
|
protected |
Modulates congestion window in CA_RECOVERY.
tcb | the socket state. |
rs | rate sample. |
Definition at line 535 of file tcp-bbr.cc.
References ns3::TcpRateOps::TcpRateSample::m_ackedSacked, ns3::TcpRateOps::TcpRateSample::m_bytesLoss, m_packetConservation, and NS_LOG_FUNCTION.
Referenced by SetCwnd().
|
protected |
Helper to restore the last-known good congestion window.
tcb | the socket state. |
Definition at line 390 of file tcp-bbr.cc.
References m_priorCwnd, and NS_LOG_FUNCTION.
Referenced by CwndEvent(), and HandleProbeRTT().
|
protected |
Helper to remember the last-known good congestion window or the latest congestion window unmodulated by loss recovery or ProbeRTT.
tcb | the socket state. |
Definition at line 376 of file tcp-bbr.cc.
References BBR_PROBE_RTT, ns3::TcpSocketState::CA_RECOVERY, m_priorCwnd, m_state, and NS_LOG_FUNCTION.
Referenced by CheckProbeRTT(), CongestionStateSet(), and GetSsThresh().
|
protected |
Sets BBR state.
state | BBR state. |
Definition at line 654 of file tcp-bbr.cc.
References BbrModeName, m_state, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by EnterDrain(), EnterProbeBW(), EnterProbeRTT(), and EnterStartup().
|
protected |
Updates congestion window based on the network model.
tcb | the socket state. |
rs | rate sample |
Definition at line 563 of file tcp-bbr.cc.
References ns3::TcpSocketState::CA_RECOVERY, ns3::TcpRateOps::TcpRateSample::m_ackedSacked, m_isPipeFilled, m_minPipeCwnd, m_targetCWnd, ModulateCwndForProbeRTT(), ModulateCwndForRecovery(), NS_LOG_FUNCTION, and UpdateTargetCwnd().
Referenced by UpdateControlParameters().
|
protected |
Updates pacing rate based on network model.
tcb | the socket state. |
gain | pacing gain. |
Definition at line 219 of file tcp-bbr.cc.
References ns3::WindowedFilter< T, Compare, TimeT, TimeDeltaT >::GetBest(), ns3::DataRate::GetBitRate(), InitPacingRate(), m_hasSeenRtt, m_isPipeFilled, m_maxBwFilter, ns3::Time::Max(), and NS_LOG_FUNCTION.
Referenced by CwndEvent(), HandleRestartFromIdle(), and UpdateControlParameters().
|
protected |
Updates send quantum based on the network model.
tcb | the socket state. |
Definition at line 462 of file tcp-bbr.cc.
References m_sendQuantum, and NS_LOG_FUNCTION.
Referenced by UpdateControlParameters().
|
virtual |
Assign a fixed random variable stream number to the random variables used by this model.
stream | first stream index to use |
Definition at line 142 of file tcp-bbr.cc.
References m_uv, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
Referenced by GetTypeId().
|
protected |
Estimates max degree of aggregation.
tcb | the socket state. |
rs | rate sample. |
Definition at line 491 of file tcp-bbr.cc.
References ns3::WindowedFilter< T, Compare, TimeT, TimeDeltaT >::GetBest(), ns3::DataRate::GetBitRate(), ns3::Time::GetSeconds(), ns3::TcpRateOps::TcpRateSample::m_ackedSacked, m_ackEpochAcked, m_ackEpochAckedResetThresh, m_ackEpochTime, ns3::TcpRateOps::TcpRateSample::m_delivered, m_extraAcked, m_extraAckedGain, m_extraAckedIdx, m_extraAckedWinRtt, m_extraAckedWinRttLength, m_maxBwFilter, m_roundStart, and ns3::Simulator::Now().
Referenced by UpdateModelAndState().
|
protected |
Updates maximum bottleneck.
tcb | the socket state. |
rs | rate sample. |
Definition at line 614 of file tcp-bbr.cc.
References ns3::WindowedFilter< T, Compare, TimeT, TimeDeltaT >::GetBest(), ns3::TcpRateOps::TcpRateSample::m_deliveryRate, ns3::TcpRateOps::TcpRateSample::m_isAppLimited, m_maxBwFilter, m_roundCount, NS_LOG_FUNCTION, ns3::WindowedFilter< T, Compare, TimeT, TimeDeltaT >::Update(), and UpdateRound().
Referenced by UpdateModelAndState().
|
protected |
Updates control parameters congestion windowm, pacing rate, send quantum.
tcb | the socket state. |
rs | rate sample. |
Definition at line 645 of file tcp-bbr.cc.
References m_pacingGain, NS_LOG_FUNCTION, SetCwnd(), SetPacingRate(), and SetSendQuantum().
Referenced by CongControl().
|
protected |
Updates BBR network model (Maximum bandwidth and minimum RTT).
tcb | the socket state. |
rs | rate sample. |
Definition at line 632 of file tcp-bbr.cc.
References CheckCyclePhase(), CheckDrain(), CheckFullPipe(), CheckProbeRTT(), NS_LOG_FUNCTION, UpdateAckAggregation(), UpdateBtlBw(), and UpdateRTprop().
Referenced by CongControl().
|
protected |
Updates round counting related variables.
tcb | the socket state. |
rs | rate sample. |
Definition at line 597 of file tcp-bbr.cc.
References m_delivered, m_nextRoundDelivered, m_packetConservation, ns3::TcpRateOps::TcpRateSample::m_priorDelivered, m_roundCount, m_roundStart, and NS_LOG_FUNCTION.
Referenced by UpdateBtlBw().
|
protected |
Updates minimum RTT.
tcb | the socket state. |
Definition at line 355 of file tcp-bbr.cc.
References m_rtProp, m_rtPropExpired, m_rtPropFilterLen, m_rtPropStamp, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by UpdateModelAndState().
|
protected |
Updates target congestion window.
tcb | the socket state. |
Definition at line 469 of file tcp-bbr.cc.
References AckAggregationCwnd(), InFlight(), m_cWndGain, m_targetCWnd, and NS_LOG_FUNCTION.
Referenced by SetCwnd().
|
friend |
TcpBbrCheckGainValuesTest friend class (for tests).
|
static |
Literal names of BBR mode for use in log messages.
Definition at line 94 of file tcp-bbr.h.
Referenced by SetBbrState().
|
static |
The number of phases in the BBR ProbeBW gain cycle.
Definition at line 50 of file tcp-bbr.h.
Referenced by AdvanceCyclePhase(), and EnterProbeBW().
|
private |
Bytes ACked in sampling epoch.
Definition at line 402 of file tcp-bbr.h.
Referenced by CongestionStateSet(), CwndEvent(), and UpdateAckAggregation().
|
private |
Max allowed val for m_ackEpochAcked, after which sampling epoch is reset.
Definition at line 398 of file tcp-bbr.h.
Referenced by GetTypeId(), and UpdateAckAggregation().
Starting of ACK sampling epoch time.
Definition at line 401 of file tcp-bbr.h.
Referenced by CongestionStateSet(), CwndEvent(), and UpdateAckAggregation().
|
private |
The index of the last transmitted packet marked as application-limited.
Definition at line 390 of file tcp-bbr.h.
Referenced by CwndEvent(), and HandleProbeRTT().
|
private |
A constant specifying the length of the BBR.BtlBw max filter window, default 10 packet-timed round trips.
Definition at line 352 of file tcp-bbr.h.
Referenced by GetTypeId(), and InitPacingRate().
|
private |
The dynamic congestion window gain factor.
Definition at line 355 of file tcp-bbr.h.
Referenced by EnterDrain(), EnterProbeBW(), EnterProbeRTT(), EnterStartup(), GetCwndGain(), and UpdateTargetCwnd().
|
private |
Current index of gain cycle.
Definition at line 381 of file tcp-bbr.h.
Referenced by AdvanceCyclePhase(), EnterProbeBW(), and InFlight().
Last time gain cycle updated.
Definition at line 380 of file tcp-bbr.h.
Referenced by AdvanceCyclePhase(), and IsNextCyclePhase().
|
private |
The total amount of data in bytes delivered so far.
Definition at line 389 of file tcp-bbr.h.
Referenced by CongControl(), HandleProbeRTT(), and UpdateRound().
|
private |
Maximum excess data acked in epoch.
Definition at line 395 of file tcp-bbr.h.
Referenced by AckAggregationCwnd(), CongestionStateSet(), and UpdateAckAggregation().
|
private |
Gain factor for adding extra ack to cwnd.
Definition at line 394 of file tcp-bbr.h.
Referenced by AckAggregationCwnd(), and UpdateAckAggregation().
|
private |
Current index in extra acked array.
Definition at line 400 of file tcp-bbr.h.
Referenced by CongestionStateSet(), and UpdateAckAggregation().
|
private |
Age of extra acked in rtt.
Definition at line 396 of file tcp-bbr.h.
Referenced by CongestionStateSet(), and UpdateAckAggregation().
|
private |
Window length of extra acked window.
Definition at line 397 of file tcp-bbr.h.
Referenced by GetTypeId(), and UpdateAckAggregation().
|
private |
Value of full bandwidth recorded.
Definition at line 373 of file tcp-bbr.h.
Referenced by CheckFullPipe(), and InitFullPipe().
|
private |
Count of full bandwidth recorded consistently.
Definition at line 374 of file tcp-bbr.h.
Referenced by CheckFullPipe(), and InitFullPipe().
|
private |
Have we seen RTT sample yet?
Definition at line 403 of file tcp-bbr.h.
Referenced by InitPacingRate(), and SetPacingRate().
|
private |
A constant specifying highest gain factor, default is 2.89.
Definition at line 356 of file tcp-bbr.h.
Referenced by EnterDrain(), EnterStartup(), and GetTypeId().
|
private |
When restarting from idle, set it true.
Definition at line 371 of file tcp-bbr.h.
Referenced by CheckProbeRTT(), CwndEvent(), and HandleRestartFromIdle().
|
private |
Set to true after first time initializtion variables.
Definition at line 387 of file tcp-bbr.h.
Referenced by CongestionStateSet().
|
private |
A boolean that records whether BBR has filled the pipe.
Definition at line 357 of file tcp-bbr.h.
Referenced by AckAggregationCwnd(), CheckDrain(), CheckFullPipe(), ExitProbeRTT(), InitFullPipe(), SetCwnd(), and SetPacingRate().
|
private |
Maximum bandwidth filter.
Definition at line 351 of file tcp-bbr.h.
Referenced by AckAggregationCwnd(), CheckFullPipe(), InFlight(), InitPacingRate(), SetPacingRate(), UpdateAckAggregation(), and UpdateBtlBw().
|
private |
The minimal congestion window value BBR tries to target, default 4 Segment size.
Definition at line 358 of file tcp-bbr.h.
Referenced by CongestionStateSet(), HandleProbeRTT(), ModulateCwndForProbeRTT(), and SetCwnd().
|
private |
Denotes the end of a packet-timed round trip.
Definition at line 362 of file tcp-bbr.h.
Referenced by HandleProbeRTT(), InitRoundCounting(), and UpdateRound().
|
private |
The dynamic pacing gain factor.
Definition at line 354 of file tcp-bbr.h.
Referenced by AdvanceCyclePhase(), EnterDrain(), EnterProbeBW(), EnterProbeRTT(), EnterStartup(), GetPacingGain(), InitPacingRate(), IsNextCyclePhase(), and UpdateControlParameters().
|
private |
Enable/Disable packet conservation mode.
Definition at line 369 of file tcp-bbr.h.
Referenced by CongestionStateSet(), CwndEvent(), ModulateCwndForRecovery(), and UpdateRound().
|
private |
The last-known good congestion window.
Definition at line 370 of file tcp-bbr.h.
Referenced by CongestionStateSet(), RestoreCwnd(), and SaveCwnd().
|
private |
The wall clock time at which the current BBR.RTProp sample was obtained.
Time to exit from BBR_PROBE_RTT state.
Definition at line 367 of file tcp-bbr.h.
Referenced by CheckProbeRTT(), CwndEvent(), and HandleProbeRTT().
|
private |
A constant specifying the minimum duration for which ProbeRTT state, default 200 millisecs.
Definition at line 363 of file tcp-bbr.h.
Referenced by GetTypeId(), and HandleProbeRTT().
|
private |
True when it is time to exit BBR_PROBE_RTT.
Definition at line 368 of file tcp-bbr.h.
Referenced by CwndEvent(), and HandleProbeRTT().
|
private |
Count of packet-timed round trips.
Definition at line 360 of file tcp-bbr.h.
Referenced by InitRoundCounting(), UpdateBtlBw(), and UpdateRound().
|
private |
A boolean that BBR sets to true once per packet-timed round trip.
Definition at line 361 of file tcp-bbr.h.
Referenced by CheckFullPipe(), CongestionStateSet(), HandleProbeRTT(), InitRoundCounting(), UpdateAckAggregation(), and UpdateRound().
|
private |
Estimated two-way round-trip propagation delay of the path, estimated from the windowed minimum recent round-trip delay sample.
Definition at line 375 of file tcp-bbr.h.
Referenced by CongestionStateSet(), InFlight(), IsNextCyclePhase(), and UpdateRTprop().
|
private |
A boolean recording whether the BBR.RTprop has expired.
Definition at line 382 of file tcp-bbr.h.
Referenced by CheckProbeRTT(), and UpdateRTprop().
A constant specifying the length of the RTProp min filter window, default 10 secs.
Definition at line 383 of file tcp-bbr.h.
Referenced by GetTypeId(), and UpdateRTprop().
|
private |
The wall clock time at which the current BBR.RTProp sample was obtained.
Definition at line 385 of file tcp-bbr.h.
Referenced by CongestionStateSet(), CwndEvent(), HandleProbeRTT(), and UpdateRTprop().
|
private |
The maximum size of a data aggregate scheduled and transmitted together.
Definition at line 378 of file tcp-bbr.h.
Referenced by CongestionStateSet(), InFlight(), and SetSendQuantum().
|
private |
Current state of BBR state machine.
Definition at line 350 of file tcp-bbr.h.
Referenced by CheckCyclePhase(), CheckDrain(), CheckProbeRTT(), CwndEvent(), GetBbrState(), HandleRestartFromIdle(), InFlight(), ModulateCwndForProbeRTT(), SaveCwnd(), and SetBbrState().
|
private |
Target value for congestion window, adapted to the estimated BDP.
Definition at line 372 of file tcp-bbr.h.
Referenced by CongestionStateSet(), SetCwnd(), and UpdateTargetCwnd().
|
private |
The number of bytes already delivered at the time of new packet transmission.
Definition at line 392 of file tcp-bbr.h.
Referenced by CongControl().
|
private |
Uniform Random Variable.
Definition at line 388 of file tcp-bbr.h.
Referenced by TcpBbr(), EnterProbeBW(), and SetStream().
|
static |
BBR uses an eight-phase cycle with the given pacing_gain value in the BBR ProbeBW gain cycle.
Definition at line 56 of file tcp-bbr.h.
Referenced by AdvanceCyclePhase().