A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fq-cobalt-queue-disc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
3 * Copyright (c) 2020 NITK Surathkal (adapted for COBALT)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Pasquale Imputato <p.imputato@gmail.com>
19 * Stefano Avallone <stefano.avallone@unina.it>
20 * Modified by: Bhaskar Kataria <bhaskar.k7920@gmail.com> (for COBALT)
21 * Tom Henderson <tomhend@u.washington.edu>
22 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
23 * Vivek Jain <jain.vivek.anand@gmail.com>
24 * Ankit Deepak <adadeepak8@gmail.com>
25 */
26
27#ifndef FQ_COBALT_QUEUE_DISC
28#define FQ_COBALT_QUEUE_DISC
29
30#include "queue-disc.h"
31
32#include "ns3/object-factory.h"
33
34#include <list>
35#include <map>
36
37namespace ns3
38{
39
40/**
41 * \ingroup traffic-control
42 *
43 * \brief A flow queue used by the FqCobalt queue disc
44 */
45
47{
48 public:
49 /**
50 * \brief Get the type ID.
51 * \return the object TypeId
52 */
53 static TypeId GetTypeId();
54 /**
55 * \brief FqCobaltFlow constructor
56 */
58
59 ~FqCobaltFlow() override;
60
61 /**
62 * \enum FlowStatus
63 * \brief Used to determine the status of this flow queue
64 */
66 {
70 };
71
72 /**
73 * \brief Set the deficit for this flow
74 * \param deficit the deficit for this flow
75 */
76 void SetDeficit(uint32_t deficit);
77 /**
78 * \brief Get the deficit for this flow
79 * \return the deficit for this flow
80 */
81 int32_t GetDeficit() const;
82 /**
83 * \brief Increase the deficit for this flow
84 * \param deficit the amount by which the deficit is to be increased
85 */
86 void IncreaseDeficit(int32_t deficit);
87 /**
88 * \brief Set the status for this flow
89 * \param status the status for this flow
90 */
91 void SetStatus(FlowStatus status);
92 /**
93 * \brief Get the status of this flow
94 * \return the status of this flow
95 */
96 FlowStatus GetStatus() const;
97 /**
98 * \brief Set the index for this flow
99 * \param index the index for this flow
100 */
101 void SetIndex(uint32_t index);
102 /**
103 * \brief Get the index of this flow
104 * \return the index of this flow
105 */
106 uint32_t GetIndex() const;
107
108 private:
109 int32_t m_deficit; //!< the deficit for this flow
110 FlowStatus m_status; //!< the status of this flow
111 uint32_t m_index; //!< the index for this flow
112};
113
114/**
115 * \ingroup traffic-control
116 *
117 * \brief A FqCobalt packet queue disc
118 */
119
121{
122 public:
123 /**
124 * \brief Get the type ID.
125 * \return the object TypeId
126 */
127 static TypeId GetTypeId();
128 /**
129 * \brief FqCobaltQueueDisc constructor
130 */
132
133 ~FqCobaltQueueDisc() override;
134
135 /**
136 * \brief Set the quantum value.
137 *
138 * \param quantum The number of bytes each queue gets to dequeue on each round of the scheduling
139 * algorithm
140 */
141 void SetQuantum(uint32_t quantum);
142
143 /**
144 * \brief Get the quantum value.
145 *
146 * \returns The number of bytes each queue gets to dequeue on each round of the scheduling
147 * algorithm
148 */
149 uint32_t GetQuantum() const;
150
151 // Reasons for dropping packets
152 static constexpr const char* UNCLASSIFIED_DROP =
153 "Unclassified drop"; //!< No packet filter able to classify packet
154 static constexpr const char* OVERLIMIT_DROP = "Overlimit drop"; //!< Overlimit dropped packets
155
156 private:
157 bool DoEnqueue(Ptr<QueueDiscItem> item) override;
158 Ptr<QueueDiscItem> DoDequeue() override;
159 bool CheckConfig() override;
160 void InitializeParams() override;
161
162 /**
163 * \brief Drop a packet from the head of the queue with the largest current byte count
164 * \return the index of the queue with the largest current byte count
165 */
167
168 /**
169 * Compute the index of the queue for the flow having the given flowHash,
170 * according to the set associative hash approach.
171 *
172 * \param flowHash the hash of the flow 5-tuple
173 * \return the index of the queue for the given flow
174 */
176
177 std::string m_interval; //!< CoDel interval attribute
178 std::string m_target; //!< CoDel target attribute
179 uint32_t m_quantum; //!< Deficit assigned to flows at each round
180 uint32_t m_flows; //!< Number of flow queues
181 uint32_t m_setWays; //!< size of a set of queues (used by set associative hash)
182 uint32_t m_dropBatchSize; //!< Max number of packets dropped from the fat flow
183 uint32_t m_perturbation; //!< hash perturbation value
184 bool m_useEcn; //!< True if ECN is used (packets are marked instead of being dropped)
185 Time m_ceThreshold; //!< Threshold above which to CE mark
186 bool m_enableSetAssociativeHash; //!< whether to enable set associative hash
187 bool m_useL4s; //!< True if L4S is used (ECT1 packets are marked at CE threshold)
188 double m_increment; //!< increment value for marking probability
189 double m_decrement; //!< decrement value for marking probability
190 double m_Pdrop; //!< Drop Probability
191 Time m_blueThreshold; //!< Threshold to enable blue enhancement
192
193 std::list<Ptr<FqCobaltFlow>> m_newFlows; //!< The list of new flows
194 std::list<Ptr<FqCobaltFlow>> m_oldFlows; //!< The list of old flows
195
196 std::map<uint32_t, uint32_t> m_flowsIndices; //!< Map with the index of class for each flow
197 std::map<uint32_t, uint32_t> m_tags; //!< Tags used by set associative hash
198
199 ObjectFactory m_flowFactory; //!< Factory to create a new flow
200 ObjectFactory m_queueDiscFactory; //!< Factory to create a new queue
201};
202
203} // namespace ns3
204
205#endif /* FQ_COBALT_QUEUE_DISC */
A flow queue used by the FqCobalt queue disc.
FlowStatus GetStatus() const
Get the status of this flow.
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
FqCobaltFlow()
FqCobaltFlow constructor.
void SetIndex(uint32_t index)
Set the index for this flow.
void IncreaseDeficit(int32_t deficit)
Increase the deficit for this flow.
int32_t m_deficit
the deficit for this flow
uint32_t m_index
the index for this flow
int32_t GetDeficit() const
Get the deficit for this flow.
uint32_t GetIndex() const
Get the index of this flow.
FlowStatus
Used to determine the status of this flow queue.
static TypeId GetTypeId()
Get the type ID.
FlowStatus m_status
the status of this flow
void SetStatus(FlowStatus status)
Set the status for this flow.
A FqCobalt packet queue disc.
ObjectFactory m_flowFactory
Factory to create a new flow.
std::map< uint32_t, uint32_t > m_tags
Tags used by set associative hash.
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
bool CheckConfig() override
Check whether the current configuration is correct.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
Time m_ceThreshold
Threshold above which to CE mark.
bool m_enableSetAssociativeHash
whether to enable set associative hash
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
std::list< Ptr< FqCobaltFlow > > m_newFlows
The list of new flows.
uint32_t m_quantum
Deficit assigned to flows at each round.
std::list< Ptr< FqCobaltFlow > > m_oldFlows
The list of old flows.
bool m_useEcn
True if ECN is used (packets are marked instead of being dropped)
uint32_t SetAssociativeHash(uint32_t flowHash)
Compute the index of the queue for the flow having the given flowHash, according to the set associati...
std::string m_target
CoDel target attribute.
uint32_t m_perturbation
hash perturbation value
FqCobaltQueueDisc()
FqCobaltQueueDisc constructor.
uint32_t m_dropBatchSize
Max number of packets dropped from the fat flow.
double m_increment
increment value for marking probability
std::string m_interval
CoDel interval attribute.
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packets.
double m_decrement
decrement value for marking probability
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
static constexpr const char * UNCLASSIFIED_DROP
No packet filter able to classify packet.
void SetQuantum(uint32_t quantum)
Set the quantum value.
Time m_blueThreshold
Threshold to enable blue enhancement.
uint32_t FqCobaltDrop()
Drop a packet from the head of the queue with the largest current byte count.
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
double m_Pdrop
Drop Probability.
uint32_t m_flows
Number of flow queues.
static TypeId GetTypeId()
Get the type ID.
uint32_t GetQuantum() const
Get the quantum value.
uint32_t m_setWays
size of a set of queues (used by set associative hash)
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
QueueDiscClass is the base class for classes that are included in a queue disc.
Definition: queue-disc.h:52
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:184
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.