A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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 "ns3/boolean.h"
31#include "ns3/data-rate.h"
32#include "ns3/event-id.h"
33#include "ns3/nstime.h"
34#include "ns3/queue-disc.h"
35#include "ns3/random-variable-stream.h"
36#include "ns3/timer.h"
37
38#define BURST_RESET_TIMEOUT 1.5
39
40class PieQueueDiscTestCase; // Forward declaration for unit test
41
42namespace ns3
43{
44
45class TraceContainer;
46class UniformRandomVariable;
47
53class PieQueueDisc : public QueueDisc
54{
55 public:
60 static TypeId GetTypeId();
61
66
70 ~PieQueueDisc() override;
71
76 {
80 };
81
96 int64_t AssignStreams(int64_t stream);
97
98 // Reasons for dropping packets
99 static constexpr const char* UNFORCED_DROP =
100 "Unforced drop";
101 static constexpr const char* FORCED_DROP =
102 "Forced drop";
103 static constexpr const char* UNFORCED_MARK =
104 "Unforced mark";
105 static constexpr const char* CE_THRESHOLD_EXCEEDED_MARK =
106 "CE threshold exceeded mark";
107
108 protected:
112 void DoDispose() override;
113
114 private:
115 friend class ::PieQueueDiscTestCase; // Test code
116 bool DoEnqueue(Ptr<QueueDiscItem> item) override;
117 Ptr<QueueDiscItem> DoDequeue() override;
118 bool CheckConfig() override;
119
123 void InitializeParams() override;
124
131 bool DropEarly(Ptr<QueueDiscItem> item, uint32_t qSize);
132
138 void CalculateP();
139
140 static const uint64_t DQCOUNT_INVALID =
141 std::numeric_limits<uint64_t>::max();
142
143 // ** Variables supplied by user
149 double m_a;
150 double m_b;
154 bool
156 bool m_useEcn;
158 double m_markEcnTh;
161 bool m_useL4s;
162
163 // ** Variables maintained by PIE
164 double m_dropProb;
172 double m_avgDqRate;
174 uint64_t m_dqCount;
178 double m_accuProb;
179 bool m_active;
180};
181
182}; // namespace ns3
183
184#endif
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:78
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.