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