|
|
| 45 |
MakeUintegerAccessor (&TcpNewReno::m_retxThresh), |
45 |
MakeUintegerAccessor (&TcpNewReno::m_retxThresh), |
| 46 |
MakeUintegerChecker<uint32_t> ()) |
46 |
MakeUintegerChecker<uint32_t> ()) |
| 47 |
.AddAttribute ("LimitedTransmit", "Enable limited transmit", |
47 |
.AddAttribute ("LimitedTransmit", "Enable limited transmit", |
| 48 |
BooleanValue (false), |
48 |
BooleanValue (false), |
| 49 |
MakeBooleanAccessor (&TcpNewReno::m_limitedTx), |
49 |
MakeBooleanAccessor (&TcpNewReno::m_limitedTx), |
| 50 |
MakeBooleanChecker ()) |
50 |
MakeBooleanChecker ()) |
| 51 |
.AddTraceSource ("CongestionWindow", |
51 |
.AddTraceSource ("CongestionWindow", |
| 52 |
"The TCP connection's congestion window", |
52 |
"The TCP connection's congestion window", |
| 53 |
MakeTraceSourceAccessor (&TcpNewReno::m_cWnd)) |
53 |
MakeTraceSourceAccessor (&TcpNewReno::m_cWnd)) |
| 54 |
; |
54 |
.AddTraceSource ("SlowStartThreshold", |
|
|
55 |
"TCP slow start threshold (bytes)", |
| 56 |
MakeTraceSourceAccessor (&TcpNewReno::m_ssThresh)) |
| 57 |
; |
| 55 |
return tid; |
58 |
return tid; |
| 56 |
} |
59 |
} |
| 57 |
|
60 |
|
|
|
| 68 |
m_cWnd (sock.m_cWnd), |
71 |
m_cWnd (sock.m_cWnd), |
| 69 |
m_ssThresh (sock.m_ssThresh), |
72 |
m_ssThresh (sock.m_ssThresh), |
| 70 |
m_initialCWnd (sock.m_initialCWnd), |
73 |
m_initialCWnd (sock.m_initialCWnd), |
|
|
74 |
m_initialSsThresh (sock.m_initialSsThresh), |
| 71 |
m_retxThresh (sock.m_retxThresh), |
75 |
m_retxThresh (sock.m_retxThresh), |
| 72 |
m_inFastRec (false), |
76 |
m_inFastRec (false), |
| 73 |
m_limitedTx (sock.m_limitedTx) |
77 |
m_limitedTx (sock.m_limitedTx) |
|
|
| 124 |
// Check for exit condition of fast recovery |
128 |
// Check for exit condition of fast recovery |
| 125 |
if (m_inFastRec && seq < m_recover) |
129 |
if (m_inFastRec && seq < m_recover) |
| 126 |
{ // Partial ACK, partial window deflation (RFC2582 sec.3 bullet #5 paragraph 3) |
130 |
{ // Partial ACK, partial window deflation (RFC2582 sec.3 bullet #5 paragraph 3) |
| 127 |
m_cWnd -= seq - m_txBuffer.HeadSequence (); |
131 |
m_cWnd += m_segmentSize - (seq - m_txBuffer.HeadSequence ()); |
| 128 |
m_cWnd += m_segmentSize; // increase cwnd |
|
|
| 129 |
NS_LOG_INFO ("Partial ACK in fast recovery: cwnd set to " << m_cWnd); |
132 |
NS_LOG_INFO ("Partial ACK in fast recovery: cwnd set to " << m_cWnd); |
| 130 |
m_txBuffer.DiscardUpTo(seq); //Bug 1850: retransmit before newack |
133 |
m_txBuffer.DiscardUpTo(seq); //Bug 1850: retransmit before newack |
| 131 |
DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet |
134 |
DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet |
|
|
| 134 |
} |
137 |
} |
| 135 |
else if (m_inFastRec && seq >= m_recover) |
138 |
else if (m_inFastRec && seq >= m_recover) |
| 136 |
{ // Full ACK (RFC2582 sec.3 bullet #5 paragraph 2, option 1) |
139 |
{ // Full ACK (RFC2582 sec.3 bullet #5 paragraph 2, option 1) |
| 137 |
m_cWnd = std::min (m_ssThresh, BytesInFlight () + m_segmentSize); |
140 |
m_cWnd = std::min (m_ssThresh.Get (), BytesInFlight () + m_segmentSize); |
| 138 |
m_inFastRec = false; |
141 |
m_inFastRec = false; |
| 139 |
NS_LOG_INFO ("Received full ACK. Leaving fast recovery with cwnd set to " << m_cWnd); |
142 |
NS_LOG_INFO ("Received full ACK. Leaving fast recovery with cwnd set to " << m_cWnd); |
| 140 |
} |
143 |
} |
|
|
| 220 |
} |
223 |
} |
| 221 |
|
224 |
|
| 222 |
void |
225 |
void |
| 223 |
TcpNewReno::SetSSThresh (uint32_t threshold) |
226 |
TcpNewReno::SetInitialSSThresh (uint32_t threshold) |
| 224 |
{ |
227 |
{ |
| 225 |
m_ssThresh = threshold; |
228 |
NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpNewReno::SetSSThresh() cannot change initial ssThresh after connection started."); |
|
|
229 |
m_initialSsThresh = threshold; |
| 226 |
} |
230 |
} |
| 227 |
|
231 |
|
| 228 |
uint32_t |
232 |
uint32_t |
| 229 |
TcpNewReno::GetSSThresh (void) const |
233 |
TcpNewReno::GetInitialSSThresh (void) const |
| 230 |
{ |
234 |
{ |
| 231 |
return m_ssThresh; |
235 |
return m_initialSsThresh; |
| 232 |
} |
236 |
} |
| 233 |
|
237 |
|
| 234 |
void |
238 |
void |
|
|
| 253 |
* m_segmentSize are set by the attribute system in ns3::TcpSocket. |
257 |
* m_segmentSize are set by the attribute system in ns3::TcpSocket. |
| 254 |
*/ |
258 |
*/ |
| 255 |
m_cWnd = m_initialCWnd * m_segmentSize; |
259 |
m_cWnd = m_initialCWnd * m_segmentSize; |
|
|
260 |
m_ssThresh = m_initialSsThresh; |
| 256 |
} |
261 |
} |
| 257 |
|
262 |
|
| 258 |
} // namespace ns3 |
263 |
} // namespace ns3 |