Linux pfifo_fast is the default priority queue enabled on Linux
systems. Packets are enqueued in three FIFO droptail queues according
to three priority bands based on their Type of Service bits or DSCP bits.
...so that all the subclasses have such attributes. This
allows queue discs to have attributes specifying the mode and
size of their queue(s) and to create queues using their
own attributes.
This commit is heavily inspired by Natale's queue rework patch:
https://codereview.appspot.com/270540044/
The (unique) transmission queue is stopped when enqueuing a packet fails, so
that upper layers do not send other packets down. When a packet transmission
is completed, if the queue is empty then wake the upper layers. If the queue
was stopped, there is now room for another packet and hence wake the upper
layers as well.
When a packet is passed to the Traffic Control layer, the IPv{4,6} header has not
been added yet. It will be added when the packet is dequeued from the queue disc.
QueueDisc is a base class providing the interface and implementing
the operations common to all the queueing disciplines. 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), plus methods to classify enqueued packets in
case they manage multiple queues internally.
This patch adds a NetDeviceQueue class to store information about a single
transmission queue of a network device. This class is meant to store the
state of a transmission queue (i.e., whether the queue is stopped or not)
and some data used by techniques such as Byte Queue Limits. Also, multi-queue
aware queue discs can aggregate a child queue disc to an object of this class.
These features (excluding BQL) are added in subsequent commits.
The NetDevice class maintains a vector of NetDeviceQueue pointers, one for
each transmission queue. A NetDevice constructor is added which creates a
single transmission queue by default for every device. The number of transmission
queues can be modified (by child classes) by calling NetDevice::SetTxQueuesN.
Two public methods, GetTxQueue and GetTxQueuesN, are also added to the NetDevice class
to return the i-th NetDeviceQueue and the number of transmission queues, respectively.
A QueueItem base class is introduced to represent the items stored
in a Queue. The base class only contains a Ptr<Packet>. Derived classes
can store additional information. DropTailQueue, RedQueue and CodelQueue,
along with their examples and testsuits, have been adapted. Objects using
such queues have been adapted too.