TCP/IP Implementation

standguideNetworking and Communications

Oct 26, 2013 (3 years and 11 months ago)

94 views

COMT 429

1

Communications Protocols
and TCP/IP

COMT 429

COMT 429

2

TCP Sliding Window
Operation

Sender

Receiver


snd.una

snd.nxt

snd.una

+snd.wnd

rcv.nxt

rcv.nxt

+rcv.wnd

snd.wnd

rcv.wnd

COMT 429

3

Example ...

Sender

Receiver

1001

2001

2501

5001

1001

5001

1501

Received and acked; not yet picked up by client

Available receive window space

Sent but no ack received yet

Next segment to send

Available window for further sends

COMT 429

4

Segment Dispatch


Dispatch segment to IP


Set RTO (Retransmit Time Out) timer


Proportional to the Round Trip Time (RTT)

Sender

1001

2001

2501

5001

Sent but no ack received yet

Next segment to send

Available window for further sends

COMT 429

5

Segment Receipt with

Pickup


Send Ack segment with Ack=2001


Window = 4000

Receiver

1001

5001

1501

Received and picked up by client

Available receive window space

2001

6001

COMT 429

6

Segment Receipt w/o

Pickup


Send Ack packet with Ack = 2001


Window = 3500

Receiver

1001

5001

1501

Received and picked up by client

Available receive window space

2001

5501

Received but not picked up by client

COMT 429

7

Acknowledgement Receipt


Seg received with Ack=2001, Win=3500


Left window edge to 2001


Right window edge to 5501

Sender

1001

2001

2501

5001

before

2001

2501

5001

after

5501

COMT 429

8

Segment Receipt After

Segment Loss


Send a “duplicate” acknowledgement


Send Ack packet with Ack = 2001


Window = 3500

Receiver

1001

5001

1501

Received and picked up by client

2001

5501

Received but not picked up by client

Last segment received

Missing segment

COMT 429

9

Retransmission


Highest Ack Number received is 2001


Duplicate Ack=2001 may have been received


RTO timer for segment 2001 expires and 2001 is
retransmitted


Trigger congestion avoidance algorithm

Sender

2001

2501

5001

5501

COMT 429

10

Retransmit Timing and

Window Size
-

Single Error


BDP (Bandwidth Delay Product)


Ethernet: 1ms * 10Mbps = 1250 bytes


Satcom T1: 500ms * 1.5Mbps = 94 kbytes


Assume window size = BDP


RTO > 2*RTT


“Recovery Ack” after retransmit needs 1 RTT


Channel idles for length of RTO (“drained pipe”)

2001

2501

5001

5501

COMT 429

11

Retransmission Timer

Implementation


Running estimate (based on Acks) of


Average RTT


RTT variance factor


Exclude retransmissions


Set RTO to RTT times RTT variance factor
(with a hard upper bound)


Around 2 RTT for lightly loaded links


As high as 16 RTT for congested links

COMT 429

12

The Congestion Collapse
Problem


Original TCP specs used the window for flow
control, and 2*RTT for the RTO


Congestion of a link causes the RTO timers to
“go off” before an ack can be returned


The network goes into steady state congestion
where every segement is transmitted about
three times

COMT 429

13

Congestion Issues


Slow Start
-

New Connection


Set send window to MSS


Increase the window by MSS for each ack
received


Exponential increase in send window size

x

x

x

x

x

x

x

1001

5000

COMT 429

14

Congestion Issues cont...


Slow Start
-

After retransmission


Exponential slow
-
start up to 1/2 of the
original window size


Increase the window by MSS for each send
window acked without loss


Linear increase in send window size

x

x

x

x

x

x

x

1001

5000

COMT 429

15

Congestion Issues cont...


Congestion Avoidance, Timer Back
-
Off


Reduce send window to 1/2 of previous
size for each retransmit (exponential back
-
off)


After a segment is retransmitted, set the
new RTO timer for that segment to 2*RTO,
up to a hard upper bound (2*MSL,
Maximum Segment Life)

COMT 429

16

Fast Retransmit


Duplicate Ack=2001 have been received


Re
-
send segment 2001
before

RTO expires


“Guess” that 2001 was lost


Wait for >=3 dup acks (segements could just
have arrived out
-
of
-
order)


Enter congestion avoidance with allowance
for duplicate acks

Sender

2001

2501

5001

5501

COMT 429

17

Selective Acknowledgement


Enabled during Syn and Syn/Ack


Receiver send segment with


Ack = 2001, Window = 3500


SACK option: block start=2501, end=2600

Receiver

1001

5001

1501

2001

5501

Last segment received

Missing Segment

2501

2601

COMT 429

18

Resources


RFC 793
-

Transmission Control Protocol


Draft
-
ietf
-
tcplw
-
sack
-
02
-

Selective Ack.


RCF 1323
-

TCP Extensions


Van Jacobson Note on Fast Recovery
(attached)