A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fq-pie-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) 2018 NITK Surathkal (modified for FQ-PIE)
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 for FQ-PIE by: Sumukha PK <sumukhapk46@gmail.com>
21 * Prajval M <26prajval98@gmail.com>
22 * Ishaan R D <ishaanrd6@gmail.com>
23 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
24 */
25
26#ifndef FQ_PIE_QUEUE_DISC
27#define FQ_PIE_QUEUE_DISC
28
29#include "queue-disc.h"
30
31#include "ns3/object-factory.h"
32
33#include <list>
34#include <map>
35
36namespace ns3
37{
38
39/**
40 * \ingroup traffic-control
41 *
42 * \brief A flow queue used by the FqPie queue disc
43 */
44
46{
47 public:
48 /**
49 * \brief Get the type ID.
50 * \return the object TypeId
51 */
52 static TypeId GetTypeId();
53 /**
54 * \brief FqPieFlow constructor
55 */
56 FqPieFlow();
57
58 ~FqPieFlow() override;
59
60 /**
61 * \enum FlowStatus
62 * \brief Used to determine the status of this flow queue
63 */
65 {
69 };
70
71 /**
72 * \brief Set the deficit for this flow
73 * \param deficit the deficit for this flow
74 */
75 void SetDeficit(uint32_t deficit);
76 /**
77 * \brief Get the deficit for this flow
78 * \return the deficit for this flow
79 */
80 int32_t GetDeficit() const;
81 /**
82 * \brief Increase the deficit for this flow
83 * \param deficit the amount by which the deficit is to be increased
84 */
85 void IncreaseDeficit(int32_t deficit);
86 /**
87 * \brief Set the status for this flow
88 * \param status the status for this flow
89 */
90 void SetStatus(FlowStatus status);
91 /**
92 * \brief Get the status of this flow
93 * \return the status of this flow
94 */
95 FlowStatus GetStatus() const;
96 /**
97 * \brief Set the index for this flow
98 * \param index the index for this flow
99 */
100 void SetIndex(uint32_t index);
101 /**
102 * \brief Get the index of this flow
103 * \return the index of this flow
104 */
105 uint32_t GetIndex() const;
106
107 private:
108 int32_t m_deficit; //!< the deficit for this flow
109 FlowStatus m_status; //!< the status of this flow
110 uint32_t m_index; //!< the index for this flow
111};
112
113/**
114 * \ingroup traffic-control
115 *
116 * \brief A FqPie packet queue disc
117 */
118
120{
121 public:
122 /**
123 * \brief Get the type ID.
124 * \return the object TypeId
125 */
126 static TypeId GetTypeId();
127 /**
128 * \brief FqPieQueueDisc constructor
129 */
131
132 ~FqPieQueueDisc() override;
133
134 /**
135 * \brief Set the quantum value.
136 *
137 * \param quantum The number of bytes each queue gets to dequeue on each round of the scheduling
138 * algorithm
139 */
140 void SetQuantum(uint32_t quantum);
141
142 /**
143 * \brief Get the quantum value.
144 *
145 * \returns The number of bytes each queue gets to dequeue on each round of the scheduling
146 * algorithm
147 */
148 uint32_t GetQuantum() const;
149
150 // Reasons for dropping packets
151 static constexpr const char* UNCLASSIFIED_DROP =
152 "Unclassified drop"; //!< No packet filter able to classify packet
153 static constexpr const char* OVERLIMIT_DROP = "Overlimit drop"; //!< Overlimit dropped packets
154
155 private:
156 bool DoEnqueue(Ptr<QueueDiscItem> item) override;
157 Ptr<QueueDiscItem> DoDequeue() override;
158 bool CheckConfig() override;
159 void InitializeParams() override;
160
161 /**
162 * \brief Drop a packet from the head of the queue with the largest current byte count
163 * \return the index of the queue with the largest current byte count
164 */
166
167 /**
168 * Compute the index of the queue for the flow having the given flowHash,
169 * according to the set associative hash approach.
170 *
171 * \param flowHash the hash of the flow 5-tuple
172 * \return the index of the queue for the given flow
173 */
175
176 // PIE queue disc parameter
177 bool m_useEcn; //!< True if ECN is used (packets are marked instead of being dropped)
178 double m_markEcnTh; //!< ECN marking threshold (default 10% as suggested in RFC 8033)
179 Time m_ceThreshold; //!< Threshold above which to CE mark
180 bool m_useL4s; //!< True if L4S is used (ECT1 packets are marked at CE threshold)
181 Time m_sUpdate; //!< Start time of the update timer
182 Time m_tUpdate; //!< Time period after which CalculateP () is called
183 Time m_qDelayRef; //!< Desired queue delay
184 uint32_t m_meanPktSize; //!< Average packet size in bytes
185 Time m_maxBurst; //!< Maximum burst allowed before random early dropping kicks in
186 double m_a; //!< Parameter to pie controller
187 double m_b; //!< Parameter to pie controller
188 uint32_t m_dqThreshold; //!< Minimum queue size in bytes before dequeue rate is measured
189 bool m_useDqRateEstimator; //!< Enable/Disable usage of dequeue rate estimator for queue delay
190 //!< calculation
191 bool
192 m_isCapDropAdjustment; //!< Enable/Disable Cap Drop Adjustment feature mentioned in RFC 8033
193 bool m_useDerandomization; //!< Enable Derandomization feature mentioned in RFC 8033
194
195 // Fq parameters
196 uint32_t m_quantum; //!< Deficit assigned to flows at each round
197 uint32_t m_flows; //!< Number of flow queues
198 uint32_t m_setWays; //!< size of a set of queues (used by set associative hash)
199 uint32_t m_dropBatchSize; //!< Max number of packets dropped from the fat flow
200 uint32_t m_perturbation; //!< hash perturbation value
201 bool m_enableSetAssociativeHash; //!< whether to enable set associative hash
202
203 std::list<Ptr<FqPieFlow>> m_newFlows; //!< The list of new flows
204 std::list<Ptr<FqPieFlow>> m_oldFlows; //!< The list of old flows
205
206 std::map<uint32_t, uint32_t> m_flowsIndices; //!< Map with the index of class for each flow
207 std::map<uint32_t, uint32_t> m_tags; //!< Tags used by set associative hash
208
209 ObjectFactory m_flowFactory; //!< Factory to create a new flow
210 ObjectFactory m_queueDiscFactory; //!< Factory to create a new queue
211};
212
213} // namespace ns3
214
215#endif /* FQ_PIE_QUEUE_DISC */
A flow queue used by the FqPie queue disc.
void SetIndex(uint32_t index)
Set the index for this flow.
FlowStatus
Used to determine the status of this flow queue.
int32_t m_deficit
the deficit for this flow
void SetStatus(FlowStatus status)
Set the status for this flow.
static TypeId GetTypeId()
Get the type ID.
~FqPieFlow() override
FlowStatus GetStatus() const
Get the status of this flow.
FlowStatus m_status
the status of this flow
uint32_t m_index
the index for this flow
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
uint32_t GetIndex() const
Get the index of this flow.
FqPieFlow()
FqPieFlow constructor.
void IncreaseDeficit(int32_t deficit)
Increase the deficit for this flow.
int32_t GetDeficit() const
Get the deficit for this flow.
A FqPie packet queue disc.
Time m_qDelayRef
Desired queue delay.
std::map< uint32_t, uint32_t > m_tags
Tags used by set associative hash.
bool m_useEcn
True if ECN is used (packets are marked instead of being dropped)
bool m_enableSetAssociativeHash
whether to enable set associative hash
uint32_t m_meanPktSize
Average packet size in bytes.
static constexpr const char * UNCLASSIFIED_DROP
No packet filter able to classify packet.
uint32_t GetQuantum() const
Get the quantum value.
uint32_t m_perturbation
hash perturbation value
FqPieQueueDisc()
FqPieQueueDisc constructor.
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
double m_a
Parameter to pie controller.
Time m_sUpdate
Start time of the update timer.
bool m_useDqRateEstimator
Enable/Disable usage of dequeue rate estimator for queue delay calculation.
Time m_ceThreshold
Threshold above which to CE mark.
uint32_t m_dqThreshold
Minimum queue size in bytes before dequeue rate is measured.
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
bool CheckConfig() override
Check whether the current configuration is correct.
uint32_t m_dropBatchSize
Max number of packets dropped from the fat flow.
uint32_t m_quantum
Deficit assigned to flows at each round.
Time m_tUpdate
Time period after which CalculateP () is called.
uint32_t FqPieDrop()
Drop a packet from the head of the queue with the largest current byte count.
bool m_isCapDropAdjustment
Enable/Disable Cap Drop Adjustment feature mentioned in RFC 8033.
std::list< Ptr< FqPieFlow > > m_newFlows
The list of new flows.
Time m_maxBurst
Maximum burst allowed before random early dropping kicks in.
bool m_useDerandomization
Enable Derandomization feature mentioned in RFC 8033.
uint32_t m_setWays
size of a set of queues (used by set associative hash)
uint32_t m_flows
Number of flow queues.
static TypeId GetTypeId()
Get the type ID.
double m_markEcnTh
ECN marking threshold (default 10% as suggested in RFC 8033)
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
uint32_t SetAssociativeHash(uint32_t flowHash)
Compute the index of the queue for the flow having the given flowHash, according to the set associati...
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packets.
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)
void SetQuantum(uint32_t quantum)
Set the quantum value.
double m_b
Parameter to pie controller.
ObjectFactory m_flowFactory
Factory to create a new flow.
std::list< Ptr< FqPieFlow > > m_oldFlows
The list of old flows.
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.