A Discrete-Event Network Simulator
API
fq-codel-queue-disc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Pasquale Imputato <p.imputato@gmail.com>
18  * Stefano Avallone <stefano.avallone@unina.it>
19  */
20 
21 #ifndef FQ_CODEL_QUEUE_DISC
22 #define FQ_CODEL_QUEUE_DISC
23 
24 #include "queue-disc.h"
25 
26 #include "ns3/object-factory.h"
27 
28 #include <list>
29 #include <map>
30 
31 namespace ns3
32 {
33 
41 {
42  public:
47  static TypeId GetTypeId();
51  FqCoDelFlow();
52 
53  ~FqCoDelFlow() override;
54 
60  {
63  OLD_FLOW
64  };
65 
70  void SetDeficit(uint32_t deficit);
75  int32_t GetDeficit() const;
80  void IncreaseDeficit(int32_t deficit);
85  void SetStatus(FlowStatus status);
90  FlowStatus GetStatus() const;
95  void SetIndex(uint32_t index);
100  uint32_t GetIndex() const;
101 
102  private:
103  int32_t m_deficit;
105  uint32_t m_index;
106 };
107 
115 {
116  public:
121  static TypeId GetTypeId();
126 
127  ~FqCoDelQueueDisc() override;
128 
135  void SetQuantum(uint32_t quantum);
136 
143  uint32_t GetQuantum() const;
144 
145  // Reasons for dropping packets
146  static constexpr const char* UNCLASSIFIED_DROP =
147  "Unclassified drop";
148  static constexpr const char* OVERLIMIT_DROP = "Overlimit drop";
149 
150  private:
151  bool DoEnqueue(Ptr<QueueDiscItem> item) override;
152  Ptr<QueueDiscItem> DoDequeue() override;
153  bool CheckConfig() override;
154  void InitializeParams() override;
155 
160  uint32_t FqCoDelDrop();
161 
162  bool m_useEcn;
170  uint32_t SetAssociativeHash(uint32_t flowHash);
171 
172  std::string m_interval;
173  std::string m_target;
174  uint32_t m_quantum;
175  uint32_t m_flows;
176  uint32_t m_setWays;
177  uint32_t m_dropBatchSize;
178  uint32_t m_perturbation;
181  bool m_useL4s;
182 
183  std::list<Ptr<FqCoDelFlow>> m_newFlows;
184  std::list<Ptr<FqCoDelFlow>> m_oldFlows;
185 
186  std::map<uint32_t, uint32_t> m_flowsIndices;
187  std::map<uint32_t, uint32_t> m_tags;
188 
191 };
192 
193 } // namespace ns3
194 
195 #endif /* FQ_CODEL_QUEUE_DISC */
A flow queue used by the FqCoDel queue disc.
FqCoDelFlow()
FqCoDelFlow constructor.
FlowStatus GetStatus() const
Get the status of this flow.
void SetIndex(uint32_t index)
Set the index for this flow.
uint32_t GetIndex() const
Get the index of this flow.
static TypeId GetTypeId()
Get the type ID.
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
int32_t m_deficit
the deficit for this flow
FlowStatus m_status
the status of this flow
int32_t GetDeficit() const
Get the deficit for this flow.
uint32_t m_index
the index for this flow
void IncreaseDeficit(int32_t deficit)
Increase the deficit for this flow.
void SetStatus(FlowStatus status)
Set the status for this flow.
FlowStatus
Used to determine the status of this flow queue.
A FqCoDel packet queue disc.
std::list< Ptr< FqCoDelFlow > > m_oldFlows
The list of old flows.
Time m_ceThreshold
Threshold above which to CE mark.
uint32_t m_setWays
size of a set of queues (used by set associative hash)
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
static constexpr const char * UNCLASSIFIED_DROP
No packet filter able to classify packet.
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packets.
ObjectFactory m_flowFactory
Factory to create a new flow.
uint32_t FqCoDelDrop()
Drop a packet from the head of the queue with the largest current byte count.
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
void SetQuantum(uint32_t quantum)
Set the quantum value.
std::string m_interval
CoDel interval attribute.
uint32_t m_dropBatchSize
Max number of packets dropped from the fat flow.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
std::string m_target
CoDel target attribute.
bool m_useEcn
True if ECN is used (packets are marked instead of being dropped)
FqCoDelQueueDisc()
FqCoDelQueueDisc constructor.
uint32_t m_perturbation
hash perturbation value
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
std::map< uint32_t, uint32_t > m_tags
Tags used by set associative hash.
bool CheckConfig() override
Check whether the current configuration is correct.
uint32_t SetAssociativeHash(uint32_t flowHash)
Compute the index of the queue for the flow having the given flowHash, according to the set associati...
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)
bool m_enableSetAssociativeHash
whether to enable set associative hash
uint32_t m_quantum
Deficit assigned to flows at each round.
std::list< Ptr< FqCoDelFlow > > m_newFlows
The list of new flows.
static TypeId GetTypeId()
Get the type ID.
uint32_t m_flows
Number of flow queues.
uint32_t GetQuantum() const
Get the quantum value.
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.