24 #include "ns3/object-factory.h"
25 #include "ns3/queue.h"
26 #include "ns3/net-device-queue-interface.h"
27 #include "ns3/socket.h"
40 .SetGroupName (
"TrafficControl")
42 .AddAttribute (
"Limit",
43 "The maximum number of packets accepted by this queue disc.",
47 MakeUintegerChecker<uint32_t> (),
49 "Use the MaxSize attribute instead")
50 .AddAttribute (
"MaxSize",
51 "The maximum number of packets accepted by this queue disc.",
71 const uint32_t
PfifoFastQueueDisc::prio2band[16] = {1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
80 NS_LOG_LOGIC (
"Queue disc limit exceeded -- dropping packet");
87 if (item->GetPacket ()->PeekPacketTag (priorityTag))
92 uint32_t band =
prio2band[priority & 0x0f];
101 NS_LOG_WARN (
"Packet enqueue failed. Check the size of the internal queues");
120 NS_LOG_LOGIC (
"Popped from band " << i <<
": " << item);
141 NS_LOG_LOGIC (
"Peeked from band " << i <<
": " << item);
171 NS_LOG_ERROR (
"PfifoFastQueueDisc cannot have classes");
177 NS_LOG_ERROR (
"PfifoFastQueueDisc needs no packet filter");
185 factory.
SetTypeId (
"ns3::DropTailQueue<QueueDiscItem>");
194 NS_LOG_ERROR (
"PfifoFastQueueDisc needs 3 internal queues");
202 NS_LOG_ERROR (
"PfifoFastQueueDisc needs 3 internal queues operating in packet mode");
206 for (uint8_t i = 0; i < 2; i++)
210 NS_LOG_ERROR (
"The capacity of some internal queue(s) is less than the queue disc capacity");
Ptr< const QueueDiscItem > Peek(void)
Get a copy of the next packet the queue discipline will extract, without actually extracting the pack...
uint32_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Class for representing queue sizes.
virtual ~PfifoFastQueueDisc()
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...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
QueueSizeUnit
Enumeration of the operating modes of queues.
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise.
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
virtual Ptr< const QueueDiscItem > DoPeek(void)
This function returns a copy of the next packet the queue disc will extract.
uint32_t GetValue() const
Get the underlying value.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Ptr< InternalQueue > GetInternalQueue(uint32_t i) const
Get the i-th internal queue.
static constexpr const char * LIMIT_EXCEEDED_DROP
Packet dropped due to queue disc limit exceeded.
void SetLimit(uint32_t limit)
Set the limit of this queue disc.
uint32_t GetLimit(void) const
Get the limit of this queue disc.
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Hold an unsigned integer type.
Use number of packets for queue size.
indicates whether the socket has a priority set.
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
Attribute or trace source is deprecated; user is warned.
uint32_t GetNPacketFilters(void) const
Get the number of packet filters.
Ptr< QueueDiscItem > Dequeue(void)
Request the queue discipline to extract a packet.
Ptr< const AttributeChecker > MakeQueueSizeChecker(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Get the type ID.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
uint8_t GetPriority(void) const
Get the tag's priority.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
Instantiate subclasses of ns3::Object.
Used by queue discs with multiple internal queues/child queue discs.
Introspection did not find any typical Config paths.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
static const uint32_t prio2band[16]
Priority to band map.
bool SetMaxSize(QueueSize size)
Set the maximum size of the queue disc.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Linux pfifo_fast is the default priority queue enabled on Linux systems.
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
QueueSize GetMaxSize(void) const
Get the maximum size of the queue disc.
PfifoFastQueueDisc()
PfifoFastQueueDisc constructor.
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.