author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Thu, 02 Oct 2014 21:17:48 -0700 | |
changeset 10978 | 754c8256c35c |
parent 10968 | 2d29fee2b7b8 |
child 11190 | f0458968b67d |
permissions | -rw-r--r-- |
9696 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2013 ResiliNets, ITTC, University of Kansas |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Authors: Siddharth Gangadhar <siddharth@ittc.ku.edu>, Truc Anh N. Nguyen <annguyen@ittc.ku.edu>, |
|
19 |
* and Greeshma Umapathi |
|
20 |
* |
|
21 |
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director |
|
22 |
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets |
|
23 |
* Information and Telecommunication Technology Center (ITTC) |
|
24 |
* and Department of Electrical Engineering and Computer Science |
|
25 |
* The University of Kansas Lawrence, KS USA. |
|
26 |
* |
|
27 |
* Work supported in part by NSF FIND (Future Internet Design) Program |
|
28 |
* under grant CNS-0626918 (Postmodern Internet Architecture), |
|
29 |
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI), |
|
30 |
* US Department of Defense (DoD), and ITTC at The University of Kansas. |
|
31 |
*/ |
|
32 |
||
33 |
#define NS_LOG_APPEND_CONTEXT \ |
|
34 |
if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } |
|
35 |
||
36 |
#include "tcp-westwood.h" |
|
37 |
#include "ns3/log.h" |
|
38 |
#include "ns3/trace-source-accessor.h" |
|
39 |
#include "ns3/simulator.h" |
|
40 |
#include "ns3/abort.h" |
|
41 |
#include "ns3/node.h" |
|
42 |
#include "ns3/sequence-number.h" |
|
43 |
#include "rtt-estimator.h" |
|
44 |
||
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10855
diff
changeset
|
45 |
namespace ns3 { |
9696 | 46 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10855
diff
changeset
|
47 |
NS_LOG_COMPONENT_DEFINE("TcpWestwood"); |
9696 | 48 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10594
diff
changeset
|
49 |
NS_OBJECT_ENSURE_REGISTERED(TcpWestwood); |
9696 | 50 |
|
51 |
TypeId |
|
52 |
TcpWestwood::GetTypeId (void) |
|
53 |
{ |
|
54 |
static TypeId tid = TypeId("ns3::TcpWestwood") |
|
55 |
.SetParent<TcpSocketBase>() |
|
56 |
.AddConstructor<TcpWestwood>() |
|
57 |
.AddTraceSource("CongestionWindow", "The TCP connection's congestion window", |
|
10978
754c8256c35c
TracedValue callback function signatures.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
58 |
MakeTraceSourceAccessor(&TcpWestwood::m_cWnd), |
754c8256c35c
TracedValue callback function signatures.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
59 |
"ns3::TracedValue::Uint32Callback") |
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
60 |
.AddTraceSource ("SlowStartThreshold", |
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
61 |
"TCP slow start threshold (bytes)", |
10978
754c8256c35c
TracedValue callback function signatures.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
62 |
MakeTraceSourceAccessor (&TcpWestwood::m_ssThresh), |
754c8256c35c
TracedValue callback function signatures.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
63 |
"ns3::TracedValue::Uint32Callback") |
9696 | 64 |
.AddAttribute("FilterType", "Use this to choose no filter or Tustin's approximation filter", |
65 |
EnumValue(TcpWestwood::TUSTIN), MakeEnumAccessor(&TcpWestwood::m_fType), |
|
66 |
MakeEnumChecker(TcpWestwood::NONE, "None", TcpWestwood::TUSTIN, "Tustin")) |
|
67 |
.AddAttribute("ProtocolType", "Use this to let the code run as Westwood or WestwoodPlus", |
|
68 |
EnumValue(TcpWestwood::WESTWOOD), |
|
69 |
MakeEnumAccessor(&TcpWestwood::m_pType), |
|
70 |
MakeEnumChecker(TcpWestwood::WESTWOOD, "Westwood",TcpWestwood::WESTWOODPLUS, "WestwoodPlus")) |
|
71 |
.AddTraceSource("EstimatedBW", "The estimated bandwidth", |
|
10978
754c8256c35c
TracedValue callback function signatures.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
72 |
MakeTraceSourceAccessor(&TcpWestwood::m_currentBW), |
754c8256c35c
TracedValue callback function signatures.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
73 |
"ns3::TracedValue::DoubleCallback"); |
9696 | 74 |
return tid; |
75 |
} |
|
76 |
||
77 |
TcpWestwood::TcpWestwood (void) : |
|
78 |
m_inFastRec(false), |
|
79 |
m_currentBW(0), |
|
80 |
m_lastSampleBW(0), |
|
81 |
m_lastBW(0), |
|
82 |
m_minRtt(0), |
|
83 |
m_lastAck(0), |
|
84 |
m_prevAckNo(0), |
|
85 |
m_accountedFor(0), |
|
86 |
m_ackedSegments(0), |
|
87 |
m_IsCount(false) |
|
88 |
{ |
|
89 |
NS_LOG_FUNCTION (this); |
|
90 |
} |
|
91 |
||
92 |
TcpWestwood::TcpWestwood (const TcpWestwood& sock) : |
|
93 |
TcpSocketBase(sock), |
|
94 |
m_cWnd(sock.m_cWnd), |
|
95 |
m_ssThresh(sock.m_ssThresh), |
|
96 |
m_initialCWnd(sock.m_initialCWnd), |
|
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
97 |
m_initialSsThresh (sock.m_initialSsThresh), |
9696 | 98 |
m_inFastRec(false), |
99 |
m_currentBW(sock.m_currentBW), |
|
100 |
m_lastSampleBW(sock.m_lastSampleBW), |
|
101 |
m_lastBW(sock.m_lastBW), |
|
102 |
m_minRtt(sock.m_minRtt), |
|
103 |
m_lastAck(sock.m_lastAck), |
|
104 |
m_prevAckNo(sock.m_prevAckNo), |
|
9713 | 105 |
m_accountedFor(sock.m_accountedFor), |
106 |
m_pType(sock.m_pType), |
|
107 |
m_fType(sock.m_fType), |
|
108 |
m_IsCount(sock.m_IsCount) |
|
9696 | 109 |
{ |
110 |
NS_LOG_FUNCTION (this); |
|
111 |
NS_LOG_LOGIC ("Invoked the copy constructor"); |
|
112 |
NS_LOG_INFO ("m_minRtt at copy constructor" << m_minRtt); |
|
113 |
} |
|
114 |
||
115 |
TcpWestwood::~TcpWestwood (void) |
|
116 |
{ |
|
117 |
} |
|
118 |
||
119 |
int |
|
120 |
TcpWestwood::Listen (void) |
|
121 |
{ |
|
122 |
NS_LOG_FUNCTION (this); |
|
123 |
InitializeCwnd(); |
|
124 |
return TcpSocketBase::Listen(); |
|
125 |
} |
|
126 |
||
127 |
int |
|
128 |
TcpWestwood::Connect (const Address & address) |
|
129 |
{ |
|
130 |
NS_LOG_FUNCTION (this << address); |
|
131 |
InitializeCwnd(); |
|
132 |
return TcpSocketBase::Connect(address); |
|
133 |
} |
|
134 |
||
135 |
uint32_t |
|
136 |
TcpWestwood::Window (void) |
|
137 |
{ |
|
138 |
NS_LOG_FUNCTION (this); |
|
139 |
return std::min (m_rWnd.Get (), m_cWnd.Get ()); |
|
140 |
} |
|
141 |
||
142 |
Ptr<TcpSocketBase> |
|
143 |
TcpWestwood::Fork (void) |
|
144 |
{ |
|
145 |
NS_LOG_FUNCTION (this); |
|
146 |
return CopyObject<TcpWestwood>(this); |
|
147 |
} |
|
148 |
||
149 |
void |
|
150 |
TcpWestwood::NewAck (const SequenceNumber32& seq) |
|
151 |
{ // Same as Reno |
|
152 |
NS_LOG_FUNCTION (this << seq); |
|
153 |
NS_LOG_LOGIC ("TcpWestwood receieved ACK for seq " << seq << |
|
154 |
" cwnd " << m_cWnd << |
|
155 |
" ssthresh " << m_ssThresh); |
|
156 |
||
157 |
// Check for exit condition of fast recovery |
|
158 |
if (m_inFastRec) |
|
159 |
{// First new ACK after fast recovery, reset cwnd as in Reno |
|
160 |
m_cWnd = m_ssThresh; |
|
161 |
m_inFastRec = false; |
|
162 |
NS_LOG_INFO ("Reset cwnd to " << m_cWnd); |
|
163 |
}; |
|
164 |
||
165 |
// Increase of cwnd based on current phase (slow start or congestion avoidance) |
|
166 |
if (m_cWnd < m_ssThresh) |
|
167 |
{ // Slow start mode, add one segSize to cWnd as in Reno |
|
168 |
m_cWnd += m_segmentSize; |
|
169 |
NS_LOG_INFO ("In SlowStart, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh); |
|
170 |
} |
|
171 |
else |
|
172 |
{ // Congestion avoidance mode, increase by (segSize*segSize)/cwnd as in Reno |
|
173 |
double adder = static_cast<double> (m_segmentSize * m_segmentSize) / m_cWnd.Get(); |
|
174 |
adder = std::max(1.0, adder); |
|
175 |
m_cWnd += static_cast<uint32_t>(adder); |
|
176 |
NS_LOG_INFO ("In CongAvoid, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh); |
|
177 |
} |
|
178 |
||
179 |
// Complete newAck processing |
|
180 |
TcpSocketBase::NewAck(seq); |
|
181 |
} |
|
182 |
||
183 |
void |
|
184 |
TcpWestwood::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader) |
|
185 |
{ |
|
186 |
NS_LOG_FUNCTION (this); |
|
187 |
int acked = 0; |
|
188 |
if ((0 != (tcpHeader.GetFlags () & TcpHeader::ACK)) && tcpHeader.GetAckNumber() >= m_prevAckNo) |
|
189 |
{// It is a duplicate ACK or a new ACK. Old ACK is ignored. |
|
190 |
if (m_pType == TcpWestwood::WESTWOOD) |
|
191 |
{// For Westwood, calculate the number of ACKed segments and estimate the BW |
|
192 |
acked = CountAck (tcpHeader); |
|
193 |
EstimateBW (acked, tcpHeader, Time(0)); |
|
194 |
} |
|
195 |
else if (m_pType == TcpWestwood::WESTWOODPLUS) |
|
196 |
{// For Weswood+, calculate the number of ACKed segments and update m_ackedSegments |
|
197 |
if (m_IsCount) |
|
198 |
{ |
|
199 |
acked = CountAck (tcpHeader); |
|
200 |
UpdateAckedSegments (acked); |
|
201 |
} |
|
202 |
} |
|
203 |
} |
|
204 |
||
205 |
TcpSocketBase::ReceivedAck (packet, tcpHeader); |
|
206 |
} |
|
207 |
||
208 |
void |
|
209 |
TcpWestwood::EstimateBW (int acked, const TcpHeader& tcpHeader, Time rtt) |
|
210 |
{ |
|
211 |
NS_LOG_FUNCTION (this); |
|
212 |
if (m_pType == TcpWestwood::WESTWOOD) |
|
213 |
{ |
|
214 |
// Get the time when the current ACK is received |
|
215 |
double currentAck = static_cast<double> (Simulator::Now().GetSeconds()); |
|
216 |
// Calculate the BW |
|
217 |
m_currentBW = acked * m_segmentSize / (currentAck - m_lastAck); |
|
218 |
// Update the last ACK time |
|
219 |
m_lastAck = currentAck; |
|
220 |
} |
|
221 |
else if (m_pType == TcpWestwood::WESTWOODPLUS) |
|
222 |
{ |
|
223 |
// Calculate the BW |
|
224 |
m_currentBW = m_ackedSegments * m_segmentSize / rtt.GetSeconds(); |
|
225 |
// Reset m_ackedSegments and m_IsCount for the next sampling |
|
226 |
m_ackedSegments = 0; |
|
227 |
m_IsCount = false; |
|
228 |
} |
|
229 |
||
230 |
// Filter the BW sample |
|
231 |
Filtering(); |
|
232 |
} |
|
233 |
||
234 |
int |
|
235 |
TcpWestwood::CountAck (const TcpHeader& tcpHeader) |
|
236 |
{ |
|
237 |
NS_LOG_FUNCTION (this); |
|
238 |
||
239 |
// Calculate the number of acknowledged segments based on the received ACK number |
|
240 |
int cumul_ack = (tcpHeader.GetAckNumber() - m_prevAckNo) / m_segmentSize; |
|
241 |
||
242 |
if (cumul_ack == 0) |
|
243 |
{// A DUPACK counts for 1 segment delivered successfully |
|
244 |
m_accountedFor++; |
|
245 |
cumul_ack = 1; |
|
246 |
} |
|
247 |
if (cumul_ack > 1) |
|
248 |
{// A delayed ACK or a cumulative ACK after a retransmission |
|
249 |
// Check how much new data it ACKs |
|
250 |
if (m_accountedFor >= cumul_ack) |
|
251 |
{ |
|
252 |
m_accountedFor -= cumul_ack; |
|
253 |
cumul_ack = 1; |
|
254 |
} |
|
255 |
else if (m_accountedFor < cumul_ack) |
|
256 |
{ |
|
257 |
cumul_ack -= m_accountedFor; |
|
258 |
m_accountedFor = 0; |
|
259 |
} |
|
260 |
} |
|
261 |
||
262 |
// Update the previous ACK number |
|
263 |
m_prevAckNo = tcpHeader.GetAckNumber(); |
|
264 |
||
265 |
return cumul_ack; |
|
266 |
} |
|
267 |
||
268 |
void |
|
269 |
TcpWestwood::UpdateAckedSegments (int acked) |
|
270 |
{ |
|
271 |
m_ackedSegments += acked; |
|
272 |
} |
|
273 |
||
274 |
void |
|
275 |
TcpWestwood::DupAck (const TcpHeader& header, uint32_t count) |
|
276 |
{ |
|
277 |
NS_LOG_FUNCTION (this << count << m_cWnd); |
|
278 |
||
279 |
if (count == 3 && !m_inFastRec) |
|
280 |
{// Triple duplicate ACK triggers fast retransmit |
|
281 |
// Adjust cwnd and ssthresh based on the estimated BW |
|
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
282 |
m_ssThresh = uint32_t(m_currentBW * static_cast<double> (m_minRtt.GetSeconds())); |
9696 | 283 |
if (m_cWnd > m_ssThresh) |
284 |
{ |
|
285 |
m_cWnd = m_ssThresh; |
|
286 |
} |
|
287 |
m_inFastRec = true; |
|
288 |
NS_LOG_INFO ("Triple dupack. Enter fast recovery mode. Reset cwnd to " << m_cWnd <<", ssthresh to " << m_ssThresh); |
|
289 |
DoRetransmit (); |
|
290 |
} |
|
291 |
else if (m_inFastRec) |
|
292 |
{// Increase cwnd for every additional DUPACK as in Reno |
|
293 |
m_cWnd += m_segmentSize; |
|
294 |
NS_LOG_INFO ("Dupack in fast recovery mode. Increase cwnd to " << m_cWnd); |
|
295 |
SendPendingData (m_connected); |
|
296 |
} |
|
297 |
} |
|
298 |
||
299 |
void |
|
300 |
TcpWestwood::Retransmit (void) |
|
301 |
{ |
|
302 |
NS_LOG_FUNCTION (this); |
|
303 |
NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ()); |
|
304 |
m_inFastRec = false; |
|
305 |
||
306 |
// If erroneous timeout in closed/timed-wait state, just return |
|
307 |
if (m_state == CLOSED || m_state == TIME_WAIT) |
|
308 |
return; |
|
309 |
// If all data are received, just return |
|
310 |
if (m_txBuffer.HeadSequence() >= m_nextTxSequence) |
|
311 |
return; |
|
312 |
||
313 |
// Upon an RTO, adjust cwnd and ssthresh based on the estimated BW |
|
314 |
m_ssThresh = std::max (static_cast<double> (2 * m_segmentSize), m_currentBW.Get() * static_cast<double> (m_minRtt.GetSeconds())); |
|
315 |
m_cWnd = m_segmentSize; |
|
316 |
||
317 |
// Restart from highest ACK |
|
318 |
m_nextTxSequence = m_txBuffer.HeadSequence(); |
|
319 |
NS_LOG_INFO ("RTO. Reset cwnd to " << m_cWnd << |
|
320 |
", ssthresh to " << m_ssThresh << ", restart from seqnum " << m_nextTxSequence); |
|
321 |
||
322 |
// Double the next RTO |
|
323 |
m_rtt->IncreaseMultiplier(); |
|
324 |
||
325 |
// Retransmit the packet |
|
326 |
DoRetransmit(); |
|
327 |
} |
|
328 |
||
329 |
void |
|
330 |
TcpWestwood::EstimateRtt (const TcpHeader& tcpHeader) |
|
331 |
{ |
|
332 |
NS_LOG_FUNCTION_NOARGS (); |
|
333 |
||
334 |
// Calculate m_lastRtt |
|
335 |
TcpSocketBase::EstimateRtt (tcpHeader); |
|
336 |
||
337 |
// Update minRtt |
|
10594
147765b4725b
Update Time scaling usage to use new functions.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
338 |
if (m_minRtt == Time (0)) |
9696 | 339 |
{ |
340 |
m_minRtt = m_lastRtt; |
|
341 |
} |
|
342 |
else |
|
343 |
{ |
|
344 |
if (m_lastRtt < m_minRtt) |
|
345 |
{ |
|
346 |
m_minRtt = m_lastRtt; |
|
347 |
} |
|
348 |
} |
|
349 |
||
350 |
// For Westwood+, start running a clock on the currently estimated RTT if possible |
|
351 |
// to trigger a new BW sampling event |
|
352 |
if (m_pType == TcpWestwood::WESTWOODPLUS) |
|
353 |
{ |
|
10594
147765b4725b
Update Time scaling usage to use new functions.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
354 |
if(m_lastRtt != Time (0) && m_state == ESTABLISHED && !m_IsCount) |
9696 | 355 |
{ |
356 |
m_IsCount = true; |
|
357 |
m_bwEstimateEvent.Cancel(); |
|
358 |
m_bwEstimateEvent = Simulator::Schedule (m_lastRtt, &TcpWestwood::EstimateBW,this,m_ackedSegments,tcpHeader,m_lastRtt); |
|
359 |
} |
|
360 |
} |
|
361 |
} |
|
362 |
||
363 |
void |
|
364 |
TcpWestwood::Filtering () |
|
365 |
{ |
|
366 |
NS_LOG_FUNCTION (this); |
|
367 |
||
368 |
double alpha = 0.9; |
|
369 |
||
370 |
if (m_fType == TcpWestwood::NONE) |
|
371 |
{ |
|
372 |
} |
|
373 |
else if (m_fType == TcpWestwood::TUSTIN) |
|
374 |
{ |
|
375 |
double sample_bwe = m_currentBW; |
|
376 |
m_currentBW = (alpha * m_lastBW) + ((1 - alpha) * ((sample_bwe + m_lastSampleBW) / 2)); |
|
377 |
m_lastSampleBW = sample_bwe; |
|
378 |
m_lastBW = m_currentBW; |
|
379 |
} |
|
380 |
} |
|
381 |
||
382 |
void |
|
383 |
TcpWestwood::SetSegSize (uint32_t size) |
|
384 |
{ |
|
385 |
NS_ABORT_MSG_UNLESS(m_state == CLOSED, "TcpWestwood::SetSegSize() cannot change segment size after connection started."); |
|
386 |
m_segmentSize = size; |
|
387 |
} |
|
388 |
||
389 |
void |
|
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
390 |
TcpWestwood::SetInitialSSThresh (uint32_t threshold) |
9696 | 391 |
{ |
392 |
NS_LOG_FUNCTION (this); |
|
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
393 |
NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpWestwood::SetSSThresh() cannot change initial ssThresh after connection started."); |
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
394 |
m_initialSsThresh = threshold; |
9696 | 395 |
} |
396 |
||
397 |
uint32_t |
|
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
398 |
TcpWestwood::GetInitialSSThresh (void) const |
9696 | 399 |
{ |
400 |
NS_LOG_FUNCTION (this); |
|
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
401 |
return m_initialSsThresh; |
9696 | 402 |
} |
403 |
||
404 |
void |
|
405 |
TcpWestwood::SetInitialCwnd (uint32_t cwnd) |
|
406 |
{ |
|
407 |
NS_ABORT_MSG_UNLESS(m_state == CLOSED, "TcpWestwood::SetInitialCwnd() cannot change initial cwnd after connection started."); |
|
408 |
m_initialCWnd = cwnd; |
|
409 |
} |
|
410 |
||
411 |
uint32_t |
|
412 |
TcpWestwood::GetInitialCwnd (void) const |
|
413 |
{ |
|
414 |
NS_LOG_FUNCTION (this); |
|
415 |
return m_initialCWnd; |
|
416 |
} |
|
417 |
||
418 |
void |
|
419 |
TcpWestwood::InitializeCwnd(void) |
|
420 |
{ |
|
421 |
NS_LOG_FUNCTION (this); |
|
422 |
/* |
|
423 |
* Initialize congestion window, default to 1 MSS (RFC2001, sec.1) and must |
|
424 |
* not be larger than 2 MSS (RFC2581, sec.3.1). Both m_initiaCWnd and |
|
425 |
* m_segmentSize are set by the attribute system in ns3::TcpSocket. |
|
426 |
*/ |
|
427 |
m_cWnd = m_initialCWnd * m_segmentSize; |
|
10855
7ef081ddfc7f
Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10652
diff
changeset
|
428 |
m_ssThresh = m_initialSsThresh; |
9696 | 429 |
} |
430 |
||
431 |
} // namespace ns3 |