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 (
"MaxSize",
112 "The maximum number of packets accepted by this queue disc",
117 .AddAttribute (
"Flows",
118 "The number of queues into which the incoming packets are classified",
121 MakeUintegerChecker<uint32_t> ())
122 .AddAttribute (
"DropBatchSize",
123 "The maximum number of packets dropped from the fat flow",
126 MakeUintegerChecker<uint32_t> ())
127 .AddAttribute (
"Perturbation",
128 "The salt used as an additional input to the hash function used to classify packets",
131 MakeUintegerChecker<uint32_t> ())
182 NS_LOG_ERROR (
"No filter has been able to classify this packet, drop it.");
191 NS_LOG_DEBUG (
"Creating a new flow queue with index " << h);
195 flow->SetQueueDisc (qd);
212 flow->GetQueueDisc ()->Enqueue (item);
240 if (flow->GetDeficit () <= 0)
249 NS_LOG_DEBUG (
"Found a new flow with positive deficit");
258 if (flow->GetDeficit () <= 0)
266 NS_LOG_DEBUG (
"Found an old flow with positive deficit");
277 item = flow->GetQueueDisc ()->Dequeue ();
281 NS_LOG_DEBUG (
"Could not get a packet from the selected flow queue");
296 NS_LOG_DEBUG (
"Dequeued packet " << item->GetPacket ());
300 flow->IncreaseDeficit (item->GetSize () * -1);
317 NS_LOG_ERROR (
"FqCoDelQueueDisc cannot have internal queues");
352 uint32_t maxBacklog = 0, index = 0;
360 if (bytes > maxBacklog)
368 uint32_t len = 0, count = 0, threshold = maxBacklog >> 1;
376 len += item->GetSize ();
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
Ptr< const AttributeChecker > MakeStringChecker(void)
A FqCoDel packet queue disc.
Ptr< NetDevice > GetNetDevice(void) const
Get the NetDevice on which this queue discipline is installed.
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.
FlowStatus
Used to determine the status of this flow queue.
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.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
Hold variables of type string.
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.
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.
int32_t GetDeficit(void) const
Get the deficit for this 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.
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
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.
int32_t m_deficit
the deficit for this flow
uint32_t m_flows
Number of flow queues.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Ptr< InternalQueue > GetInternalQueue(std::size_t i) const
Get the i-th internal queue.
Hold an unsigned integer type.
Use number of packets for queue size.
uint32_t GetQuantum(void) const
Get the quantum value.
uint32_t m_perturbation
hash perturbation value
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
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...
Ptr< QueueDiscClass > GetQueueDiscClass(std::size_t i) const
Get the i-th queue disc class.
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.
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::size_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
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.
QueueSize GetMaxSize(void) const
Get the maximum size of the queue disc.
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
Used by queue discs with multiple internal queues/child queue discs.
std::size_t GetNPacketFilters(void) const
Get the number of packet filters.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
FlowStatus GetStatus(void) const
Get the status of this flow.
bool SetMaxSize(QueueSize size)
Set the maximum size of the 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.
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.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
ObjectFactory m_flowFactory
Factory to create a new flow.
std::size_t GetNInternalQueues(void) const
Get the number of internal queues.