Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource

This commit is contained in:
Tommaso Pecorella
2014-08-13 23:46:16 +02:00
parent 10269d0a5b
commit fbad78fbb4
17 changed files with 97 additions and 58 deletions

View File

@@ -56,12 +56,17 @@ us a note on ns-developers mailing list.</p>
<ul>
<li> New "const double& SpectrumValue:: operator[] (size_t index) const".
</li>
<li> A new TraceSource has been added to TCP sockets: SlowStartThreshold.
</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
<li> "Icmpv6L4Protocol::ForgeEchoRequest" is now returning a packet with the proper IPv6 header.
</li>
<li> The TCP socket Attribute "SlowStartThreshold" has been renamed "InitialSlowStartThreshold" to
clarify that the effect is only on the initial value.
</li>
</ul>
<h2>Changes to build system:</h2>

View File

@@ -29,6 +29,7 @@ Bugs fixed
----------
- Bug 1762 - UE stuck in IDLE_CONNECTING because RRC CONN REQ is not transmitted
- Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
- Bug 1921 - Icmpv6L4Protocol::ForgeEchoRequest returns a malformed packet
- Bug 1930 - Use of invalid reference in OLSR RemoveLinkTuple
- Bug 1932 - NdiscCache entry is not failsafe on double neighbor probing.

View File

@@ -57,6 +57,9 @@ NscTcpSocketImpl::GetTypeId ()
.AddTraceSource ("CongestionWindow",
"The TCP connection's congestion window",
MakeTraceSourceAccessor (&NscTcpSocketImpl::m_cWnd))
.AddTraceSource ("SlowStartThreshold",
"TCP slow start threshold (bytes)",
MakeTraceSourceAccessor (&NscTcpSocketImpl::m_ssThresh))
;
return tid;
}
@@ -106,6 +109,7 @@ NscTcpSocketImpl::NscTcpSocketImpl(const NscTcpSocketImpl& sock)
m_cWnd (sock.m_cWnd),
m_ssThresh (sock.m_ssThresh),
m_initialCWnd (sock.m_initialCWnd),
m_initialSsThresh (sock.m_initialSsThresh),
m_lastMeasuredRtt (Seconds (0.0)),
m_cnTimeout (sock.m_cnTimeout),
m_cnCount (sock.m_cnCount),
@@ -152,6 +156,7 @@ NscTcpSocketImpl::SetNode (Ptr<Node> node)
m_node = node;
// Initialize some variables
m_cWnd = m_initialCWnd * m_segmentSize;
m_ssThresh = m_initialSsThresh;
m_rxWindowSize = m_advertisedWindowSize;
}
@@ -730,15 +735,15 @@ NscTcpSocketImpl::GetAdvWin (void) const
}
void
NscTcpSocketImpl::SetSSThresh (uint32_t threshold)
NscTcpSocketImpl::SetInitialSSThresh (uint32_t threshold)
{
m_ssThresh = threshold;
m_initialSsThresh = threshold;
}
uint32_t
NscTcpSocketImpl::GetSSThresh (void) const
NscTcpSocketImpl::GetInitialSSThresh (void) const
{
return m_ssThresh;
return m_initialSsThresh;
}
void

View File

@@ -187,8 +187,8 @@ private:
* \returns the window size
*/
virtual uint32_t GetAdvWin (void) const;
virtual void SetSSThresh (uint32_t threshold);
virtual uint32_t GetSSThresh (void) const;
virtual void SetInitialSSThresh (uint32_t threshold);
virtual uint32_t GetInitialSSThresh (void) const;
virtual void SetInitialCwnd (uint32_t cwnd);
virtual uint32_t GetInitialCwnd (void) const;
virtual void SetConnTimeout (Time timeout);
@@ -240,9 +240,10 @@ private:
uint32_t m_segmentSize; //!< SegmentSize
uint32_t m_rxWindowSize; //!< Receive window size
uint32_t m_advertisedWindowSize; //!< Window to advertise
TracedValue<uint32_t> m_ssThresh; //!< Slow Start Threshold
TracedValue<uint32_t> m_cWnd; //!< Congestion window
uint32_t m_ssThresh; //!< Slow Start Threshold
uint32_t m_initialCWnd; //!< Initial cWnd value
uint32_t m_initialSsThresh; //!< Initial Slow Start Threshold
// Round trip time estimation
Time m_lastMeasuredRtt; //!< Last measured RTT

View File

