A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-illinois.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 ResiliNets, ITTC, University of Kansas
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Keerthi Ganta <keerthiganta@ku.edu>
18 * Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
19 *
20 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
21 * ResiliNets Research Group https://resilinets.org/
22 * Information and Telecommunication Technology Center (ITTC)
23 * and Department of Electrical Engineering and Computer Science
24 * The University of Kansas Lawrence, KS USA.
25 */
26
27#ifndef TCPILLINOIS_H
28#define TCPILLINOIS_H
29
30#include "tcp-congestion-ops.h"
31
32namespace ns3
33{
34
35class TcpSocketState;
36
37/**
38 * \ingroup congestionOps
39 *
40 * \brief An implementation of TCP Illinois algorithm
41 *
42 * TCP Illinois is a hybrid congestion control algorithm designed for
43 * high-speed networks. Illinois implements a Concave-AIMD (or C-AIMD)
44 * algorithm that uses packet loss as the primary congestion signal to
45 * determine the direction of window update and queueing delay as the
46 * secondary congestion signal to determine the amount of change.
47 *
48 * The additive increase and multiplicative decrease factors (denoted as
49 * alpha and beta, respectively) are functions of the current average queueing
50 * delay da as shown in Equations (1) and (2). To improve the protocol
51 * robustness against sudden fluctuations in its delay sampling,
52 * Illinois allows the increment of alpha to alphaMax
53 * only if da stays below d1 for a some (theta) amount of time.
54 *
55 * / alphaMax if da <= d1
56 * alpha = (1)
57 * \ k1 / (k2 + da) otherwise
58 *
59 * / betaMin if da <= d2
60 * beta = k3 + k4da if d2 < da < d3 (2)
61 * \ betaMax otherwise
62 *
63 * where the calculations of k1, k2, k3, and k4 are shown in Equations (3), (4),
64 * (5), and (6).
65 *
66 * k1 = (dm - d1)(alphaMin)alphaMax / (alphaMax - alphaMin) (3)
67 *
68 * k2 = ((dm - d1)alphaMin / (alphaMax - alphaMin)) - d1 (4)
69 *
70 * k3 = ((alphaMin)d3 - (alphaMax)d2) / (d3 - d2) (5)
71 *
72 * k4 = (alphaMax - alphaMin) / (d3 - d2) (6)
73 *
74 * with da the current average queueing delay calculated in Equation (7) where:
75 * Ta is the average RTT (sumRtt / cntRtt in the implementation) and
76 * Tmin (baseRtt in the implementation) is the minimum RTT ever seen
77 * dm the maximum (average) queueing delay calculated in Equation (8) where
78 * Tmax (maxRtt in the implementation) is the maximum RTT ever seen
79 *
80 * da = Ta - Tmin (7)
81 *
82 * dm = Tmax - Tmin (8)
83 *
84 * di (i = 1,2,3) are calculated in Equation (9) (0 <= eta_1 < 1, and
85 * 0 <= eta_2 <= eta_3 <=1)
86 *
87 * di = (eta_i)dm (9)
88 *
89 * Illinois only executes its adaptation of alpha and beta when cwnd exceeds a
90 * threshold called winThresh. Otherwise, it sets alpha and beta to the base
91 * values of 1 and 0.5, respectively.
92 *
93 * Following the implementation of Illinois in the Linux kernel, we use the following
94 * default parameter settings:
95 *
96 * alphaMin = 0.3 (0.1 in the Illinois paper)
97 * alphaMax = 10.0
98 * betaMin = 0.125
99 * betaMax = 0.5
100 * winThresh = 15 (10 in the Illinois paper)
101 * theta = 5
102 * eta1 = 0.01
103 * eta2 = 0.1
104 * eta3 = 0.8
105 *
106 * More information: http://www.doi.org/10.1145/1190095.1190166
107 */
109{
110 public:
111 /**
112 * \brief Get the type ID.
113 * \return the object TypeId
114 */
115 static TypeId GetTypeId();
116
117 /**
118 * Create an unbound tcp socket.
119 */
120 TcpIllinois();
121
122 /**
123 * \brief Copy constructor
124 * \param sock the object to copy
125 */
126 TcpIllinois(const TcpIllinois& sock);
127 ~TcpIllinois() override;
128
129 std::string GetName() const override;
130
131 /**
132 * \brief Get slow start threshold after congestion event
133 *
134 * \param tcb internal congestion state
135 * \param bytesInFlight bytes in flight
136 *
137 * \return the slow start threshold value
138 */
139 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
140
141 Ptr<TcpCongestionOps> Fork() override;
142
143 /**
144 * \brief Reset Illinois parameters to default values upon a loss
145 *
146 * \param tcb internal congestion state
147 * \param newState new congestion state to which the TCP is going to switch
148 */
150 const TcpSocketState::TcpCongState_t newState) override;
151
152 /**
153 * \brief Adjust cwnd following Illinois congestion avoidance algorithm
154 *
155 * \param tcb internal congestion state
156 * \param segmentsAcked count of segments ACKed
157 */
158 void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
159
160 /**
161 * \brief Measure RTT for each ACK
162 * Keep track of min and max RTT
163 *
164 * \param tcb internal congestion state
165 * \param segmentsAcked count of segments ACKed
166 * \param rtt last RTT
167 */
168 void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
169
170 protected:
171 private:
172 /**
173 * \brief Recalculate alpha and beta every RTT
174 *
175 * \param cWnd current Cwnd (in bytes)
176 */
177 void RecalcParam(uint32_t cWnd);
178
179 /**
180 * \brief Calculate additive increase factor alpha
181 *
182 * If average queueing delay is at minimum, then alpha is set to alphaMax.
183 * Otherwise, alpha is a decreasing function of average queueing delay.
184 *
185 * \param da current average queueing delay
186 * \param dm maximum average queueing delay
187 *
188 */
189 void CalculateAlpha(double da, double dm);
190
191 /**
192 * \brief Calculate multiplicative decrease factor beta
193 *
194 * If the current average queueing delay is <= 10% of max. (average) queueing delay,
195 * beta is set to betaMin, which equals to 1/8 by default.
196 * If the current average queueing delay is >= 80% of max. (average) queueing delay,
197 * beta is set to betaMax, which equals to 1/2 by default.
198 * Otherwise, beta is an increasing function of average queueing delay.
199 *
200 * \param da current average queueing delay
201 * \param dm maximum average queueing delay
202 *
203 */
204 void CalculateBeta(double da, double dm);
205
206 /**
207 * \brief Calculate average queueing delay
208 *
209 * \return average queueing delay da
210 */
211 Time CalculateAvgDelay() const;
212
213 /**
214 * \brief Calculate maximum queueing delay
215 *
216 * \return maximum average queueing delay dm
217 */
218 Time CalculateMaxDelay() const;
219
220 /**
221 * \brief Reset Illinois parameters
222 *
223 * \param nextTxSequence Next sequence to transmit
224 */
225 void Reset(const SequenceNumber32& nextTxSequence);
226
227 private:
228 Time m_sumRtt; //!< Sum of all RTT measurements during last RTT
229 uint32_t m_cntRtt; //!< Number of RTT measurements during last RTT
230 Time m_baseRtt; //!< Minimum of all RTT measurements
231 Time m_maxRtt; //!< Maximum of all RTT measurements
232 SequenceNumber32 m_endSeq; //!< Right edge of current RTT
233 bool m_rttAbove; //!< True when da > d1
234 uint8_t m_rttLow; //!< Number of RTTs da has stayed below d1
235 double m_alphaMin; //!< Minimum alpha threshold
236 double m_alphaMax; //!< Maximum alpha threshold
237 double m_alphaBase; //!< Base value of alpha for standard AIMD
238 double m_alpha; //!< Additive increase factor
239 double m_betaMin; //!< Minimum beta threshold
240 double m_betaMax; //!< Maximum beta threshold
241 double m_betaBase; //!< Base value of beta for standard AIMD
242 double m_beta; //!< Multiplicative decrease factor
243 uint32_t m_winThresh; //!< Window threshold for adaptive sizing
244 uint32_t m_theta; //!< Number of RTTs required before setting alpha to its max
245 uint32_t m_ackCnt; //!< Number of received ACK
246};
247
248} // namespace ns3
249
250#endif // TCPILLINOIS_H
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
An implementation of TCP Illinois algorithm.
Definition: tcp-illinois.h:109
double m_alphaBase
Base value of alpha for standard AIMD.
Definition: tcp-illinois.h:237
double m_beta
Multiplicative decrease factor.
Definition: tcp-illinois.h:242
uint32_t m_ackCnt
Number of received ACK.
Definition: tcp-illinois.h:245
void RecalcParam(uint32_t cWnd)
Recalculate alpha and beta every RTT.
Time CalculateMaxDelay() const
Calculate maximum queueing delay.
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get slow start threshold after congestion event.
bool m_rttAbove
True when da > d1.
Definition: tcp-illinois.h:233
std::string GetName() const override
Get the name of the congestion control algorithm.
static TypeId GetTypeId()
Get the type ID.
Definition: tcp-illinois.cc:40
double m_betaMin
Minimum beta threshold.
Definition: tcp-illinois.h:239
void CalculateAlpha(double da, double dm)
Calculate additive increase factor alpha.
void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override
Reset Illinois parameters to default values upon a loss.
Time m_baseRtt
Minimum of all RTT measurements.
Definition: tcp-illinois.h:230
double m_alphaMin
Minimum alpha threshold.
Definition: tcp-illinois.h:235
uint32_t m_winThresh
Window threshold for adaptive sizing.
Definition: tcp-illinois.h:243
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
Definition: tcp-illinois.h:229
TcpIllinois()
Create an unbound tcp socket.
Definition: tcp-illinois.cc:89
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Adjust cwnd following Illinois congestion avoidance algorithm.
uint8_t m_rttLow
Number of RTTs da has stayed below d1.
Definition: tcp-illinois.h:234
void CalculateBeta(double da, double dm)
Calculate multiplicative decrease factor beta.
Time m_maxRtt
Maximum of all RTT measurements.
Definition: tcp-illinois.h:231
double m_alpha
Additive increase factor.
Definition: tcp-illinois.h:238
double m_betaMax
Maximum beta threshold.
Definition: tcp-illinois.h:240
double m_betaBase
Base value of beta for standard AIMD.
Definition: tcp-illinois.h:241
uint32_t m_theta
Number of RTTs required before setting alpha to its max.
Definition: tcp-illinois.h:244
~TcpIllinois() override
Time m_sumRtt
Sum of all RTT measurements during last RTT.
Definition: tcp-illinois.h:228
double m_alphaMax
Maximum alpha threshold.
Definition: tcp-illinois.h:236
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
void Reset(const SequenceNumber32 &nextTxSequence)
Reset Illinois parameters.
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Measure RTT for each ACK Keep track of min and max RTT.
Time CalculateAvgDelay() const
Calculate average queueing delay.
SequenceNumber32 m_endSeq
Right edge of current RTT.
Definition: tcp-illinois.h:232
The NewReno implementation.
TcpCongState_t
Definition of the Congestion state machine.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.