29 #include "ns3/tcp-congestion-ops.h" 30 #include "ns3/tcp-socket-base.h" 31 #include "ns3/tcp-veno.h" 60 uint32_t segmentsAcked,
62 const std::string &name);
65 virtual void DoRun (
void);
82 uint32_t MultiplicativeDecrease (uint32_t diff,
const UintegerValue &beta, uint32_t bytesInFlight);
118 uint32_t segmentSize,
121 uint32_t segmentsAcked,
123 const std::string &name)
126 m_segmentSize (segmentSize),
127 m_ssThresh (ssThresh),
129 m_segmentsAcked (segmentsAcked),
138 m_state = CreateObject<TcpSocketState> ();
157 uint32_t expectedCwnd;
159 expectedCwnd = segCwnd * tmp;
163 diff = segCwnd - expectedCwnd;
192 "Veno has not decremented cWnd correctly based on its" 193 "multiplicative decrease algo.");
207 "CWnd has not updated correctly based on Veno linear increase algorithm");
222 if (diff < beta.
Get ())
243 uint32_t bytesInFlight)
245 uint32_t calculatedSsThresh;
246 if (diff < beta.
Get ())
248 static double tmp = 4.0 / 5.0;
255 return calculatedSsThresh;
275 if (segmentsAcked >= 1)
278 return segmentsAcked - 1;
287 if (segmentsAcked > 0)
291 state->
m_cWnd +=
static_cast<uint32_t
> (adder);
308 "Veno test on cWnd in slow start and non-congestive loss"),
311 "Veno test on cWnd with diff < beta"),
314 "Veno increment test on cWnd with diff > beta"),
Simulation virtual time values and global simulation resolution.
Testing the additive increase and multiplicative decrease of TcpVeno.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get slow start threshold during Veno multiplicative-decrease phase.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void NewReno_IncreaseWindow(Ptr< TcpSocketState > state, uint32_t segmentsAcked)
Mimics the NewReno IncreaseWindow algorithm.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint32_t m_segmentSize
Segment size.
Data structure that records the congestion state of a connection.
uint32_t m_segmentsAcked
Number of segments ACKed.
TcpVenoTest(uint32_t cWnd, uint32_t segmentSize, uint32_t ssThresh, Time rtt, uint32_t segmentsAcked, uint32_t numRtt, const std::string &name)
Constructor.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Hold an unsigned integer type.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
bool m_inc
Internal flag to increase every other round.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
Ptr< TcpSocketState > m_state
TCP socket state.
uint32_t m_ssThresh
Slow Start Threshold.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AdditiveIncrease(Ptr< TcpSocketState > state, uint32_t diff, UintegerValue beta)
TCP Veno additive increase formula.
uint32_t m_numRtt
Number of RTT (i.e., rounds) of the test.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Enable/disable Veno depending on the congestion state.
TracedValue< uint32_t > m_cWnd
Congestion window.
uint32_t MultiplicativeDecrease(uint32_t diff, const UintegerValue &beta, uint32_t bytesInFlight)
TCP Veno multiplicative decrease formula.
uint32_t NewReno_SlowStart(Ptr< TcpSocketState > state, uint32_t segmentsAcked)
Mimics the NewReno SlowStart algorithm.
uint32_t m_segmentSize
Segment size.
static TcpVenoTestSuite g_tcpVenoTest
Static variable for test initialization.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Perform RTT sampling needed to execute Veno algorithm.
void NewReno_CongestionAvoidance(Ptr< TcpSocketState > state, uint32_t segmentsAcked)
Mimics the NewReno Congestion Avoidance algorithm.
T Get(void) const
Get the underlying value.
Time m_minRtt
Minimum RTT observed throughout the connection.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following Veno additive increase algorithm.
uint32_t m_cWnd
Congestion window.
This test suite implements a Unit Test.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.