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