@@ -45,13 +45,16 @@ TcpNewReno::GetTypeId (void)
MakeUintegerAccessor (&TcpNewReno::m_retxThresh),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("LimitedTransmit", "Enable limited transmit",
BooleanValue (false),
MakeBooleanAccessor (&TcpNewReno::m_limitedTx),
MakeBooleanChecker ())
BooleanValue (false),
MakeBooleanAccessor (&TcpNewReno::m_limitedTx),
MakeBooleanChecker ())
.AddTraceSource ("CongestionWindow",
"The TCP connection's congestion window",
MakeTraceSourceAccessor (&TcpNewReno::m_cWnd))
;
.AddTraceSource ("SlowStartThreshold",
"TCP slow start threshold (bytes)",
MakeTraceSourceAccessor (&TcpNewReno::m_ssThresh))
;
return tid;
}
@@ -68,6 +71,7 @@ TcpNewReno::TcpNewReno (const TcpNewReno& sock)
m_cWnd (sock.m_cWnd),
m_ssThresh (sock.m_ssThresh),
m_initialCWnd (sock.m_initialCWnd),
m_initialSsThresh (sock.m_initialSsThresh),
m_retxThresh (sock.m_retxThresh),
m_inFastRec (false),
m_limitedTx (sock.m_limitedTx)
@@ -124,8 +128,7 @@ TcpNewReno::NewAck (const SequenceNumber32& seq)
// Check for exit condition of fast recovery
if (m_inFastRec && seq < m_recover)
{ // Partial ACK, partial window deflation (RFC2582 sec.3 bullet #5 paragraph 3)
m_cWnd -= seq - m_txBuffer.HeadSequence ();
m_cWnd += m_segmentSize; // increase cwnd
m_cWnd += m_segmentSize - (seq - m_txBuffer.HeadSequence ());
NS_LOG_INFO ("Partial ACK in fast recovery: cwnd set to " << m_cWnd);
m_txBuffer.DiscardUpTo(seq); //Bug 1850: retransmit before newack
DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet
@@ -134,7 +137,7 @@ TcpNewReno::NewAck (const SequenceNumber32& seq)
}
else if (m_inFastRec && seq >= m_recover)
{ // Full ACK (RFC2582 sec.3 bullet #5 paragraph 2, option 1)
m_cWnd = std::min (m_ssThresh, BytesInFlight () + m_segmentSize);
m_cWnd = std::min (m_ssThresh.Get (), BytesInFlight () + m_segmentSize);
m_inFastRec = false;
NS_LOG_INFO ("Received full ACK. Leaving fast recovery with cwnd set to " << m_cWnd);
}
@@ -220,15 +223,16 @@ TcpNewReno::SetSegSize (uint32_t size)
}
void
TcpNewReno::SetSSThresh (uint32_t threshold)
TcpNewReno::SetInitialSSThresh (uint32_t threshold)
{
m_ssThresh = threshold;
NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpNewReno::SetSSThresh() cannot change initial ssThresh after connection started.");
m_initialSsThresh = threshold;
}
uint32_t
TcpNewReno::GetSSThresh (void) const
TcpNewReno::GetInitialSSThresh (void) const
{
return m_ssThresh;
return m_initialSsThresh;
}
void
@@ -253,6 +257,7 @@ TcpNewReno::InitializeCwnd (void)
* m_segmentSize are set by the attribute system in ns3::TcpSocket.
*/
m_cWnd = m_initialCWnd * m_segmentSize;
m_ssThresh = m_initialSsThresh;
}
} // namespace ns3

View File

@@ -65,8 +65,8 @@ protected:
// Implementing ns3::TcpSocket -- Attribute get/set
virtual void SetSegSize (uint32_t size);
virtual void SetSSThresh (uint32_t threshold);
virtual uint32_t GetSSThresh (void) const;
virtual void SetInitialSSThresh (uint32_t threshold);
virtual uint32_t GetInitialSSThresh (void) const;
virtual void SetInitialCwnd (uint32_t cwnd);
virtual uint32_t GetInitialCwnd (void) const;
private:
@@ -77,8 +77,9 @@ private:
protected:
TracedValue<uint32_t> m_cWnd; //!< Congestion window
uint32_t m_ssThresh; //!< Slow Start Threshold
TracedValue<uint32_t> m_ssThresh; //!< Slow Start Threshold
uint32_t m_initialCWnd; //!< Initial cWnd value
uint32_t m_initialSsThresh; //!< Initial Slow Start Threshold value
SequenceNumber32 m_recover; //!< Previous highest Tx seqnum for fast recovery
uint32_t m_retxThresh; //!< Fast Retransmit threshold
bool m_inFastRec; //!< currently in fast recovery

