18.3 Traffic Control in the Outgoing Direction

   


The traffic-control framework defines three basic elements:

  • Queuing discipline: Each network device is allocated to a queuing discipline. In general, packets to be sent are passed to a queuing discipline and sorted within this queue by specific rules. During a search for packets ready to be sent, these packets can be removed no earlier than when the queuing discipline has marked them as ready for transmission. The algorithm used within a queuing discipline remains invisible to the outside. Examples for queuing disciplines include simple FIFO buffers and token buckets. More elaborate queuing disciplines can also manage several queues. Queuing disciplines are defined in files with names beginning with sch_ (in the net/sched directory).

  • Classes: Queuing disciplines can have several interfaces, and these interfaces are used to insert packets in the queue management. This allows us to distinguish packets by classes. Within one single queue discipline, we could allocate packets to different classes (e.g., to handle them with different priorities). Classes are defined within the queuing discipline (i.e., also in files with names beginning with sch_).

  • Filters: Filters are generally used to allocate outgoing packets to classes within a queuing discipline. Filters are defined in files with names beginning with cls_.

Much as with a construction kit, single elements can be connected, even recursively: Other queuing disciplines, with their corresponding classes and filters, can be used within one single queuing discipline.

Figure 18-2 shows an example for the resulting traffic-control tree. On the outside, we first see only the enqueue and dequeue functions of the upper queuing discipline. In this example, packets passed via the function enqueue () are checked one after another by the filter rules and allocated to the class visited by the filter for the first time. If none of the filter rules matches, then a default filter can be used to define an allocation system. Behind the classes there are other queuing disciplines. Because this is a tree, we also speak of the parent of a queuing discipline. For example, the queuing discipline 1:0 is a so-called outer queuing discipline and the parent of the classes 1:1 and 1:2. The queuing disciplines 2:0 and 3:0 are also called inner queuing disciplines.

Figure 18-2. Example for a tree consisting of queuing disciplines, classes, and filters.

graphics/18fig02.gif


Packets are removed recursively from this tree for transmission: When the dequeue () function of the outer queuing discipline is invoked, the function searches the queuing disciplines of the respective classes recursively for packets ready to be sent, depending on the type of queuing discipline.

The path a packet takes through the kernel was described in detail in Chapter 6. Figure 18-3 shows how the traffic-control example relates to the transmission process shown in Figure 6-4. Rather than one single FIFO queue, we now insert a more extensive and configurable tree to handle transmit data streams; no other changes to the functions of the transmission process are required.

Figure 18-3. Inserting the traffic-control tree in the transmission process in the Linux kernel.

graphics/18fig03.gif


The following sections describe the interfaces of queuing disciplines, classes, and filters.


       


    Linux Network Architecture
    Linux Network Architecture
    ISBN: 131777203
    EAN: N/A
    Year: 2004
    Pages: 187

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net