A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::RedQueueDisc Class Reference

A RED packet queue disc. More...

#include "red-queue-disc.h"

+ Inheritance diagram for ns3::RedQueueDisc:
+ Collaboration diagram for ns3::RedQueueDisc:

Public Types

enum  { DTYPE_NONE , DTYPE_FORCED , DTYPE_UNFORCED }
 Drop types. More...
 
enum  FengStatus { Above , Between , Below }
 Used in Feng's Adaptive RED. More...
 
- Public Types inherited from ns3::QueueDisc
typedef Queue< QueueDiscItemInternalQueue
 Internal queues store QueueDiscItem objects.
 
typedef std::function< void(Ptr< QueueDiscItem >)> SendCallback
 Callback invoked to send a packet to the receiving object when Run is called.
 
enum  WakeMode { WAKE_ROOT = 0x00 , WAKE_CHILD = 0x01 }
 Used to determine whether the queue disc itself or its children must be activated when a netdevice wakes a transmission queue. More...
 

Public Member Functions

 RedQueueDisc ()
 RedQueueDisc Constructor.
 
 ~RedQueueDisc () override
 Destructor.
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model.
 
double GetAredAlpha ()
 Get the alpha value to adapt m_curMaxP.
 
double GetAredBeta ()
 Get the beta value to adapt m_curMaxP.
 
double GetFengAdaptiveA ()
 Get the alpha value to adapt m_curMaxP in Feng's Adaptive RED.
 
double GetFengAdaptiveB ()
 Get the beta value to adapt m_curMaxP in Feng's Adaptive RED.
 
void SetAredAlpha (double alpha)
 Set the alpha value to adapt m_curMaxP.
 
void SetAredBeta (double beta)
 Set the beta value to adapt m_curMaxP.
 
void SetFengAdaptiveA (double a)
 Set the alpha value to adapt m_curMaxP in Feng's Adaptive RED.
 
void SetFengAdaptiveB (double b)
 Set the beta value to adapt m_curMaxP in Feng's Adaptive RED.
 
void SetTh (double minTh, double maxTh)
 Set the thresh limits of RED.
 
- Public Member Functions inherited from ns3::QueueDisc
 QueueDisc (const QueueDisc &)=delete
 
 QueueDisc (QueueDiscSizePolicy policy, QueueSizeUnit unit)
 Constructor.
 
 QueueDisc (QueueDiscSizePolicy policy=QueueDiscSizePolicy::SINGLE_INTERNAL_QUEUE)
 Constructor.
 
 ~QueueDisc () override
 
void AddInternalQueue (Ptr< InternalQueue > queue)
 Add an internal queue to the tail of the list of queues.
 
void AddPacketFilter (Ptr< PacketFilter > filter)
 Add a packet filter to the tail of the list of filters used to classify packets.
 
void AddQueueDiscClass (Ptr< QueueDiscClass > qdClass)
 Add a queue disc class to the tail of the list of classes.
 
int32_t Classify (Ptr< QueueDiscItem > item)
 Classify a packet by calling the packet filters, one at a time, until either a filter able to classify the packet is found or all the filters have been processed.
 
Ptr< QueueDiscItemDequeue ()
 Extract from the queue disc the packet that has been dequeued by calling Peek, if any, or call the private DoDequeue method (which must be implemented by derived classes) to dequeue a packet, otherwise.
 
bool Enqueue (Ptr< QueueDiscItem > item)
 Pass a packet to store to the queue discipline.
 
QueueSize GetCurrentSize () const
 Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise.
 
Ptr< InternalQueueGetInternalQueue (std::size_t i) const
 Get the i-th internal queue.
 
QueueSize GetMaxSize () const
 Get the maximum size of the queue disc.
 
uint32_t GetNBytes () const
 Get the amount of bytes stored by the queue disc.
 
Ptr< NetDeviceQueueInterfaceGetNetDeviceQueueInterface () const
 
std::size_t GetNInternalQueues () const
 Get the number of internal queues.
 
std::size_t GetNPacketFilters () const
 Get the number of packet filters.
 
uint32_t GetNPackets () const
 Get the number of packets stored by the queue disc.
 
std::size_t GetNQueueDiscClasses () const
 Get the number of queue disc classes.
 
Ptr< PacketFilterGetPacketFilter (std::size_t i) const
 Get the i-th packet filter.
 
Ptr< QueueDiscClassGetQueueDiscClass (std::size_t i) const
 Get the i-th queue disc class.
 
virtual uint32_t GetQuota () const
 Get the maximum number of dequeue operations following a packet enqueue.
 
SendCallback GetSendCallback () const
 
const StatsGetStats ()
 Retrieve all the collected statistics.
 
virtual WakeMode GetWakeMode () const
 When setting up the wake callbacks on the netdevice queues, it is necessary to determine which queue disc (the root queue disc or one of its children) should be activated when the netdevice wakes one of its transmission queues.
 
QueueDiscoperator= (const QueueDisc &)=delete
 
Ptr< const QueueDiscItemPeek ()
 Get a copy of the next packet the queue discipline will extract.
 