View File

@@ -47,6 +47,9 @@ TcpReno::GetTypeId (void)
.AddTraceSource ("CongestionWindow",
"The TCP connection's congestion window",
MakeTraceSourceAccessor (&TcpReno::m_cWnd))
.AddTraceSource ("SlowStartThreshold",
"TCP slow start threshold (bytes)",
MakeTraceSourceAccessor (&TcpReno::m_ssThresh))
;
return tid;
}
@@ -61,6 +64,7 @@ TcpReno::TcpReno (const TcpReno& sock)
m_cWnd (sock.m_cWnd),
m_ssThresh (sock.m_ssThresh),
m_initialCWnd (sock.m_initialCWnd),
m_initialSsThresh (sock.m_initialSsThresh),
m_retxThresh (sock.m_retxThresh),
m_inFastRec (false)
{
@@ -194,15 +198,16 @@ TcpReno::SetSegSize (uint32_t size)
}
void
TcpReno::SetSSThresh (uint32_t threshold)
TcpReno::SetInitialSSThresh (uint32_t threshold)
{
m_ssThresh = threshold;
NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpReno::SetSSThresh() cannot change initial ssThresh after connection started.");
m_initialSsThresh = threshold;
}
uint32_t
TcpReno::GetSSThresh (void) const
TcpReno::GetInitialSSThresh (void) const
{
return m_ssThresh;
return m_initialSsThresh;
}
void
@@ -227,6 +232,7 @@ TcpReno::InitializeCwnd (void)
* m_segmentSize are set by the attribute system in ns3::TcpSocket.
*/
m_cWnd = m_initialCWnd * m_segmentSize;
m_ssThresh = m_initialSsThresh;
}
} // namespace ns3

View File

@@ -67,8 +67,8 @@ protected:
// Implementing ns3::TcpSocket -- Attribute get/set
virtual void SetSegSize (uint32_t size);
virtual void SetSSThresh (uint32_t threshold);
virtual uint32_t GetSSThresh (void) const;
virtual void SetInitialSSThresh (uint32_t threshold);
virtual uint32_t GetInitialSSThresh (void) const;
virtual void SetInitialCwnd (uint32_t cwnd);
virtual uint32_t GetInitialCwnd (void) const;
private:
@@ -79,8 +79,9 @@ private:
protected:
TracedValue<uint32_t> m_cWnd; //!< Congestion window
uint32_t m_ssThresh; //!< Slow Start Threshold
TracedValue<uint32_t> m_ssThresh; //!< Slow Start Threshold
uint32_t m_initialCWnd; //!< Initial cWnd value
uint32_t m_initialSsThresh; //!< Initial Slow Start Threshold value
uint32_t m_retxThresh; //!< Fast Retransmit threshold
bool m_inFastRec; //!< currently in fast recovery
};

View File

@@ -63,13 +63,13 @@ TcpRfc793::DupAck (const TcpHeader& t, uint32_t count)
}
void
TcpRfc793::SetSSThresh (uint32_t threshold)
TcpRfc793::SetInitialSSThresh (uint32_t threshold)
{
NS_LOG_WARN ("DoD TCP does not perform slow start");
}
uint32_t
TcpRfc793::GetSSThresh (void) const
TcpRfc793::GetInitialSSThresh (void) const
{
NS_LOG_WARN ("DoD TCP does not perform slow start");
return 0;

View File

@@ -58,8 +58,8 @@ public:
protected:
virtual Ptr<TcpSocketBase> Fork (); // Call CopyObject<TcpRfc793> to clone me
virtual void DupAck (const TcpHeader& t, uint32_t count);
virtual void SetSSThresh (uint32_t threshold);
virtual uint32_t GetSSThresh (void) const;
virtual void SetInitialSSThresh (uint32_t threshold);
virtual uint32_t GetInitialSSThresh (void) const;
virtual void SetInitialCwnd (uint32_t cwnd);
virtual uint32_t GetInitialCwnd (void) const;
};

View File

@@ -132,8 +132,8 @@ protected:
virtual uint32_t GetRcvBufSize (void) const;
virtual void SetSegSize (uint32_t size);
virtual uint32_t GetSegSize (void) const;
virtual void SetSSThresh (uint32_t threshold) = 0;
virtual uint32_t GetSSThresh (void) const = 0;
virtual void SetInitialSSThresh (uint32_t threshold) = 0;
virtual uint32_t GetInitialSSThresh (void) const = 0;
virtual void SetInitialCwnd (uint32_t cwnd) = 0;
virtual uint32_t GetInitialCwnd (void) const = 0;
virtual void SetConnTimeout (Time timeout);

