A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
14
class
TcpBicIncrementTest
;
15
class
TcpBicDecrementTest
;
16
17
namespace
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
70
class
TcpBic
:
public
TcpCongestionOps
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
*/
102
virtual
uint32_t
Update
(
Ptr<TcpSocketState>
tcb);
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
TcpBicDecrementTest
Testing the congestion avoidance decrement on TcpBic.
Definition
tcp-bic-test.cc:186
TcpBicIncrementTest
Testing the congestion avoidance increment on TcpBic.
Definition
tcp-bic-test.cc:24
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TcpBic
BIC congestion control algorithm.
Definition
tcp-bic.h:71
ns3::TcpBic::m_fastConvergence
bool m_fastConvergence
Enable or disable fast convergence algorithm.
Definition
tcp-bic.h:117
ns3::TcpBic::m_lastMaxCwnd
uint32_t m_lastMaxCwnd
Last maximum cWnd.
Definition
tcp-bic.h:125
ns3::TcpBic::m_lowWnd
uint32_t m_lowWnd
Lower bound on congestion window.
Definition
tcp-bic.h:120
ns3::TcpBic::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
tcp-bic.cc:19
ns3::TcpBic::GetSsThresh
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
ns3::TcpBic::m_b
uint8_t m_b
Binary search coefficient.
Definition
tcp-bic.h:128
ns3::TcpBic::m_lastCwnd
uint32_t m_lastCwnd
Last cWnd.
Definition
tcp-bic.h:126
ns3::TcpBic::m_maxIncr
uint32_t m_maxIncr
Maximum window increment.
Definition
tcp-bic.h:119
ns3::TcpBic::m_beta
double m_beta
Beta for cubic multiplicative increase.
Definition
tcp-bic.h:118
ns3::TcpBic::Update
virtual uint32_t Update(Ptr< TcpSocketState > tcb)
Bic window update after a new ack received.
Definition
tcp-bic.cc:129
ns3::TcpBic::TcpBic
TcpBic()
Constructor.
Definition
tcp-bic.cc:63
ns3::TcpBic::m_smoothPart
uint32_t m_smoothPart
Number of RTT needed to reach Wmax from Wmax-B.
Definition
tcp-bic.h:121
ns3::TcpBic::IncreaseWindow
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Congestion avoidance algorithm implementation.
Definition
tcp-bic.cc:90
ns3::TcpBic::m_epochStart
Time m_epochStart
Beginning of an epoch.
Definition
tcp-bic.h:127
ns3::TcpBic::m_cWndCnt
uint32_t m_cWndCnt
cWnd integer-to-float counter
Definition
tcp-bic.h:124
ns3::TcpBic::Fork
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Definition
tcp-bic.cc:269
ns3::TcpBic::GetName
std::string GetName() const override
Get the name of the congestion control algorithm.
Definition
tcp-bic.cc:226
ns3::TcpCongestionOps
Congestion control abstract class.
Definition
tcp-congestion-ops.h:41
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
tcp-congestion-ops.h
tcp-recovery-ops.h
src
internet
model
tcp-bic.h
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0