28 #include "ns3/tcp-socket-base.h"
41 .AddConstructor<TcpVeno> ()
42 .SetGroupName (
"Internet")
43 .AddAttribute (
"Beta",
"Threshold for congestion detection",
46 MakeUintegerChecker<uint32_t> ())
56 m_doingVenoNow (true),
67 m_baseRtt (sock.m_baseRtt),
68 m_minRtt (sock.m_minRtt),
69 m_cntRtt (sock.m_cntRtt),
70 m_doingVenoNow (true),
73 m_ackCnt (sock.m_ackCnt),
87 return CopyObject<TcpVeno> (
this);
155 NS_LOG_LOGIC (
"Veno is not turned on, we follow NewReno algorithm.");
163 NS_LOG_LOGIC (
"We do not have enough RTT samples to perform Veno "
164 "calculations, we behave like NewReno.");
169 NS_LOG_LOGIC (
"We have enough RTT samples to perform Veno calculations.");
172 uint32_t segCwnd = tcb->GetCwndInSegments ();
177 NS_LOG_DEBUG (
"Calculated targetCwnd = " << targetCwnd);
180 m_diff = (segCwnd * 2) - targetCwnd;
183 if (tcb->m_cWnd < tcb->m_ssThresh)
185 NS_LOG_LOGIC (
"We are in slow start, behave like NewReno.");
190 NS_LOG_LOGIC (
"We are in congestion avoidance, execute Veno additive "
196 NS_LOG_LOGIC (
"Available bandwidth not fully utilized, increase "
197 "cwnd by 1 every RTT");
204 NS_LOG_LOGIC (
"Available bandwidth fully utilized, increase cwnd "
205 "by 1 every other RTT");
231 uint32_t bytesInFlight)
239 NS_LOG_LOGIC (
"Random loss is most likely to have occurred, "
240 "cwnd is reduced by 1/5");
241 return std::max (bytesInFlight * 4 / 5, 2 * tcb->m_segmentSize);
247 NS_LOG_LOGIC (
"Congestive loss is most likely to have occurred, "
249 return std::max (bytesInFlight / 2, 2 * tcb->m_segmentSize);
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across socket.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Normal state, no dubious events.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get slow start threshold during Veno multiplicative-decrease phase.
TcpVeno(void)
Create an unbound tcp socket.
virtual uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Tcp NewReno slow start algorithm.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void DisableVeno()
Turn off Veno.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Try to increase the cWnd following the NewReno specification.
The NewReno implementation.
An implementation of TCP Veno.
bool m_inc
If true, cwnd needs to be incremented.
uint32_t m_beta
Threshold for congestion detection.
static Time Max()
Maximum representable Time.
bool m_doingVenoNow
If true, do Veno for this RTT.
Hold an unsigned integer type.
uint32_t m_diff
Difference between expected and actual throughput.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
TcpCongState_t
Definition of the Congestion state machine.
void EnableVeno(Ptr< TcpSocketState > tcb)
Enable Veno algorithm to start Veno sampling.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Enable/disable Veno depending on the congestion state.
static TypeId GetTypeId(void)
Get the type ID.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Perform RTT sampling needed to execute Veno algorithm.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time m_baseRtt
Minimum of all RTT measurements seen during connection.
uint32_t m_cntRtt
of RTT measurements during last RTT
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following Veno additive increase algorithm.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
NewReno congestion avoidance.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Time m_minRtt
Minimum of RTTs measured within last RTT.