View File

@@ -58,11 +58,11 @@ TcpSocket::GetTypeId (void)
MakeUintegerAccessor (&TcpSocket::GetSegSize,
&TcpSocket::SetSegSize),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("SlowStartThreshold",
"TCP slow start threshold (bytes)",
.AddAttribute ("InitialSlowStartThreshold",
"TCP initial slow start threshold (bytes)",
UintegerValue (0xffff),
MakeUintegerAccessor (&TcpSocket::GetSSThresh,
&TcpSocket::SetSSThresh),
MakeUintegerAccessor (&TcpSocket::GetInitialSSThresh,
&TcpSocket::SetInitialSSThresh),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("InitialCwnd",
"TCP initial congestion window size (segments)",

View File

@@ -119,16 +119,16 @@ private:
virtual uint32_t GetSegSize (void) const = 0;
/**
* \brief Set the Slow Start Threshold.
* \brief Set the initial Slow Start Threshold.
* \param threshold the Slow Start Threshold (in bytes)
*/
virtual void SetSSThresh (uint32_t threshold) = 0;
virtual void SetInitialSSThresh (uint32_t threshold) = 0;
/**
* \brief Get the Slow Start Threshold.
* \brief Get the initial Slow Start Threshold.
* \returns the Slow Start Threshold (in bytes)
*/
virtual uint32_t GetSSThresh (void) const = 0;
virtual uint32_t GetInitialSSThresh (void) const = 0;
/**
* \brief Set the initial Congestion Window.

View File

@@ -47,6 +47,9 @@ TcpTahoe::GetTypeId (void)
.AddTraceSource ("CongestionWindow",
"The TCP connection's congestion window",
MakeTraceSourceAccessor (&TcpTahoe::m_cWnd))
.AddTraceSource ("SlowStartThreshold",
"TCP slow start threshold (bytes)",
MakeTraceSourceAccessor (&TcpTahoe::m_ssThresh))
;
return tid;
}
@@ -61,6 +64,7 @@ TcpTahoe::TcpTahoe (const TcpTahoe& sock)
m_cWnd (sock.m_cWnd),
m_ssThresh (sock.m_ssThresh),
m_initialCWnd (sock.m_initialCWnd),
m_initialSsThresh (sock.m_initialSsThresh),
m_retxThresh (sock.m_retxThresh)
{
NS_LOG_FUNCTION (this);
@@ -108,7 +112,7 @@ void
TcpTahoe::NewAck (SequenceNumber32 const& seq)
{
NS_LOG_FUNCTION (this << seq);
NS_LOG_LOGIC ("TcpTahoe receieved ACK for seq " << seq <<
NS_LOG_LOGIC ("TcpTahoe received ACK for seq " << seq <<
" cwnd " << m_cWnd <<
" ssthresh " << m_ssThresh);
if (m_cWnd < m_ssThresh)
@@ -172,15 +176,16 @@ TcpTahoe::SetSegSize (uint32_t size)
}
void
TcpTahoe::SetSSThresh (uint32_t threshold)
TcpTahoe::SetInitialSSThresh (uint32_t threshold)
{
m_ssThresh = threshold;
NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpTahoe::SetSSThresh() cannot change initial ssThresh after connection started.");
m_initialSsThresh = threshold;
}
uint32_t
TcpTahoe::GetSSThresh (void) const
TcpTahoe::GetInitialSSThresh (void) const
{
return m_ssThresh;
return m_initialSsThresh;
}
void
@@ -205,6 +210,7 @@ TcpTahoe::InitializeCwnd (void)
* m_segmentSize are set by the attribute system in ns3::TcpSocket.
*/
m_cWnd = m_initialCWnd * m_segmentSize;
m_ssThresh = m_initialSsThresh;
}
} // namespace ns3

View File

@@ -71,8 +71,8 @@ protected:
// Implementing ns3::TcpSocket -- Attribute get/set
virtual void SetSegSize (uint32_t size);
virtual void SetSSThresh (uint32_t threshold);
virtual uint32_t GetSSThresh (void) const;
virtual void SetInitialSSThresh (uint32_t threshold);
virtual uint32_t GetInitialSSThresh (void) const;
virtual void SetInitialCwnd (uint32_t cwnd);
virtual uint32_t GetInitialCwnd (void) const;
private:
@@ -83,8 +83,9 @@ private:
protected:
TracedValue<uint32_t> m_cWnd; //!< Congestion window
uint32_t m_ssThresh; //!< Slow Start Threshold
TracedValue<uint32_t> m_ssThresh; //!< Slow Start Threshold
uint32_t m_initialCWnd; //!< Initial cWnd value
uint32_t m_initialSsThresh; //!< Initial Slow Start Threshold value
uint32_t m_retxThresh; //!< Fast Retransmit threshold
};

