27 #include "ns3/tcp-congestion-ops.h"
28 #include "ns3/tcp-illinois.h"
29 #include "ns3/tcp-socket-base.h"
61 uint32_t segmentsAcked,
64 const std::string& name);
67 void DoRun()
override;
82 Time CalculateMaxDelay();
87 Time CalculateAvgDelay();
129 uint32_t segmentsAcked,
132 const std::string& name)
135 m_ssThresh(ssThresh),
139 m_segmentsAcked(segmentsAcked),
140 m_nextTxSeq(nextTxSeq),
141 m_lastAckedSeq(lastAckedSeq),
170 for (uint32_t count = 1; count <
m_cntRtt; ++count)
186 uint32_t ssThresh = cong->GetSsThresh(state,
m_cWnd);
211 uint32_t oldCwnd = segCwnd;
224 if (segCwnd != oldCwnd)
236 cong->GetAttribute(
"AlphaBase", alphaBase);
238 cong->GetAttribute(
"WinThresh", winThresh);
242 NS_LOG_INFO(
"cWnd < winThresh, set alpha & beta to base values");
250 NS_LOG_INFO(
"Updated to dm = " << dm <<
" da = " << da);
273 cong->GetAttribute(
"AlphaMax", alphaMax);
275 cong->GetAttribute(
"Theta", theta);
277 cong->GetAttribute(
"AlphaMin", alphaMin);
279 double d1 = dm / 100;
300 (dm + (da * (alphaMax.
Get() - alphaMin.
Get())) / alphaMin.
Get());
309 cong->GetAttribute(
"BetaMin", betaMin);
311 cong->GetAttribute(
"BetaMax", betaMax);
322 else if (da > d2 && da < d3)
324 m_beta = (betaMin.
Get() * d3 - betaMax.
Get() * d2 + (betaMax.
Get() - betaMin.
Get()) * da) /
328 else if (da >= d3 || d3 <= d2)
341 NS_LOG_DEBUG(
"Calculated ssThresh (in segments) = " << ssThresh);
365 "Illinois test on cWnd and ssThresh when in slow start"),
376 "Illinois test on cWnd and ssThresh when avg queueing delay is at minimum"),
387 "Illinois test on cWnd and ssThresh when avg queueing delay is at maximum"),
397 "Illinois test on cWnd and ssThresh when avg queueing "
398 "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.
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.
void DoRun() override
Implementation to actually run this TestCase.
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() 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_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.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
#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.