A Discrete-Event Network Simulator
API
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 NITK Surathkal
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: Shravya Ks <shravya.ks0@gmail.com>
19 * Smriti Murali <m.smriti.95@gmail.com>
20 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
21 */
22
23/*
24 * PORT NOTE: This code was ported from ns-2.36rc1 (queue/pie.h).
25 * Most of the comments are also ported from the same.
26 */
27
28#ifndef PIE_QUEUE_DISC_H
29#define PIE_QUEUE_DISC_H
30
31#include "ns3/queue-disc.h"
32#include "ns3/nstime.h"
33#include "ns3/boolean.h"
34#include "ns3/data-rate.h"
35#include "ns3/timer.h"
36#include "ns3/event-id.h"
37#include "ns3/random-variable-stream.h"
38
39#define BURST_RESET_TIMEOUT 1.5
40
41class PieQueueDiscTestCase; // Forward declaration for unit test
42namespace ns3 {
43
44class TraceContainer;
45class UniformRandomVariable;
46
52class PieQueueDisc : public QueueDisc
53{
54public:
59 static TypeId GetTypeId (void);
60
64 PieQueueDisc ();
65
69 virtual ~PieQueueDisc ();
70
75 {
79 };
80
86 Time GetQueueDelay (void);
95 int64_t AssignStreams (int64_t stream);
96
97 // Reasons for dropping packets
98 static constexpr const char* UNFORCED_DROP = "Unforced drop";
99 static constexpr const char* FORCED_DROP = "Forced drop";
100 static constexpr const char* UNFORCED_MARK = "Unforced mark";
101 static constexpr const char* CE_THRESHOLD_EXCEEDED_MARK = "CE threshold exceeded mark";
102
103protected:
107 virtual void DoDispose (void);
108
109private:
110 friend class::PieQueueDiscTestCase; // Test code
111 virtual bool DoEnqueue (Ptr<QueueDiscItem> item);
112 virtual Ptr<QueueDiscItem> DoDequeue (void);
113 virtual bool CheckConfig (void);
114
118 virtual void InitializeParams (void);
119
126 bool DropEarly (Ptr<QueueDiscItem> item, uint32_t qSize);
127
133 void CalculateP ();
134
135
137
138 // ** Variables supplied by user
144 double m_a;
145 double m_b;
149 bool m_useEcn;
151 double m_markEcnTh;
154 bool m_useL4s;
155
156 // ** Variables maintained by PIE
157 double m_dropProb;
164 double m_avgDqRate;
166 uint64_t m_dqCount;
169 double m_accuProb;
170 bool m_active;
171};
172
173}; // namespace ns3
174
175#endif
176
#define max(a, b)
Definition: 80211b.c:43
Pie Queue Disc Test Case.
An identifier for simulation events.
Definition: event-id.h:54
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.
virtual void InitializeParams(void)
Initialize the queue parameters.
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...
virtual ~PieQueueDisc()
PieQueueDisc Destructor.
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.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
BurstStateT m_burstState
Used to determine the current state of burst.
bool DropEarly(Ptr< QueueDiscItem > item, uint32_t qSize)
Check if a packet needs to be dropped due to probability drop.
static TypeId GetTypeId(void)
Get the type ID.
bool m_active
Indicates whether PIE is in active state or not.
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
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.
virtual void DoDispose(void)
Dispose of the object.
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.
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.
Time GetQueueDelay(void)
Get queue delay.
BurstStateT
Burst types.
PieQueueDisc()
PieQueueDisc Constructor.
Time m_qDelay
Current value of queue delay.
uint64_t m_dqCount
Number of bytes departed since current measurement cycle starts.
double m_b
Parameter to pie controller.
static constexpr const char * UNFORCED_MARK
Early probability marks: proactive.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
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.