A Discrete-Event Network Simulator
API
pie-queue-disc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 NITK Surathkal
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: Shravya Ks <shravya.ks0@gmail.com>
18  * Smriti Murali <m.smriti.95@gmail.com>
19  * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
20  */
21 
22 /*
23  * PORT NOTE: This code was ported from ns-2.36rc1 (queue/pie.h).
24  * Most of the comments are also ported from the same.
25  */
26 
27 #ifndef PIE_QUEUE_DISC_H
28 #define PIE_QUEUE_DISC_H
29 
30 #include "queue-disc.h"
31 
32 #include "ns3/boolean.h"
33 #include "ns3/data-rate.h"
34 #include "ns3/event-id.h"
35 #include "ns3/nstime.h"
36 #include "ns3/random-variable-stream.h"
37 #include "ns3/timer.h"
38 
39 #define BURST_RESET_TIMEOUT 1.5
40 
41 class PieQueueDiscTestCase; // Forward declaration for unit test
42 
43 namespace ns3
44 {
45 
46 class TraceContainer;
47 class UniformRandomVariable;
48 
54 class PieQueueDisc : public QueueDisc
55 {
56  public:
61  static TypeId GetTypeId();
62 
66  PieQueueDisc();
67 
71  ~PieQueueDisc() override;
72 
77  {
81  };
82 
97  int64_t AssignStreams(int64_t stream);
98 
99  // Reasons for dropping packets
100  static constexpr const char* UNFORCED_DROP =
101  "Unforced drop";
102  static constexpr const char* FORCED_DROP =
103  "Forced drop";
104  static constexpr const char* UNFORCED_MARK =
105  "Unforced mark";
106  static constexpr const char* CE_THRESHOLD_EXCEEDED_MARK =
107  "CE threshold exceeded mark";
108 
109  protected:
113  void DoDispose() override;
114 
115  private:
116  friend class ::PieQueueDiscTestCase; // Test code
117  bool DoEnqueue(Ptr<QueueDiscItem> item) override;
118  Ptr<QueueDiscItem> DoDequeue() override;
119  bool CheckConfig() override;
120 
124  void InitializeParams() override;
125 
132  bool DropEarly(Ptr<QueueDiscItem> item, uint32_t qSize);
133 
139  void CalculateP();
140 
141  static const uint64_t DQCOUNT_INVALID =
143 
144  // ** Variables supplied by user
148  uint32_t m_meanPktSize;
150  double m_a;
151  double m_b;
152  uint32_t m_dqThreshold;
155  bool
157  bool m_useEcn;
159  double m_markEcnTh;
162  bool m_useL4s;
163 
164  // ** Variables maintained by PIE
165  double m_dropProb;
170  uint32_t m_burstReset;
173  double m_avgDqRate;
175  uint64_t m_dqCount;
179  double m_accuProb;
180  bool m_active;
181 };
182 
183 }; // namespace ns3
184 
185 #endif
#define max(a, b)
Definition: 80211b.c:42
Pie Queue Disc Test Case.
An identifier for simulation events.
Definition: event-id.h:55
Implements PIE Active Queue Management discipline.
uint32_t m_dqThreshold
Minimum queue size in bytes before dequeue rate is measured.
uint32_t m_meanPktSize
Average packet size in bytes.
double m_markEcnTh
ECN marking threshold (default 10% as suggested in RFC 8033)
bool m_useDqRateEstimator
Enable/Disable usage of dequeue rate estimator for queue delay calculation.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
void DoDispose() override
Dispose of the object.
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)
Time m_sUpdate
Start time of the update timer.
Time m_dqStart
Start timestamp of current measurement cycle.
bool m_useDerandomization
Enable Derandomization feature mentioned in RFC 8033.
static constexpr const char * UNFORCED_DROP
Early probability drops: proactive.
Time m_maxBurst
Maximum burst allowed before random early dropping kicks in.
EventId m_rtrsEvent
Event used to decide the decision of interval of drop probability calculation.
void CalculateP()
Periodically update the drop probability based on the delay samples: not only the current delay sampl...
Time m_ceThreshold
Threshold above which to CE mark.
Time m_qDelayOld
Old value of queue delay.
double m_dropProb
Variable used in calculation of drop probability.
Time m_burstAllowance
Current max burst value in seconds that is allowed before random drops kick in.
BurstStateT m_burstState
Used to determine the current state of burst.
Time GetQueueDelay()
Get queue delay.
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
bool DropEarly(Ptr< QueueDiscItem > item, uint32_t qSize)
Check if a packet needs to be dropped due to probability drop.
bool m_active
Indicates whether PIE is in active state or not.
double m_avgDqRate
Time averaged dequeue rate.
static const uint64_t DQCOUNT_INVALID
Invalid dqCount value.
uint32_t m_burstReset
Used to reset value of burst allowance.
void InitializeParams() override
Initialize the queue parameters.
bool m_inMeasurement
Indicates whether we are in a measurement cycle.
static constexpr const char * FORCED_DROP
Drops due to queue limit: reactive.
Time m_qDelayRef
Desired queue delay.
~PieQueueDisc() override
PieQueueDisc Destructor.
double m_a
Parameter to pie controller.
static constexpr const char * CE_THRESHOLD_EXCEEDED_MARK
Early probability marks: proactive.
Time m_activeThreshold
Threshold for activating PIE (disabled by default)
bool m_isCapDropAdjustment
Enable/Disable Cap Drop Adjustment feature mentioned in RFC 8033.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
double m_accuProb
Accumulated drop probability.
Ptr< UniformRandomVariable > m_uv
Rng stream.
bool m_useEcn
Enable ECN Marking functionality.
Time m_tUpdate
Time period after which CalculateP () is called.
BurstStateT
Burst types.
PieQueueDisc()
PieQueueDisc Constructor.
bool CheckConfig() override
Check whether the current configuration is correct.
Time m_qDelay
Current value of queue delay.
uint64_t m_dqCount
Number of bytes departed since current measurement cycle starts.
static TypeId GetTypeId()
Get the type ID.
double m_b
Parameter to pie controller.
static constexpr const char * UNFORCED_MARK
Early probability marks: proactive.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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.