310 likes | 910 Views
CISC 856 – TCP OPTIONS. SELECTIVE ACKNOWLEDGEMENT (SACK) RFC 2018 DUPLICATE SELECTIVE ACKNOWLEDGMENT (DSACK) RFC 2883. Rajesh Ponnurangam Computers & Information Sciences University of Delaware. Thanks to Dr.Paul Amer and Pallavi Mahajan. TCP without SACK. TCP uses cumulative ACKs
E N D
CISC 856 – TCP OPTIONS SELECTIVE ACKNOWLEDGEMENT (SACK) RFC 2018 DUPLICATE SELECTIVE ACKNOWLEDGMENT (DSACK) RFC 2883 Rajesh Ponnurangam Computers & Information Sciences University of Delaware Thanks to Dr.Paul Amer and Pallavi Mahajan
TCP without SACK • TCP uses cumulative ACKs • Receiver identifies the last byte of data successfully received • Out of rrder segments are not ACKed • Receiver sends duplicate ACKs • TCP without SACK forces the TCP sender • Either to wait an RTT to find out a segment was lost • Or, unnecessarily retransmit data that has been correctly received • Can result in reduced overall throughput
TCP with Selective Ack (SACK) • SACK + Selective Repeat Retransmission Policy allows • receiver informs sender about all segments that are successfully received. • sender fast retransmits only the missing data segments • SACK is implemented using two TCP Options • SACK-Permitted Option • SACK Option
TCP header length 1 6 options kind=4 length=2 kind=1 kind=1 SYN bit SACK-permitted NOP NOP SACK-Permitted Option • Sack–Permitted option • is allowed only in a SYN Segment. • indicates sender handles SACKs, and receiver should send SACKs if possible. • SACK option can be used once connection is established TCP Header Source port address Destination port address Sequence Number Cumulative Ack No. Window size Checksum Urgent pointer
Source port address Destination port address Sequence Number Cumulative Ack No. Window size Checksum Urgent pointer kind=1 kind=1 Source port address Destination port address Sequence Number Source port address Destination port address Cumulative Ack No. Sequence Number SYN “SACK-permitted” Window size Cumulative Ack No. TCP connection establishment phase Checksum Urgent pointer Window size 1 SYN/ACK options kind=1 kind=1 Checksum Urgent pointer “SACK-permitted” options ACK kind=1 kind=1 NOP NOP NOP NOP SYN bit 1 1 1 data transfer phase cum ack and optional SACKs kind=4 kind=4 length=2 length=2 ACK bit SYN bit ACK bit SACK-permitted SACK-permitted SACK-Permitted Option and SACK RECEIVER SENDER
SACK Option • Length of SACK with n blocks? Source port address Destination port address = (2 + 8 * n) bytes Sequence Number Cumulative Ack No. • Max number bytes available for TCP Options? HLEN Window size Checksum Urgent pointer = 40 bytes Kind=1 Kind=5 Length=?? Kind=1 Left edge of 1st block • Max number of SACK blocks possible? Right edge of 1st block = 4 SACK blocks (barring no other TCP Options) Left edge of nth block Right edge of nth block
1 - 100 1-100 101-200 101 - 200 ACK 201 201-300 301-400 501 - 600 401 - 500 ACK 201 SACK 401-601 1-100 101-200 401-500 501-600 SACK Example receiver’s buffer sender receiver
SACK Rules • With SACKs, the ACK field is still a cum ACK • A SACK cannot be sent unless the SACK-Permitted option has been received (in the SYN) • The 1st SACK block MUST specify the contiguous block of data containing the segment which triggered this acknowledgment • If SACKs are sent, SACK option should be included in all ACK’s which do not ACK the highest sequence number in the data receiver’s queue
Generating SACKs – data receiver behavior • If the data receiver has not received a SACK-Permitted Option for a given connection, the receiver must not send SACK options on that connection • The receiver should send an ACK for every valid segment that arrives containing new data • The data receiver should include as many distinct SACK blocks as possible in the SACK option • SACK option should be filled out by repeating the most recently reported SACK blocks • The data receiver provides the sender with the most up-to-date info about the state of the network and the receiver’s queue
Interpreting SACKs - Data Sender behavior • The sender records the SACK for future reference • Maintains a retransmission queue containing unacknowledged segments • One possible implementation • Turns on SACK bit for the segment in retransmission queue when it receives a SACK • Skips SACKed data during any later fast retransmission • On fast retransmit, retransmits data not SACKed so far and less than the highest SACKed data • Turns off SACK bit after retransmission time out
100-299 1099 699 ACK300 100 299 300 500 500 699 300-499 500-699 900-1099 ACK300, SACK 500-700 700-899 1100-1299 300 900 ACK300, SACK 900-1100, 500-700 Another SACK Example Receiver Buffer sender receiver
1099 1099 1099 ACK1100 300 900 500 500 500 300-499 700-899 900 300 700 699 699 900 300 ACK700, SACK 900-1100 1100-1299 1100 Another SACK Example (cont’d) sender receiver
200-599 300-399 100-199 100-199 200-299 500-599 300-399 400-499 sender receiver ACK600 ACK600 ACK200 ACK200 ACK200 ACK200 ACK200 sender receiver 400-499 ACK200, SACK 300-400 500-599 ACK200, SACK 300-500 200-299 200-299 ACK200, SACK 300-600 fast retransmit fast retransmit Without SACK vs. With SACK TCP with SACK TCP without SACK
Data Receiver Reneging Reneging – fail to fulfill a promise or obligation • Data receiver is permitted to discard data in its queue that has not been acknowledged to the data sender, even if the data has already been SACKed • Such discarding of SACKed segments is discouraged, but may occur if the receiver must give buffer space back to the OS • If reneging occurs • first SACK should reflect the newest segment even if its going to be discarded • Except for the newest segment, all SACK blocks MUST NOT report any old data which is no longer actually held by the receiver
100 199 100-199 200 200 200 399 200-299 ACK200 300-399 reneg occurs; window decreases 200 400-499 599 ACK 200; SACK 500-600 ACK 200; SACK 300-400 window increases 500-599 300 500 Reneging Example sender receiver
Consequences of Reneging • Sender must maintain normal TCP timeouts • Data cannot be considered “communicated” until a cum ACK is sent • Sender must retransmit the data at the left window edge after a retransmit timeout, even if that data has been SACKed by the receiver • Sender MUST NOT discard data before being acked by the Cum Ack
SACK Observations • SACK TCP follows standard TCP congestion control; Adding SACK to TCP does not change the basic underlying congestion control algorithms • SACK TCP has major advantages when compared TCP Tahoe, Reno, Vegas and New Reno, as PDUs have been provided with additional information due to the SACK • Difference in behavior when multiple packets are dropped from one window of data • SACK information allows the sender to better decide what to retransmit and what not to
Duplicate SACK (D-SACK) Extension to SACK – RFC 2883 • How is SACK option used when duplicate segments are received? • D-SACK does not require separate negotiation between a TCP sender and receiver that have already negotiated SACK • When D-SACK is used, the first block of the SACK option should be a D-SACK block specifying a duplicate segment • A D-SACK block is only used to report a duplicate contiguous sequence of data received by the receiver in the most recent segment • Each duplicate contiguous sequence of data received is reported in at most one D-SACK block
200-399 999 999 799 ACK400 200 399 400 600 600 600 800 800 400-599 800-999 600-799 ACK400, SACK 600-800 ACK400, SACK 600-1000 400 400 ACK400, SACK 800-1000, 600-1000 D-SACK Example Segment replicated by the network Receiver Buffer sender receiver
500-599 1100-1199 899 500 599 800 600 699 699 899 800 600-699 800-899 900-999 700-799 1000-1099 1199 1100 ACK600, SACK 1100-1200 ACK700, SACK 1100-1200 700-899 1100 1199 600 1100 1199 600 ACK900, SACK 800-900,1100-1200 1100 1199 700 ACK700, SACK 800-900,1100-1200 DSACK – Another example Receiver Buffer sender receiver
Interpreting D-SACK - Data Sender Behavior • The loss of a single ACK can prevent this information from reaching the sender. • How does sender knows the first SACK block is a D-SACK? • Compares the sequence space in the 1st SACK block to the cum ACK • if seq_space < cum_ACK, then duplicate data has been received • if seq_space > cum_ACK, then sender compares seq_space with the seq_space in 2nd SACK block (if there is one) • if the 1st SACK block is reporting duplicate data that lies above the cumulative ACK, then the 1st SACK block will be a subset of the 2nd SACK block.
100-199 300-399 200-299 300-399 100-199 200-299 ACK200 ACK200 sender receiver sender receiver cwnd =10 cwnd =10 200-299 200-299 400-499 400-499 ACK200, SACK 300-400 ACK200, SACK 300-400 500-599 500-599 ACK200, SACK 300-500 ACK200, SACK 300-500 ACK200, SACK 300-600 ACK200, SACK 300-600 fast retransmit fast retransmit cwnd =5 cwnd =5 cwnd =5 cwnd =5 ACK600 ACK600 ACK600 ACK600, SACK 200-300 cwnd =5 cwnd =10 DSACK Example TCP with SACK & without D-SACK TCP with SACK and D-SACK
D-SACK and Retransmissions • D-SACK allows TCP sender to determine when a retransmission was “spurious” (ie, unnecessary) and then undo congestion control measures • D-SACK allows TCP sender to determine if the network is duplicating TCP-PDUs • D-SACK does not allow a sender to determine if both the original and retransmitted data are received, or the original is lost and the retransmitted data is duplicated by the network.
SACK and D-SACK Interaction • There is no difference between SACK and D-SACK, except that the first SACK block is used to report a duplicate segment in D-SACK. • D-SACK does not require separate negotiation between a TCP sender and receiver that have already negotiated SACK capability. • D-SACK is compatible with current implementations of SACK option in TCP.
Current Implementations of SACK • Windows 2000/XP • Controlled by a registry parameter – SackOpts in “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters” - SackOpts="1" • Windows Vista • Windows Server 2008 and Windows Vista support TCP SACK • Free BSD and NetBSD have optional modules • Solaris 7 and later
References • RFC 2018 – TCP Selective Acknowledgement Options. • RFC 2883 – An Extension to SACK option for TCP. • Kevin Fall and Sally Floyd, “Simulation-based Comparisons of Tahoe, Reno, and SACK TCP”, Lawrence Berkley National Laboratory.