42 .AddConstructor<TcpVegas> ()
43 .SetGroupName (
"Internet")
44 .AddAttribute (
"Alpha",
"Lower bound of packets in network",
47 MakeUintegerChecker<uint32_t> ())
48 .AddAttribute (
"Beta",
"Upper bound of packets in network",
51 MakeUintegerChecker<uint32_t> ())
52 .AddAttribute (
"Gamma",
"Limit on increase",
55 MakeUintegerChecker<uint32_t> ())
68 m_doingVegasNow (true),
76 m_alpha (sock.m_alpha),
78 m_gamma (sock.m_gamma),
79 m_baseRtt (sock.m_baseRtt),
80 m_minRtt (sock.m_minRtt),
81 m_cntRtt (sock.m_cntRtt),
82 m_doingVegasNow (true),
96 return CopyObject<TcpVegas> (
this);
163 NS_LOG_LOGIC (
"Vegas is not turned on, we follow NewReno algorithm.");
171 NS_LOG_LOGIC (
"A Vegas cycle has finished, we adjust cwnd once per RTT.");
182 NS_LOG_LOGIC (
"We do not have enough RTT samples to do Vegas, so we behave like NewReno.");
187 NS_LOG_LOGIC (
"We have enough RTT samples to perform Vegas calculations");
207 targetCwnd =
static_cast<uint32_t
> (segCwnd * tmp);
208 NS_LOG_DEBUG (
"Calculated targetCwnd = " << targetCwnd);
215 diff = segCwnd - targetCwnd;
225 NS_LOG_LOGIC (
"We are going too fast. We need to slow down and "
226 "change to linear increase/decrease mode.");
227 segCwnd =
std::min (segCwnd, targetCwnd + 1);
235 NS_LOG_LOGIC (
"We are in slow start and diff < m_gamma, so we "
236 "follow NewReno slow start");
241 NS_LOG_LOGIC (
"We are in linear increase/decrease mode");
245 NS_LOG_LOGIC (
"We are going too fast, so we slow down by decrementing cwnd");
256 NS_LOG_LOGIC (
"We are going too slow, so we speed up by incrementing cwnd");
290 uint32_t bytesInFlight)
293 return std::max (
std::min (tcb->m_ssThresh.Get (), tcb->m_cWnd.Get () - tcb->m_segmentSize), 2 * tcb->m_segmentSize);
Smart pointer class similar to boost::intrusive_ptr.
The NewReno implementation.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Try to increase the cWnd following the NewReno specification.
virtual uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Tcp NewReno slow start algorithm.
uint32_t m_segmentSize
Segment size.
uint32_t GetCwndInSegments() const
Get cwnd in segments rather than bytes.
TcpCongState_t
Definition of the Congestion state machine.
@ CA_OPEN
Normal state, no dubious events.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
TracedValue< uint32_t > m_cWnd
Congestion window.
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
An implementation of TCP Vegas.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Enable/disable Vegas algorithm depending on the congestion state.
void DisableVegas()
Stop taking Vegas samples.
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
TcpVegas(void)
Create an unbound tcp socket.
uint32_t m_alpha
Alpha threshold, lower bound of packets in network.
uint32_t m_beta
Beta threshold, upper bound of packets in network.
bool m_doingVegasNow
If true, do Vegas for this RTT.
void EnableVegas(Ptr< TcpSocketState > tcb)
Enable Vegas algorithm to start taking Vegas samples.
Time m_minRtt
Minimum of all RTT measurements within last RTT.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Compute RTTs needed to execute Vegas algorithm.
Time m_baseRtt
Minimum of all Vegas RTT measurements seen during connection.
uint32_t m_gamma
Gamma threshold, limit on increase.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following Vegas linear increase/decrease algorithm.
static TypeId GetTypeId(void)
Get the type ID.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get slow start threshold following Vegas principle.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
SequenceNumber32 m_begSndNxt
Right edge during last RTT.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
bool IsZero(void) const
Exactly equivalent to t == 0.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.