|
.. include:: replace.txt
.. highlight:: cpp
SACK option and TCP SACK implementation in |ns3|
------------------------------------------------
This chapter describes the SACK option and TCP SACK implementation in |ns3|. This implementation is contained in the following files:
.. sourcecode:: text
src/internet/model/tcp-option-sack-permitted.{cc,h}
src/internet/model/tcp-option-sack.{cc,h}
src/internet/model/tcp-socket-base.{cc,h}
src/internet/model/tcp-option.{cc,h}
src/internet/model/tcp-scoreboard.{cc,h}
src/internet/model/tcp-rx-buffer.{cc,h}
src/internet/model/tcp-sack.{cc,h}
Model Description
*****************
SACK option implementation
==========================
TCP SACK extention [Mat96] addresses the catastrophic throughput degradation of TCP in the presence of multiple packet losses from a single window of data. The SACK extension comprises of 2 options: SACK-permitted and SACK. The SACK-permitted, defined in class :cpp:class:`TcpOptionSackPermitted`, is sent in a SYN segment to allow the SACK option usage during a connection lifetime. The SACK option, defined in class :cpp:class:`TcpOptionSack`, is sent by a data receiver to inform the sender of non-contiguous blocks of data that have been received and queued in the receving buffer but cannot be acknowledged due to some missing segments. Each block is defined by two 32-bit unsigned integers specifying the left and the right edge of the block. Note that with the 40-byte TCP option limitation in addition to the presence of TCP Timestamp option, the maximum number of SACK blocks can be appended to each packet is 3.
The class :cpp:class:`TcpSocketBase` handles the SACK-permitted and SACK option processing to enable the use of SACK mechanism by all TCP variants available in |ns3|. Before transmitting an ACK that does not acknowledge the highest sequence number received, a receiver tries to find all isolated data chunks in the receving buffer. This is done by calling ``TcpRxBuffer::GetIsolatedDataChunks ()`` from ``TcpSocketBase::ReceivedData ()``. The returned list of isolated data blocks is then sorted by an auxiliary routine ``TcpSocketBase::ArrageSackBlocks ()`` to make sure that the block containing the segment that triggers this particular ACK packet is at the front of the list. When the SACK list is ready and the ACK segment is constructed, ``TcpSocketBase::AddOptionSack ()`` is called, which in turn calls ``TcpHeader::AppendOption ()`` to append as many SACK blocks to the packet as possible.
On the sender side, a scoreboard handled by the class :cpp:class:`TcpScoreBoard` is maintained to keep track of SACK information. When the sender receives an ACK with SACK option appended, the sender calls ``TcpScoreBoard::Update ()`` to turn on the SACK flag for all transmitted segments that are covered by the received SACK blocks. When deciding on a packet for retransmission, the sender will skip segments with SACK flag set.
TCP SACK implementation
=======================
The main TCP SACK implementation is located in :cpp:class:`TcpSack` featuring the conservative loss recovery algorithm based on SACK for TCP [Bla12].
Note that this algorithm has a different definition of a duplicate ACK when comparing to the conventional dupACK definition as in Tahoe, Reno, or NewReno,
which requires the implementation to define a new routine ``TcpSack::SackDupAck ()`` to replace the regular ``TcpSocketBase::DupAck ()``.
The heart of the algorithm is the `pipe` mechanism implemented in ``TcpSack::StartPipe ()`` routine, which allows additional data packet retransmissions
to recover multiple losses in a sending window and additional new segment transmission to fully utilize the available network bandwidth.
References
==========
.. [Mat96] M. Mathis, J. Mahdavi, S. Floyd, and A. Romanow, RFC 2018: TCP Selective Acknowledgment Options, October 1996. Available online at `<http://tools.ietf.org/html/rfc2018>`_.
.. [Bla12] E. Blanton, M. Allman, L. Wang, I. Jarvinen, M. Kojio, and Y. Nishida, RFC 6675: A Conservative Loss Recovery Algorithm Based on Selective Acknowledgment (SACK) for TCP, August 2012. Available online at `<https://tools.ietf.org/html/rfc6675>`_.
Validation
==========
The SACK option model is tested using :cpp:class:`TcpOptionTestSuite` class and :cpp:class:`TcpSackTestSuite` class defined in `src/internet/test/tcp-option-test.cc` and `src/internet/test/tcp-sack-test.cc`, respectively. These two test suites can be run using the following commands:
::
$ ./waf configure --enable-examples --enable-tests
$ ./waf build
$ ./test.py -s tcp-option
$ ./test.py -s tcp-sack
The TCP SACK model is tested using :cpp:class`Ns3TcpLossTestSuite` class defined in `src/test/ns3tcp-loss-test-suite.cc`, which can be run using the following command (after enabling tests):
::
$ ./test.py -s ns3-tcp-loss
Example
=======
The SACK option and TCP SACK can be simulated using the example `tcp-variants-comparison.cc` located in ``examples/tcp``.
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+2836 lines, -163 lines) |
Patch |
 |
