QueueDisc is an abstract base class providing the interface and implementing the operations common to all the queueing disciplines. More...
#include "queue-disc.h"
Public Types | |
typedef Callback< void, Ptr< QueueItem > > | ParentDropCallback |
Callback invoked by a child queue disc to notify the parent of a packet drop. More... | |
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 () | |
void | AddInternalQueue (Ptr< Queue > queue) |
Add an internal queue to the tail of the list of queues. More... | |
void | AddPacketFilter (Ptr< PacketFilter > filter) |
Add a packet filter to the tail of the list of filters used to classify packets. More... | |
void | AddQueueDiscClass (Ptr< QueueDiscClass > qdClass) |
Add a queue disc class to the tail of the list of classes. More... | |
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. More... | |
Ptr< QueueDiscItem > | Dequeue (void) |
Request the queue discipline to extract a packet. More... | |
bool | Enqueue (Ptr< QueueDiscItem > item) |
Pass a packet to store to the queue discipline. More... | |
Ptr< Queue > | GetInternalQueue (uint32_t i) const |
Get the i-th internal queue. More... | |
uint32_t | GetNBytes (void) const |
Get the amount of bytes stored by the queue disc. More... | |
Ptr< NetDevice > | GetNetDevice (void) const |
Get the NetDevice on which this queue discipline is installed. More... | |
uint32_t | GetNInternalQueues (void) const |
Get the number of internal queues. More... | |
uint32_t | GetNPacketFilters (void) const |
Get the number of packet filters. More... | |
uint32_t | GetNPackets (void) const |
Get the number of packets stored by the queue disc. More... | |
uint32_t | GetNQueueDiscClasses (void) const |
Get the number of queue disc classes. More... | |
Ptr< PacketFilter > | GetPacketFilter (uint32_t i) const |
Get the i-th packet filter. More... | |
Ptr< QueueDiscClass > | GetQueueDiscClass (uint32_t i) const |
Get the i-th queue disc class. More... | |
virtual uint32_t | GetQuota (void) const |
Get the maximum number of dequeue operations following a packet enqueue. More... | |
uint32_t | GetTotalDroppedBytes (void) const |
Get the total amount of dropped bytes. More... | |
uint32_t | GetTotalDroppedPackets (void) const |
Get the total number of dropped packets. More... | |
uint32_t | GetTotalReceivedBytes (void) const |
Get the total amount of received bytes. More... | |
uint32_t | GetTotalReceivedPackets (void) const |
Get the total number of received packets. More... | |
uint32_t | GetTotalRequeuedBytes (void) const |
Get the total amount of requeued bytes. More... | |
uint32_t | GetTotalRequeuedPackets (void) const |
Get the total number of requeued packets. More... | |
WakeMode | GetWakeMode (void) |
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. More... | |
Ptr< const QueueDiscItem > | Peek (void) const |
Get a copy of the next packet the queue discipline will extract, without actually extracting the packet. More... | |
void | Run (void) |
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. More... | |
void | SetNetDevice (Ptr< NetDevice > device) |
Set the NetDevice on which this queue discipline is installed. More... | |
virtual void | SetParentDropCallback (ParentDropCallback cb) |
Set the parent drop callback. More... | |
virtual void | SetQuota (const uint32_t quota) |
Set the maximum number of dequeue operations following a packet enqueue. More... | |
![]() | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Implement the GetInstanceTypeId method defined in ObjectBase. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) const |
Check if the object has been initialized. More... | |
![]() | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static void | Cleanup (void) |
Noop. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
virtual void | DoDispose (void) |
Dispose of the object. More... | |
virtual void | DoInitialize (void) |
Check whether the configuration is correct and initialize parameters. More... | |
void | Drop (Ptr< QueueItem > item) |
Drop a packet. More... | |
![]() | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Member Functions | |
virtual bool | CheckConfig (void)=0 |
Check whether the current configuration is correct. More... | |
Ptr< QueueDiscItem > | DequeuePacket (void) |
Modelled after the Linux function dequeue_skb (net/sched/sch_generic.c) More... | |
virtual Ptr< QueueDiscItem > | DoDequeue (void)=0 |
This function actually extracts a packet from the queue disc. More... | |
virtual bool | DoEnqueue (Ptr< QueueDiscItem > item)=0 |
This function actually enqueues a packet into the queue disc. More... | |
virtual Ptr< const QueueDiscItem > | DoPeek (void) const =0 |
This function returns a copy of the next packet the queue disc will extract. More... | |
virtual void | InitializeParams (void)=0 |
Initialize parameters (if any) before the first packet is enqueued. More... | |
void | NotifyParentDrop (Ptr< QueueItem > item) |
Notify the parent queue disc of a packet drop. More... | |
void | Requeue (Ptr< QueueDiscItem > item) |
Modelled after the Linux function dev_requeue_skb (net/sched/sch_generic.c) Requeues a packet whose transmission failed. More... | |
bool | Restart (void) |
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). More... | |
bool | RunBegin (void) |
Modelled after the Linux function qdisc_run_begin (include/net/sch_generic.h). More... | |
void | RunEnd (void) |
Modelled after the Linux function qdisc_run_end (include/net/sch_generic.h). More... | |
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. More... | |
Private Attributes | |
std::vector< Ptr< QueueDiscClass > > | m_classes |
Classes. More... | |
Ptr< NetDevice > | m_device |
The NetDevice on which this queue discipline is installed. More... | |
Ptr< NetDeviceQueueInterface > | m_devQueueIface |
NetDevice queue interface. More... | |
std::vector< Ptr< PacketFilter > > | m_filters |
Packet filters. More... | |
TracedValue< uint32_t > | m_nBytes |
Number of bytes in the queue. More... | |
TracedValue< uint32_t > | m_nPackets |
Number of packets in the queue. More... | |
uint32_t | m_nTotalDroppedBytes |
Total dropped bytes. More... | |
uint32_t | m_nTotalDroppedPackets |
Total dropped packets. More... | |
uint32_t | m_nTotalReceivedBytes |
Total received bytes. More... | |
uint32_t | m_nTotalReceivedPackets |
Total received packets. More... | |
uint32_t | m_nTotalRequeuedBytes |
Total requeued bytes. More... | |
uint32_t | m_nTotalRequeuedPackets |
Total requeued packets. More... | |
ParentDropCallback | m_parentDropCallback |
Parent drop callback. More... | |
std::vector< Ptr< Queue > > | m_queues |
Internal queues. More... | |
uint32_t | m_quota |
Maximum number of packets dequeued in a qdisc run. More... | |
Ptr< QueueDiscItem > | m_requeued |
The last packet that failed to be transmitted. More... | |
bool | m_running |
The queue disc is performing multiple dequeue operations. More... | |
TracedCallback< Ptr< const QueueItem > > | m_traceDequeue |
Traced callback: fired when a packet is dequeued. More... | |
TracedCallback< Ptr< const QueueItem > > | m_traceDrop |
Traced callback: fired when a packet is dropped. More... | |
TracedCallback< Ptr< const QueueItem > > | m_traceEnqueue |
Traced callback: fired when a packet is enqueued. More... | |
TracedCallback< Ptr< const QueueItem > > | m_traceRequeue |
Traced callback: fired when a packet is requeued. More... | |
Static Private Attributes | |
static const uint32_t | DEFAULT_QUOTA = 64 |
Default quota (as in /proc/sys/net/core/dev_weight) More... | |
Additional Inherited Members | |
![]() | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
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 may stop the queue disc when its transmission queue(s) is/are (almost) full. Also, a netdevice may wake the queue disc when its transmission queue(s) is/are (almost) empty. Waking a queue disc is equivalent to make it run.
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 288 bytes (on a 64-bit architecture).
Definition at line 205 of file queue-disc.h.
typedef Callback<void, Ptr<QueueItem> > ns3::QueueDisc::ParentDropCallback |
Callback invoked by a child queue disc to notify the parent of a packet drop.
Definition at line 425 of file queue-disc.h.
ns3::QueueDisc::QueueDisc | ( | ) |
Definition at line 175 of file queue-disc.cc.
References NS_LOG_FUNCTION.
Add an internal queue to the tail of the list of queues.
queue | the queue to be added |
Definition at line 314 of file queue-disc.cc.
References Drop(), m_queues, ns3::MakeCallback(), and NS_LOG_FUNCTION.
Referenced by ns3::PfifoFastQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::QueueDiscFactory::CreateQueueDisc(), PfifoFastQueueDiscTosPrioritization::DoRun(), PfifoFastQueueDiscDscpPrioritization::DoRun(), PfifoFastQueueDiscOverflow::DoRun(), and PfifoFastQueueDiscNoPriority::DoRun().
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 337 of file queue-disc.cc.
References m_filters, and NS_LOG_FUNCTION.
Referenced by ns3::QueueDiscFactory::CreateQueueDisc(), FqCoDelQueueDiscNoSuitableFilter::DoRun(), FqCoDelQueueDiscIPFlowsSeparationAndPacketLimit::DoRun(), FqCoDelQueueDiscDeficit::DoRun(), FqCoDelQueueDiscTCPFlowsSeparation::DoRun(), and FqCoDelQueueDiscUDPFlowsSeparation::DoRun().
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 357 of file queue-disc.cc.
References Drop(), m_classes, ns3::MakeCallback(), NS_ABORT_MSG_IF, NS_LOG_FUNCTION, and WAKE_CHILD.
Referenced by ns3::QueueDiscFactory::CreateQueueDisc(), and ns3::FqCoDelQueueDisc::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.
Implemented in ns3::RedQueueDisc, ns3::CoDelQueueDisc, ns3::PieQueueDisc, ns3::FqCoDelQueueDisc, and ns3::PfifoFastQueueDisc.
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 385 of file queue-disc.cc.
References f(), m_filters, NS_LOG_FUNCTION, and ns3::PacketFilter::PF_NO_MATCH.
Referenced by ns3::FqCoDelQueueDisc::DoEnqueue().
Ptr< QueueDiscItem > ns3::QueueDisc::Dequeue | ( | void | ) |
Request the queue discipline to extract a packet.
This function only updates the statistics and calls the (private) DoDequeue function, which must be implemented by derived classes.
Definition at line 467 of file queue-disc.cc.
References DoDequeue(), m_nBytes, m_nPackets, m_traceDequeue, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by CoDelQueueDiscBasicDrop::Dequeue(), DequeuePacket(), ns3::PfifoFastQueueDisc::DoDequeue(), CoDelQueueDiscBasicEnqueueDequeue::DoRun(), FqCoDelQueueDiscDeficit::DoRun(), PieQueueDiscTestCase::RunPieTest(), RedQueueDiscTestCase::RunRedTest(), PfifoFastQueueDiscDscpPrioritization::TestDscpValue(), and PfifoFastQueueDiscTosPrioritization::TestTosValue().
|
private |
Modelled after the Linux function dequeue_skb (net/sched/sch_generic.c)
Definition at line 549 of file queue-disc.cc.
References Dequeue(), m_devQueueIface, m_nBytes, m_nPackets, m_requeued, m_traceDequeue, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by Restart().
|
privatepure virtual |
This function actually extracts a packet from the queue disc.
Implemented in ns3::RedQueueDisc, ns3::CoDelQueueDisc, ns3::PieQueueDisc, ns3::FqCoDelQueueDisc, and ns3::PfifoFastQueueDisc.
Referenced by Dequeue().
|
protectedvirtual |
Dispose of the object.
Reimplemented from ns3::Object.
Reimplemented in ns3::RedQueueDisc, and ns3::PieQueueDisc.
Definition at line 190 of file queue-disc.cc.
References ns3::Object::DoDispose(), m_classes, m_device, m_devQueueIface, m_filters, m_queues, m_requeued, and NS_LOG_FUNCTION.
Referenced by ns3::PieQueueDisc::DoDispose(), and ns3::RedQueueDisc::DoDispose().
|
privatepure virtual |
This function actually enqueues a packet into the queue disc.
item | item to enqueue |
Implemented in ns3::RedQueueDisc, ns3::PieQueueDisc, ns3::CoDelQueueDisc, ns3::FqCoDelQueueDisc, and ns3::PfifoFastQueueDisc.
Referenced by Enqueue().
|
protectedvirtual |
Check whether the configuration is correct and initialize parameters.
Reimplemented from ns3::Object.
Definition at line 203 of file queue-disc.cc.
References CheckConfig(), ns3::Object::DoInitialize(), InitializeParams(), m_classes, m_device, m_devQueueIface, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_UNUSED.
|
privatepure virtual |
This function returns a copy of the next packet the queue disc will extract.
Implemented in ns3::RedQueueDisc, ns3::CoDelQueueDisc, ns3::PieQueueDisc, ns3::FqCoDelQueueDisc, and ns3::PfifoFastQueueDisc.
Referenced by Peek().
Drop a packet.
item | item that was dropped This method is called by subclasses to notify parent (this class) of packet drops. |
Definition at line 411 of file queue-disc.cc.
References GetWakeMode(), m_nBytes, m_nPackets, m_nTotalDroppedBytes, m_nTotalDroppedPackets, m_traceDrop, NotifyParentDrop(), NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and WAKE_CHILD.
Referenced by AddInternalQueue(), AddQueueDiscClass(), ns3::CoDelQueueDisc::DoDequeue(), ns3::PfifoFastQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), and ns3::RedQueueDisc::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 451 of file queue-disc.cc.
References DoEnqueue(), m_nBytes, m_nPackets, m_nTotalReceivedBytes, m_nTotalReceivedPackets, m_traceEnqueue, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by FqCoDelQueueDiscIPFlowsSeparationAndPacketLimit::AddPacket(), FqCoDelQueueDiscDeficit::AddPacket(), PfifoFastQueueDiscOverflow::AddPacket(), FqCoDelQueueDiscTCPFlowsSeparation::AddPacket(), FqCoDelQueueDiscUDPFlowsSeparation::AddPacket(), FqCoDelQueueDiscNoSuitableFilter::DoRun(), CoDelQueueDiscBasicEnqueueDequeue::DoRun(), CoDelQueueDiscBasicOverflow::DoRun(), PfifoFastQueueDiscNoPriority::DoRun(), AutoRedQueueDiscTestCase::Enqueue(), RedQueueDiscTestCase::Enqueue(), CoDelQueueDiscBasicOverflow::Enqueue(), CoDelQueueDiscBasicDrop::Enqueue(), PieQueueDiscTestCase::RunPieTest(), RedQueueDiscTestCase::RunRedTest(), ns3::TrafficControlLayer::Send(), PfifoFastQueueDiscDscpPrioritization::TestDscpValue(), and PfifoFastQueueDiscTosPrioritization::TestTosValue().
Get the i-th internal queue.
i | the index of the queue |
Definition at line 324 of file queue-disc.cc.
References m_queues, and NS_ASSERT.
Referenced by ns3::PieQueueDisc::CalculateP(), ns3::PfifoFastQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::DoDequeue(), ns3::PieQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoDequeue(), ns3::RedQueueDisc::DoDequeue(), ns3::PfifoFastQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::RedQueueDisc::DoEnqueue(), ns3::PfifoFastQueueDisc::DoPeek(), ns3::PieQueueDisc::DoPeek(), ns3::CoDelQueueDisc::DoPeek(), ns3::RedQueueDisc::DoPeek(), PfifoFastQueueDiscTosPrioritization::DoRun(), PfifoFastQueueDiscDscpPrioritization::DoRun(), PfifoFastQueueDiscOverflow::DoRun(), PfifoFastQueueDiscNoPriority::DoRun(), ns3::FqCoDelQueueDisc::FqCoDelDrop(), ns3::CoDelQueueDisc::GetQueueSize(), ns3::PieQueueDisc::GetQueueSize(), ns3::RedQueueDisc::GetQueueSize(), ns3::CoDelQueueDisc::OkToDrop(), PfifoFastQueueDiscDscpPrioritization::TestDscpValue(), and PfifoFastQueueDiscTosPrioritization::TestTosValue().
uint32_t ns3::QueueDisc::GetNBytes | ( | void | ) | const |
Get the amount of bytes stored by the queue disc.
Note that the amount of bytes stored by the queue disc is updated as soon as a packet is received by the queue disc and before actually enqueuing the packet (i.e., before calling DoEnqueue). Thus, while implementing the DoEnqueue method of a subclass, keep in mind that GetNBytes returns the amount of bytes stored in the queue disc, including the size of the packet that we are trying to enqueue.
Definition at line 237 of file queue-disc.cc.
References m_nBytes, and NS_LOG_FUNCTION.
Referenced by ns3::PieQueueDisc::CalculateP(), ns3::PieQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoDequeue(), ns3::RedQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::RedQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoPeek(), ns3::CoDelQueueDisc::DoPeek(), ns3::RedQueueDisc::DoPeek(), ns3::FqCoDelQueueDisc::FqCoDelDrop(), ns3::CoDelQueueDisc::OkToDrop(), CoDelQueueDiscBasicEnqueueDequeue::QueueTestSize(), CoDelQueueDiscBasicOverflow::QueueTestSize(), and CoDelQueueDiscBasicDrop::QueueTestSize().
Get the NetDevice on which this queue discipline is installed.
Definition at line 293 of file queue-disc.cc.
References m_device, and NS_LOG_FUNCTION.
Referenced by ns3::FqCoDelQueueDisc::InitializeParams().
uint32_t ns3::QueueDisc::GetNInternalQueues | ( | void | ) | const |
Get the number of internal queues.
Definition at line 331 of file queue-disc.cc.
References m_queues.
Referenced by ns3::PfifoFastQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::PfifoFastQueueDisc::DoDequeue(), and ns3::PfifoFastQueueDisc::DoPeek().
uint32_t ns3::QueueDisc::GetNPacketFilters | ( | void | ) | const |
Get the number of packet filters.
Definition at line 351 of file queue-disc.cc.
References m_filters.
Referenced by ns3::PfifoFastQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), and ns3::RedQueueDisc::CheckConfig().
uint32_t ns3::QueueDisc::GetNPackets | ( | void | ) | const |
Get the number of packets stored by the queue disc.
Note that the number of packets stored by the queue disc is updated as soon as a packet is received by the queue disc and before actually enqueuing the packet (i.e., before calling DoEnqueue). Thus, while implementing the DoEnqueue method of a subclass, keep in mind that GetNPackets returns the number of packets stored in the queue disc, including the packet that we are trying to enqueue.
Definition at line 230 of file queue-disc.cc.
References m_nPackets, and NS_LOG_FUNCTION.
Referenced by ns3::PfifoFastQueueDisc::DoDequeue(), ns3::CoDelQueueDisc::DoDequeue(), ns3::RedQueueDisc::DoDequeue(), ns3::PfifoFastQueueDisc::DoEnqueue(), ns3::FqCoDelQueueDisc::DoEnqueue(), ns3::CoDelQueueDisc::DoEnqueue(), ns3::PieQueueDisc::DoEnqueue(), ns3::RedQueueDisc::DoEnqueue(), ns3::PfifoFastQueueDisc::DoPeek(), ns3::PieQueueDisc::DoPeek(), ns3::CoDelQueueDisc::DoPeek(), ns3::RedQueueDisc::DoPeek(), CoDelQueueDiscBasicEnqueueDequeue::QueueTestSize(), CoDelQueueDiscBasicOverflow::QueueTestSize(), CoDelQueueDiscBasicDrop::QueueTestSize(), and Transmit().
uint32_t ns3::QueueDisc::GetNQueueDiscClasses | ( | void | ) | const |
Get the number of queue disc classes.
Definition at line 379 of file queue-disc.cc.
References m_classes.
Referenced by ns3::PfifoFastQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::RedQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::DoEnqueue(), FqCoDelQueueDiscNoSuitableFilter::DoRun(), and ns3::FqCoDelQueueDisc::FqCoDelDrop().
Ptr< PacketFilter > ns3::QueueDisc::GetPacketFilter | ( | uint32_t | i | ) | const |
Get the i-th packet filter.
i | the index of the packet filter |
Definition at line 344 of file queue-disc.cc.
Ptr< QueueDiscClass > ns3::QueueDisc::GetQueueDiscClass | ( | uint32_t | i | ) | const |
Get the i-th queue disc class.
i | the index of the queue disc class |
Definition at line 372 of file queue-disc.cc.
References m_classes, and NS_ASSERT.
Referenced by ns3::FqCoDelQueueDisc::DoEnqueue(), FqCoDelQueueDiscIPFlowsSeparationAndPacketLimit::DoRun(), FqCoDelQueueDiscDeficit::DoRun(), FqCoDelQueueDiscTCPFlowsSeparation::DoRun(), FqCoDelQueueDiscUDPFlowsSeparation::DoRun(), and ns3::FqCoDelQueueDisc::FqCoDelDrop().
|
virtual |
Get the maximum number of dequeue operations following a packet enqueue.
Definition at line 307 of file queue-disc.cc.
References m_quota, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
uint32_t ns3::QueueDisc::GetTotalDroppedBytes | ( | void | ) | const |
Get the total amount of dropped bytes.
Definition at line 265 of file queue-disc.cc.
References m_nTotalDroppedBytes, and NS_LOG_FUNCTION.
uint32_t ns3::QueueDisc::GetTotalDroppedPackets | ( | void | ) | const |
Get the total number of dropped packets.
Definition at line 258 of file queue-disc.cc.
References m_nTotalDroppedPackets, and NS_LOG_FUNCTION.
uint32_t ns3::QueueDisc::GetTotalReceivedBytes | ( | void | ) | const |
Get the total amount of received bytes.
Definition at line 251 of file queue-disc.cc.
References m_nTotalReceivedBytes, and NS_LOG_FUNCTION.
uint32_t ns3::QueueDisc::GetTotalReceivedPackets | ( | void | ) | const |
Get the total number of received packets.
Definition at line 244 of file queue-disc.cc.
References m_nTotalReceivedPackets, and NS_LOG_FUNCTION.
uint32_t ns3::QueueDisc::GetTotalRequeuedBytes | ( | void | ) | const |
Get the total amount of requeued bytes.
Definition at line 279 of file queue-disc.cc.
References m_nTotalRequeuedBytes, and NS_LOG_FUNCTION.
uint32_t ns3::QueueDisc::GetTotalRequeuedPackets | ( | void | ) | const |
Get the total number of requeued packets.
Definition at line 272 of file queue-disc.cc.
References m_nTotalRequeuedPackets, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 129 of file queue-disc.cc.
References DEFAULT_QUOTA, GetQuota(), m_classes, m_filters, m_nBytes, m_nPackets, m_queues, m_traceDequeue, m_traceDrop, m_traceEnqueue, m_traceRequeue, ns3::MakeObjectVectorAccessor(), ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), ns3::TypeId::SetParent(), and SetQuota().
QueueDisc::WakeMode ns3::QueueDisc::GetWakeMode | ( | void | ) |
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.
Definition at line 399 of file queue-disc.cc.
References WAKE_ROOT.
Referenced by Drop().
|
privatepure virtual |
Initialize parameters (if any) before the first packet is enqueued.
Implemented in ns3::CoDelQueueDisc, ns3::RedQueueDisc, ns3::PieQueueDisc, ns3::FqCoDelQueueDisc, and ns3::PfifoFastQueueDisc.
Referenced by DoInitialize().
Notify the parent queue disc of a packet drop.
item | item that was dropped |
Definition at line 440 of file queue-disc.cc.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_parentDropCallback, and NS_LOG_FUNCTION.
Referenced by Drop().
Ptr< const QueueDiscItem > ns3::QueueDisc::Peek | ( | void | ) | const |
Get a copy of the next packet the queue discipline will extract, without actually extracting the packet.
This function only calls the (private) DoPeek function, which must be implemented by derived classes.
Definition at line 487 of file queue-disc.cc.
References DoPeek(), and NS_LOG_FUNCTION.
|
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 595 of file queue-disc.cc.
References m_nBytes, m_nPackets, m_nTotalRequeuedBytes, m_nTotalRequeuedPackets, m_requeued, m_traceRequeue, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
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 535 of file queue-disc.cc.
References DequeuePacket(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and Transmit().
Referenced by Run().
void ns3::QueueDisc::Run | ( | void | ) |
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 494 of file queue-disc.cc.
References m_quota, NS_LOG_FUNCTION, Restart(), RunBegin(), and RunEnd().
Referenced by ns3::TrafficControlLayer::DoInitialize(), and ns3::TrafficControlLayer::Send().
|
private |
Modelled after the Linux function qdisc_run_begin (include/net/sch_generic.h).
Definition at line 515 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 528 of file queue-disc.cc.
References m_running, and NS_LOG_FUNCTION.
Referenced by Run().
Set the NetDevice on which this queue discipline is installed.
device | the NetDevice on which this queue discipline is installed. |
Definition at line 286 of file queue-disc.cc.
References m_device, and NS_LOG_FUNCTION.
Referenced by ns3::TrafficControlHelper::Install().
|
virtual |
Set the parent drop callback.
cb | the callback to set |
Called when a queue disc class is added to a queue disc in order to set a callback to the Drop method of the parent queue disc.
Definition at line 405 of file queue-disc.cc.
References m_parentDropCallback.
|
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 300 of file queue-disc.cc.
References m_quota, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
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 611 of file queue-disc.cc.
References GetNPackets(), m_device, m_devQueueIface, NS_ASSERT, NS_LOG_FUNCTION, and Requeue().
Referenced by Restart().
|
staticprivate |
Default quota (as in /proc/sys/net/core/dev_weight)
Definition at line 534 of file queue-disc.h.
Referenced by GetTypeId().
|
private |
Classes.
Definition at line 538 of file queue-disc.h.
Referenced by AddQueueDiscClass(), DoDispose(), DoInitialize(), GetNQueueDiscClasses(), GetQueueDiscClass(), and GetTypeId().
The NetDevice on which this queue discipline is installed.
Definition at line 550 of file queue-disc.h.
Referenced by DoDispose(), DoInitialize(), GetNetDevice(), SetNetDevice(), and Transmit().
|
private |
NetDevice queue interface.
Definition at line 551 of file queue-disc.h.
Referenced by DequeuePacket(), DoDispose(), DoInitialize(), and Transmit().
|
private |
Packet filters.
Definition at line 537 of file queue-disc.h.
Referenced by AddPacketFilter(), Classify(), DoDispose(), GetNPacketFilters(), GetPacketFilter(), and GetTypeId().
|
private |
Number of bytes in the queue.
Definition at line 541 of file queue-disc.h.
Referenced by Dequeue(), DequeuePacket(), Drop(), Enqueue(), GetNBytes(), GetTypeId(), and Requeue().
|
private |
Number of packets in the queue.
Definition at line 540 of file queue-disc.h.
Referenced by Dequeue(), DequeuePacket(), Drop(), Enqueue(), GetNPackets(), GetTypeId(), and Requeue().
|
private |
Total dropped bytes.
Definition at line 546 of file queue-disc.h.
Referenced by Drop(), and GetTotalDroppedBytes().
|
private |
Total dropped packets.
Definition at line 545 of file queue-disc.h.
Referenced by Drop(), and GetTotalDroppedPackets().
|
private |
Total received bytes.
Definition at line 544 of file queue-disc.h.
Referenced by Enqueue(), and GetTotalReceivedBytes().
|
private |
Total received packets.
Definition at line 543 of file queue-disc.h.
Referenced by Enqueue(), and GetTotalReceivedPackets().
|
private |
Total requeued bytes.
Definition at line 548 of file queue-disc.h.
Referenced by GetTotalRequeuedBytes(), and Requeue().
|
private |
Total requeued packets.
Definition at line 547 of file queue-disc.h.
Referenced by GetTotalRequeuedPackets(), and Requeue().
|
private |
Parent drop callback.
Definition at line 554 of file queue-disc.h.
Referenced by NotifyParentDrop(), and SetParentDropCallback().
Internal queues.
Definition at line 536 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 549 of file queue-disc.h.
Referenced by GetQuota(), Run(), and SetQuota().
|
private |
The last packet that failed to be transmitted.
Definition at line 553 of file queue-disc.h.
Referenced by DequeuePacket(), DoDispose(), and Requeue().
|
private |
The queue disc is performing multiple dequeue operations.
Definition at line 552 of file queue-disc.h.
Referenced by RunBegin(), and RunEnd().
|
private |
Traced callback: fired when a packet is dequeued.
Definition at line 559 of file queue-disc.h.
Referenced by Dequeue(), DequeuePacket(), and GetTypeId().
|
private |
Traced callback: fired when a packet is dropped.
Definition at line 563 of file queue-disc.h.
Referenced by Drop(), and GetTypeId().
|
private |
Traced callback: fired when a packet is enqueued.
Definition at line 557 of file queue-disc.h.
Referenced by Enqueue(), and GetTypeId().
|
private |
Traced callback: fired when a packet is requeued.
Definition at line 561 of file queue-disc.h.
Referenced by GetTypeId(), and Requeue().