QueueDisc is an abstract base class providing the interface and implementing the operations common to all the queueing disciplines. More...
#include "queue-disc.h"
Classes | |
struct | Stats |
Structure that keeps the queue disc statistics. More... | |
Public Types | |
typedef Queue< QueueDiscItem > | InternalQueue |
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 | |
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< QueueDiscItem > | Dequeue () |
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 () |
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise. | |
Ptr< InternalQueue > | GetInternalQueue (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< NetDeviceQueueInterface > | GetNetDeviceQueueInterface () 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< PacketFilter > | GetPacketFilter (std::size_t i) const |
Get the i-th packet filter. | |
Ptr< QueueDiscClass > | GetQueueDiscClass (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 Stats & | GetStats () |
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. | |
QueueDisc & | operator= (const QueueDisc &)=delete |
Ptr< const QueueDiscItem > | Peek () |
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< Object > | GetObject () 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< Object > | GetObject (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. | |
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. | |
SimpleRefCount & | operator= (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::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 * | 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. | |
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 Types | |
typedef std::function< void(Ptr< const QueueDiscItem >, const char *)> | ChildQueueDiscDropFunctor |
Type for the function objects notifying that a packet has been dropped by a child queue disc. | |
typedef std::function< void(Ptr< const QueueDiscItem >, const char *)> | ChildQueueDiscMarkFunctor |
Type for the function objects notifying that a packet has been marked by a child queue disc. | |
typedef std::function< void(Ptr< const QueueDiscItem >)> | InternalQueueDropFunctor |
Type for the function objects notifying that a packet has been dropped by an internal queue. | |
Private Member Functions | |
virtual bool | CheckConfig ()=0 |
Check whether the current configuration is correct. | |
Ptr< QueueDiscItem > | DequeuePacket () |
Modelled after the Linux function dequeue_skb (net/sched/sch_generic.c) | |
virtual Ptr< QueueDiscItem > | DoDequeue ()=0 |
This function actually extracts a packet from the queue disc. | |
virtual bool | DoEnqueue (Ptr< QueueDiscItem > item)=0 |
This function actually enqueues a packet into the queue disc. | |
virtual Ptr< const QueueDiscItem > | DoPeek () |
Return a copy of the next packet the queue disc will extract. | |
virtual void | InitializeParams ()=0 |
Initialize parameters (if any) before the first packet is enqueued. | |
void | PacketDequeued (Ptr< const QueueDiscItem > item) |
Perform the actions required when the queue disc is notified of a packet dequeue. | |
void | PacketEnqueued (Ptr< const QueueDiscItem > item) |
Perform the actions required when the queue disc is notified of a packet enqueue. | |
void | Requeue (Ptr< QueueDiscItem > item) |
Modelled after the Linux function dev_requeue_skb (net/sched/sch_generic.c) Requeues a packet whose transmission failed. | |
bool | Restart () |
Modelled after the Linux function qdisc_restart (net/sched/sch_generic.c) Dequeue a packet (by calling DequeuePacket) and send it to the device (by calling Transmit). | |
bool | RunBegin () |
Modelled after the Linux function qdisc_run_begin (include/net/sch_generic.h). | |
void | RunEnd () |
Modelled after the Linux function qdisc_run_end (include/net/sch_generic.h). | |
bool | Transmit (Ptr< QueueDiscItem > item) |
Modelled after the Linux function sch_direct_xmit (net/sched/sch_generic.c) Sends a packet to the device if the device queue is not stopped, and requeues it otherwise. | |
Private Attributes | |
ChildQueueDiscDropFunctor | m_childQueueDiscDadFunctor |
Function object called when a child queue disc dropped a packet after dequeue. | |
ChildQueueDiscDropFunctor | m_childQueueDiscDbeFunctor |
Function object called when a child queue disc dropped a packet before enqueue. | |
std::string | m_childQueueDiscDropMsg |
Reason why a packet was dropped by a child queue disc. | |
ChildQueueDiscMarkFunctor | m_childQueueDiscMarkFunctor |
Function object called when a child queue disc marked a packet. | |
std::string | m_childQueueDiscMarkMsg |
Reason why a packet was marked by a child queue disc. | |
std::vector< Ptr< QueueDiscClass > > | m_classes |
Classes. | |
Ptr< NetDeviceQueueInterface > | m_devQueueIface |
NetDevice queue interface. | |
std::vector< Ptr< PacketFilter > > | m_filters |
Packet filters. | |
InternalQueueDropFunctor | m_internalQueueDadFunctor |
Function object called when an internal queue dropped a packet after dequeue. | |
InternalQueueDropFunctor | m_internalQueueDbeFunctor |
Function object called when an internal queue dropped a packet before enqueue. | |
QueueSize | m_maxSize |
max queue size | |
TracedValue< uint32_t > | m_nBytes |
Number of bytes in the queue. | |
TracedValue< uint32_t > | m_nPackets |
Number of packets in the queue. | |
bool | m_peeked |
A packet was dequeued because Peek was called. | |
bool | m_prohibitChangeMode |
True if changing mode is prohibited. | |
std::vector< Ptr< InternalQueue > > | m_queues |
Internal queues. | |
uint32_t | m_quota |
Maximum number of packets dequeued in a qdisc run. | |
Ptr< QueueDiscItem > | m_requeued |
The last packet that failed to be transmitted. | |
bool | m_running |
The queue disc is performing multiple dequeue operations. | |
SendCallback | m_send |
Callback used to send a packet to the receiving object. | |
QueueDiscSizePolicy | m_sizePolicy |
The queue disc size policy. | |
TracedCallback< Time > | m_sojourn |
Sojourn time of the latest dequeued packet. | |
Stats | m_stats |
The collected statistics. | |
TracedCallback< Ptr< const QueueDiscItem > > | m_traceDequeue |
Traced callback: fired when a packet is dequeued. | |
TracedCallback< Ptr< const QueueDiscItem > > | m_traceDrop |
Traced callback: fired when a packet is dropped. | |
TracedCallback< Ptr< const QueueDiscItem >, const char * > | m_traceDropAfterDequeue |
Traced callback: fired when a packet is dropped after dequeue. | |
TracedCallback< Ptr< const QueueDiscItem >, const char * > | m_traceDropBeforeEnqueue |
Traced callback: fired when a packet is dropped before enqueue. | |
TracedCallback< Ptr< const QueueDiscItem > > | m_traceEnqueue |
Traced callback: fired when a packet is enqueued. | |
TracedCallback< Ptr< const QueueDiscItem >, const char * > | m_traceMark |
Traced callback: fired when a packet is marked. | |
TracedCallback< Ptr< const QueueDiscItem > > | m_traceRequeue |
Traced callback: fired when a packet is requeued. | |
Static Private Attributes | |
static const uint32_t | DEFAULT_QUOTA = 64 |
Default quota (as in /proc/sys/net/core/dev_weight) | |
Additional Inherited Members | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
QueueDisc is an abstract base class providing the interface and implementing the operations common to all the queueing disciplines.
Introspection did not find any typical Config paths.
Child classes need to implement the methods used to enqueue a packet (DoEnqueue), dequeue a single packet (DoDequeue), get a copy of the next packet to extract (DoPeek), check whether the current configuration is correct (CheckConfig).
As in Linux, a queue disc may contain distinct elements:
Notice that a child queue disc must be attached to every class and a packet filter is only able to classify packets of a single protocol. Also, while in Linux some queue discs (e.g., fq-codel) use an internal classifier and do not make use of packet filters, in ns-3 every queue disc including multiple queues or multiple classes needs an external filter to classify packets (this is to avoid having the traffic-control module depend on other modules such as internet).
Queue disc configuration vary from queue disc to queue disc. A typical taxonomy divides queue discs in classful (i.e., support classes) and classless (i.e., do not support classes). More recently, after the appearance of multi-queue devices (such as Wifi), some multi-queue aware queue discs have been introduced. Multi-queue aware queue discs handle as many queues (or queue discs – without using classes) as the number of transmission queues used by the device on which the queue disc is installed. An attempt is made, also, to enqueue each packet in the "same" queue both within the queue disc and within the device.
The traffic control layer interacts with a queue disc in a simple manner: after requesting to enqueue a packet, the traffic control layer requests the qdisc to "run", i.e., to dequeue a set of packets, until a predefined number ("quota") of packets is dequeued or the netdevice stops the queue disc. A netdevice shall stop the queue disc when its transmission queue does not have room for another packet. Also, a netdevice shall wake the queue disc when it detects that there is room for another packet in its transmission queue, but the transmission queue is stopped. Waking a queue disc is equivalent to make it run.
Every queue disc collects statistics about the total number of packets/bytes received from the upper layers (in case of root queue disc) or from the parent queue disc (in case of child queue disc), enqueued, dequeued, requeued, dropped, dropped before enqueue, dropped after dequeue, queued in the queue disc and sent to the netdevice or to the parent queue disc. Note that packets that are dequeued may be requeued, i.e., retained by the traffic control infrastructure, if the netdevice is not ready to receive them. Requeued packets are not part of the queue disc. The following identities hold:
Separate counters are also kept for each possible reason to drop a packet. When a packet is dropped by an internal queue, e.g., because the queue is full, the reason is "Dropped by internal queue". When a packet is dropped by a child queue disc, the reason is "(Dropped by child queue disc) " followed by the reason why the child queue disc dropped the packet.
The QueueDisc base class provides the SojournTime trace source, which provides the sojourn time of every packet dequeued from a queue disc, including packets that are dropped or requeued after being dequeued. The sojourn time is taken when the packet is dequeued from the queue disc, hence it does not account for the additional time the packet is retained within the traffic control infrastructure in case it is requeued.
The design and implementation of this class is heavily inspired by Linux. For more details, see the traffic-control model page.
Size of this type is 968 bytes (on a 64-bit architecture).
Definition at line 183 of file queue-disc.h.
|
private |
Type for the function objects notifying that a packet has been dropped by a child queue disc.
Definition at line 729 of file queue-disc.h.
|
private |
Type for the function objects notifying that a packet has been marked by a child queue disc.
Definition at line 731 of file queue-disc.h.
Internal queues store QueueDiscItem objects.
Definition at line 428 of file queue-disc.h.
|
private |
Type for the function objects notifying that a packet has been dropped by an internal queue.
Definition at line 727 of file queue-disc.h.
typedef std::function<void(Ptr<QueueDiscItem>)> ns3::QueueDisc::SendCallback |
Callback invoked to send a packet to the receiving object when Run is called.
Definition at line 363 of file queue-disc.h.
Used to determine whether the queue disc itself or its children must be activated when a netdevice wakes a transmission queue.
Enumerator | |
---|---|
WAKE_ROOT | |
WAKE_CHILD |
Definition at line 502 of file queue-disc.h.
ns3::QueueDisc::QueueDisc | ( | QueueDiscSizePolicy | policy = QueueDiscSizePolicy::SINGLE_INTERNAL_QUEUE | ) |
Constructor.
policy | the policy to handle the queue disc size |
Definition at line 321 of file queue-disc.cc.
References CHILD_QUEUE_DISC_DROP, CHILD_QUEUE_DISC_MARK, DropAfterDequeue(), DropBeforeEnqueue(), INTERNAL_QUEUE_DROP, m_childQueueDiscDadFunctor, m_childQueueDiscDbeFunctor, m_childQueueDiscDropMsg, m_childQueueDiscMarkFunctor, m_childQueueDiscMarkMsg, m_internalQueueDadFunctor, m_internalQueueDbeFunctor, Mark(), NS_LOG_FUNCTION, and ns3::PeekPointer().
ns3::QueueDisc::QueueDisc | ( | QueueDiscSizePolicy | policy, |
QueueSizeUnit | unit | ||
) |
Constructor.
policy | the policy to handle the queue disc size |
unit | The fixed operating mode of this queue disc |
Definition at line 366 of file queue-disc.cc.
References m_maxSize, and m_prohibitChangeMode.
|
override |
Definition at line 373 of file queue-disc.cc.
References NS_LOG_FUNCTION.
|
delete |
void ns3::QueueDisc::AddInternalQueue | ( | Ptr< InternalQueue > | queue | ) |
Add an internal queue to the tail of the list of queues.
queue | the queue to be added |
Definition at line 577 of file queue-disc.cc.
References m_internalQueueDadFunctor, m_internalQueueDbeFunctor, m_queues, ns3::MakeCallback(), NS_LOG_FUNCTION, PacketDequeued(), and PacketEnqueued().
Referenced by ns3::CobaltQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::FifoQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), and TestChildQueueDisc::CheckConfig().
void ns3::QueueDisc::AddPacketFilter | ( | Ptr< PacketFilter > | filter | ) |
Add a packet filter to the tail of the list of filters used to classify packets.
filter | the packet filter to be added |
Definition at line 608 of file queue-disc.cc.
References m_filters, and NS_LOG_FUNCTION.
void ns3::QueueDisc::AddQueueDiscClass | ( | Ptr< QueueDiscClass > | qdClass | ) |
Add a queue disc class to the tail of the list of classes.
qdClass | the queue disc class to be added |
Definition at line 628 of file queue-disc.cc.
References m_childQueueDiscDadFunctor, m_childQueueDiscDbeFunctor, m_childQueueDiscMarkFunctor, m_classes, ns3::MakeCallback(), NS_ABORT_MSG_IF, NS_LOG_FUNCTION, PacketDequeued(), PacketEnqueued(), and WAKE_CHILD.
Referenced by ns3::PrioQueueDisc::CheckConfig(), ns3::TbfQueueDisc::CheckConfig(), TestParentQueueDisc::CheckConfig(), ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), and ns3::FqPieQueueDisc::DoEnqueue().
|
privatepure virtual |
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.
Implemented in ns3::CobaltQueueDisc, ns3::CoDelQueueDisc, ns3::FifoQueueDisc, ns3::FqCobaltQueueDisc, ns3::FqCoDelQueueDisc, ns3::FqPieQueueDisc, ns3::MqQueueDisc, ns3::PfifoFastQueueDisc, ns3::PieQueueDisc, ns3::PrioQueueDisc, ns3::RedQueueDisc, ns3::TbfQueueDisc, TestChildQueueDisc, and TestParentQueueDisc.
Referenced by DoInitialize().
int32_t ns3::QueueDisc::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.
item | item to classify |
Definition at line 671 of file queue-disc.cc.
References f(), m_filters, NS_LOG_FUNCTION, and ns3::PacketFilter::PF_NO_MATCH.
Referenced by ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::FqPieQueueDisc::DoEnqueue(), and ns3::PrioQueueDisc::DoEnqueue().
Ptr< QueueDiscItem > ns3::QueueDisc::Dequeue | ( | ) |
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.
Definition at line 894 of file queue-disc.cc.
References DoDequeue(), m_nBytes, m_nPackets, m_peeked, m_requeued, m_stats, NS_ASSERT, NS_LOG_FUNCTION, ns3::QueueDisc::Stats::nTotalDequeuedBytes, ns3::QueueDisc::Stats::nTotalDequeuedPackets, ns3::QueueDisc::Stats::nTotalEnqueuedBytes, ns3::QueueDisc::Stats::nTotalEnqueuedPackets, and PacketDequeued().
Referenced by DequeuePacket(), ns3::PfifoFastQueueDisc::DoDequeue(), ns3::PrioQueueDisc::DoDequeue(), and DoPeek().
|
private |
Modelled after the Linux function dequeue_skb (net/sched/sch_generic.c)
Definition at line 1008 of file queue-disc.cc.
References Dequeue(), m_devQueueIface, m_peeked, m_requeued, NS_LOG_FUNCTION, and PacketDequeued().
Referenced by Restart().
|
privatepure virtual |
This function actually extracts a packet from the queue disc.
Implemented in ns3::CobaltQueueDisc, ns3::CoDelQueueDisc, ns3::FifoQueueDisc, ns3::FqCobaltQueueDisc, ns3::FqCoDelQueueDisc, ns3::FqPieQueueDisc, ns3::MqQueueDisc, ns3::PfifoFastQueueDisc, ns3::PieQueueDisc, ns3::PrioQueueDisc, ns3::RedQueueDisc, ns3::TbfQueueDisc, TestChildQueueDisc, and TestParentQueueDisc.
Referenced by Dequeue().
|
overrideprotectedvirtual |
Dispose of the object.
Reimplemented from ns3::Object.
Reimplemented in ns3::RedQueueDisc, and ns3::TbfQueueDisc.
Definition at line 379 of file queue-disc.cc.
References ns3::Object::DoDispose(), m_childQueueDiscDadFunctor, m_childQueueDiscDbeFunctor, m_classes, m_devQueueIface, m_filters, m_internalQueueDadFunctor, m_internalQueueDbeFunctor, m_queues, m_requeued, m_send, and NS_LOG_FUNCTION.
Referenced by ns3::CobaltQueueDisc::DoDispose(), ns3::PieQueueDisc::DoDispose(), ns3::RedQueueDisc::DoDispose(), and ns3::TbfQueueDisc::DoDispose().
|
privatepure virtual |
This function actually enqueues a packet into the queue disc.
item | item to enqueue |
Implemented in ns3::CobaltQueueDisc, ns3::CoDelQueueDisc, ns3::FifoQueueDisc, ns3::FqCobaltQueueDisc, ns3::FqCoDelQueueDisc, ns3::FqPieQueueDisc, ns3::MqQueueDisc, ns3::PfifoFastQueueDisc, ns3::PieQueueDisc, ns3::PrioQueueDisc, ns3::RedQueueDisc, ns3::TbfQueueDisc, TestChildQueueDisc, and TestParentQueueDisc.
Referenced by Enqueue().
|
overrideprotectedvirtual |
Check whether the configuration is correct and initialize parameters.
This method is not virtual to prevent subclasses from redefining it. Subclasses must instead provide the implementation of the CheckConfig and InitializeParams methods (which are called by this method).
Reimplemented from ns3::Object.
Definition at line 396 of file queue-disc.cc.
References CheckConfig(), ns3::Object::DoInitialize(), InitializeParams(), m_classes, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
privatevirtual |
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.
Reimplemented in ns3::CobaltQueueDisc, ns3::FifoQueueDisc, ns3::MqQueueDisc, ns3::PfifoFastQueueDisc, ns3::PrioQueueDisc, and ns3::RedQueueDisc.
Definition at line 935 of file queue-disc.cc.
References Dequeue(), m_peeked, m_requeued, and NS_LOG_FUNCTION.
Referenced by Peek().
|
protected |
Perform the actions required when the queue disc is notified of a packet dropped after dequeue.
item | item that was dropped |
reason | the reason why the item was dropped This method must be called by subclasses to record that a packet was dropped after dequeue for the specified reason |
Definition at line 766 of file queue-disc.cc.
References m_peeked, m_stats, m_traceDrop, m_traceDropAfterDequeue, ns3::QueueDisc::Stats::nDroppedBytesAfterDequeue, ns3::QueueDisc::Stats::nDroppedPacketsAfterDequeue, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::QueueDisc::Stats::nTotalDroppedBytes, ns3::QueueDisc::Stats::nTotalDroppedBytesAfterDequeue, ns3::QueueDisc::Stats::nTotalDroppedPackets, ns3::QueueDisc::Stats::nTotalDroppedPacketsAfterDequeue, and PacketDequeued().
Referenced by QueueDisc(), ns3::CobaltQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoDequeue(), TestChildQueueDisc::DoDequeue(), ns3::FqCobaltQueueDisc::FqCobaltDrop(), ns3::FqCoDelQueueDisc::FqCoDelDrop(), and ns3::FqPieQueueDisc::FqPieDrop().
|
protected |
Perform the actions required when the queue disc is notified of a packet dropped before enqueue.
item | item that was dropped |
reason | the reason why the item was dropped This method must be called by subclasses to record that a packet was dropped before enqueue for the specified reason |
Definition at line 726 of file queue-disc.cc.
References m_stats, m_traceDrop, m_traceDropBeforeEnqueue, ns3::QueueDisc::Stats::nDroppedBytesBeforeEnqueue, ns3::QueueDisc::Stats::nDroppedPacketsBeforeEnqueue, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::QueueDisc::Stats::nTotalDroppedBytes, ns3::QueueDisc::Stats::nTotalDroppedBytesBeforeEnqueue, ns3::QueueDisc::Stats::nTotalDroppedPackets, and ns3::QueueDisc::Stats::nTotalDroppedPacketsBeforeEnqueue.
Referenced by QueueDisc(), ns3::CobaltQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::FifoQueueDisc::DoEnqueue(), ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::FqPieQueueDisc::DoEnqueue(), ns3::PfifoFastQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::RedQueueDisc::DoEnqueue(), and TestChildQueueDisc::DoEnqueue().
bool ns3::QueueDisc::Enqueue | ( | Ptr< QueueDiscItem > | item | ) |
Pass a packet to store to the queue discipline.
This function only updates the statistics and calls the (private) DoEnqueue function, which must be implemented by derived classes.
item | item to enqueue |
Definition at line 859 of file queue-disc.cc.
References DoEnqueue(), m_stats, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, ns3::QueueDisc::Stats::nTotalDroppedBytesBeforeEnqueue, ns3::QueueDisc::Stats::nTotalDroppedPacketsBeforeEnqueue, ns3::QueueDisc::Stats::nTotalEnqueuedBytes, ns3::QueueDisc::Stats::nTotalEnqueuedPackets, ns3::QueueDisc::Stats::nTotalReceivedBytes, and ns3::QueueDisc::Stats::nTotalReceivedPackets.
QueueSize ns3::QueueDisc::GetCurrentSize | ( | ) |
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise.
Do not call this method if the queue disc size is not limited.
Definition at line 519 of file queue-disc.cc.
References ns3::BYTES, GetMaxSize(), m_nBytes, m_nPackets, NS_ABORT_MSG, NS_LOG_FUNCTION, and ns3::PACKETS.
Referenced by ns3::CobaltQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::FifoQueueDisc::DoEnqueue(), ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::FqPieQueueDisc::DoEnqueue(), ns3::PfifoFastQueueDisc::DoEnqueue(), and ns3::PieQueueDisc::DoEnqueue().
Ptr< QueueDisc::InternalQueue > ns3::QueueDisc::GetInternalQueue | ( | std::size_t | i | ) | const |
Get the i-th internal queue.
i | the index of the queue |
Definition at line 595 of file queue-disc.cc.
References m_queues, and NS_ASSERT.
Referenced by ns3::PieQueueDisc::CalculateP(), ns3::PfifoFastQueueDisc::CheckConfig(), ns3::CobaltQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoDequeue(), ns3::FifoQueueDisc::DoDequeue(), ns3::PfifoFastQueueDisc::DoDequeue(), ns3::PieQueueDisc::DoDequeue(), ns3::RedQueueDisc::DoDequeue(), TestChildQueueDisc::DoDequeue(), ns3::CobaltQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::FifoQueueDisc::DoEnqueue(), ns3::PfifoFastQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::RedQueueDisc::DoEnqueue(), TestChildQueueDisc::DoEnqueue(), ns3::CobaltQueueDisc::DoPeek(), ns3::FifoQueueDisc::DoPeek(), ns3::PfifoFastQueueDisc::DoPeek(), ns3::RedQueueDisc::DoPeek(), GetMaxSize(), ns3::CoDelQueueDisc::OkToDrop(), and SetMaxSize().
QueueSize ns3::QueueDisc::GetMaxSize | ( | ) | const |
Get the maximum size of the queue disc.
Definition at line 450 of file queue-disc.cc.
References GetInternalQueue(), GetNInternalQueues(), GetNQueueDiscClasses(), GetQueueDiscClass(), m_maxSize, m_sizePolicy, ns3::MULTIPLE_QUEUES, ns3::NO_LIMITS, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::SINGLE_CHILD_QUEUE_DISC, and ns3::SINGLE_INTERNAL_QUEUE.
Referenced by ns3::CobaltQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::FifoQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::TbfQueueDisc::CheckConfig(), ns3::CobaltQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::FifoQueueDisc::DoEnqueue(), ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::FqPieQueueDisc::DoEnqueue(), ns3::PfifoFastQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DropEarly(), GetCurrentSize(), ns3::CobaltQueueDisc::GetTypeId(), ns3::CoDelQueueDisc::GetTypeId(), ns3::FifoQueueDisc::GetTypeId(), ns3::FqCobaltQueueDisc::GetTypeId(), ns3::FqCoDelQueueDisc::GetTypeId(), ns3::FqPieQueueDisc::GetTypeId(), ns3::PfifoFastQueueDisc::GetTypeId(), ns3::PieQueueDisc::GetTypeId(), ns3::RedQueueDisc::GetTypeId(), ns3::TbfQueueDisc::GetTypeId(), ns3::FqCobaltQueueDisc::InitializeParams(), ns3::FqCoDelQueueDisc::InitializeParams(), ns3::FqPieQueueDisc::InitializeParams(), ns3::RedQueueDisc::InitializeParams(), and ns3::RedQueueDisc::ModifyP().
uint32_t ns3::QueueDisc::GetNBytes | ( | ) | const |
Get the amount of bytes stored by the queue disc.
The requeued packet, if any, is counted.
Definition at line 443 of file queue-disc.cc.
References m_nBytes, and NS_LOG_FUNCTION.
Referenced by ns3::PieQueueDisc::CalculateP(), ns3::CobaltQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoDequeue(), ns3::PieQueueDisc::DoDequeue(), ns3::RedQueueDisc::DoDequeue(), ns3::TbfQueueDisc::DoDequeue(), ns3::CobaltQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::FifoQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::RedQueueDisc::DoEnqueue(), ns3::TbfQueueDisc::DoEnqueue(), ns3::CobaltQueueDisc::DoPeek(), ns3::RedQueueDisc::DoPeek(), and ns3::CoDelQueueDisc::OkToDrop().
Ptr< NetDeviceQueueInterface > ns3::QueueDisc::GetNetDeviceQueueInterface | ( | ) | const |
Get the pointer to the NetDeviceQueueInterface object aggregated to the object receiving the packets dequeued from this queue disc.
Definition at line 542 of file queue-disc.cc.
References m_devQueueIface, and NS_LOG_FUNCTION.
Referenced by ns3::FqCobaltQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::CheckConfig(), ns3::FqPieQueueDisc::CheckConfig(), and ns3::TbfQueueDisc::CheckConfig().
std::size_t ns3::QueueDisc::GetNInternalQueues | ( | ) | const |
Get the number of internal queues.
Definition at line 602 of file queue-disc.cc.
References m_queues.
Referenced by ns3::CobaltQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::FifoQueueDisc::CheckConfig(), ns3::FqCobaltQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::CheckConfig(), ns3::FqPieQueueDisc::CheckConfig(), ns3::MqQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::PrioQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::TbfQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::DoDequeue(), ns3::PfifoFastQueueDisc::DoPeek(), GetMaxSize(), and SetMaxSize().
std::size_t ns3::QueueDisc::GetNPacketFilters | ( | ) | const |
Get the number of packet filters.
Definition at line 622 of file queue-disc.cc.
References m_filters.
Referenced by ns3::CobaltQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::FifoQueueDisc::CheckConfig(), ns3::MqQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::TbfQueueDisc::CheckConfig(), ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), and ns3::FqPieQueueDisc::DoEnqueue().
uint32_t ns3::QueueDisc::GetNPackets | ( | ) | const |
Get the number of packets stored by the queue disc.
The requeued packet, if any, is counted.
Definition at line 436 of file queue-disc.cc.
References m_nPackets, and NS_LOG_FUNCTION.
Referenced by ns3::CobaltQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoDequeue(), ns3::PfifoFastQueueDisc::DoDequeue(), ns3::PrioQueueDisc::DoDequeue(), ns3::RedQueueDisc::DoDequeue(), ns3::TbfQueueDisc::DoDequeue(), TestChildQueueDisc::DoDequeue(), ns3::CobaltQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::FifoQueueDisc::DoEnqueue(), ns3::PfifoFastQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::PrioQueueDisc::DoEnqueue(), ns3::RedQueueDisc::DoEnqueue(), ns3::TbfQueueDisc::DoEnqueue(), TestChildQueueDisc::DoEnqueue(), ns3::CobaltQueueDisc::DoPeek(), ns3::PfifoFastQueueDisc::DoPeek(), ns3::PrioQueueDisc::DoPeek(), ns3::RedQueueDisc::DoPeek(), and Transmit().
std::size_t ns3::QueueDisc::GetNQueueDiscClasses | ( | ) | const |
Get the number of queue disc classes.
Definition at line 665 of file queue-disc.cc.
References m_classes.
Referenced by ns3::CobaltQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::FifoQueueDisc::CheckConfig(), ns3::FqCobaltQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::CheckConfig(), ns3::FqPieQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::PrioQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::TbfQueueDisc::CheckConfig(), ns3::PrioQueueDisc::DoDequeue(), ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::FqPieQueueDisc::DoEnqueue(), ns3::PrioQueueDisc::DoEnqueue(), ns3::PrioQueueDisc::DoPeek(), ns3::FqCobaltQueueDisc::FqCobaltDrop(), ns3::FqCoDelQueueDisc::FqCoDelDrop(), ns3::FqPieQueueDisc::FqPieDrop(), GetMaxSize(), and SetMaxSize().
Ptr< PacketFilter > ns3::QueueDisc::GetPacketFilter | ( | std::size_t | i | ) | const |
Get the i-th packet filter.
i | the index of the packet filter |
Definition at line 615 of file queue-disc.cc.
Ptr< QueueDiscClass > ns3::QueueDisc::GetQueueDiscClass | ( | std::size_t | i | ) | const |
Get the i-th queue disc class.
i | the index of the queue disc class |
Definition at line 658 of file queue-disc.cc.
References m_classes, and NS_ASSERT.
Referenced by ns3::PrioQueueDisc::DoDequeue(), ns3::TbfQueueDisc::DoDequeue(), TestParentQueueDisc::DoDequeue(), ns3::FqCobaltQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::FqPieQueueDisc::DoEnqueue(), ns3::PrioQueueDisc::DoEnqueue(), ns3::TbfQueueDisc::DoEnqueue(), TestParentQueueDisc::DoEnqueue(), ns3::PrioQueueDisc::DoPeek(), ns3::FqCobaltQueueDisc::FqCobaltDrop(), ns3::FqCoDelQueueDisc::FqCoDelDrop(), ns3::FqPieQueueDisc::FqPieDrop(), GetMaxSize(), ns3::FqCobaltQueueDisc::SetAssociativeHash(), ns3::FqCoDelQueueDisc::SetAssociativeHash(), ns3::FqPieQueueDisc::SetAssociativeHash(), and SetMaxSize().
|
virtual |
Get the maximum number of dequeue operations following a packet enqueue.
Definition at line 570 of file queue-disc.cc.
References m_quota, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
QueueDisc::SendCallback ns3::QueueDisc::GetSendCallback | ( | ) | const |
Get the callback used by the Transmit method (called eventually by the Run method) to send a packet to the receiving object.
Definition at line 556 of file queue-disc.cc.
References m_send, and NS_LOG_FUNCTION.
const QueueDisc::Stats & ns3::QueueDisc::GetStats | ( | ) |
Retrieve all the collected statistics.
Definition at line 416 of file queue-disc.cc.
References m_requeued, m_stats, NS_ASSERT, ns3::QueueDisc::Stats::nTotalDequeuedBytes, ns3::QueueDisc::Stats::nTotalDequeuedPackets, ns3::QueueDisc::Stats::nTotalDroppedBytes, ns3::QueueDisc::Stats::nTotalDroppedBytesAfterDequeue, ns3::QueueDisc::Stats::nTotalDroppedBytesBeforeEnqueue, ns3::QueueDisc::Stats::nTotalDroppedPackets, ns3::QueueDisc::Stats::nTotalDroppedPacketsAfterDequeue, ns3::QueueDisc::Stats::nTotalDroppedPacketsBeforeEnqueue, ns3::QueueDisc::Stats::nTotalSentBytes, and ns3::QueueDisc::Stats::nTotalSentPackets.
|
static |
Get the type ID.
Definition at line 252 of file queue-disc.cc.
References DEFAULT_QUOTA, GetQuota(), m_classes, m_filters, m_nBytes, m_nPackets, m_queues, m_sojourn, m_traceDequeue, m_traceDrop, m_traceDropAfterDequeue, m_traceDropBeforeEnqueue, m_traceEnqueue, m_traceMark, m_traceRequeue, ns3::MakeObjectVectorAccessor(), ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), ns3::TypeId::SetParent(), and SetQuota().
|
virtual |
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.
The implementation of this method for the base class returns WAKE_ROOT, i.e., the root queue disc is activated. Subclasses implementing queue discs adopting a different strategy (e.g., multi-queue aware queue discs such as mq) have to redefine this method.
Reimplemented in ns3::MqQueueDisc.
Definition at line 686 of file queue-disc.cc.
References WAKE_ROOT.
|
privatepure virtual |
Initialize parameters (if any) before the first packet is enqueued.
This method is automatically called at simulation initialization time, after the CheckConfig() method has been called.
Implemented in ns3::CobaltQueueDisc, ns3::CoDelQueueDisc, ns3::FifoQueueDisc, ns3::FqCobaltQueueDisc, ns3::FqCoDelQueueDisc, ns3::FqPieQueueDisc, ns3::MqQueueDisc, ns3::PfifoFastQueueDisc, ns3::PieQueueDisc, ns3::PrioQueueDisc, ns3::RedQueueDisc, ns3::TbfQueueDisc, TestChildQueueDisc, and TestParentQueueDisc.
Referenced by DoInitialize().
|
protected |
Marks the given packet and, if successful, updates the counters associated with the given reason.
item | item that has to be marked |
reason | the reason why the item has to be marked |
Definition at line 817 of file queue-disc.cc.
References m_stats, m_traceMark, ns3::QueueDisc::Stats::nMarkedBytes, ns3::QueueDisc::Stats::nMarkedPackets, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::QueueDisc::Stats::nTotalMarkedBytes, and ns3::QueueDisc::Stats::nTotalMarkedPackets.
Referenced by QueueDisc(), ns3::CobaltQueueDisc::CobaltShouldDrop(), ns3::CoDelQueueDisc::DoDequeue(), ns3::PieQueueDisc::DoDequeue(), ns3::PieQueueDisc::DoEnqueue(), and ns3::RedQueueDisc::DoEnqueue().
|
private |
Perform the actions required when the queue disc is notified of a packet dequeue.
item | item that was dequeued |
Definition at line 704 of file queue-disc.cc.
References m_nBytes, m_nPackets, m_peeked, m_sojourn, m_stats, m_traceDequeue, ns3::Simulator::Now(), NS_LOG_LOGIC, ns3::QueueDisc::Stats::nTotalDequeuedBytes, and ns3::QueueDisc::Stats::nTotalDequeuedPackets.
Referenced by AddInternalQueue(), AddQueueDiscClass(), Dequeue(), DequeuePacket(), and DropAfterDequeue().
|
private |
Perform the actions required when the queue disc is notified of a packet enqueue.
item | item that was enqueued |
Definition at line 692 of file queue-disc.cc.
References m_nBytes, m_nPackets, m_stats, m_traceEnqueue, NS_LOG_LOGIC, ns3::QueueDisc::Stats::nTotalEnqueuedBytes, and ns3::QueueDisc::Stats::nTotalEnqueuedPackets.
Referenced by AddInternalQueue(), and AddQueueDiscClass().
Ptr< const QueueDiscItem > ns3::QueueDisc::Peek | ( | ) |
Get a copy of the next packet the queue discipline will extract.
This function only calls the (private) DoPeek function. This base class provides a default implementation of DoPeek, which dequeues the next packet but retains it into the queue disc.
Definition at line 928 of file queue-disc.cc.
References DoPeek(), and NS_LOG_FUNCTION.
Referenced by ns3::PfifoFastQueueDisc::DoPeek(), and ns3::PrioQueueDisc::DoPeek().
|
private |
Modelled after the Linux function dev_requeue_skb (net/sched/sch_generic.c) Requeues a packet whose transmission failed.
item | the packet to requeue |
Definition at line 1058 of file queue-disc.cc.
References m_requeued, m_stats, m_traceRequeue, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::QueueDisc::Stats::nTotalRequeuedBytes, and ns3::QueueDisc::Stats::nTotalRequeuedPackets.
Referenced by Transmit().
|
private |
Modelled after the Linux function qdisc_restart (net/sched/sch_generic.c) Dequeue a packet (by calling DequeuePacket) and send it to the device (by calling Transmit).
Definition at line 994 of file queue-disc.cc.
References DequeuePacket(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and Transmit().
Referenced by Run().
void ns3::QueueDisc::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.
Definition at line 953 of file queue-disc.cc.
References m_quota, NS_LOG_FUNCTION, Restart(), RunBegin(), and RunEnd().
Referenced by ns3::TbfQueueDisc::DoDequeue(), and ns3::TrafficControlLayer::ScanDevices().
|
private |
Modelled after the Linux function qdisc_run_begin (include/net/sch_generic.h).
Definition at line 974 of file queue-disc.cc.
References m_running, and NS_LOG_FUNCTION.
Referenced by Run().
|
private |
Modelled after the Linux function qdisc_run_end (include/net/sch_generic.h).
Set the qdisc as not running.
Definition at line 987 of file queue-disc.cc.
References m_running, and NS_LOG_FUNCTION.
Referenced by Run().
bool ns3::QueueDisc::SetMaxSize | ( | QueueSize | size | ) |
Set the maximum size of the queue disc.
Trying to set a null size has no effect.
size | the maximum size. |
Definition at line 478 of file queue-disc.cc.
References GetInternalQueue(), GetNInternalQueues(), GetNQueueDiscClasses(), GetQueueDiscClass(), ns3::QueueSize::GetUnit(), ns3::QueueSize::GetValue(), m_maxSize, m_prohibitChangeMode, m_sizePolicy, ns3::MULTIPLE_QUEUES, ns3::NO_LIMITS, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::SINGLE_CHILD_QUEUE_DISC, and ns3::SINGLE_INTERNAL_QUEUE.
Referenced by ns3::CobaltQueueDisc::GetTypeId(), ns3::CoDelQueueDisc::GetTypeId(), ns3::FifoQueueDisc::GetTypeId(), ns3::FqCobaltQueueDisc::GetTypeId(), ns3::FqCoDelQueueDisc::GetTypeId(), ns3::FqPieQueueDisc::GetTypeId(), ns3::PfifoFastQueueDisc::GetTypeId(), ns3::PieQueueDisc::GetTypeId(), ns3::RedQueueDisc::GetTypeId(), and ns3::TbfQueueDisc::GetTypeId().
void ns3::QueueDisc::SetNetDeviceQueueInterface | ( | Ptr< NetDeviceQueueInterface > | ndqi | ) |
ndqi | the NetDeviceQueueInterface aggregated to the receiving object. |
Set the pointer to the NetDeviceQueueInterface object aggregated to the object receiving the packets dequeued from this queue disc.
Definition at line 535 of file queue-disc.cc.
References m_devQueueIface, and NS_LOG_FUNCTION.
|
virtual |
Set the maximum number of dequeue operations following a packet enqueue.
quota | the maximum number of dequeue operations following a packet enqueue. |
Definition at line 563 of file queue-disc.cc.
References m_quota, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::QueueDisc::SetSendCallback | ( | SendCallback | func | ) |
func | the callback to send a packet to the receiving object. |
Set the callback used by the Transmit method (called eventually by the Run method) to send a packet to the receiving object.
Definition at line 549 of file queue-disc.cc.
References m_send, and NS_LOG_FUNCTION.
|
private |
Modelled after the Linux function sch_direct_xmit (net/sched/sch_generic.c) Sends a packet to the device if the device queue is not stopped, and requeues it otherwise.
item | the packet to transmit |
Definition at line 1072 of file queue-disc.cc.
References GetNPackets(), m_devQueueIface, m_send, NS_ASSERT_MSG, NS_LOG_FUNCTION, and Requeue().
Referenced by Restart().
|
staticconstexpr |
Packet dropped by a child queue disc.
Definition at line 524 of file queue-disc.h.
Referenced by QueueDisc().
|
staticconstexpr |
Packet marked by a child queue disc.
Definition at line 526 of file queue-disc.h.
Referenced by QueueDisc().
|
staticprivate |
Default quota (as in /proc/sys/net/core/dev_weight)
Definition at line 688 of file queue-disc.h.
Referenced by GetTypeId().
|
staticconstexpr |
Packet dropped by an internal queue.
Definition at line 522 of file queue-disc.h.
Referenced by QueueDisc(), and RedQueueDiscTestCase::RunRedTest().
|
private |
Function object called when a child queue disc dropped a packet after dequeue.
Definition at line 740 of file queue-disc.h.
Referenced by QueueDisc(), AddQueueDiscClass(), and DoDispose().
|
private |
Function object called when a child queue disc dropped a packet before enqueue.
Definition at line 738 of file queue-disc.h.
Referenced by QueueDisc(), AddQueueDiscClass(), and DoDispose().
|
private |
Reason why a packet was dropped by a child queue disc.
Definition at line 706 of file queue-disc.h.
Referenced by QueueDisc().
|
private |
Function object called when a child queue disc marked a packet.
Definition at line 742 of file queue-disc.h.
Referenced by QueueDisc(), and AddQueueDiscClass().
|
private |
Reason why a packet was marked by a child queue disc.
Definition at line 707 of file queue-disc.h.
Referenced by QueueDisc().
|
private |
Classes.
Definition at line 692 of file queue-disc.h.
Referenced by AddQueueDiscClass(), DoDispose(), DoInitialize(), GetNQueueDiscClasses(), GetQueueDiscClass(), and GetTypeId().
|
private |
NetDevice queue interface.
Definition at line 701 of file queue-disc.h.
Referenced by DequeuePacket(), DoDispose(), GetNetDeviceQueueInterface(), SetNetDeviceQueueInterface(), and Transmit().
|
private |
Packet filters.
Definition at line 691 of file queue-disc.h.
Referenced by AddPacketFilter(), Classify(), DoDispose(), GetNPacketFilters(), GetPacketFilter(), and GetTypeId().
|
private |
Function object called when an internal queue dropped a packet after dequeue.
Definition at line 736 of file queue-disc.h.
Referenced by QueueDisc(), AddInternalQueue(), and DoDispose().
|
private |
Function object called when an internal queue dropped a packet before enqueue.
Definition at line 734 of file queue-disc.h.
Referenced by QueueDisc(), AddInternalQueue(), and DoDispose().
|
private |
max queue size
Definition at line 697 of file queue-disc.h.
Referenced by QueueDisc(), GetMaxSize(), and SetMaxSize().
|
private |
Number of bytes in the queue.
Definition at line 695 of file queue-disc.h.
Referenced by Dequeue(), GetCurrentSize(), GetNBytes(), GetTypeId(), PacketDequeued(), and PacketEnqueued().
|
private |
Number of packets in the queue.
Definition at line 694 of file queue-disc.h.
Referenced by Dequeue(), GetCurrentSize(), GetNPackets(), GetTypeId(), PacketDequeued(), and PacketEnqueued().
|
private |
A packet was dequeued because Peek was called.
Definition at line 705 of file queue-disc.h.
Referenced by Dequeue(), DequeuePacket(), DoPeek(), DropAfterDequeue(), and PacketDequeued().
|
private |
True if changing mode is prohibited.
Definition at line 709 of file queue-disc.h.
Referenced by QueueDisc(), and SetMaxSize().
|
private |
Internal queues.
Definition at line 690 of file queue-disc.h.
Referenced by AddInternalQueue(), DoDispose(), GetInternalQueue(), GetNInternalQueues(), and GetTypeId().
|
private |
Maximum number of packets dequeued in a qdisc run.
Definition at line 700 of file queue-disc.h.
Referenced by GetQuota(), Run(), and SetQuota().
|
private |
The last packet that failed to be transmitted.
Definition at line 704 of file queue-disc.h.
Referenced by Dequeue(), DequeuePacket(), DoDispose(), DoPeek(), GetStats(), and Requeue().
|
private |
The queue disc is performing multiple dequeue operations.
Definition at line 703 of file queue-disc.h.
Referenced by RunBegin(), and RunEnd().
|
private |
Callback used to send a packet to the receiving object.
Definition at line 702 of file queue-disc.h.
Referenced by DoDispose(), GetSendCallback(), SetSendCallback(), and Transmit().
|
private |
The queue disc size policy.
Definition at line 708 of file queue-disc.h.
Referenced by GetMaxSize(), and SetMaxSize().
|
private |
Sojourn time of the latest dequeued packet.
Definition at line 696 of file queue-disc.h.
Referenced by GetTypeId(), and PacketDequeued().
|
private |
The collected statistics.
Definition at line 699 of file queue-disc.h.
Referenced by Dequeue(), DropAfterDequeue(), DropBeforeEnqueue(), Enqueue(), GetStats(), Mark(), PacketDequeued(), PacketEnqueued(), and Requeue().
|
private |
Traced callback: fired when a packet is dequeued.
Definition at line 714 of file queue-disc.h.
Referenced by GetTypeId(), and PacketDequeued().
|
private |
Traced callback: fired when a packet is dropped.
Definition at line 718 of file queue-disc.h.
Referenced by DropAfterDequeue(), DropBeforeEnqueue(), and GetTypeId().
|
private |
Traced callback: fired when a packet is dropped after dequeue.
Definition at line 722 of file queue-disc.h.
Referenced by DropAfterDequeue(), and GetTypeId().
|
private |
Traced callback: fired when a packet is dropped before enqueue.
Definition at line 720 of file queue-disc.h.
Referenced by DropBeforeEnqueue(), and GetTypeId().
|
private |
Traced callback: fired when a packet is enqueued.
Definition at line 712 of file queue-disc.h.
Referenced by GetTypeId(), and PacketEnqueued().
|
private |
Traced callback: fired when a packet is marked.
Definition at line 724 of file queue-disc.h.
Referenced by GetTypeId(), and Mark().
|
private |
Traced callback: fired when a packet is requeued.
Definition at line 716 of file queue-disc.h.
Referenced by GetTypeId(), and Requeue().