This section discusses queuing disciplines, which form a basic. building block for the support of QoS in linux. It also discusses the various queuing disciplines that are supported in linux. Each network device has a queue associated with it. There are 11 types of queuing disciplines that are currently supported in linux, which includes:
Queues are identified by a handle <major number:minor number>, where the minor number is zero for queues. Handles are used to associate classes to queuing disciplines. Classes are discussed in the next subsection.
Queuing disciplines and classes are tied to one another. The presence of classes and their semantics are fundamental properties of the queuing disciplines. In contrast, filters can be arbitrarily combined with queuing disciplines and classes, as long as the queuing disciplines have classes. Not all queuing disciplines are associated with classes. For example, the Token Bucket Flow (TBF) does not have any classes associated with it.
Figure 3 shows an example queue. In this example, there are two types of queuing disciplines, one for high priority and one for low priority. The filter selects the one for high priority, while the remaining are treated low priority. The low priority packets are served by a FIFO queue, while the high priority packets are served by a Token Bucket Flow Algorithm. The TBF queue is used to ensure that the low priority packets are not starved.
One of the main advantages of the QoS support in linux is the flexibility with which the combination of queues and classes can be set up. Each queuing discipline may have a number of classes. These classes don't store the packets themselves, but instead, use another queuing discipline for this purpose, which in turn, may have a number of classes and so on. It is this flexibility that makes the QoS support in linux unique.
When a linux kernel configured for QoS support is booted up, the function net_dev_init (in net/core/dev.c) calls the function pktsched_init (in net/sched/sch_api.c) to initialize the traffic control unit in the linux kernel. In pktsched_init, the queuing disciplines that have been compiled into the kernel are all registered and initialized. The pointers to access the the functions tc_ctl_qdisc, tc_dump_qdisc, tc_ctl_tclass and tc_dump_tclass, which are used to perform various functions on queuing disciplines and classes are also initialized in pktsched_init.
The functions that are supported on the various queuing disciplines are discussed in the following sections. These functions are defined in the Qdisc_ops structure in include/net/pkt_sched.h.