12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Functio<strong>ns</strong> for Window Management <strong>The</strong> usable send window <strong>at</strong> any time is given by the function window(). It retur<strong>ns</strong>the minimum of the congestion window <strong>and</strong> the variable wnd_, which represents the receiver’s advertised window.opencwnd() - this function ope<strong>ns</strong> the congestion window. It is invoked when a new ACK arrives. When in slow-start,the function merely increments cwnd_ by each ACK received. When in congestion avoidance, the st<strong>and</strong>ard configur<strong>at</strong>ionincrements cwnd_ by its reciprocal. Other window growth optio<strong>ns</strong> are supported during congestion avoidance, but they areexperimental (<strong>and</strong> not documented; contact Sally Floyd for details).closecwnd(int how) - this function reduces the congestion window. It may be invoked in several ways: when entering fastretra<strong>ns</strong>mit, due to a timer expir<strong>at</strong>ion, or due to a congestion notific<strong>at</strong>ion (ECN bit set). Its argument how indic<strong>at</strong>es how thecongestion window should be reduced. <strong>The</strong> value 0 is used for retra<strong>ns</strong>mission timeouts <strong>and</strong> fast retra<strong>ns</strong>mit in Tahoe TCP. Ittypically causes the TCP to enter slow-start <strong>and</strong> reduce ssthresh_ to half the current window. <strong>The</strong> value 1 is used by RenoTCP for implementing fast recovery (which avoids returning to slow-start). <strong>The</strong> value 2 is used for reducing the windowdue to an ECN indic<strong>at</strong>ion. It resets the congestion window to its initial value (usually causing slow-start), but does not alterssthresh_.Functio<strong>ns</strong> for Processing ACKs recv() - this function is the main reception p<strong>at</strong>h for ACKs. Note th<strong>at</strong> because only onedirection of d<strong>at</strong>a flow is in use, this function should only ever be invoked with a pure ACK packet (i.e. no d<strong>at</strong>a). <strong>The</strong> functio<strong>ns</strong>tores the timestamp from the ACK in ts_peer_, <strong>and</strong> checks for the presence of the ECN bit (reducing the send windowif appropri<strong>at</strong>e). If the ACK is a new ACK, it calls newack(), <strong>and</strong> otherwise checks to see if it is a duplic<strong>at</strong>e of the last ACKseen. If so, it enters fast retra<strong>ns</strong>mit by closing the window, resetting the retra<strong>ns</strong>mission timer, <strong>and</strong> sending a packet by callingsend_much.newack() - this function processes a “new” ACK (one th<strong>at</strong> contai<strong>ns</strong> an ACK number higher than any seen so far). <strong>The</strong> functio<strong>ns</strong>ets a new retra<strong>ns</strong>mission timer by calling newtimer(), upd<strong>at</strong>es the RTT estim<strong>at</strong>ion by calling rtt_upd<strong>at</strong>e, <strong>and</strong> upd<strong>at</strong>es thehighest <strong>and</strong> last ACK variables.Functio<strong>ns</strong> for Managing the Retra<strong>ns</strong>mission Timer <strong>The</strong>se functio<strong>ns</strong> serve two purposes: estim<strong>at</strong>ing the round-trip time<strong>and</strong> setting the actual retra<strong>ns</strong>mission timer. rtt_init - this function initializes srtt_ <strong>and</strong> rtt_ to zero, sets rttvar_ to3/tcp_tick_, <strong>and</strong> sets the backoff multiplier to one.rtt_timeout - this function gives the timeout value in seconds th<strong>at</strong> should be used to schedule the next retra<strong>ns</strong>mission timer.It computes this based on the current estim<strong>at</strong>es of the mean <strong>and</strong> devi<strong>at</strong>ion of the round-trip time. In addition, it implementsKarn’s exponential timer backoff for multiple co<strong>ns</strong>ecutive retra<strong>ns</strong>mission timeouts.rtt_upd<strong>at</strong>e - this function takes as argument the measured RTT <strong>and</strong> averages it in to the running mean <strong>and</strong> devi<strong>at</strong>ion estim<strong>at</strong>orsaccording to the description above. Note th<strong>at</strong> t_srtt_ <strong>and</strong> t_rttvar are both stored in fixed-point (integers). <strong>The</strong>y have3 <strong>and</strong> 2 bits, respectively, to the right of the binary point.reset_rtx_timer - This function is invoked during fast retra<strong>ns</strong>mit or during a timeout. It sets a retra<strong>ns</strong>mission timer by callingset_rtx_timer <strong>and</strong> if invoked by a timeout also calls rtt_backoff.rtt_backoff - this function backs off the retra<strong>ns</strong>mission timer (by doubling it).newtimer - this function called only when a new ACK arrives. If the sender’s left window edge is beyond the ACK, the<strong>ns</strong>et_rtx_timer is called, otherwise if a retra<strong>ns</strong>mission timer is pending it is cancelled.295

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!