Connected: An Internet Encyclopedia
2.2 Using the Window Scale Option
Up:
Connected: An Internet Encyclopedia
Up:
Requests For Comments
Up:
RFC 1072
Up:
2. TCP WINDOW SCALE OPTION
Prev: 2.1 Window Scale Option
Next: 3. TCP SELECTIVE ACKNOWLEDGMENT OPTIONS
2.2 Using the Window Scale Option
2.2 Using the Window Scale Option
A model implementation of window scaling is as follows, using the
notation of RFC-793 [Postel81]:
- The send-window (SND.WND) and receive-window (RCV.WND) sizes
in the connection state block and in all sequence space
calculations are expanded from 16 to 32 bits.
- Two window shift counts are added to the connection state:
snd.scale and rcv.scale. These are shift counts to be
applied to the incoming and outgoing windows, respectively.
The precise algorithm is shown below.
- All outgoing SYN segments are sent with the Window Scale
option, containing a value shift.cnt = R that the TCP would
like to use for its receive window.
- Snd.scale and rcv.scale are initialized to zero, and are
changed only during processing of a received SYN segment. If
the SYN segment contains a Window Scale option with shift.cnt
= S, set snd.scale to S and set rcv.scale to R; otherwise,
both snd.scale and rcv.scale are left at zero.
- The window field (SEG.WND) in the header of every incoming
segment, with the exception of SYN segments, will be left-
shifted by snd.scale bits before updating SND.WND:
SND.WND = SEG.WND << snd.scale
(assuming the other conditions of RFC793 are met, and using
the "C" notation "<<" for left-shift).
- The window field (SEG.WND) of every outgoing segment, with
the exception of SYN segments, will have been right-shifted
by rcv.scale bits:
SEG.WND = RCV.WND >> rcv.scale.
TCP determines if a data segment is "old" or "new" by testing if
its sequence number is within 2**31 bytes of the left edge of the
window. If not, the data is "old" and discarded. To insure that
new data is never mistakenly considered old and vice-versa, the
left edge of the sender's window has to be at least 2**31 away
from the right edge of the receiver's window. Similarly with the
sender's right edge and receiver's left edge. Since the right and
left edges of either the sender's or receiver's window differ by
the window size, and since the sender and receiver windows can be
out of phase by at most the window size, the above constraints
imply that 2 * the max window size must be less than 2**31, or
max window < 2**30
Since the max window is 2**S (where S is the scaling shift count)
times at most 2**16 - 1 (the maximum unscaled window), the maximum
window is guaranteed to be < 2*30 if S <= 14. Thus, the shift
count must be limited to 14. (This allows windows of 2**30 = 1
Gbyte.) If a Window Scale option is received with a shift.cnt
value exceeding 14, the TCP should log the error but use 14
instead of the specified value.
Next: 3. TCP SELECTIVE ACKNOWLEDGMENT OPTIONS
Connected: An Internet Encyclopedia
2.2 Using the Window Scale Option