23 #include "ns3/string.h"
24 #include "ns3/queue.h"
27 #include "ns3/net-device-queue-interface.h"
39 .SetGroupName (
"TrafficControl")
99 .SetGroupName (
"TrafficControl")
101 .AddAttribute (
"Interval",
102 "The CoDel algorithm interval for each FQCoDel queue",
106 .AddAttribute (
"Target",
107 "The CoDel algorithm target queue delay for each FQCoDel queue",
111 .AddAttribute (
"PacketLimit",
112 "The hard limit on the real queue size, measured in packets",
116 MakeUintegerChecker<uint32_t> (),
118 "Use the MaxSize attribute instead")
119 .AddAttribute (
"MaxSize",
120 "The maximum number of packets accepted by this queue disc",
125 .AddAttribute (
"Flows",
126 "The number of queues into which the incoming packets are classified",
129 MakeUintegerChecker<uint32_t> ())
130 .AddAttribute (
"DropBatchSize",
131 "The maximum number of packets dropped from the fat flow",
134 MakeUintegerChecker<uint32_t> ())
173 NS_LOG_ERROR (
"No filter has been able to classify this packet, drop it.");
183 NS_LOG_DEBUG (
"Creating a new flow queue with index " << h);
187 flow->SetQueueDisc (qd);
204 flow->GetQueueDisc ()->Enqueue (item);
232 if (flow->GetDeficit () <= 0)
241 NS_LOG_DEBUG (
"Found a new flow with positive deficit");
250 if (flow->GetDeficit () <= 0)
258 NS_LOG_DEBUG (
"Found an old flow with positive deficit");
269 item = flow->GetQueueDisc ()->Dequeue ();
273 NS_LOG_DEBUG (
"Could not get a packet from the selected flow queue");
288 NS_LOG_DEBUG (
"Dequeued packet " << item->GetPacket ());
292 flow->IncreaseDeficit (item->GetSize () * -1);
331 NS_LOG_ERROR (
"FqCoDelQueueDisc needs at least a packet filter");
337 NS_LOG_ERROR (
"FqCoDelQueueDisc cannot have internal queues");
372 uint32_t maxBacklog = 0, index = 0;
380 if (bytes > maxBacklog)
388 uint32_t len = 0, count = 0, threshold = maxBacklog >> 1;
396 len += item->GetSize ();
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
Ptr< const AttributeChecker > MakeStringChecker(void)
A FqCoDel packet queue disc.
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.
uint32_t m_quantum
Deficit assigned to flows at each round.
void AddQueueDiscClass(Ptr< QueueDiscClass > qdClass)
Add a queue disc class to the tail of the list of classes.
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...
static const int PF_NO_MATCH
Standard value used by packet filters to indicate that no match was possible.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Hold variables of type string.
QueueSizeUnit
Enumeration of the operating modes of queues.
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise.
uint32_t FqCoDelDrop(void)
Drop a packet from the head of the queue with the largest current byte count.
uint32_t m_dropBatchSize
Max number of packets dropped from the fat flow.
static TypeId GetTypeId(void)
Get the type ID.
#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.
virtual Ptr< const QueueDiscItem > DoPeek(void)
This function returns a copy of the next packet the queue disc will extract.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
uint32_t GetValue() const
Get the underlying value.
FqCoDelFlow()
FqCoDelFlow constructor.
void SetStatus(FlowStatus status)
Set the status for this flow.
A flow queue used by the FqCoDel queue disc.
Ptr< InternalQueue > GetInternalQueue(uint32_t i) const
Get the i-th internal queue.
int32_t m_deficit
the deficit for this flow
uint32_t m_flows
Number of flow queues.
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Hold an unsigned integer type.
FlowStatus GetStatus(void) const
Get the status of this flow.
Use number of packets for queue size.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
Attribute or trace source is deprecated; user is warned.
int32_t Classify(Ptr< QueueDiscItem > item)
Classify a packet by calling the packet filters, one at a time, until either a filter able to classif...
uint32_t GetNPacketFilters(void) const
Get the number of packet filters.
static constexpr const char * UNCLASSIFIED_DROP
No packet filter able to classify packet.
QueueDiscClass is the base class for classes that are included in a queue disc.
Ptr< const AttributeChecker > MakeQueueSizeChecker(void)
std::list< Ptr< FqCoDelFlow > > m_newFlows
The list of new flows.
int32_t GetDeficit(void) const
Get the deficit for this flow.
uint32_t GetQuantum(void) const
Get the quantum value.
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string m_interval
CoDel interval attribute.
void SetQuantum(uint32_t quantum)
Set the quantum value.
std::string m_target
CoDel target attribute.
virtual ~FqCoDelQueueDisc()
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
static TypeId GetTypeId(void)
Get the type ID.
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
FqCoDelQueueDisc()
FqCoDelQueueDisc constructor.
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
uint32_t GetLimit(void) const
Get the limit of this queue disc.
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
Ptr< const QueueDiscItem > PeekDequeued(void)
Dequeue a packet and retain it in the queue disc as a requeued packet.
Used by queue discs with multiple internal queues/child queue discs.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
bool SetMaxSize(QueueSize size)
Set the maximum size of the queue disc.
void SetLimit(uint32_t limit)
Set the limit of this queue disc.
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...
std::list< Ptr< FqCoDelFlow > > m_oldFlows
The list of old flows.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packets.
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void IncreaseDeficit(int32_t deficit)
Increase the deficit for this flow.
FlowStatus
Used to determine the status of this flow queue.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
FlowStatus m_status
the status of this flow
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< NetDevice > GetNetDevice(void) const
Get the NetDevice on which this queue discipline is installed.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Ptr< QueueDiscClass > GetQueueDiscClass(uint32_t i) const
Get the i-th queue disc class.
ObjectFactory m_flowFactory
Factory to create a new flow.
QueueSize GetMaxSize(void) const
Get the maximum size of the queue disc.