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