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