A Discrete-Event Network Simulator
API
fq-codel-queue-disc.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
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  */
21 
22 #ifndef FQ_CODEL_QUEUE_DISC
23 #define FQ_CODEL_QUEUE_DISC
24 
25 #include "ns3/queue-disc.h"
26 #include "ns3/object-factory.h"
27 #include <list>
28 #include <map>
29 
30 namespace ns3 {
31 
38 class FqCoDelFlow : public QueueDiscClass {
39 public:
44  static TypeId GetTypeId (void);
48  FqCoDelFlow ();
49 
50  virtual ~FqCoDelFlow ();
51 
57  {
60  OLD_FLOW
61  };
62 
67  void SetDeficit (uint32_t deficit);
72  int32_t GetDeficit (void) const;
77  void IncreaseDeficit (int32_t deficit);
82  void SetStatus (FlowStatus status);
87  FlowStatus GetStatus (void) const;
92  void SetIndex (uint32_t index);
97  uint32_t GetIndex (void) const;
98 
99 private:
100  int32_t m_deficit;
102  uint32_t m_index;
103 };
104 
105 
112 class FqCoDelQueueDisc : public QueueDisc {
113 public:
118  static TypeId GetTypeId (void);
122  FqCoDelQueueDisc ();
123 
124  virtual ~FqCoDelQueueDisc ();
125 
131  void SetQuantum (uint32_t quantum);
132 
138  uint32_t GetQuantum (void) const;
139 
140  // Reasons for dropping packets
141  static constexpr const char* UNCLASSIFIED_DROP = "Unclassified drop";
142  static constexpr const char* OVERLIMIT_DROP = "Overlimit drop";
143 
144 private:
145  virtual bool DoEnqueue (Ptr<QueueDiscItem> item);
146  virtual Ptr<QueueDiscItem> DoDequeue (void);
147  virtual bool CheckConfig (void);
148  virtual void InitializeParams (void);
149 
154  uint32_t FqCoDelDrop (void);
155 
156  bool m_useEcn;
157 
164  uint32_t SetAssociativeHash (uint32_t flowHash);
165 
166  std::string m_interval;
167  std::string m_target;
168  uint32_t m_quantum;
169  uint32_t m_flows;
170  uint32_t m_setWays;
171  uint32_t m_dropBatchSize;
172  uint32_t m_perturbation;
175  bool m_useL4s;
176 
177  std::list<Ptr<FqCoDelFlow> > m_newFlows;
178  std::list<Ptr<FqCoDelFlow> > m_oldFlows;
179 
180  std::map<uint32_t, uint32_t> m_flowsIndices;
181  std::map<uint32_t, uint32_t> m_tags;
182 
185 };
186 
187 } // namespace ns3
188 
189 #endif /* FQ_CODEL_QUEUE_DISC */
190 
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::FqCoDelFlow::SetDeficit
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
Definition: fq-codel-queue-disc.cc:59
ns3::FqCoDelQueueDisc
A FqCoDel packet queue disc.
Definition: fq-codel-queue-disc.h:112
ns3::FqCoDelFlow::~FqCoDelFlow
virtual ~FqCoDelFlow()
Definition: fq-codel-queue-disc.cc:53
ns3::FqCoDelFlow::GetDeficit
int32_t GetDeficit(void) const
Get the deficit for this flow.
Definition: fq-codel-queue-disc.cc:66
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::FqCoDelQueueDisc::GetQuantum
uint32_t GetQuantum(void) const
Get the quantum value.
Definition: fq-codel-queue-disc.cc:195
ns3::FqCoDelQueueDisc::OVERLIMIT_DROP
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packets.
Definition: fq-codel-queue-disc.h:142
ns3::QueueDisc
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:181
ns3::FqCoDelQueueDisc::m_flowsIndices
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
Definition: fq-codel-queue-disc.h:180
ns3::FqCoDelQueueDisc::m_enableSetAssociativeHash
bool m_enableSetAssociativeHash
whether to enable set associative hash
Definition: fq-codel-queue-disc.h:174
ns3::FqCoDelQueueDisc::m_ceThreshold
Time m_ceThreshold
Threshold above which to CE mark.
Definition: fq-codel-queue-disc.h:173
ns3::FqCoDelFlow
A flow queue used by the FqCoDel queue disc.
Definition: fq-codel-queue-disc.h:38
ns3::FqCoDelFlow::m_status
FlowStatus m_status
the status of this flow
Definition: fq-codel-queue-disc.h:101
ns3::FqCoDelQueueDisc::m_newFlows
std::list< Ptr< FqCoDelFlow > > m_newFlows
The list of new flows.
Definition: fq-codel-queue-disc.h:177
ns3::FqCoDelQueueDisc::UNCLASSIFIED_DROP
static constexpr const char * UNCLASSIFIED_DROP
No packet filter able to classify packet.
Definition: fq-codel-queue-disc.h:141
ns3::FqCoDelQueueDisc::m_flowFactory
ObjectFactory m_flowFactory
Factory to create a new flow.
Definition: fq-codel-queue-disc.h:183
ns3::FqCoDelFlow::SetStatus
void SetStatus(FlowStatus status)
Set the status for this flow.
Definition: fq-codel-queue-disc.cc:80
ns3::FqCoDelFlow::FqCoDelFlow
FqCoDelFlow()
FqCoDelFlow constructor.
Definition: fq-codel-queue-disc.cc:45
ns3::FqCoDelFlow::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: fq-codel-queue-disc.cc:35
ns3::FqCoDelQueueDisc::m_tags
std::map< uint32_t, uint32_t > m_tags
Tags used by set associative hash.
Definition: fq-codel-queue-disc.h:181
ns3::FqCoDelFlow::FlowStatus
FlowStatus
Used to determine the status of this flow queue.
Definition: fq-codel-queue-disc.h:57
ns3::FqCoDelQueueDisc::m_target
std::string m_target
CoDel target attribute.
Definition: fq-codel-queue-disc.h:167
ns3::FqCoDelFlow::SetIndex
void SetIndex(uint32_t index)
Set the index for this flow.
Definition: fq-codel-queue-disc.cc:94
ns3::QueueDiscClass
QueueDiscClass is the base class for classes that are included in a queue disc.
Definition: queue-disc.h:49
ns3::FqCoDelQueueDisc::m_quantum
uint32_t m_quantum
Deficit assigned to flows at each round.
Definition: fq-codel-queue-disc.h:168
ns3::FqCoDelQueueDisc::m_queueDiscFactory
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
Definition: fq-codel-queue-disc.h:184
ns3::FqCoDelQueueDisc::m_oldFlows
std::list< Ptr< FqCoDelFlow > > m_oldFlows
The list of old flows.
Definition: fq-codel-queue-disc.h:178
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::FqCoDelQueueDisc::m_useEcn
bool m_useEcn
True if ECN is used (packets are marked instead of being dropped)
Definition: fq-codel-queue-disc.h:156
ns3::FqCoDelFlow::INACTIVE
@ INACTIVE
Definition: fq-codel-queue-disc.h:58
ns3::FqCoDelQueueDisc::m_useL4s
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)
Definition: fq-codel-queue-disc.h:175
ns3::FqCoDelFlow::NEW_FLOW
@ NEW_FLOW
Definition: fq-codel-queue-disc.h:59
ns3::FqCoDelQueueDisc::FqCoDelDrop
uint32_t FqCoDelDrop(void)
Drop a packet from the head of the queue with the largest current byte count.
Definition: fq-codel-queue-disc.cc:463
ns3::FqCoDelQueueDisc::DoEnqueue
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
Definition: fq-codel-queue-disc.cc:230
ns3::FqCoDelQueueDisc::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: fq-codel-queue-disc.cc:109
ns3::FqCoDelFlow::GetIndex
uint32_t GetIndex(void) const
Get the index of this flow.
Definition: fq-codel-queue-disc.cc:101
ns3::FqCoDelFlow::m_index
uint32_t m_index
the index for this flow
Definition: fq-codel-queue-disc.h:102
ns3::FqCoDelFlow::OLD_FLOW
@ OLD_FLOW
Definition: fq-codel-queue-disc.h:60
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition: object-factory.h:48
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::FqCoDelQueueDisc::m_dropBatchSize
uint32_t m_dropBatchSize
Max number of packets dropped from the fat flow.
Definition: fq-codel-queue-disc.h:171
ns3::FqCoDelFlow::m_deficit
int32_t m_deficit
the deficit for this flow
Definition: fq-codel-queue-disc.h:100
ns3::FqCoDelQueueDisc::m_setWays
uint32_t m_setWays
size of a set of queues (used by set associative hash)
Definition: fq-codel-queue-disc.h:170
ns3::FqCoDelQueueDisc::m_flows
uint32_t m_flows
Number of flow queues.
Definition: fq-codel-queue-disc.h:169
ns3::FqCoDelQueueDisc::m_perturbation
uint32_t m_perturbation
hash perturbation value
Definition: fq-codel-queue-disc.h:172
ns3::FqCoDelQueueDisc::SetAssociativeHash
uint32_t SetAssociativeHash(uint32_t flowHash)
Compute the index of the queue for the flow having the given flowHash, according to the set associati...
Definition: fq-codel-queue-disc.cc:201
ns3::FqCoDelQueueDisc::SetQuantum
void SetQuantum(uint32_t quantum)
Set the quantum value.
Definition: fq-codel-queue-disc.cc:188
ns3::FqCoDelFlow::GetStatus
FlowStatus GetStatus(void) const
Get the status of this flow.
Definition: fq-codel-queue-disc.cc:87
ns3::FqCoDelQueueDisc::~FqCoDelQueueDisc
virtual ~FqCoDelQueueDisc()
Definition: fq-codel-queue-disc.cc:182
ns3::FqCoDelQueueDisc::FqCoDelQueueDisc
FqCoDelQueueDisc()
FqCoDelQueueDisc constructor.
Definition: fq-codel-queue-disc.cc:175
ns3::FqCoDelQueueDisc::CheckConfig
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Definition: fq-codel-queue-disc.cc:395
ns3::FqCoDelQueueDisc::InitializeParams
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
Definition: fq-codel-queue-disc.cc:450
ns3::FqCoDelQueueDisc::m_interval
std::string m_interval
CoDel interval attribute.
Definition: fq-codel-queue-disc.h:166
ns3::FqCoDelQueueDisc::DoDequeue
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
Definition: fq-codel-queue-disc.cc:312
ns3::FqCoDelFlow::IncreaseDeficit
void IncreaseDeficit(int32_t deficit)
Increase the deficit for this flow.
Definition: fq-codel-queue-disc.cc:73