As already mentioned, queues and classes are tied to one another. Each class owns a queue, which by default is a FIFO queue. When the enqueue function of a queuing discipline is called, the queuing discipline applies the filters to determine the class to which the packet belongs. It then calls the enqueue function of the queuing discipline that is owned by this class.
There are two ways by which a class can be identified. One is via the class identifier, which is specified by the user. The other identifier, which is used within the kernel to identify a class, is referred to as the internal identifier. This ID is unique and is assigned by the queuing discipline. The class ID is a u32 data type, while the internal ID is an unsigned long integer. Most of the functions on classes use the internal ID to identify the class. However, there are a few functions (like the get and the change function, which will be discussed later) that use the class ID too.
Multiple class IDs may map to the same internal ID, however, the class ID will convey some additional information from the classifier to the queuing discipline or class.
The class ID, similar to a queuing discipline identifier, is structured in the form of a < major number:minor number>. The major number corresponds to their instance of the queuing discipline while the minor number identifies the class within that instance.
Not all queuing disciplines support classes. The ones that support classes include the CBQ, the DS_MARK, the CSZ and the p-FIFO queuing disciplines. The rest of the queuing disciplines do not support classes.
With this introduction on classes, let us now discuss the functions that can be performed on classes. These functions are defined in the Qdisc_class_ops structure in include/net/pkt_sched.h.
The following operations are permitted for the manipulation of the classes within the various queuing disciplines that support classes. This is defined in include/net/pkt_sched.h.