A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-yeah.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 ResiliNets, ITTC, University of Kansas
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
7 *
8 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
9 * ResiliNets Research Group https://resilinets.org/
10 * Information and Telecommunication Technology Center (ITTC)
11 * and Department of Electrical Engineering and Computer Science
12 * The University of Kansas Lawrence, KS USA.
13 */
14
15#ifndef TCPYEAH_H
16#define TCPYEAH_H
17
18#include "tcp-recovery-ops.h"
19#include "tcp-scalable.h"
20
21namespace ns3
22{
23
24/**
25 * \ingroup congestionOps
26 *
27 * \brief An implementation of TCP YeAH
28 *
29 * YeAH-TCP (Yet Another HighSpeed TCP) is a heuristic designed to balance various
30 * requirements of a state-of-the-art congestion control algorithm:
31 * 1) fully exploit the link capacity of high BDP networks while inducing a small
32 * number of congestion events
33 * 2) compete friendly with Reno flows
34 * 3) achieve intra and RTT fairness
35 * 4) robust to random losses
36 * 5) achieve high performance regardless of buffer size
37 *
38 * YeAH operates between 2 modes: Fast and Slow mode. In the Fast mode when the
39 * queue occupancy is small and the network congestion level is low, YeAH
40 * increments its congestion window according to the aggressive STCP rule.
41 * When the number of packets in the queue grows beyond a threshold and the
42 * network congestion level is high, YeAH enters its Slow mode, acting as Reno
43 * with a decongestion algorithm. YeAH employs Vegas' mechanism for calculating
44 * the backlog as in Equation (1). The estimation of the network congestion
45 * level is shown in Equation (2).
46 *
47 * Q = (RTT - BaseRTT) (cwnd / RTT) (1)
48 * L = (RTT - BaseRTT) / BaseRTT (2)
49 *
50 * To ensure TCP friendliness, YeAH also implements an algorithm to detect the
51 * presence of legacy Reno flows. Upon the receipt of 3 duplicate ACKs,
52 * YeAH decreases its slow start threshold according to Equation (3) if
53 * it's not competing with Reno flows. Otherwise, the ssthresh is halved
54 * as in Reno.
55 *
56 * ssthresh = min{max{cwnd/8, Q}, cwnd/2}
57 *
58 * More information: http://www.csc.lsu.edu/~sjpark/cs7601/4-YeAH_TCP.pdf
59 */
60
61class TcpYeah : public TcpNewReno
62{
63 public:
64 /**
65 * \brief Get the type ID.
66 * \return the object TypeId
67 */
68 static TypeId GetTypeId();
69
70 /**
71 * Create an unbound tcp socket.
72 */
73 TcpYeah();
74
75 /**
76 * \brief Copy constructor
77 * \param sock the object to copy
78 */
79 TcpYeah(const TcpYeah& sock);
80 ~TcpYeah() override;
81
82 std::string GetName() const override;
83
84 /**
85 * \brief Compute RTTs needed to execute YeAH algorithm
86 *
87 * The function filters RTT samples from the last RTT to find
88 * the current smallest propagation delay + queueing delay (minRtt).
89 * We take the minimum to avoid the effects of delayed ACKs.
90 *
91 * The function also min-filters all RTT measurements seen to find the
92 * propagation delay (baseRtt).
93 *
94 * \param tcb internal congestion state
95 * \param segmentsAcked count of segments ACKed
96 * \param rtt last RTT
97 *
98 */
99 void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
100
101 /**
102 * \brief Enable/disable YeAH algorithm depending on the congestion state
103 *
104 * We only start a YeAH cycle when we are in normal congestion state (CA_OPEN state).
105 *
106 * \param tcb internal congestion state
107 * \param newState new congestion state to which the TCP is going to switch
108 */
110 const TcpSocketState::TcpCongState_t newState) override;
111
112 /**
113 * \brief Adjust cwnd following YeAH dual-mode algorithm
114 *
115 * \param tcb internal congestion state
116 * \param segmentsAcked count of segments ACKed
117 */
118 void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
119
120 /**
121 * \brief Get slow start threshold upon the receipt of 3 dupACKs
122 *
123 * \param tcb internal congestion state
124 * \param bytesInFlight number of outstanding bytes
125 *
126 * \return the slow start threshold value
127 */
128 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
129
130 Ptr<TcpCongestionOps> Fork() override;
131
132 protected:
133 private:
134 /**
135 * \brief Enable YeAH algorithm to start taking YeAH samples
136 *
137 * YeAH algorithm is enabled in the following situations:
138 * 1. at the establishment of a connection
139 * 2. after an RTO
140 * 3. after fast recovery
141 * 4. when an idle connection is restarted
142 *
143 * \param nextTxSequence Sequence to transmit next
144 */
145 void EnableYeah(const SequenceNumber32& nextTxSequence);
146
147 /**
148 * \brief Stop taking YeAH samples
149 */
150 void DisableYeah();
151
152 private:
153 uint32_t m_alpha; //!< Maximum backlog allowed at the bottleneck queue; Q_max in the paper
154 uint32_t m_gamma; //!< Fraction of queue to be removed per RTT when precautionary decongestion
155 //!< executed
156 uint32_t m_delta; //!< Log minimum fraction of cwnd to be removed on loss
157 uint32_t m_epsilon; //!< Log maximum fraction to be removed on early decongestion
158 uint32_t m_phy; //!< Maximum delta from base
159 uint32_t m_rho; //!< Minimum number of consecutive RTT to consider competition with Reno flows
160 //!< on loss
161 uint32_t m_zeta; //!< Minimum number of state switches to reset m_renoCount
162
163 uint32_t m_stcpAiFactor; //!< STCP additive increase parameter
164 Ptr<TcpScalable> m_stcp; //!< TcpScalable object
165 Time m_baseRtt; //!< Minimum of all YeAH RTT measurements seen during connection
166 Time m_minRtt; //!< Minimum of all RTTs measured within last RTT
167 uint32_t m_cntRtt; //!< Number of RTT measurements during last RTT
168 bool m_doingYeahNow; //!< If true, do YeAH for this RTT
169 SequenceNumber32 m_begSndNxt; //!< Right edge during last RTT
170 uint32_t m_lastQ; //!< Last number of packets in the bottleneck queue
171 uint32_t m_doingRenoNow; //!< Number of RTTs in "Slow" mode
172 uint32_t m_renoCount; //!< Estimated cwnd of competing Reno flow
173 uint32_t m_fastCount; //!< Number of RTTs in "Fast" mode
174};
175
176} // namespace ns3
177
178#endif // TCPYEAH_H
Smart pointer class similar to boost::intrusive_ptr.
The NewReno implementation.
TcpCongState_t
Definition of the Congestion state machine.
An implementation of TCP YeAH.
Definition tcp-yeah.h:62
Time m_minRtt
Minimum of all RTTs measured within last RTT.
Definition tcp-yeah.h:166
uint32_t m_zeta
Minimum number of state switches to reset m_renoCount.
Definition tcp-yeah.h:161
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Adjust cwnd following YeAH dual-mode algorithm.
Definition tcp-yeah.cc:193
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Compute RTTs needed to execute YeAH algorithm.
Definition tcp-yeah.cc:138
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Definition tcp-yeah.cc:132
uint32_t m_renoCount
Estimated cwnd of competing Reno flow.
Definition tcp-yeah.h:172
bool m_doingYeahNow
If true, do YeAH for this RTT.
Definition tcp-yeah.h:168
void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override
Enable/disable YeAH algorithm depending on the congestion state.
Definition tcp-yeah.cc:178
static TypeId GetTypeId()
Get the type ID.
Definition tcp-yeah.cc:26
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
Definition tcp-yeah.h:167
std::string GetName() const override
Get the name of the congestion control algorithm.
Definition tcp-yeah.cc:304
uint32_t m_lastQ
Last number of packets in the bottleneck queue.
Definition tcp-yeah.h:170
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get slow start threshold upon the receipt of 3 dupACKs.
Definition tcp-yeah.cc:310
SequenceNumber32 m_begSndNxt
Right edge during last RTT.
Definition tcp-yeah.h:169
uint32_t m_stcpAiFactor
STCP additive increase parameter.
Definition tcp-yeah.h:163
Ptr< TcpScalable > m_stcp
TcpScalable object.
Definition tcp-yeah.h:164
uint32_t m_alpha
Maximum backlog allowed at the bottleneck queue; Q_max in the paper.
Definition tcp-yeah.h:153
uint32_t m_phy
Maximum delta from base.
Definition tcp-yeah.h:158
uint32_t m_epsilon
Log maximum fraction to be removed on early decongestion.
Definition tcp-yeah.h:157
void EnableYeah(const SequenceNumber32 &nextTxSequence)
Enable YeAH algorithm to start taking YeAH samples.
Definition tcp-yeah.cc:159
uint32_t m_doingRenoNow
Number of RTTs in "Slow" mode.
Definition tcp-yeah.h:171
uint32_t m_rho
Minimum number of consecutive RTT to consider competition with Reno flows on loss.
Definition tcp-yeah.h:159
TcpYeah()
Create an unbound tcp socket.
Definition tcp-yeah.cc:76
void DisableYeah()
Stop taking YeAH samples.
Definition tcp-yeah.cc:170
uint32_t m_fastCount
Number of RTTs in "Fast" mode.
Definition tcp-yeah.h:173
Time m_baseRtt
Minimum of all YeAH RTT measurements seen during connection.
Definition tcp-yeah.h:165
uint32_t m_gamma
Fraction of queue to be removed per RTT when precautionary decongestion executed.
Definition tcp-yeah.h:154
uint32_t m_delta
Log minimum fraction of cwnd to be removed on loss.
Definition tcp-yeah.h:156
~TcpYeah() override
Definition tcp-yeah.cc:126
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.