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",
115 MakeUintegerChecker<uint32_t> ())
116 .AddAttribute (
"Flows",
117 "The number of queues into which the incoming packets are classified",
120 MakeUintegerChecker<uint32_t> ())
121 .AddAttribute (
"DropBatchSize",
122 "The maximum number of packets dropped from the fat flow",
125 MakeUintegerChecker<uint32_t> ())
163 NS_LOG_ERROR (
"No filter has been able to classify this packet, drop it.");
173 NS_LOG_DEBUG (
"Creating a new flow queue with index " << h);
177 flow->SetQueueDisc (qd);
194 flow->GetQueueDisc ()->Enqueue (item);
222 if (flow->GetDeficit () <= 0)
231 NS_LOG_DEBUG (
"Found a new flow with positive deficit");
240 if (flow->GetDeficit () <= 0)
248 NS_LOG_DEBUG (
"Found an old flow with positive deficit");
259 item = flow->GetQueueDisc ()->Dequeue ();
263 NS_LOG_DEBUG (
"Could not get a packet from the selected flow queue");
278 NS_LOG_DEBUG (
"Dequeued packet " << item->GetPacket ());
282 flow->IncreaseDeficit (-item->GetSize ());
310 return flow->GetQueueDisc ()->Peek ();
325 NS_LOG_ERROR (
"FqCoDelQueueDisc needs at least a packet filter");
331 NS_LOG_ERROR (
"FqCoDelQueueDisc cannot have internal queues");
367 uint32_t maxBacklog = 0, index = 0;
375 if (bytes > maxBacklog)
383 uint32_t len = 0, count = 0, threshold = maxBacklog >> 1;
391 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 "...
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.
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
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.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
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.
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
Hold variables of type enum.
virtual Ptr< const QueueDiscItem > DoPeek(void) const
This function returns a copy of the next packet the queue disc will extract.
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.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
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.
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.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
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.
Use number of packets for maximum queue disc size.
#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.
uint32_t m_limit
Maximum number of packets in the queue disc.
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.
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.