void Run ()
 Modelled after the Linux function __qdisc_run (net/sched/sch_generic.c) Dequeues multiple packets, until a quota is exceeded or sending a packet to the device failed.
 
bool SetMaxSize (QueueSize size)
 Set the maximum size of the queue disc.
 
void SetNetDeviceQueueInterface (Ptr< NetDeviceQueueInterface > ndqi)
 
virtual void SetQuota (const uint32_t quota)
 Set the maximum number of dequeue operations following a packet enqueue.
 
void SetSendCallback (SendCallback func)
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::QueueDisc
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Static Public Attributes

static constexpr const char * FORCED_DROP = "Forced drop"
 Forced drops, m_qAvg > m_maxTh.
 
static constexpr const char * FORCED_MARK = "Forced mark"
 Forced marks, m_qAvg > m_maxTh.
 
static constexpr const char * UNFORCED_DROP = "Unforced drop"
 Early probability drops.
 
static constexpr const char * UNFORCED_MARK = "Unforced mark"
 Early probability marks.
 
- Static Public Attributes inherited from ns3::QueueDisc
static constexpr const char * CHILD_QUEUE_DISC_DROP
 Packet dropped by a child queue disc.
 
static constexpr const char * CHILD_QUEUE_DISC_MARK
 Packet marked by a child queue disc.
 
static constexpr const char * INTERNAL_QUEUE_DROP
 Packet dropped by an internal queue.
 

Protected Member Functions

void DoDispose () override
 Dispose of the object.
 
- Protected Member Functions inherited from ns3::QueueDisc
void DoDispose () override
 Dispose of the object.
 
void DoInitialize () override
 Check whether the configuration is correct and initialize parameters.
 
void DropAfterDequeue (Ptr< const QueueDiscItem > item, const char *reason)
 Perform the actions required when the queue disc is notified of a packet dropped after dequeue.
 
void DropBeforeEnqueue (Ptr< const QueueDiscItem > item, const char *reason)
 Perform the actions required when the queue disc is notified of a packet dropped before enqueue.
 
bool Mark (Ptr< QueueDiscItem > item, const char *reason)
 Marks the given packet and, if successful, updates the counters associated with the given reason.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Private Member Functions

double CalculatePNew ()
 Returns a probability using these function parameters for the DropEarly function.
 
bool CheckConfig () override
 Check whether the current configuration is correct.
 
Ptr< QueueDiscItemDoDequeue () override
 This function actually extracts a packet from the queue disc.
 
bool DoEnqueue (Ptr< QueueDiscItem > item) override
 This function actually enqueues a packet into the queue disc.
 
Ptr< const QueueDiscItemDoPeek () override
 Return a copy of the next packet the queue disc will extract.
 
bool DropEarly (Ptr< QueueDiscItem > item, uint32_t qSize)
 Check if a packet needs to be dropped due to probability mark.
 
double Estimator (uint32_t nQueued, uint32_t m, double qAvg, double qW)
 Compute the average queue size.
 
void InitializeParams () override
 Initialize the queue parameters.
 
double ModifyP (double p, uint32_t size)
 Returns a probability using these function parameters for the DropEarly function.
 
void UpdateMaxP (double newAve)
 Update m_curMaxP.
 
void UpdateMaxPFeng (double newAve)
 Update m_curMaxP based on Feng's Adaptive RED.
 

Private Attributes

double m_a
 Decrement parameter for m_curMaxP in Feng's Adaptive RED.
 
double m_alpha
 Increment parameter for m_curMaxP in ARED.
 
double m_b
 Increment parameter for m_curMaxP in Feng's Adaptive RED.
 
double m_beta
 Decrement parameter for m_curMaxP in ARED.
 
double m_bottom
 Lower bound for m_curMaxP in ARED.
 
uint32_t m_cautious
 0 for default RED 1 experimental (see red-queue-disc.cc) 2 experimental (see red-queue-disc.cc) 3 use Idle packet size in the ptc
 
uint32_t m_count
 Number of packets since last random number generation.
 
uint32_t m_countBytes
 Number of bytes since last drop.
 
double m_curMaxP
 Current max_p.
 
FengStatus m_fengStatus
 For use in Feng's Adaptive RED.
 
uint32_t m_idle
 0/1 idle status
 
uint32_t m_idlePktSize
 Avg pkt size used during idle times.
 
Time m_idleTime
 Start of current idle period.
 
Time m_interval
 Time interval to update m_curMaxP.
 
bool m_isAdaptMaxP
 True to adapt m_curMaxP.
 
bool m_isARED
 True to enable Adaptive RED.
 
bool m_isFengAdaptive
 True to enable Feng's Adaptive RED.
 
bool m_isGentle
 True to increase dropping prob.
 
bool m_isNonlinear
 True to enable Nonlinear RED.
 
bool m_isNs1Compat
 Ns-1 compatibility.
 
bool m_isWait
 True for waiting between dropped packets.
 
Time m_lastSet
 Last time m_curMaxP was updated.
 
DataRate m_linkBandwidth
 Link bandwidth.
 