View File

@@ -56,6 +56,9 @@ TcpWestwood::GetTypeId (void)
.AddConstructor<TcpWestwood>()
.AddTraceSource("CongestionWindow", "The TCP connection's congestion window",
MakeTraceSourceAccessor(&TcpWestwood::m_cWnd))
.AddTraceSource ("SlowStartThreshold",
"TCP slow start threshold (bytes)",
MakeTraceSourceAccessor (&TcpWestwood::m_ssThresh))
.AddAttribute("FilterType", "Use this to choose no filter or Tustin's approximation filter",
EnumValue(TcpWestwood::TUSTIN), MakeEnumAccessor(&TcpWestwood::m_fType),
MakeEnumChecker(TcpWestwood::NONE, "None", TcpWestwood::TUSTIN, "Tustin"))
@@ -88,6 +91,7 @@ TcpWestwood::TcpWestwood (const TcpWestwood& sock) :
m_cWnd(sock.m_cWnd),
m_ssThresh(sock.m_ssThresh),
m_initialCWnd(sock.m_initialCWnd),
m_initialSsThresh (sock.m_initialSsThresh),
m_inFastRec(false),
m_currentBW(sock.m_currentBW),
m_lastSampleBW(sock.m_lastSampleBW),
@@ -272,7 +276,7 @@ TcpWestwood::DupAck (const TcpHeader& header, uint32_t count)
if (count == 3 && !m_inFastRec)
{// Triple duplicate ACK triggers fast retransmit
// Adjust cwnd and ssthresh based on the estimated BW
m_ssThresh = m_currentBW * static_cast<double> (m_minRtt.GetSeconds());
m_ssThresh = uint32_t(m_currentBW * static_cast<double> (m_minRtt.GetSeconds()));
if (m_cWnd > m_ssThresh)
{
m_cWnd = m_ssThresh;
@@ -380,17 +384,18 @@ TcpWestwood::SetSegSize (uint32_t size)
}
void
TcpWestwood::SetSSThresh (uint32_t threshold)
TcpWestwood::SetInitialSSThresh (uint32_t threshold)
{
NS_LOG_FUNCTION (this);
m_ssThresh = threshold;
NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpWestwood::SetSSThresh() cannot change initial ssThresh after connection started.");
m_initialSsThresh = threshold;
}
uint32_t
TcpWestwood::GetSSThresh (void) const
TcpWestwood::GetInitialSSThresh (void) const
{
NS_LOG_FUNCTION (this);
return m_ssThresh;
return m_initialSsThresh;
}
void
@@ -417,6 +422,7 @@ TcpWestwood::InitializeCwnd(void)
* m_segmentSize are set by the attribute system in ns3::TcpSocket.
*/
m_cWnd = m_initialCWnd * m_segmentSize;
m_ssThresh = m_initialSsThresh;
}
} // namespace ns3

View File

@@ -122,8 +122,8 @@ protected:
// Implementing ns3::TcpSocket -- Attribute get/set
virtual void SetSegSize (uint32_t size);
virtual void SetSSThresh (uint32_t threshold);
virtual uint32_t GetSSThresh (void) const;
virtual void SetInitialSSThresh (uint32_t threshold);
virtual uint32_t GetInitialSSThresh (void) const;
virtual void SetInitialCwnd (uint32_t cwnd);
virtual uint32_t GetInitialCwnd (void) const;
@@ -164,8 +164,9 @@ private:
protected:
TracedValue<uint32_t> m_cWnd; //!< Congestion window
uint32_t m_ssThresh; //!< Slow Start Threshold
TracedValue<uint32_t> m_ssThresh; //!< Slow Start Threshold
uint32_t m_initialCWnd; //!< Initial cWnd value
uint32_t m_initialSsThresh; //!< Initial Slow Start Threshold value
bool m_inFastRec; //!< Currently in fast recovery if TRUE
TracedValue<double> m_currentBW; //!< Current value of the estimated BW