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 * 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 by: Bhaskar Kataria <bhaskar.k7920@gmail.com> (for COBALT)
10 * Tom Henderson <tomhend@u.washington.edu>
11 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
12 * Vivek Jain <jain.vivek.anand@gmail.com>
13 * Ankit Deepak <adadeepak8@gmail.com>
14 */
15
16#ifndef FQ_COBALT_QUEUE_DISC
17#define FQ_COBALT_QUEUE_DISC
18
19#include "queue-disc.h"
20
21#include "ns3/object-factory.h"
22
23#include <list>
24#include <map>
25
26namespace ns3
27{
28
29/**
30 * \ingroup traffic-control
31 *
32 * \brief A flow queue used by the FqCobalt queue disc
33 */
34
36{
37 public:
38 /**
39 * \brief Get the type ID.
40 * \return the object TypeId
41 */
42 static TypeId GetTypeId();
43 /**
44 * \brief FqCobaltFlow constructor
45 */
47
48 ~FqCobaltFlow() override;
49
50 /**
51 * \enum FlowStatus
52 * \brief Used to determine the status of this flow queue
53 */
60
61 /**
62 * \brief Set the deficit for this flow
63 * \param deficit the deficit for this flow
64 */
65 void SetDeficit(uint32_t deficit);
66 /**
67 * \brief Get the deficit for this flow
68 * \return the deficit for this flow
69 */
70 int32_t GetDeficit() const;
71 /**
72 * \brief Increase the deficit for this flow
73 * \param deficit the amount by which the deficit is to be increased
74 */
75 void IncreaseDeficit(int32_t deficit);
76 /**
77 * \brief Set the status for this flow
78 * \param status the status for this flow
79 */
80 void SetStatus(FlowStatus status);
81 /**
82 * \brief Get the status of this flow
83 * \return the status of this flow
84 */
85 FlowStatus GetStatus() const;
86 /**
87 * \brief Set the index for this flow
88 * \param index the index for this flow
89 */
90 void SetIndex(uint32_t index);
91 /**
92 * \brief Get the index of this flow
93 * \return the index of this flow
94 */
95 uint32_t GetIndex() const;
96
97 private:
98 int32_t m_deficit; //!< the deficit for this flow
99 FlowStatus m_status; //!< the status of this flow
100 uint32_t m_index; //!< the index for this flow
101};
102
103/**
104 * \ingroup traffic-control
105 *
106 * \brief A FqCobalt packet queue disc
107 */
108
110{
111 public:
112 /**
113 * \brief Get the type ID.
114 * \return the object TypeId
115 */
116 static TypeId GetTypeId();
117 /**
118 * \brief FqCobaltQueueDisc constructor
119 */
121
122 ~FqCobaltQueueDisc() override;
123
124 /**
125 * \brief Set the quantum value.
126 *
127 * \param quantum The number of bytes each queue gets to dequeue on each round of the scheduling
128 * algorithm
129 */
130 void SetQuantum(uint32_t quantum);
131
132 /**
133 * \brief Get the quantum value.
134 *
135 * \returns The number of bytes each queue gets to dequeue on each round of the scheduling
136 * algorithm
137 */
138 uint32_t GetQuantum() const;
139
140 // Reasons for dropping packets
141 static constexpr const char* UNCLASSIFIED_DROP =
142 "Unclassified drop"; //!< No packet filter able to classify packet
143 static constexpr const char* OVERLIMIT_DROP = "Overlimit drop"; //!< Overlimit dropped packets
144
145 private:
146 bool DoEnqueue(Ptr<QueueDiscItem> item) override;
147 Ptr<QueueDiscItem> DoDequeue() override;
148 bool CheckConfig() override;
149 void InitializeParams() override;
150
151 /**
152 * \brief Drop a packet from the head of the queue with the largest current byte count
153 * \return the index of the queue with the largest current byte count
154 */
156
157 /**
158 * Compute the index of the queue for the flow having the given flowHash,
159 * according to the set associative hash approach.
160 *
161 * \param flowHash the hash of the flow 5-tuple
162 * \return the index of the queue for the given flow
163 */
165
166 std::string m_interval; //!< CoDel interval attribute
167 std::string m_target; //!< CoDel target attribute
168 uint32_t m_quantum; //!< Deficit assigned to flows at each round
169 uint32_t m_flows; //!< Number of flow queues
170 uint32_t m_setWays; //!< size of a set of queues (used by set associative hash)
171 uint32_t m_dropBatchSize; //!< Max number of packets dropped from the fat flow
172 uint32_t m_perturbation; //!< hash perturbation value
173 bool m_useEcn; //!< True if ECN is used (packets are marked instead of being dropped)
174 Time m_ceThreshold; //!< Threshold above which to CE mark
175 bool m_enableSetAssociativeHash; //!< whether to enable set associative hash
176 bool m_useL4s; //!< True if L4S is used (ECT1 packets are marked at CE threshold)
177 double m_increment; //!< increment value for marking probability
178 double m_decrement; //!< decrement value for marking probability
179 double m_Pdrop; //!< Drop Probability
180 Time m_blueThreshold; //!< Threshold to enable blue enhancement
181
182 std::list<Ptr<FqCobaltFlow>> m_newFlows; //!< The list of new flows
183 std::list<Ptr<FqCobaltFlow>> m_oldFlows; //!< The list of old flows
184
185 std::map<uint32_t, uint32_t> m_flowsIndices; //!< Map with the index of class for each flow
186 std::map<uint32_t, uint32_t> m_tags; //!< Tags used by set associative hash
187
188 ObjectFactory m_flowFactory; //!< Factory to create a new flow
189 ObjectFactory m_queueDiscFactory; //!< Factory to create a new queue
190};
191
192} // namespace ns3
193
194#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.
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.