Time m_linkDelay
 Link delay.
 
double m_lInterm
 The max probability of dropping a packet.
 
double m_maxTh
 Maximum threshold for m_qAvg (bytes or packets), should be >= 2 * m_minTh.
 
uint32_t m_meanPktSize
 Avg pkt size.
 
double m_minTh
 Minimum threshold for m_qAvg (bytes or packets)
 
uint32_t m_old
 0 when average queue first exceeds threshold
 
double m_ptc
 packet time constant in packets/second
 
double m_qAvg
 Average queue length.
 
double m_qW
 Queue weight given to cur queue size sample.
 
Time m_rtt
 Rtt to be considered while automatically setting m_bottom in ARED.
 
Time m_targetDelay
 Target average queuing delay in ARED.
 
double m_top
 Upper bound for m_curMaxP in ARED.
 
bool m_useEcn
 True if ECN is used (packets are marked instead of being dropped)
 
bool m_useHardDrop
 True if packets are always dropped above max threshold.
 
Ptr< UniformRandomVariablem_uv
 rng stream
 
double m_vA
 1.0 / (m_maxTh - m_minTh)
 
double m_vB
 -m_minTh / (m_maxTh - m_minTh)
 
double m_vC
 (1.0 - m_curMaxP) / m_maxTh - used in "gentle" mode
 
double m_vD
 2.0 * m_curMaxP - 1.0 - used in "gentle" mode
 
double m_vProb
 Prob.
 

Additional Inherited Members

Detailed Description

A RED packet queue disc.

Introspection did not find any typical Config paths.


Attributes

  • ARED: True to enable ARED
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
  • AdaptMaxP: True to adapt m_curMaxP
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
  • Alpha: Increment parameter for m_curMaxP in ARED
    • Set with class: ns3::DoubleValue
    • Underlying type: double 0:1
    • Initial value: 0.01
    • Flags: constructwrite
  • Beta: Decrement parameter for m_curMaxP in ARED
    • Set with class: ns3::DoubleValue
    • Underlying type: double 0:1
    • Initial value: 0.9
    • Flags: constructwrite
  • Bottom: Lower bound for m_curMaxP in ARED
    • Set with class: ns3::DoubleValue
    • Underlying type: double 0:1
    • Initial value: 0
    • Flags: constructwriteread
  • FengAdaptive: True to enable Feng's Adaptive RED
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
  • FengAlpha: Decrement parameter for m_curMaxP in Feng's Adaptive RED
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 3
    • Flags: constructwrite
  • FengBeta: Increment parameter for m_curMaxP in Feng's Adaptive RED
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 2
    • Flags: constructwrite
  • Gentle: True to increases dropping probability slowly when average queue exceeds maxthresh
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • IdlePktSize: Average packet size used during idle times. Used when m_cautions = 3
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 0
    • Flags: constructwriteread
  • Interval: Time interval to update m_curMaxP
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+08ns
    • Flags: constructwriteread
  • LInterm: The maximum probability of dropping a packet
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 50
    • Flags: constructwriteread
  • LastSet: Store the last time m_curMaxP was updated
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: constructwriteread
  • LinkBandwidth: The RED link bandwidth
  • LinkDelay: The RED link delay
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +2e+07ns
    • Flags: constructwriteread
  • MaxSize: The maximum number of packets accepted by this queue disc
  • MaxTh: Maximum average length threshold in packets/bytes
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 15
    • Flags: constructwriteread
  • MeanPktSize: Average of packet size
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 500
    • Flags: constructwriteread
  • MinTh: Minimum average length threshold in packets/bytes
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 5
    • Flags: constructwriteread
  • NLRED: True to enable Nonlinear RED
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
  • Ns1Compat: NS-1 compatibility
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
  • QW: Queue weight related to the exponential weighted moving average (EWMA)
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.002
    • Flags: constructwriteread
  • Rtt: Round Trip Time to be considered while automatically setting m_bottom
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+08ns
    • Flags: constructwriteread
  • TargetDelay: Target average queuing delay in ARED
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+06ns
    • Flags: constructwriteread
  • Top: Upper bound for m_curMaxP in ARED
    • Set with class: ns3::DoubleValue
    • Underlying type: double 0:1
    • Initial value: 0.5
    • Flags: constructwriteread
  • UseEcn: True to use ECN (packets are marked instead of being dropped)
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
  • UseHardDrop: True to always drop packets above max threshold
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • Wait: True for waiting between dropped packets
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread

Attributes defined in parent class ns3::QueueDisc

No TraceSources are defined for this type.

TraceSources defined in parent class ns3::QueueDisc

Size of this type is 1272 bytes (on a 64-bit architecture).

Definition at line 80 of file red-queue-disc.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Drop types.

Enumerator
DTYPE_NONE 

Ok, no drop.

DTYPE_FORCED 

A "forced" drop.

DTYPE_UNFORCED 

An "unforced" (random) drop.

Definition at line 115 of file red-queue-disc.h.

◆ FengStatus

Used in Feng's Adaptive RED.

Enumerator
Above 