M |
examples/tcp/tcp-variants-comparison.cc
|
View
|
|
4 chunks |
+23 lines, -28 lines |
0 comments
|
Download
|
 |
A |
src/internet/doc/sack-option-tcp-sack.rst
|
View
|
|
1 chunk |
+70 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-header.h
|
View
|
|
4 chunks |
+17 lines, -3 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-header.cc
|
View
|
|
14 chunks |
+39 lines, -27 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-option.h
|
View
|
|
1 chunk |
+8 lines, -6 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-option.cc
|
View
|
|
5 chunks |
+14 lines, -8 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-option-sack.h
|
View
|
|
1 chunk |
+82 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-option-sack.cc
|
View
|
|
1 chunk |
+147 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-option-sack-permitted.h
|
View
|
|
1 chunk |
+57 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-option-sack-permitted.cc
|
View
|
|
1 chunk |
+100 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-rx-buffer.h
|
View
|
|
3 chunks |
+14 lines, -2 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-rx-buffer.cc
|
View
|
|
6 chunks |
+87 lines, -8 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-sack.h
|
View
|
|
1 chunk |
+181 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-sack.cc
|
View
|
|
1 chunk |
+478 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-scoreboard.h
|
View
|
|
1 chunk |
+235 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/internet/model/tcp-scoreboard.cc
|
View
|
|
1 chunk |
+496 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-socket-base.h
|
View
|
|
7 chunks |
+54 lines, -4 lines |
0 comments
|
Download
|
 |
M |
src/internet/model/tcp-socket-base.cc
|
View
|
|
35 chunks |
+249 lines, -49 lines |
0 comments
|
Download
|
 |
M |
src/internet/test/tcp-option-test.cc
|
View
|
|
3 chunks |
+104 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/internet/test/tcp-sack-test.cc
|
View
|
|
1 chunk |
+334 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/internet/wscript
|
View
|
|
5 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/ns3tcp-loss-test-suite.cc
|
View
|
|
12 chunks |
+36 lines, -28 lines |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-NewReno0-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-NewReno1-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-NewReno2-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-NewReno3-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-NewReno4-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Reno0-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Reno1-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Reno2-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Reno3-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Reno4-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
A |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Sack0-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
A |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Sack1-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
A |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Sack2-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
A |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Sack3-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
A |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Sack4-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Tahoe0-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Tahoe1-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Tahoe2-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Tahoe3-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Tahoe4-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Westwood0-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Westwood1-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Westwood2-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Westwood3-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-Westwood4-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-WestwoodPlus0-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-WestwoodPlus1-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-WestwoodPlus2-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-WestwoodPlus3-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
 |
M |
src/test/ns3tcp/response-vectors/ns3tcp-loss-WestwoodPlus4-response-vectors.pcap
|
View
|
|
Binary file |
0 comments
|
Download
|
|