29 #include "ns3/tcp-congestion-ops.h"
30 #include "ns3/tcp-socket-base.h"
31 #include "ns3/tcp-illinois.h"
63 uint32_t segmentsAcked,
66 const std::string &name);
69 virtual void DoRun ();
84 Time CalculateMaxDelay ();
89 Time CalculateAvgDelay ();
131 uint32_t segmentsAcked,
134 const std::string & name)
137 m_ssThresh (ssThresh),
141 m_segmentsAcked (segmentsAcked),
142 m_nextTxSeq (nextTxSeq),
143 m_lastAckedSeq (lastAckedSeq),
172 for (uint32_t count = 1; count <
m_cntRtt; ++count)
184 "CWnd has not updated correctly");
189 uint32_t ssThresh = cong->GetSsThresh (state,
m_cWnd);
192 "SsThresh has not updated correctly");
218 uint32_t oldCwnd = segCwnd;
231 if (segCwnd != oldCwnd)
245 cong->GetAttribute (
"AlphaBase", alphaBase);
247 cong->GetAttribute (
"WinThresh", winThresh);
251 NS_LOG_INFO (
"cWnd < winThresh, set alpha & beta to base values");
259 NS_LOG_INFO (
"Updated to dm = " << dm <<
" da = " << da);
282 cong->GetAttribute (
"AlphaMax", alphaMax);
284 cong->GetAttribute (
"Theta", theta);
286 cong->GetAttribute (
"AlphaMin", alphaMin);
288 double d1 = dm / 100;
308 m_alpha = (dm * alphaMax.
Get ()) / (dm + (da * (alphaMax.
Get () - alphaMin.
Get ())) / alphaMin.
Get ());
317 cong->GetAttribute (
"BetaMin", betaMin);
319 cong->GetAttribute (
"BetaMax", betaMax);
329 else if (da > d2 && da < d3)
331 m_beta = (betaMin.
Get () * d3 - betaMax.
Get () * d2 + (betaMax.
Get () - betaMin.
Get ()) * da) / (d3 - d2);
334 else if (da >= d3 || d3 <= d2)
347 NS_LOG_DEBUG (
"Calculated ssThresh (in segments) = " << ssThresh);
366 "Illinois test on cWnd and ssThresh when in slow start"),
369 "Illinois test on cWnd and ssThresh when avg queueing delay is at minimum"),
372 "Illinois test on cWnd and ssThresh when avg queueing delay is at maximum"),
375 "Illinois test on cWnd and ssThresh when avg queueing delay is in between its min & max"),
TcpIllinois C-AIMD algorithm tests.
Time CalculateAvgDelay()
Calculate the average delay.
Time CalculateMaxDelay()
Calculate the maximum delay.
void CalculateAlpha(Ptr< TcpIllinois > cong, double da, double dm)
Calculate the TCP Illinois alpha param.
SequenceNumber32 m_lastAckedSeq
Last ACKed sequence number.
void RecalcParam(Ptr< TcpIllinois > cong)
Recalculate the internal TCP Illinois params.
uint32_t m_ackCnt
ACK counter.
virtual void DoRun()
Implementation to actually run this TestCase.
void IncreaseWindow(Ptr< TcpIllinois > cong)
Increases the TCP window.
SequenceNumber32 m_nextTxSeq
Next Tx sequence number.
uint8_t m_rttLow
RTT low counter.
TcpIllinoisTest(uint32_t cWnd, uint32_t ssThresh, uint32_t segmentSize, uint32_t cntRtt, Time maxRtt, uint32_t segmentsAcked, SequenceNumber32 nextTxSeq, SequenceNumber32 lastAckedSeq, const std::string &name)
Constructor.
uint32_t m_cntRtt
RTT counter.
uint32_t m_cWnd
Congestion window.
bool m_rttAbove
RTT above threshold.
void CalculateBeta(Ptr< TcpIllinois > cong, double da, double dm)
Calculate the TCP Illinois beta param.
Time m_sumRtt
Sum of all the RTTs.
void GetSsThresh()
brief Get and check the SSH threshold.
double m_alpha
TCP Illinois alpha parameter.
uint32_t m_ssThresh
Slow Start Threshold.
double m_beta
TCP Illinois beta parameter.
uint32_t m_segmentSize
Segment size.
uint32_t m_segmentsAcked
Number of segments ACKed.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Smart pointer class similar to boost::intrusive_ptr.
uint32_t m_segmentSize
Segment size.
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.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
Simulation virtual time values and global simulation resolution.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
T Get(void) 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_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#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 TcpIllinoisTestSuite g_tcpIllinoisTest
Static variable for test initialization.