Rename ACK state to Congestion state machine
This commit is contained in:
@@ -148,10 +148,10 @@ TcpSocketBase::GetTypeId (void)
|
||||
"TCP state",
|
||||
MakeTraceSourceAccessor (&TcpSocketBase::m_state),
|
||||
"ns3::TcpStatesTracedValueCallback")
|
||||
.AddTraceSource ("AckState",
|
||||
"TCP ACK machine state",
|
||||
MakeTraceSourceAccessor (&TcpSocketBase::m_ackStateTrace),
|
||||
"ns3::TcpSocketState::TcpAckStatesTracedValueCallback")
|
||||
.AddTraceSource ("CongState",
|
||||
"TCP Congestion machine state",
|
||||
MakeTraceSourceAccessor (&TcpSocketBase::m_congStateTrace),
|
||||
"ns3::TcpSocketState::TcpCongStatesTracedValueCallback")
|
||||
.AddTraceSource ("RWND",
|
||||
"Remote side's flow control window",
|
||||
MakeTraceSourceAccessor (&TcpSocketBase::m_rWnd),
|
||||
@@ -200,10 +200,10 @@ TcpSocketState::GetTypeId (void)
|
||||
"TCP slow start threshold (bytes)",
|
||||
MakeTraceSourceAccessor (&TcpSocketState::m_ssThresh),
|
||||
"ns3::TracedValue::Uint32Callback")
|
||||
.AddTraceSource ("AckState",
|
||||
"TCP ACK machine state",
|
||||
MakeTraceSourceAccessor (&TcpSocketState::m_ackState),
|
||||
"ns3::TracedValue::TcpAckStatesTracedValueCallback")
|
||||
.AddTraceSource ("CongState",
|
||||
"TCP Congestion machine state",
|
||||
MakeTraceSourceAccessor (&TcpSocketState::m_congState),
|
||||
"ns3::TracedValue::TcpCongStatesTracedValueCallback")
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ TcpSocketState::TcpSocketState (void)
|
||||
m_initialCWnd (0),
|
||||
m_initialSsThresh (0),
|
||||
m_segmentSize (0),
|
||||
m_ackState (OPEN)
|
||||
m_congState (CA_OPEN)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -226,14 +226,14 @@ TcpSocketState::TcpSocketState (const TcpSocketState &other)
|
||||
m_initialCWnd (other.m_initialCWnd),
|
||||
m_initialSsThresh (other.m_initialSsThresh),
|
||||
m_segmentSize (other.m_segmentSize),
|
||||
m_ackState (other.m_ackState)
|
||||
m_congState (other.m_congState)
|
||||
{
|
||||
}
|
||||
|
||||
const char* const
|
||||
TcpSocketState::TcpAckStateName[TcpSocketState::LAST_ACKSTATE] =
|
||||
TcpSocketState::TcpCongStateName[TcpSocketState::CA_LAST_STATE] =
|
||||
{
|
||||
"OPEN", "DISORDER", "CWR", "RECOVERY", "LOSS"
|
||||
"CA_OPEN", "CA_DISORDER", "CA_CWR", "CA_RECOVERY", "CA_LOSS"
|
||||
};
|
||||
|
||||
TcpSocketBase::TcpSocketBase (void)
|
||||
@@ -284,8 +284,8 @@ TcpSocketBase::TcpSocketBase (void)
|
||||
MakeCallback (&TcpSocketBase::UpdateSsThresh, this));
|
||||
NS_ASSERT (ok == true);
|
||||
|
||||
ok = m_tcb->TraceConnectWithoutContext ("AckState",
|
||||
MakeCallback (&TcpSocketBase::UpdateAckState, this));
|
||||
ok = m_tcb->TraceConnectWithoutContext ("CongState",
|
||||
MakeCallback (&TcpSocketBase::UpdateCongState, this));
|
||||
NS_ASSERT (ok == true);
|
||||
}
|
||||
|
||||
@@ -364,8 +364,8 @@ TcpSocketBase::TcpSocketBase (const TcpSocketBase& sock)
|
||||
MakeCallback (&TcpSocketBase::UpdateSsThresh, this));
|
||||
NS_ASSERT (ok == true);
|
||||
|
||||
ok = m_tcb->TraceConnectWithoutContext ("AckState",
|
||||
MakeCallback (&TcpSocketBase::UpdateAckState, this));
|
||||
ok = m_tcb->TraceConnectWithoutContext ("CongState",
|
||||
MakeCallback (&TcpSocketBase::UpdateCongState, this));
|
||||
NS_ASSERT (ok == true);
|
||||
}
|
||||
|
||||
@@ -1352,16 +1352,16 @@ TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
// There is a DupAck
|
||||
++m_dupAckCount;
|
||||
|
||||
if (m_tcb->m_ackState == TcpSocketState::OPEN)
|
||||
if (m_tcb->m_congState == TcpSocketState::CA_OPEN)
|
||||
{
|
||||
// From Open we go Disorder
|
||||
NS_ASSERT_MSG (m_dupAckCount == 1, "From OPEN->DISORDER but with " <<
|
||||
m_dupAckCount << " dup ACKs");
|
||||
m_tcb->m_ackState = TcpSocketState::DISORDER;
|
||||
m_tcb->m_congState = TcpSocketState::CA_DISORDER;
|
||||
|
||||
NS_LOG_DEBUG ("OPEN -> DISORDER");
|
||||
}
|
||||
else if (m_tcb->m_ackState == TcpSocketState::DISORDER)
|
||||
else if (m_tcb->m_congState == TcpSocketState::CA_DISORDER)
|
||||
{
|
||||
if (m_dupAckCount < m_retxThresh && m_limitedTx)
|
||||
{
|
||||
@@ -1373,10 +1373,10 @@ TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
else if (m_dupAckCount == m_retxThresh)
|
||||
{
|
||||
// triple duplicate ack triggers fast retransmit (RFC2582 sec.3 bullet #1)
|
||||
NS_LOG_DEBUG (TcpSocketState::TcpAckStateName[m_tcb->m_ackState] <<
|
||||
NS_LOG_DEBUG (TcpSocketState::TcpCongStateName[m_tcb->m_congState] <<
|
||||
" -> RECOVERY");
|
||||
m_recover = m_highTxMark;
|
||||
m_tcb->m_ackState = TcpSocketState::RECOVERY;
|
||||
m_tcb->m_congState = TcpSocketState::CA_RECOVERY;
|
||||
|
||||
m_tcb->m_ssThresh = m_congestionControl->GetSsThresh (m_tcb,
|
||||
BytesInFlight ());
|
||||
@@ -1393,7 +1393,7 @@ TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
"in DISORDER state");
|
||||
}
|
||||
}
|
||||
else if (m_tcb->m_ackState == TcpSocketState::RECOVERY)
|
||||
else if (m_tcb->m_congState == TcpSocketState::CA_RECOVERY)
|
||||
{ // Increase cwnd for every additional dupack (RFC2582, sec.3 bullet #3)
|
||||
m_tcb->m_cWnd += m_tcb->m_segmentSize;
|
||||
NS_LOG_INFO (m_dupAckCount << " Dupack received in fast recovery mode."
|
||||
@@ -1435,17 +1435,17 @@ TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
segsAcked = 1;
|
||||
}
|
||||
|
||||
if (m_tcb->m_ackState == TcpSocketState::DISORDER)
|
||||
if (m_tcb->m_congState == TcpSocketState::CA_DISORDER)
|
||||
{
|
||||
// The network reorder packets. Linux changes the counting lost
|
||||
// packet algorithm from FACK to NewReno. We simply go back in Open.
|
||||
m_tcb->m_ackState = TcpSocketState::OPEN;
|
||||
m_tcb->m_congState = TcpSocketState::CA_OPEN;
|
||||
m_congestionControl->PktsAcked (m_tcb, segsAcked, m_lastRtt);
|
||||
m_dupAckCount = 0;
|
||||
|
||||
NS_LOG_DEBUG ("DISORDER -> OPEN");
|
||||
}
|
||||
else if (m_tcb->m_ackState == TcpSocketState::RECOVERY)
|
||||
else if (m_tcb->m_congState == TcpSocketState::CA_RECOVERY)
|
||||
{
|
||||
if (tcpHeader.GetAckNumber () < m_recover)
|
||||
{
|
||||
@@ -1512,20 +1512,20 @@ TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
*/
|
||||
m_congestionControl->PktsAcked (m_tcb, segsAcked, m_lastRtt);
|
||||
newSegsAcked = (tcpHeader.GetAckNumber () - m_recover) / m_tcb->m_segmentSize;
|
||||
m_tcb->m_ackState = TcpSocketState::OPEN;
|
||||
m_tcb->m_congState = TcpSocketState::CA_OPEN;
|
||||
|
||||
NS_LOG_INFO ("Received full ACK for seq " << tcpHeader.GetAckNumber () <<
|
||||
". Leaving fast recovery with cwnd set to " << m_tcb->m_cWnd);
|
||||
NS_LOG_DEBUG ("RECOVERY -> OPEN");
|
||||
}
|
||||
}
|
||||
else if (m_tcb->m_ackState == TcpSocketState::LOSS)
|
||||
else if (m_tcb->m_congState == TcpSocketState::CA_LOSS)
|
||||
{
|
||||
// Go back in OPEN state
|
||||
m_isFirstPartialAck = true;
|
||||
m_congestionControl->PktsAcked (m_tcb, segsAcked, m_lastRtt);
|
||||
m_dupAckCount = 0;
|
||||
m_tcb->m_ackState = TcpSocketState::OPEN;
|
||||
m_tcb->m_congState = TcpSocketState::CA_OPEN;
|
||||
NS_LOG_DEBUG ("LOSS -> OPEN");
|
||||
}
|
||||
|
||||
@@ -1543,7 +1543,7 @@ TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
|
||||
if (m_isFirstPartialAck == false)
|
||||
{
|
||||
NS_ASSERT (m_tcb->m_ackState == TcpSocketState::RECOVERY);
|
||||
NS_ASSERT (m_tcb->m_congState == TcpSocketState::CA_RECOVERY);
|
||||
}
|
||||
|
||||
NewAck (tcpHeader.GetAckNumber (), resetRTO);
|
||||
@@ -2799,9 +2799,9 @@ TcpSocketBase::Retransmit ()
|
||||
m_nextTxSequence = m_txBuffer->HeadSequence (); // Restart from highest Ack
|
||||
m_dupAckCount = 0;
|
||||
|
||||
if (m_tcb->m_ackState != TcpSocketState::LOSS)
|
||||
if (m_tcb->m_congState != TcpSocketState::CA_LOSS)
|
||||
{
|
||||
m_tcb->m_ackState = TcpSocketState::LOSS;
|
||||
m_tcb->m_congState = TcpSocketState::CA_LOSS;
|
||||
m_tcb->m_ssThresh = m_congestionControl->GetSsThresh (m_tcb, BytesInFlight ());
|
||||
m_tcb->m_cWnd = m_tcb->m_segmentSize;
|
||||
}
|
||||
@@ -3275,10 +3275,10 @@ TcpSocketBase::UpdateSsThresh (uint32_t oldValue, uint32_t newValue)
|
||||
}
|
||||
|
||||
void
|
||||
TcpSocketBase::UpdateAckState (TcpSocketState::TcpAckState_t oldValue,
|
||||
TcpSocketState::TcpAckState_t newValue)
|
||||
TcpSocketBase::UpdateCongState (TcpSocketState::TcpCongState_t oldValue,
|
||||
TcpSocketState::TcpCongState_t newValue)
|
||||
{
|
||||
m_ackStateTrace (oldValue, newValue);
|
||||
m_congStateTrace (oldValue, newValue);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
TcpSocketState (const TcpSocketState &other);
|
||||
|
||||
/**
|
||||
* \brief Definition of the ACK state machine
|
||||
* \brief Definition of the Congestion state machine
|
||||
*
|
||||
* The design of this state machine is taken from Linux v4.0, but it has been
|
||||
* maintained in the Linux mainline from ages. It basically avoids to maintain
|
||||
@@ -110,39 +110,39 @@ public:
|
||||
* different algorithm in a cleaner way.
|
||||
*
|
||||
* These states represent the situation from a congestion control point of view:
|
||||
* in fact, apart the OPEN state, the other states represent a situation in
|
||||
* in fact, apart the CA_OPEN state, the other states represent a situation in
|
||||
* which there is a congestion, and different actions should be taken,
|
||||
* depending on the case.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OPEN, /**< Normal state, no dubious events */
|
||||
DISORDER, /**< In all the respects it is "Open",
|
||||
* but requires a bit more attention. It is entered when
|
||||
* we see some SACKs or dupacks. It is split of "Open" */
|
||||
CWR, /**< cWnd was reduced due to some Congestion Notification event.
|
||||
* It can be ECN, ICMP source quench, local device congestion.
|
||||
* Not used in NS-3 right now. */
|
||||
RECOVERY, /**< CWND was reduced, we are fast-retransmitting. */
|
||||
LOSS, /**< CWND was reduced due to RTO timeout or SACK reneging. */
|
||||
LAST_ACKSTATE /**< Used only in debug messages */
|
||||
} TcpAckState_t;
|
||||
CA_OPEN, /**< Normal state, no dubious events */
|
||||
CA_DISORDER, /**< In all the respects it is "Open",
|
||||
* but requires a bit more attention. It is entered when
|
||||
* we see some SACKs or dupacks. It is split of "Open" */
|
||||
CA_CWR, /**< cWnd was reduced due to some Congestion Notification event.
|
||||
* It can be ECN, ICMP source quench, local device congestion.
|
||||
* Not used in NS-3 right now. */
|
||||
CA_RECOVERY, /**< CWND was reduced, we are fast-retransmitting. */
|
||||
CA_LOSS, /**< CWND was reduced due to RTO timeout or SACK reneging. */
|
||||
CA_LAST_STATE /**< Used only in debug messages */
|
||||
} TcpCongState_t;
|
||||
|
||||
/**
|
||||
* \ingroup tcp
|
||||
* TracedValue Callback signature for TcpAckState_t
|
||||
* TracedValue Callback signature for TcpCongState_t
|
||||
*
|
||||
* \param [in] oldValue original value of the traced variable
|
||||
* \param [in] newValue new value of the traced variable
|
||||
*/
|
||||
typedef void (* TcpAckStatesTracedValueCallback)(const TcpAckState_t oldValue,
|
||||
const TcpAckState_t newValue);
|
||||
typedef void (* TcpCongStatesTracedValueCallback)(const TcpCongState_t oldValue,
|
||||
const TcpCongState_t newValue);
|
||||
|
||||
/**
|
||||
* \brief Literal names of TCP states for use in log messages
|
||||
*/
|
||||
static const char* const TcpAckStateName[TcpSocketState::LAST_ACKSTATE];
|
||||
static const char* const TcpCongStateName[TcpSocketState::CA_LAST_STATE];
|
||||
|
||||
// Congestion control
|
||||
TracedValue<uint32_t> m_cWnd; //!< Congestion window
|
||||
@@ -153,8 +153,7 @@ public:
|
||||
// Segment
|
||||
uint32_t m_segmentSize; //!< Segment size
|
||||
|
||||
// Ack state
|
||||
TracedValue<TcpAckState_t> m_ackState; //!< State in the ACK state machine
|
||||
TracedValue<TcpCongState_t> m_congState; //!< State in the Congestion state machine
|
||||
|
||||
/**
|
||||
* \brief Get cwnd in segments rather than bytes
|
||||
@@ -177,20 +176,20 @@ public:
|
||||
* this class is modified from the original NS-3 TCP socket implementation
|
||||
* (TcpSocketImpl) by Raj Bhattacharjea <raj.b@gatech.edu> of Georgia Tech.
|
||||
*
|
||||
* Ack state machine
|
||||
* Congestion state machine
|
||||
* ---------------------------
|
||||
*
|
||||
* The socket maintains two state machines; the TCP one, and another called
|
||||
* "Ack state machine", which keeps track of the phase we are in. Currently,
|
||||
* "Congestion state machine", which keeps track of the phase we are in. Currently,
|
||||
* ns-3 manages the states:
|
||||
*
|
||||
* - OPEN
|
||||
* - DISORDER
|
||||
* - RECOVERY
|
||||
* - LOSS
|
||||
* - CA_OPEN
|
||||
* - CA_DISORDER
|
||||
* - CA_RECOVERY
|
||||
* - CA_LOSS
|
||||
*
|
||||
* Another one (CWR) is present but not used. For more information, see
|
||||
* the TcpAckState_t documentation.
|
||||
* Another one (CA_CWR) is present but not used. For more information, see
|
||||
* the TcpCongState_t documentation.
|
||||
*
|
||||
* Congestion control interface
|
||||
* ---------------------------
|
||||
@@ -203,7 +202,7 @@ public:
|
||||
* The variables needed to congestion control classes to operate correctly have
|
||||
* been moved inside the TcpSocketState class. It contains information on the
|
||||
* congestion window, slow start threshold, segment size and the state of the
|
||||
* Ack state machine.
|
||||
* Congestion state machine.
|
||||
*
|
||||
* To track the trace inside the TcpSocketState class, a "forward" technique is
|
||||
* used, which consists in chaining callbacks from TcpSocketState to TcpSocketBase
|
||||
@@ -328,9 +327,9 @@ public:
|
||||
TracedCallback<uint32_t, uint32_t> m_ssThTrace;
|
||||
|
||||
/**
|
||||
* \brief Callback pointer for ack state trace chaining
|
||||
* \brief Callback pointer for congestion state trace chaining
|
||||
*/
|
||||
TracedCallback<TcpSocketState::TcpAckState_t, TcpSocketState::TcpAckState_t> m_ackStateTrace;
|
||||
TracedCallback<TcpSocketState::TcpCongState_t, TcpSocketState::TcpCongState_t> m_congStateTrace;
|
||||
|
||||
/**
|
||||
* \brief Callback function to hook to TcpSocketState congestion window
|
||||
@@ -347,12 +346,12 @@ public:
|
||||
void UpdateSsThresh (uint32_t oldValue, uint32_t newValue);
|
||||
|
||||
/**
|
||||
* \brief Callback function to hook to TcpSocketState ack state
|
||||
* \param oldValue old ack state value
|
||||
* \param newValue new ack state value
|
||||
* \brief Callback function to hook to TcpSocketState congestion state
|
||||
* \param oldValue old congestion state value
|
||||
* \param newValue new congestion state value
|
||||
*/
|
||||
void UpdateAckState (TcpSocketState::TcpAckState_t oldValue,
|
||||
TcpSocketState::TcpAckState_t newValue);
|
||||
void UpdateCongState (TcpSocketState::TcpCongState_t oldValue,
|
||||
TcpSocketState::TcpCongState_t newValue);
|
||||
|
||||
/**
|
||||
* \brief Install a congestion control algorithm on this socket
|
||||
@@ -995,13 +994,13 @@ protected:
|
||||
|
||||
/**
|
||||
* \ingroup tcp
|
||||
* TracedValue Callback signature for TcpAckState_t
|
||||
* TracedValue Callback signature for TcpCongState_t
|
||||
*
|
||||
* \param [in] oldValue original value of the traced variable
|
||||
* \param [in] newValue new value of the traced variable
|
||||
*/
|
||||
typedef void (* TcpAckStatesTracedValueCallback)(const TcpSocketState::TcpAckState_t oldValue,
|
||||
const TcpSocketState::TcpAckState_t newValue);
|
||||
typedef void (* TcpCongStatesTracedValueCallback)(const TcpSocketState::TcpCongState_t oldValue,
|
||||
const TcpSocketState::TcpCongState_t newValue);
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ TcpFastRetrTest::RcvAck (const Ptr<const TcpSocketState> tcb, const TcpHeader &h
|
||||
{
|
||||
if (h.GetAckNumber ().GetValue () < m_seqToKill)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::OPEN,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_OPEN,
|
||||
"Not in OPEN state to respond to a loss");
|
||||
NS_TEST_ASSERT_MSG_EQ (GetDupAckCount (SENDER), 0,
|
||||
"Dupack different than 0 but no loss detected");
|
||||
@@ -229,25 +229,25 @@ TcpFastRetrTest::RcvAck (const Ptr<const TcpSocketState> tcb, const TcpHeader &h
|
||||
if (GetDupAckCount(SENDER) == 0 &&
|
||||
GetDupAckCount (SENDER) < GetReTxThreshold (SENDER))
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::OPEN,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_OPEN,
|
||||
"Not in OPEN state for processing dupack");
|
||||
}
|
||||
else if (GetDupAckCount (SENDER) > 0 &&
|
||||
GetDupAckCount (SENDER) < GetReTxThreshold (SENDER))
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::DISORDER,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_DISORDER,
|
||||
"Not in DISORDER state after receiving dupacks");
|
||||
}
|
||||
else if (GetDupAckCount (SENDER) >= GetReTxThreshold (SENDER))
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::RECOVERY,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_RECOVERY,
|
||||
"Not in RECOVERY state after reaching retxthresh");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (who == RECEIVER)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::OPEN,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_OPEN,
|
||||
"Receiver not in OPEN state");
|
||||
}
|
||||
}
|
||||
@@ -269,13 +269,13 @@ TcpFastRetrTest::ProcessedAck (const Ptr<const TcpSocketState> tcb, const TcpHea
|
||||
|
||||
if (GetDupAckCount (SENDER) < GetReTxThreshold (SENDER))
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::DISORDER,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_DISORDER,
|
||||
"DupAck less than ReTxThreshold but not "
|
||||
"in DISORDER state");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_GT_OR_EQ (GetAckStateFrom (tcb), TcpSocketState::RECOVERY,
|
||||
NS_TEST_ASSERT_MSG_GT_OR_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_RECOVERY,
|
||||
"DupAck greater than ReTxThreshold but not "
|
||||
"in RECOVERY or LOSS state");
|
||||
m_pktWasDropped = true;
|
||||
@@ -290,7 +290,7 @@ TcpFastRetrTest::ProcessedAck (const Ptr<const TcpSocketState> tcb, const TcpHea
|
||||
}
|
||||
else if (who == RECEIVER)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::OPEN,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_OPEN,
|
||||
"Different state than OPEN in the receiver");
|
||||
}
|
||||
}
|
||||
@@ -302,23 +302,23 @@ TcpFastRetrTest::RTOExpired(const Ptr<const TcpSocketState> tcb, SocketWho who)
|
||||
}
|
||||
|
||||
void
|
||||
TcpFastRetrTest::AckStateTrace (const TcpSocketState::TcpAckState_t oldValue,
|
||||
const TcpSocketState::TcpAckState_t newValue)
|
||||
TcpFastRetrTest::CongStateTrace (const TcpSocketState::TcpCongState_t oldValue,
|
||||
const TcpSocketState::TcpCongState_t newValue)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << oldValue << newValue);
|
||||
|
||||
if (oldValue == TcpSocketState::OPEN && newValue == TcpSocketState::DISORDER)
|
||||
if (oldValue == TcpSocketState::CA_OPEN && newValue == TcpSocketState::CA_DISORDER)
|
||||
{
|
||||
}
|
||||
else if (oldValue == TcpSocketState::OPEN
|
||||
&& newValue == TcpSocketState::RECOVERY
|
||||
else if (oldValue == TcpSocketState::CA_OPEN
|
||||
&& newValue == TcpSocketState::CA_RECOVERY
|
||||
&& GetReTxThreshold (SENDER) > 1)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (true, false,
|
||||
"Invalid OPEN to RECOVERY state change");
|
||||
}
|
||||
else if (oldValue == TcpSocketState::DISORDER
|
||||
&& newValue == TcpSocketState::RECOVERY)
|
||||
else if (oldValue == TcpSocketState::CA_DISORDER
|
||||
&& newValue == TcpSocketState::CA_RECOVERY)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetReTxThreshold (SENDER), GetDupAckCount (SENDER),
|
||||
"DISORDER to RECOVERY state change but not reached "
|
||||
|
||||
@@ -49,8 +49,8 @@ protected:
|
||||
virtual void ProcessedAck (const Ptr<const TcpSocketState> tcb,
|
||||
const TcpHeader& h, SocketWho who);
|
||||
|
||||
virtual void AckStateTrace (const TcpSocketState::TcpAckState_t oldValue,
|
||||
const TcpSocketState::TcpAckState_t newValue);
|
||||
virtual void CongStateTrace (const TcpSocketState::TcpCongState_t oldValue,
|
||||
const TcpSocketState::TcpCongState_t newValue);
|
||||
|
||||
virtual void Tx (const Ptr<const Packet> p, const TcpHeader&h, SocketWho who);
|
||||
virtual void Rx (const Ptr<const Packet> p, const TcpHeader&h, SocketWho who);
|
||||
|
||||
@@ -181,8 +181,8 @@ TcpGeneralTest::DoRun (void)
|
||||
m_senderSocket->SetRetransmitCb (MakeCallback (&TcpGeneralTest::RtoExpiredCb, this));
|
||||
m_senderSocket->TraceConnectWithoutContext ("CongestionWindow",
|
||||
MakeCallback (&TcpGeneralTest::CWndTrace, this));
|
||||
m_senderSocket->TraceConnectWithoutContext ("AckState",
|
||||
MakeCallback (&TcpGeneralTest::AckStateTrace, this));
|
||||
m_senderSocket->TraceConnectWithoutContext ("CongState",
|
||||
MakeCallback (&TcpGeneralTest::CongStateTrace, this));
|
||||
m_senderSocket->TraceConnectWithoutContext ("Tx",
|
||||
MakeCallback (&TcpGeneralTest::TxPacketCb, this));
|
||||
m_senderSocket->TraceConnectWithoutContext ("Rx",
|
||||
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
* to TcpSocketMsgBase, there are many information provided to children:
|
||||
*
|
||||
* - Tracing of states inside the state machines (TCP and ACK ones, through
|
||||
* functions AckStateTrace and TcpStateTrace)
|
||||
* functions CongStateTrace and TcpStateTrace)
|
||||
* - cWnd tracing (through CWndTrace)
|
||||
* - Socket closing: error state, or normal state (NormalClose and ErrorClose)
|
||||
* - Packet drop, inside queue or over the link (QueueDrop, PhyDrop)
|
||||
@@ -418,8 +418,8 @@ protected:
|
||||
* \param oldValue old value
|
||||
* \param newValue new value
|
||||
*/
|
||||
virtual void AckStateTrace (const TcpSocketState::TcpAckState_t oldValue,
|
||||
const TcpSocketState::TcpAckState_t newValue)
|
||||
virtual void CongStateTrace (const TcpSocketState::TcpCongState_t oldValue,
|
||||
const TcpSocketState::TcpCongState_t newValue)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -656,10 +656,10 @@ private:
|
||||
* \param tcb Transmission control block
|
||||
* \return the state of the ACK state machine
|
||||
*/
|
||||
static inline TcpSocketState::TcpAckState_t
|
||||
GetAckStateFrom (Ptr<const TcpSocketState> tcb)
|
||||
static inline TcpSocketState::TcpCongState_t
|
||||
GetCongStateFrom (Ptr<const TcpSocketState> tcb)
|
||||
{
|
||||
return tcb->m_ackState.Get ();
|
||||
return tcb->m_congState.Get ();
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -54,7 +54,7 @@ TcpRtoTest::RTOExpired (const Ptr<const TcpSocketState> tcb, SocketWho who)
|
||||
// and because of this we must check all the involved variables.
|
||||
NS_TEST_ASSERT_MSG_EQ (m_rtoExpired, false,
|
||||
"Second RTO expired");
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::LOSS,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_LOSS,
|
||||
"Ack state machine not in LOSS state after a loss");
|
||||
|
||||
m_rtoExpired = true;
|
||||
@@ -72,12 +72,12 @@ TcpRtoTest::RcvAck (const Ptr<const TcpSocketState> tcb, const TcpHeader& h,
|
||||
|
||||
if (m_rtoExpired && who == SENDER)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::LOSS,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_LOSS,
|
||||
"Ack state machine not in LOSS state after a loss");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::OPEN,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_OPEN,
|
||||
"Ack state machine not in OPEN state after recovering "
|
||||
"from loss");
|
||||
}
|
||||
@@ -90,7 +90,7 @@ TcpRtoTest::ProcessedAck (const Ptr<const TcpSocketState> tcb, const TcpHeader &
|
||||
// Called after the ACK processing. Every time we should be in OPEN state,
|
||||
// without any packet lost or marked as retransmitted, in both the sockets
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (GetAckStateFrom (tcb), TcpSocketState::OPEN,
|
||||
NS_TEST_ASSERT_MSG_EQ (GetCongStateFrom (tcb), TcpSocketState::CA_OPEN,
|
||||
"Ack state machine not in OPEN state after recovering "
|
||||
"from loss");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user