A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-veno.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: Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
18 *
19 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
20 * ResiliNets Research Group https://resilinets.org/
21 * Information and Telecommunication Technology Center (ITTC)
22 * and Department of Electrical Engineering and Computer Science
23 * The University of Kansas Lawrence, KS USA.
24 */
25
26#ifndef TCPVENO_H
27#define TCPVENO_H
28
29#include "tcp-congestion-ops.h"
30
31namespace ns3
32{
33
34class TcpSocketState;
35
36/**
37 * \ingroup congestionOps
38 *
39 * \brief An implementation of TCP Veno
40 *
41 * TCP Veno enhances Reno algorithm for more effectively dealing with random
42 * packet loss in wireless access networks by employing Vegas's method in
43 * estimating the backlog at the bottleneck queue to distinguish between
44 * congestive and non-congestive states.
45 *
46 * The backlog (the number of packets accumulated at the bottleneck queue) is
47 * calculated using Equation (1):
48 *
49 * N = Actual * (RTT - BaseRTT) = Diff * BaseRTT (1)
50 * where
51 * Diff = Expected - Actual = cwnd/BaseRTT - cwnd/RTT
52 *
53 * Veno makes decision on cwnd modification based on the calculated N and its
54 * predefined threshold beta.
55 *
56 * Specifically, it refines the additive increase algorithm of Reno so that the
57 * connection can stay longer in the stable state by incrementing cwnd by
58 * 1/cwnd for every other new ACK received after the available bandwidth has
59 * been fully utilized, i.e. when N exceeds beta. Otherwise, Veno increases
60 * its cwnd by 1/cwnd upon every new ACK receipt as in Reno.
61 *
62 * In the multiplicative decrease algorithm, when Veno is in the non-congestive
63 * state, i.e. when N is less than beta, Veno decrements its cwnd by only 1/5
64 * because the loss encountered is more likely a corruption-based loss than a
65 * congestion-based. Only when N is greater than beta, Veno halves its sending
66 * rate as in Reno.
67 *
68 * More information: http://dx.doi.org/10.1109/JSAC.2002.807336
69 */
70
71class TcpVeno : public TcpNewReno
72{
73 public:
74 /**
75 * \brief Get the type ID.
76 * \return the object TypeId
77 */
78 static TypeId GetTypeId();
79
80 /**
81 * Create an unbound tcp socket.
82 */
83 TcpVeno();
84
85 /**
86 * \brief Copy constructor
87 * \param sock the object to copy
88 */
89 TcpVeno(const TcpVeno& sock);
90 ~TcpVeno() override;
91
92 std::string GetName() const override;
93
94 /**
95 * \brief Perform RTT sampling needed to execute Veno algorithm
96 *
97 * The function filters RTT samples from the last RTT to find
98 * the current smallest propagation delay + queueing delay (m_minRtt).
99 * We take the minimum to avoid the effects of delayed ACKs.
100 *
101 * The function also min-filters all RTT measurements seen to find the
102 * propagation delay (m_baseRtt).
103 *
104 * \param tcb internal congestion state
105 * \param segmentsAcked count of segments ACKed
106 * \param rtt last RTT
107 *
108 */
109 void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
110
111 /**
112 * \brief Enable/disable Veno depending on the congestion state
113 *
114 * We only start a Veno when we are in normal congestion state (CA_OPEN state).
115 *
116 * \param tcb internal congestion state
117 * \param newState new congestion state to which the TCP is going to switch
118 */
120 const TcpSocketState::TcpCongState_t newState) override;
121
122 /**
123 * \brief Adjust cwnd following Veno additive increase algorithm
124 *
125 * \param tcb internal congestion state
126 * \param segmentsAcked count of segments ACKed
127 */
128 void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
129
130 /**
131 * \brief Get slow start threshold during Veno multiplicative-decrease phase
132 *
133 * \param tcb internal congestion state
134 * \param bytesInFlight bytes in flight
135 *
136 * \return the slow start threshold value
137 */
138 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
139
140 Ptr<TcpCongestionOps> Fork() override;
141
142 protected:
143 private:
144 /**
145 * \brief Enable Veno algorithm to start Veno sampling
146 *
147 * Veno algorithm is enabled in the following situations:
148 * 1. at the establishment of a connection
149 * 2. after an RTO
150 * 3. after fast recovery
151 * 4. when an idle connection is restarted
152 *
153 */
154 void EnableVeno();
155
156 /**
157 * \brief Turn off Veno
158 */
159 void DisableVeno();
160
161 private:
162 Time m_baseRtt; //!< Minimum of all RTT measurements seen during connection
163 Time m_minRtt; //!< Minimum of RTTs measured within last RTT
164 uint32_t m_cntRtt; //!< Number of RTT measurements during last RTT
165 bool m_doingVenoNow; //!< If true, do Veno for this RTT
166 uint32_t m_diff; //!< Difference between expected and actual throughput
167 bool m_inc; //!< If true, cwnd needs to be incremented
168 uint32_t m_ackCnt; //!< Number of received ACK
169 uint32_t m_beta; //!< Threshold for congestion detection
170};
171
172} // namespace ns3
173
174#endif // TCPVENO_H
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
The NewReno implementation.
TcpCongState_t
Definition of the Congestion state machine.
An implementation of TCP Veno.
Definition: tcp-veno.h:72
std::string GetName() const override
Get the name of the congestion control algorithm.
Definition: tcp-veno.cc:234
bool m_inc
If true, cwnd needs to be incremented.
Definition: tcp-veno.h:167
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Perform RTT sampling needed to execute Veno algorithm.
Definition: tcp-veno.cc:93
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get slow start threshold during Veno multiplicative-decrease phase.
Definition: tcp-veno.cc:240
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
Definition: tcp-veno.h:164
static TypeId GetTypeId()
Get the type ID.
Definition: tcp-veno.cc:39
void EnableVeno()
Enable Veno algorithm to start Veno sampling.
Definition: tcp-veno.cc:114
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Adjust cwnd following Veno additive increase algorithm.
Definition: tcp-veno.cc:147
Time m_minRtt
Minimum of RTTs measured within last RTT.
Definition: tcp-veno.h:163
bool m_doingVenoNow
If true, do Veno for this RTT.
Definition: tcp-veno.h:165
uint32_t m_ackCnt
Number of received ACK.
Definition: tcp-veno.h:168
uint32_t m_beta
Threshold for congestion detection.
Definition: tcp-veno.h:169
void DisableVeno()
Turn off Veno.
Definition: tcp-veno.cc:123
void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override
Enable/disable Veno depending on the congestion state.
Definition: tcp-veno.cc:131
~TcpVeno() override
Definition: tcp-veno.cc:81
TcpVeno()
Create an unbound tcp socket.
Definition: tcp-veno.cc:53
uint32_t m_diff
Difference between expected and actual throughput.
Definition: tcp-veno.h:166
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Definition: tcp-veno.cc:87
Time m_baseRtt
Minimum of all RTT measurements seen during connection.
Definition: tcp-veno.h:162
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.