A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-bic.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Natale Patriciello <natale.patriciello@gmail.com>
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 */
18
19#ifndef TCPBIC_H
20#define TCPBIC_H
21
22#include "tcp-congestion-ops.h"
23#include "tcp-recovery-ops.h"
24
27
28namespace ns3
29{
30
31/**
32 * \ingroup congestionOps
33 *
34 * \brief BIC congestion control algorithm
35 *
36 * In TCP Bic the congestion control problem is viewed as a search
37 * problem. Taking as a starting point the current window value
38 * and as a target point the last maximum window value
39 * (i.e. the cWnd value just before the loss event) a binary search
40 * technique can be used to update the cWnd value at the midpoint between
41 * the two, directly or using an additive increase strategy if the distance from
42 * the current window is too large.
43 *
44 * This way, assuming a no-loss period, the congestion window logarithmically
45 * approaches the maximum value of cWnd until the difference between it and cWnd
46 * falls below a preset threshold. After reaching such a value (or the maximum
47 * window is unknown, i.e. the binary search does not start at all) the algorithm
48 * switches to probing the new maximum window with a 'slow start' strategy.
49 *
50 * If a loss occur in either these phases, the current window (before the loss)
51 * can be treated as the new maximum, and the reduced (with a multiplicative
52 * decrease factor Beta) window size can be used as the new minimum.
53 *
54 * To maintain the performance of TCP Bic as close as possible with the Linux
55 * implementation, and at the same time maintain the friendliness with other TCP
56 * flavors, the cWnd is increased only after a certain number of ACKs
57 * are received, following RFC 6356. After the slow start phase, and after each
58 * new ACK, a value is calculated by the method Update. This number
59 * (m_cnt in the code) represents the ACK packets that should be received
60 * before increasing the cWnd by one segment. After a trivial check on the
61 * arrived ACKs (represented by m_cWndCnt in the code), the
62 * cWnd can be increased and m_cWndCnt can be set to zero, or
63 * otherwise m_cWndCnt can be increased by one and the
64 * cWnd can be left untouched.
65 *
66 * The binary search on the cWnd size space is done by varying the returned
67 * cnt, depending on the internal state of the class (e.g. the last maximum
68 * and the current cWnd size).
69 *
70 * The reference paper for BIC can be found in:
71 * http://an.kaist.ac.kr/courses/2006/cs540/reading/bic-tcp.pdf
72 *
73 * This model has a number of configurable parameters that are exposed as
74 * attributes of the TcpBic TypeId. This model also exports trace sources,
75 * for tracking the congestion window, slow start threshold, and the internal
76 * state of the protocol.
77 *
78 * More information on this implementation: http://dl.acm.org/citation.cfm?id=2756518
79 */
80
82{
83 public:
84 /**
85 * \brief Get the type ID.
86 * \return the object TypeId
87 */
88 static TypeId GetTypeId();
89
90 /**
91 * \brief Constructor
92 */
93 TcpBic();
94
95 /**
96 * Copy constructor.
97 * \param sock The socket to copy from.
98 */
99 TcpBic(const TcpBic& sock);
100
101 std::string GetName() const override;
102 void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
103 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
104
105 Ptr<TcpCongestionOps> Fork() override;
106
107 protected:
108 /**
109 * \brief Bic window update after a new ack received
110 * \param tcb the socket state.
111 * \returns The number of segments acked since the last cwnd increment.
112 */
114
115 private:
116 /**
117 * \brief TcpBicIncrementTest friend class (for tests).
118 * \relates TcpBicIncrementTest
119 */
120 friend class ::TcpBicIncrementTest;
121 /**
122 * \brief TcpBicDecrementTest friend class (for tests).
123 * \relates TcpBicDecrementTest
124 */
125 friend class ::TcpBicDecrementTest;
126
127 // User parameters
128 bool m_fastConvergence; //!< Enable or disable fast convergence algorithm
129 double m_beta; //!< Beta for cubic multiplicative increase
130 uint32_t m_maxIncr; //!< Maximum window increment
131 uint32_t m_lowWnd; //!< Lower bound on congestion window
132 uint32_t m_smoothPart; //!< Number of RTT needed to reach Wmax from Wmax-B
133
134 // Bic parameters
135 uint32_t m_cWndCnt; //!< cWnd integer-to-float counter
136 uint32_t m_lastMaxCwnd; //!< Last maximum cWnd
137 uint32_t m_lastCwnd; //!< Last cWnd
138 Time m_epochStart; //!< Beginning of an epoch
139 uint8_t m_b; //!< Binary search coefficient
140};
141
142} // namespace ns3
143#endif // TCPBIC_H
Testing the congestion avoidance decrement on TcpBic.
Testing the congestion avoidance increment on TcpBic.
Definition: tcp-bic-test.cc:35
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
BIC congestion control algorithm.
Definition: tcp-bic.h:82
bool m_fastConvergence
Enable or disable fast convergence algorithm.
Definition: tcp-bic.h:128
uint32_t m_lastMaxCwnd
Last maximum cWnd.
Definition: tcp-bic.h:136
uint32_t m_lowWnd
Lower bound on congestion window.
Definition: tcp-bic.h:131
static TypeId GetTypeId()
Get the type ID.
Definition: tcp-bic.cc:30
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
Definition: tcp-bic.cc:243
uint8_t m_b
Binary search coefficient.
Definition: tcp-bic.h:139
uint32_t m_lastCwnd
Last cWnd.
Definition: tcp-bic.h:137
uint32_t m_maxIncr
Maximum window increment.
Definition: tcp-bic.h:130
double m_beta
Beta for cubic multiplicative increase.
Definition: tcp-bic.h:129
virtual uint32_t Update(Ptr< TcpSocketState > tcb)
Bic window update after a new ack received.
Definition: tcp-bic.cc:140
TcpBic()
Constructor.
Definition: tcp-bic.cc:74
uint32_t m_smoothPart
Number of RTT needed to reach Wmax from Wmax-B.
Definition: tcp-bic.h:132
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Congestion avoidance algorithm implementation.
Definition: tcp-bic.cc:101
Time m_epochStart
Beginning of an epoch.
Definition: tcp-bic.h:138
uint32_t m_cWndCnt
cWnd integer-to-float counter
Definition: tcp-bic.h:135
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Definition: tcp-bic.cc:280
std::string GetName() const override
Get the name of the congestion control algorithm.
Definition: tcp-bic.cc:237
Congestion control abstract class.
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.