A Discrete-Event Network Simulator
API
fq-pie-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  * Copyright (c) 2018 NITK Surathkal (modified for FQ-PIE)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Pasquale Imputato <p.imputato@gmail.com>
20  * Stefano Avallone <stefano.avallone@unina.it>
21  * Modified for FQ-PIE by: Sumukha PK <sumukhapk46@gmail.com>
22  * Prajval M <26prajval98@gmail.com>
23  * Ishaan R D <ishaanrd6@gmail.com>
24  * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
25  */
26 
27 #ifndef FQ_PIE_QUEUE_DISC
28 #define FQ_PIE_QUEUE_DISC
29 
30 #include "ns3/queue-disc.h"
31 #include "ns3/object-factory.h"
32 #include <list>
33 #include <map>
34 
35 namespace ns3 {
36 
43 class FqPieFlow : public QueueDiscClass
44 {
45 public:
50  static TypeId GetTypeId (void);
54  FqPieFlow ();
55 
56  virtual ~FqPieFlow ();
57 
63  {
66  OLD_FLOW
67  };
68 
73  void SetDeficit (uint32_t deficit);
78  int32_t GetDeficit (void) const;
83  void IncreaseDeficit (int32_t deficit);
88  void SetStatus (FlowStatus status);
93  FlowStatus GetStatus (void) const;
98  void SetIndex (uint32_t index);
103  uint32_t GetIndex (void) const;
104 
105 private:
106  int32_t m_deficit;
108  uint32_t m_index;
109 };
110 
111 
118 class FqPieQueueDisc : public QueueDisc
119 {
120 public:
125  static TypeId GetTypeId (void);
129  FqPieQueueDisc ();
130 
131  virtual ~FqPieQueueDisc ();
132 
138  void SetQuantum (uint32_t quantum);
139 
145  uint32_t GetQuantum (void) const;
146 
147  // Reasons for dropping packets
148  static constexpr const char* UNCLASSIFIED_DROP = "Unclassified drop";
149  static constexpr const char* OVERLIMIT_DROP = "Overlimit drop";
150 
151 private:
152  virtual bool DoEnqueue (Ptr<QueueDiscItem> item);
153  virtual Ptr<QueueDiscItem> DoDequeue (void);
154  virtual bool CheckConfig (void);
155  virtual void InitializeParams (void);
156 
161  uint32_t FqPieDrop (void);
162 
170  uint32_t SetAssociativeHash (uint32_t flowHash);
171 
172  // PIE queue disc parameter
173  bool m_useEcn;
174  double m_markEcnTh;
176  bool m_useL4s;
180  uint32_t m_meanPktSize;
182  double m_a;
183  double m_b;
184  uint32_t m_dqThreshold;
188 
189  // Fq parameters
190  uint32_t m_quantum;
191  uint32_t m_flows;
192  uint32_t m_setWays;
193  uint32_t m_dropBatchSize;
194  uint32_t m_perturbation;
196 
197  std::list<Ptr<FqPieFlow> > m_newFlows;
198  std::list<Ptr<FqPieFlow> > m_oldFlows;
199 
200  std::map<uint32_t, uint32_t> m_flowsIndices;
201  std::map<uint32_t, uint32_t> m_tags;
202 
205 };
206 
207 } // namespace ns3
208 
209 #endif /* FQ_PIE_QUEUE_DISC */
A flow queue used by the FqPie queue disc.
uint32_t GetIndex(void) const
Get the index of this flow.
FlowStatus GetStatus(void) const
Get the status of this flow.
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.
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.
int32_t GetDeficit(void) const
Get the deficit for this flow.
static TypeId GetTypeId(void)
Get the type ID.
FqPieFlow()
FqPieFlow constructor.
void IncreaseDeficit(int32_t deficit)
Increase 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.
uint32_t FqPieDrop(void)
Drop a packet from the head of the queue with the largest current byte count.
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 m_perturbation
hash perturbation value
FqPieQueueDisc()
FqPieQueueDisc constructor.
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
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.
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.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
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.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
double m_markEcnTh
ECN marking threshold (default 10% as suggested in RFC 8033)
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
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)
uint32_t GetQuantum(void) const
Get the quantum value.
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.
static TypeId GetTypeId(void)
Get the type ID.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
QueueDiscClass is the base class for classes that are included in a queue disc.
Definition: queue-disc.h:49
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:181
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.