10#include "ns3/simulator.h"
24 .AddConstructor<TcpBic>()
25 .SetGroupName(
"Internet")
26 .AddAttribute(
"FastConvergence",
27 "Turn on/off fast convergence.",
32 "Beta for multiplicative decrease",
36 .AddAttribute(
"MaxIncr",
37 "Limit on increment allowed during binary search",
41 .AddAttribute(
"LowWnd",
42 "Threshold window size (in segments) for engaging BIC response",
46 .AddAttribute(
"SmoothPart",
47 "Number of RTT needed to approach cWnd_max from "
48 "cWnd_max-BinarySearchCoefficient. It can be viewed as the gradient "
49 "of the slow start AIM phase: less this value is, "
50 "more steep the increment will be.",
54 .AddAttribute(
"BinarySearchCoefficient",
55 "Inverse of the coefficient for the "
56 "binary search. Default 4, as in Linux",
75 m_fastConvergence(sock.m_fastConvergence),
77 m_maxIncr(sock.m_maxIncr),
78 m_lowWnd(sock.m_lowWnd),
79 m_smoothPart(sock.m_smoothPart),
80 m_cWndCnt(sock.m_cWndCnt),
81 m_lastMaxCwnd(sock.m_lastMaxCwnd),
82 m_lastCwnd(sock.m_lastCwnd),
83 m_epochStart(sock.m_epochStart),
94 if (tcb->m_cWnd < tcb->m_ssThresh)
96 tcb->m_cWnd += tcb->m_segmentSize;
99 NS_LOG_INFO(
"In SlowStart, updated to cwnd " << tcb->m_cWnd <<
" ssthresh "
103 if (tcb->m_cWnd >= tcb->m_ssThresh && segmentsAcked > 0)
115 tcb->m_cWnd += tcb->m_segmentSize;
117 NS_LOG_INFO(
"In CongAvoid, updated to cwnd " << tcb->m_cWnd);
121 NS_LOG_INFO(
"Not enough segments have been ACKed to increment cwnd."
133 uint32_t segCwnd = tcb->GetCwndInSegments();
145 NS_LOG_INFO(
"Under lowWnd, compatibility mode. Behaving as NewReno");
155 <<
" and dist=" << dist);
175 cnt =
static_cast<uint32_t>(segCwnd / dist);
177 NS_LOG_INFO(
"Binary search increase, cnt=" << cnt);
236 uint32_t segCwnd = tcb->GetCwndInSegments();
256 ssThresh = std::max(2 * tcb->m_segmentSize, bytesInFlight / 2);
257 NS_LOG_INFO(
"Less than lowWindow, ssTh= " << ssThresh);
261 ssThresh =
static_cast<uint32_t>(std::max(segCwnd *
m_beta, 2.0) * tcb->m_segmentSize);
262 NS_LOG_INFO(
"More than lowWindow, ssTh= " << ssThresh);
This class can be used to hold variables of floating point type such as 'double' or 'float'.
friend Ptr< T > CopyObject(Ptr< T > object)
Copy an Object.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
BIC congestion control algorithm.
bool m_fastConvergence
Enable or disable fast convergence algorithm.
uint32_t m_lastMaxCwnd
Last maximum cWnd.
uint32_t m_lowWnd
Lower bound on congestion window.
static TypeId GetTypeId()
Get the type ID.
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
uint8_t m_b
Binary search coefficient.
uint32_t m_lastCwnd
Last cWnd.
uint32_t m_maxIncr
Maximum window increment.
double m_beta
Beta for cubic multiplicative increase.
virtual uint32_t Update(Ptr< TcpSocketState > tcb)
Bic window update after a new ack received.
uint32_t m_smoothPart
Number of RTT needed to reach Wmax from Wmax-B.
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Congestion avoidance algorithm implementation.
Time m_epochStart
Beginning of an epoch.
uint32_t m_cWndCnt
cWnd integer-to-float counter
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
std::string GetName() const override
Get the name of the congestion control algorithm.
Congestion control abstract class.
Simulation virtual time values and global simulation resolution.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)