When m_qAvg > m_maxTh.

Between 

When m_maxTh < m_qAvg < m_minTh.

Below 

When m_qAvg < m_minTh.

Definition at line 105 of file red-queue-disc.h.

Constructor & Destructor Documentation

◆ RedQueueDisc()

ns3::RedQueueDisc::RedQueueDisc ( )

RedQueueDisc Constructor.

Create a RED queue disc

Definition at line 228 of file red-queue-disc.cc.

References m_uv, and NS_LOG_FUNCTION.

◆ ~RedQueueDisc()

ns3::RedQueueDisc::~RedQueueDisc ( )
override

Destructor.

Destructor

Definition at line 235 of file red-queue-disc.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::RedQueueDisc::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 334 of file red-queue-disc.cc.

References m_uv, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

◆ CalculatePNew()

double ns3::RedQueueDisc::CalculatePNew ( )
private

Returns a probability using these function parameters for the DropEarly function.

Returns
Prob. of packet drop before "count"

Definition at line 717 of file red-queue-disc.cc.

References m_curMaxP, m_isGentle, m_isNonlinear, m_maxTh, m_qAvg, m_vA, m_vB, m_vC, m_vD, and NS_LOG_FUNCTION.

Referenced by DropEarly().

+ Here is the caller graph for this function:

◆ CheckConfig()

bool ns3::RedQueueDisc::CheckConfig ( )
overrideprivatevirtual

Check whether the current configuration is correct.

Default objects (such as internal queues) might be created by this method to ensure the configuration is correct. This method is automatically called at simulation initialization time, and it is called before the InitializeParams () method. It is appropriate to promote parameter initialization to this method if it aids in checking for correct configuration.

See also
QueueDisc::InitializeParams
Returns
true if the configuration is correct, false otherwise

Implements ns3::QueueDisc.

Definition at line 859 of file red-queue-disc.cc.

References ns3::QueueDisc::AddInternalQueue(), ns3::CreateObjectWithAttributes(), ns3::QueueDisc::GetMaxSize(), ns3::QueueDisc::GetNInternalQueues(), ns3::QueueDisc::GetNPacketFilters(), ns3::QueueDisc::GetNQueueDiscClasses(), m_isAdaptMaxP, m_isARED, m_isFengAdaptive, NS_LOG_ERROR, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoDequeue()

Ptr< QueueDiscItem > ns3::RedQueueDisc::DoDequeue ( )
overrideprivatevirtual

This function actually extracts a packet from the queue disc.

Returns
0 if the operation was not successful; the item otherwise.

Implements ns3::QueueDisc.

Definition at line 814 of file red-queue-disc.cc.

