27#include "ns3/tcp-congestion-ops.h"
28#include "ns3/tcp-socket-base.h"
29#include "ns3/tcp-veno.h"
60 const std::string& name);
63 void DoRun()
override;
122 const std::string& name)
126 m_ssThresh(ssThresh),
128 m_segmentsAcked(segmentsAcked),
137 m_state = CreateObject<TcpSocketState>();
158 expectedCwnd = segCwnd * tmp;
162 diff = segCwnd - expectedCwnd;
166 cong->GetAttribute(
"Beta", beta);
192 "Veno has not decremented cWnd correctly based on its"
193 "multiplicative decrease algo.");
209 "CWnd has not updated correctly based on Veno linear increase algorithm");
224 if (diff < beta.
Get())
249 if (diff < beta.
Get())
251 static double tmp = 4.0 / 5.0;
257 calculatedSsThresh = std::max(2 *
m_segmentSize, bytesInFlight / 2);
259 return calculatedSsThresh;
265 if (state->m_cWnd < state->m_ssThresh)
270 if (state->m_cWnd >= state->m_ssThresh)
279 if (segmentsAcked >= 1)
281 state->m_cWnd += state->m_segmentSize;
282 return segmentsAcked - 1;
291 if (segmentsAcked > 0)
294 static_cast<double>(state->m_segmentSize * state->m_segmentSize) / state->m_cWnd.Get();
295 adder = std::max(1.0, adder);
296 state->m_cWnd +=
static_cast<uint32_t>(adder);
317 "Veno test on cWnd in slow start and non-congestive loss"),
318 TestCase::Duration::QUICK);
325 "Veno test on cWnd with diff < beta"),
326 TestCase::Duration::QUICK);
333 "Veno increment test on cWnd with diff > beta"),
334 TestCase::Duration::QUICK);
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.
Time m_minRtt
Minimum RTT observed throughout the connection.
@ 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.
static constexpr auto UNIT
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.
#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.