16#include "ns3/tcp-congestion-ops.h"
17#include "ns3/tcp-socket-base.h"
18#include "ns3/tcp-veno.h"
49 const std::string& name);
52 void DoRun()
override;
111 const std::string& name)
147 expectedCwnd = segCwnd * tmp;
151 diff = segCwnd - expectedCwnd;
155 cong->GetAttribute(
"Beta", beta);
181 "Veno has not decremented cWnd correctly based on its"
182 "multiplicative decrease algo.");
198 "CWnd has not updated correctly based on Veno linear increase algorithm");
213 if (diff < beta.
Get())
238 if (diff < beta.
Get())
240 static double tmp = 4.0 / 5.0;
246 calculatedSsThresh = std::max(2 *
m_segmentSize, bytesInFlight / 2);
248 return calculatedSsThresh;
254 if (state->m_cWnd < state->m_ssThresh)
259 if (state->m_cWnd >= state->m_ssThresh)
268 if (segmentsAcked >= 1)
270 state->m_cWnd += state->m_segmentSize;
271 return segmentsAcked - 1;
280 if (segmentsAcked > 0)
283 static_cast<double>(state->m_segmentSize * state->m_segmentSize) / state->m_cWnd.Get();
284 adder = std::max(1.0, adder);
285 state->m_cWnd +=
static_cast<uint32_t>(adder);
306 "Veno test on cWnd in slow start and non-congestive loss"),
314 "Veno test on cWnd with diff < beta"),
322 "Veno increment test on cWnd with diff > beta"),
Testing the additive increase and multiplicative decrease of TcpVeno.
void NewReno_CongestionAvoidance(Ptr< TcpSocketState > state, uint32_t segmentsAcked)
Mimics the NewReno Congestion Avoidance algorithm.
uint32_t m_numRtt
Number of RTT (i.e., rounds) of the test.
bool m_inc
Internal flag to increase every other round.
uint32_t m_segmentsAcked
Number of segments ACKed.
uint32_t MultiplicativeDecrease(uint32_t diff, const UintegerValue &beta, uint32_t bytesInFlight) const
TCP Veno multiplicative decrease formula.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t NewReno_SlowStart(Ptr< TcpSocketState > state, uint32_t segmentsAcked)
Mimics the NewReno SlowStart algorithm.
uint32_t m_cWnd
Congestion window.
TcpVenoTest(uint32_t cWnd, uint32_t segmentSize, uint32_t ssThresh, Time rtt, uint32_t segmentsAcked, uint32_t numRtt, const std::string &name)
Constructor.
uint32_t m_ssThresh
Slow Start Threshold.
Ptr< TcpSocketState > m_state
TCP socket state.
uint32_t m_segmentSize
Segment size.
void NewReno_IncreaseWindow(Ptr< TcpSocketState > state, uint32_t segmentsAcked)
Mimics the NewReno IncreaseWindow algorithm.
void AdditiveIncrease(Ptr< TcpSocketState > state, uint32_t diff, UintegerValue beta)
TCP Veno additive increase formula.
Smart pointer class similar to boost::intrusive_ptr.
Data structure that records the congestion state of a connection.
uint32_t m_segmentSize
Segment size.
@ CA_OPEN
Normal state, no dubious events.
TracedValue< uint32_t > m_cWnd
Congestion window.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
@ UNIT
This test suite implements a Unit Test.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
T Get() const
Get the underlying value.
Hold an unsigned integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpVenoTestSuite g_tcpVenoTest
Static variable for test initialization.