References ns3::QueueDisc::GetInternalQueue(), ns3::QueueDisc::GetNBytes(), ns3::QueueDisc::GetNPackets(), m_idle, m_idleTime, ns3::Simulator::Now(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ DoDispose()

void ns3::RedQueueDisc::DoDispose ( )
overrideprotectedvirtual

Dispose of the object.

Reimplemented from ns3::QueueDisc.

Definition at line 241 of file red-queue-disc.cc.

References ns3::QueueDisc::DoDispose(), m_uv, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoEnqueue()

bool ns3::RedQueueDisc::DoEnqueue ( Ptr< QueueDiscItem item)
overrideprivatevirtual

This function actually enqueues a packet into the queue disc.

Parameters
itemitem to enqueue
Returns
True if the operation was successful; false otherwise

Implements ns3::QueueDisc.

Definition at line 342 of file red-queue-disc.cc.

References ns3::QueueDisc::DropBeforeEnqueue(), DropEarly(), DTYPE_FORCED, DTYPE_NONE, DTYPE_UNFORCED, Estimator(), FORCED_DROP, FORCED_MARK, ns3::QueueDisc::GetInternalQueue(), ns3::QueueDisc::GetNBytes(), ns3::QueueDisc::GetNPackets(), m_cautious, m_count, m_countBytes, m_idle, m_idlePktSize, m_idleTime, m_isGentle, m_isNs1Compat, m_maxTh, m_meanPktSize, m_minTh, m_old, m_ptc, m_qAvg, m_qW, m_useEcn, m_useHardDrop, m_vProb, ns3::QueueDisc::Mark(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, UNFORCED_DROP, and UNFORCED_MARK.

+ Here is the call graph for this function:

◆ DoPeek()

Ptr< const QueueDiscItem > ns3::RedQueueDisc::DoPeek ( )
overrideprivatevirtual

Return a copy of the next packet the queue disc will extract.

The implementation of this method is based on the qdisc_peek_dequeued function of the Linux kernel, which dequeues a packet and retains it in the queue disc as a requeued packet. The packet is not traced as requeued, nor is the total count of requeued packets increased. The packet is still considered to be part of the queue disc and the dequeue trace is fired when Dequeue is called and the packet is actually extracted from the queue disc.

This approach is especially recommended for queue discs for which it is not obvious what is the next packet that will be dequeued (e.g., queue discs having multiple internal queues or child queue discs or queue discs that drop packets after dequeue). Subclasses can however provide their own implementation of this method that overrides the default one.

Returns
0 if the operation was not successful; the packet otherwise.

Reimplemented from ns3::QueueDisc.

Definition at line 841 of file red-queue-disc.cc.

References ns3::QueueDisc::GetInternalQueue(), ns3::QueueDisc::GetNBytes(), ns3::QueueDisc::GetNPackets(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ DropEarly()

bool ns3::RedQueueDisc::DropEarly ( Ptr< QueueDiscItem item,
uint32_t  qSize 
)
private

Check if a packet needs to be dropped due to probability mark.

Parameters
itemqueue item
qSizequeue size
Returns
false for no drop/mark, true for drop
Todo:
Implement set bit to mark

Definition at line 655 of file red-queue-disc.cc.

References CalculatePNew(), ns3::UniformRandomVariable::GetValue(), m_cautious, m_count, m_countBytes, m_ptc, m_qAvg, m_qW, m_uv, m_vProb, ModifyP(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by DoEnqueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Estimator()

double ns3::RedQueueDisc::Estimator ( uint32_t  nQueued,
uint32_t  m,
double  qAvg,
double  qW 
)
private

Compute the average queue size.

Parameters
nQueuednumber of queued packets
msimulated number of packets arrival during idle period
qAvgaverage queue size
qWqueue weight given to cur q size sample
Returns
new average queue size

Definition at line 633 of file red-queue-disc.cc.

References m_interval, m_isAdaptMaxP, m_isFengAdaptive, m_lastSet, ns3::Simulator::Now(), NS_LOG_FUNCTION, UpdateMaxP(), and UpdateMaxPFeng().

Referenced by DoEnqueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAredAlpha()

double ns3::RedQueueDisc::GetAredAlpha ( )

Get the alpha value to adapt m_curMaxP.

Returns
The alpha value to adapt m_curMaxP.

Definition at line 261 of file red-queue-disc.cc.

References m_alpha, and NS_LOG_FUNCTION.

◆ GetAredBeta()

double ns3::RedQueueDisc::GetAredBeta ( )

Get the beta value to adapt m_curMaxP.

Returns
The beta value to adapt m_curMaxP.

Definition at line 280 of file red-queue-disc.cc.

References m_beta, and NS_LOG_FUNCTION.

◆ GetFengAdaptiveA()

double ns3::RedQueueDisc::GetFengAdaptiveA ( )

Get the alpha value to adapt m_curMaxP in Feng's Adaptive RED.

Returns
The alpha value to adapt m_curMaxP in Feng's Adaptive RED.

Definition at line 299 of file red-queue-disc.cc.

References m_a, and NS_LOG_FUNCTION.

◆ GetFengAdaptiveB()

double ns3::RedQueueDisc::GetFengAdaptiveB ( )

Get the beta value to adapt m_curMaxP in Feng's Adaptive RED.

Returns
The beta value to adapt m_curMaxP in Feng's Adaptive RED.

Definition at line 318 of file red-queue-disc.cc.

References m_b, and NS_LOG_FUNCTION.

◆ GetTypeId()

◆ InitializeParams()

void ns3::RedQueueDisc::InitializeParams ( )
overrideprivatevirtual

Initialize the queue parameters.

Note: if the link bandwidth changes in the course of the simulation, the bandwidth-dependent RED parameters do not change. This should be fixed, but it would require some extra parameters, and didn't seem worth the trouble...

Implements ns3::QueueDisc.

Definition at line 455 of file red-queue-disc.cc.

References Above, ns3::BYTES, ns3::DataRate::GetBitRate(), ns3::QueueDisc::GetMaxSize(), ns3::Time::GetSeconds(), ns3::QueueSize::GetUnit(), m_bottom, m_cautious, m_count, m_countBytes, m_curMaxP, m_fengStatus, m_idle, m_idleTime, m_isAdaptMaxP, m_isARED, m_isFengAdaptive, m_isGentle, m_isWait, m_linkBandwidth, m_linkDelay, m_lInterm, m_maxTh, m_meanPktSize, m_minTh, m_old, m_ptc, m_qAvg, m_qW, m_rtt, m_targetDelay, m_vA, m_vB, m_vC, m_vD, ns3::NanoSeconds(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_INFO.

+ Here is the call graph for this function:

◆ ModifyP()

double ns3::RedQueueDisc::ModifyP ( double  p,
uint32_t  size 
)
private

Returns a probability using these function parameters for the DropEarly function.

Parameters
pProb. of packet drop before "count"
sizepacket size
Returns
Prob. of packet drop

Definition at line 763 of file red-queue-disc.cc.

References ns3::BYTES, ns3::QueueDisc::GetMaxSize(), ns3::QueueSize::GetUnit(), m_count, m_countBytes, m_isWait, m_meanPktSize, and NS_LOG_FUNCTION.

Referenced by DropEarly().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAredAlpha()

void ns3::RedQueueDisc::SetAredAlpha ( double  alpha)

Set the alpha value to adapt m_curMaxP.

Parameters
alphaThe value of alpha to adapt m_curMaxP.

Definition at line 249 of file red-queue-disc.cc.

References m_alpha, NS_LOG_FUNCTION, and NS_LOG_WARN.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetAredBeta()

void ns3::RedQueueDisc::SetAredBeta ( double  beta)

Set the beta value to adapt m_curMaxP.

Parameters
betaThe value of beta to adapt m_curMaxP.

Definition at line 268 of file red-queue-disc.cc.

References m_beta, NS_LOG_FUNCTION, and NS_LOG_WARN.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetFengAdaptiveA()

void ns3::RedQueueDisc::SetFengAdaptiveA ( double  a)

Set the alpha value to adapt m_curMaxP in Feng's Adaptive RED.

Parameters
aThe value of alpha to adapt m_curMaxP in Feng's Adaptive RED.

Definition at line 287 of file red-queue-disc.cc.

References m_a, NS_LOG_FUNCTION, and NS_LOG_WARN.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetFengAdaptiveB()

void ns3::RedQueueDisc::SetFengAdaptiveB ( double  b)

Set the beta value to adapt m_curMaxP in Feng's Adaptive RED.

Parameters
bThe value of beta to adapt m_curMaxP in Feng's Adaptive RED.

Definition at line 306 of file red-queue-disc.cc.

References m_b, NS_LOG_FUNCTION, and NS_LOG_WARN.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetTh()

void ns3::RedQueueDisc::SetTh ( double  minTh,
double  maxTh 
)

Set the thresh limits of RED.

Parameters
minThMinimum thresh in bytes or packets.
maxThMaximum thresh in bytes or packets.

Definition at line 325 of file red-queue-disc.cc.

References m_maxTh, m_minTh, NS_ASSERT, and NS_LOG_FUNCTION.

◆ UpdateMaxP()

void ns3::RedQueueDisc::UpdateMaxP ( double  newAve)
private

Update m_curMaxP.

Parameters
newAvenew average queue length

Definition at line 605 of file red-queue-disc.cc.

References m_alpha, m_beta, m_bottom, m_curMaxP, m_lastSet, m_maxTh, m_minTh, m_top, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by Estimator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateMaxPFeng()

void ns3::RedQueueDisc::UpdateMaxPFeng ( double  newAve)
private

Update m_curMaxP based on Feng's Adaptive RED.

Parameters
newAvenew average queue length

Definition at line 583 of file red-queue-disc.cc.

References Above, Below, Between, m_a, m_b, m_curMaxP, m_fengStatus, m_maxTh, m_minTh, and NS_LOG_FUNCTION.

Referenced by Estimator().

+ Here is the caller graph for this function:

Member Data Documentation

◆ FORCED_DROP

constexpr const char* ns3::RedQueueDisc::FORCED_DROP = "Forced drop"
staticconstexpr

Forced drops, m_qAvg > m_maxTh.

Definition at line 198 of file red-queue-disc.h.

Referenced by DoEnqueue(), and RedQueueDiscTestCase::RunRedTest().

◆ FORCED_MARK

constexpr const char* ns3::RedQueueDisc::FORCED_MARK = "Forced mark"
staticconstexpr

Forced marks, m_qAvg > m_maxTh.

Definition at line 201 of file red-queue-disc.h.

Referenced by DoEnqueue().

◆ m_a

double ns3::RedQueueDisc::m_a
private

Decrement parameter for m_curMaxP in Feng's Adaptive RED.

Definition at line 284 of file red-queue-disc.h.

Referenced by GetFengAdaptiveA(), SetFengAdaptiveA(), and UpdateMaxPFeng().

◆ m_alpha

double ns3::RedQueueDisc::m_alpha
private

Increment parameter for m_curMaxP in ARED.

Definition at line 278 of file red-queue-disc.h.

Referenced by GetAredAlpha(), SetAredAlpha(), and UpdateMaxP().

◆ m_b

double ns3::RedQueueDisc::m_b
private

Increment parameter for m_curMaxP in Feng's Adaptive RED.

Definition at line 283 of file red-queue-disc.h.

Referenced by GetFengAdaptiveB(), SetFengAdaptiveB(), and UpdateMaxPFeng().

◆ m_beta

double ns3::RedQueueDisc::m_beta
private

Decrement parameter for m_curMaxP in ARED.

Definition at line 279 of file red-queue-disc.h.

Referenced by GetAredBeta(), SetAredBeta(), and UpdateMaxP().

◆ m_bottom

double ns3::RedQueueDisc::m_bottom
private

Lower bound for m_curMaxP in ARED.

Definition at line 277 of file red-queue-disc.h.

Referenced by GetTypeId(), InitializeParams(), and UpdateMaxP().

◆ m_cautious

uint32_t ns3::RedQueueDisc::m_cautious
private

0 for default RED 1 experimental (see red-queue-disc.cc) 2 experimental (see red-queue-disc.cc) 3 use Idle packet size in the ptc

Definition at line 312 of file red-queue-disc.h.

Referenced by DoEnqueue(), DropEarly(), and InitializeParams().

◆ m_count

uint32_t ns3::RedQueueDisc::m_count
private

Number of packets since last random number generation.

Definition at line 304 of file red-queue-disc.h.

Referenced by DoEnqueue(), DropEarly(), InitializeParams(), and ModifyP().

◆ m_countBytes

uint32_t ns3::RedQueueDisc::m_countBytes
private

Number of bytes since last drop.

Definition at line 299 of file red-queue-disc.h.

Referenced by DoEnqueue(), DropEarly(), InitializeParams(), and ModifyP().

◆ m_curMaxP

double ns3::RedQueueDisc::m_curMaxP
private

Current max_p.

Definition at line 296 of file red-queue-disc.h.

Referenced by CalculatePNew(), InitializeParams(), UpdateMaxP(), and UpdateMaxPFeng().

◆ m_fengStatus

FengStatus ns3::RedQueueDisc::m_fengStatus
private

For use in Feng's Adaptive RED.

Definition at line 305 of file red-queue-disc.h.

Referenced by InitializeParams(), and UpdateMaxPFeng().

◆ m_idle

uint32_t ns3::RedQueueDisc::m_idle
private

0/1 idle status

Definition at line 301 of file red-queue-disc.h.

Referenced by DoDequeue(), DoEnqueue(), and InitializeParams().

◆ m_idlePktSize

uint32_t ns3::RedQueueDisc::m_idlePktSize
private

Avg pkt size used during idle times.

Definition at line 265 of file red-queue-disc.h.

Referenced by DoEnqueue(), and GetTypeId().

◆ m_idleTime

Time ns3::RedQueueDisc::m_idleTime
private

Start of current idle period.

Definition at line 313 of file red-queue-disc.h.

Referenced by DoDequeue(), DoEnqueue(), and InitializeParams().

◆ m_interval

Time ns3::RedQueueDisc::m_interval
private

Time interval to update m_curMaxP.

Definition at line 275 of file red-queue-disc.h.

Referenced by Estimator(), and GetTypeId().

◆ m_isAdaptMaxP

bool ns3::RedQueueDisc::m_isAdaptMaxP
private

True to adapt m_curMaxP.

Definition at line 269 of file red-queue-disc.h.

Referenced by CheckConfig(), Estimator(), GetTypeId(), and InitializeParams().

◆ m_isARED

bool ns3::RedQueueDisc::m_isARED
private

True to enable Adaptive RED.

Definition at line 268 of file red-queue-disc.h.

Referenced by CheckConfig(), GetTypeId(), and InitializeParams().

◆ m_isFengAdaptive

bool ns3::RedQueueDisc::m_isFengAdaptive
private

True to enable Feng's Adaptive RED.

Definition at line 281 of file red-queue-disc.h.

Referenced by CheckConfig(), Estimator(), GetTypeId(), and InitializeParams().

◆ m_isGentle

bool ns3::RedQueueDisc::m_isGentle
private

True to increase dropping prob.

slowly when m_qAvg exceeds m_maxTh

Definition at line 267 of file red-queue-disc.h.

Referenced by CalculatePNew(), DoEnqueue(), GetTypeId(), and InitializeParams().

◆ m_isNonlinear

bool ns3::RedQueueDisc::m_isNonlinear
private

True to enable Nonlinear RED.

Definition at line 282 of file red-queue-disc.h.

Referenced by CalculatePNew(), and GetTypeId().

◆ m_isNs1Compat

bool ns3::RedQueueDisc::m_isNs1Compat
private

Ns-1 compatibility.

Definition at line 285 of file red-queue-disc.h.

Referenced by DoEnqueue(), and GetTypeId().

◆ m_isWait

bool ns3::RedQueueDisc::m_isWait
private

True for waiting between dropped packets.

Definition at line 266 of file red-queue-disc.h.

Referenced by GetTypeId(), InitializeParams(), and ModifyP().

◆ m_lastSet

Time ns3::RedQueueDisc::m_lastSet
private

Last time m_curMaxP was updated.

Definition at line 297 of file red-queue-disc.h.

Referenced by Estimator(), GetTypeId(), and UpdateMaxP().

◆ m_linkBandwidth

DataRate ns3::RedQueueDisc::m_linkBandwidth
private

Link bandwidth.

Definition at line 286 of file red-queue-disc.h.

Referenced by GetTypeId(), and InitializeParams().

◆ m_linkDelay

Time ns3::RedQueueDisc::m_linkDelay
private

Link delay.

Definition at line 287 of file red-queue-disc.h.

Referenced by GetTypeId(), and InitializeParams().

◆ m_lInterm

double ns3::RedQueueDisc::m_lInterm
private

The max probability of dropping a packet.

Definition at line 273 of file red-queue-disc.h.

Referenced by GetTypeId(), and InitializeParams().

◆ m_maxTh

double ns3::RedQueueDisc::m_maxTh
private

Maximum threshold for m_qAvg (bytes or packets), should be >= 2 * m_minTh.

Definition at line 271 of file red-queue-disc.h.

Referenced by CalculatePNew(), DoEnqueue(), GetTypeId(), InitializeParams(), SetTh(), UpdateMaxP(), and UpdateMaxPFeng().

◆ m_meanPktSize

uint32_t ns3::RedQueueDisc::m_meanPktSize
private

Avg pkt size.

Definition at line 264 of file red-queue-disc.h.

Referenced by DoEnqueue(), GetTypeId(), InitializeParams(), and ModifyP().

◆ m_minTh

double ns3::RedQueueDisc::m_minTh
private

Minimum threshold for m_qAvg (bytes or packets)

Definition at line 270 of file red-queue-disc.h.

Referenced by DoEnqueue(), GetTypeId(), InitializeParams(), SetTh(), UpdateMaxP(), and UpdateMaxPFeng().

◆ m_old

uint32_t ns3::RedQueueDisc::m_old
private

0 when average queue first exceeds threshold

Definition at line 300 of file red-queue-disc.h.

Referenced by DoEnqueue(), and InitializeParams().

◆ m_ptc

double ns3::RedQueueDisc::m_ptc
private

packet time constant in packets/second

Definition at line 302 of file red-queue-disc.h.

Referenced by DoEnqueue(), DropEarly(), and InitializeParams().

◆ m_qAvg

double ns3::RedQueueDisc::m_qAvg
private

Average queue length.

Definition at line 303 of file red-queue-disc.h.

Referenced by CalculatePNew(), DoEnqueue(), DropEarly(), and InitializeParams().

◆ m_qW

double ns3::RedQueueDisc::m_qW
private

Queue weight given to cur queue size sample.

Definition at line 272 of file red-queue-disc.h.

Referenced by DoEnqueue(), DropEarly(), GetTypeId(), and InitializeParams().

◆ m_rtt

Time ns3::RedQueueDisc::m_rtt
private

Rtt to be considered while automatically setting m_bottom in ARED.

Definition at line 280 of file red-queue-disc.h.

Referenced by GetTypeId(), and InitializeParams().

◆ m_targetDelay

Time ns3::RedQueueDisc::m_targetDelay
private

Target average queuing delay in ARED.

Definition at line 274 of file red-queue-disc.h.

Referenced by GetTypeId(), and InitializeParams().

◆ m_top

double ns3::RedQueueDisc::m_top
private

Upper bound for m_curMaxP in ARED.

Definition at line 276 of file red-queue-disc.h.

Referenced by GetTypeId(), and UpdateMaxP().

◆ m_useEcn

bool ns3::RedQueueDisc::m_useEcn
private

True if ECN is used (packets are marked instead of being dropped)

Definition at line 288 of file red-queue-disc.h.

Referenced by DoEnqueue(), and GetTypeId().

◆ m_useHardDrop

bool ns3::RedQueueDisc::m_useHardDrop
private

True if packets are always dropped above max threshold.

Definition at line 289 of file red-queue-disc.h.

Referenced by DoEnqueue(), and GetTypeId().

◆ m_uv

Ptr<UniformRandomVariable> ns3::RedQueueDisc::m_uv
private

rng stream

Definition at line 315 of file red-queue-disc.h.

Referenced by RedQueueDisc(), AssignStreams(), DoDispose(), and DropEarly().

◆ m_vA

double ns3::RedQueueDisc::m_vA
private

1.0 / (m_maxTh - m_minTh)

Definition at line 292 of file red-queue-disc.h.

Referenced by CalculatePNew(), and InitializeParams().

◆ m_vB

double ns3::RedQueueDisc::m_vB
private

-m_minTh / (m_maxTh - m_minTh)

Definition at line 293 of file red-queue-disc.h.

Referenced by CalculatePNew(), and InitializeParams().

◆ m_vC

double ns3::RedQueueDisc::m_vC
private

(1.0 - m_curMaxP) / m_maxTh - used in "gentle" mode

Definition at line 294 of file red-queue-disc.h.

Referenced by CalculatePNew(), and InitializeParams().

◆ m_vD

double ns3::RedQueueDisc::m_vD
private

2.0 * m_curMaxP - 1.0 - used in "gentle" mode

Definition at line 295 of file red-queue-disc.h.

Referenced by CalculatePNew(), and InitializeParams().

◆ m_vProb

double ns3::RedQueueDisc::m_vProb
private

Prob.

of packet drop

Definition at line 298 of file red-queue-disc.h.

Referenced by DoEnqueue(), and DropEarly().

◆ UNFORCED_DROP

constexpr const char* ns3::RedQueueDisc::UNFORCED_DROP = "Unforced drop"
staticconstexpr

Early probability drops.

Definition at line 197 of file red-queue-disc.h.

Referenced by DoEnqueue(), AredQueueDiscTestCase::RunAredDiscTest(), and RedQueueDiscTestCase::RunRedTest().

◆ UNFORCED_MARK

constexpr const char* ns3::RedQueueDisc::UNFORCED_MARK = "Unforced mark"
staticconstexpr

Early probability marks.

Definition at line 200 of file red-queue-disc.h.

Referenced by DoEnqueue(), and RedQueueDiscTestCase::RunRedTest().


The documentation for this class was generated from the following files: