next up previous
Next: Queuing Disciplines Up: Implementation Previous: Implementation

Basic Principle

The basic principle involved in the implementation of QoS in linux is shown in Figure 1. This figure shows how the kernel processes incoming packets, and how it generates packets to be sent to the network. The input de-multiplexer examines the incoming packets to determine if the packets are destined for the local node. If so, they are sent to the higher layer for further processing. If not, it sends the packets to the forwarding block. The forwarding block, which may also received locally generated packets from the higher layer, looks up the routing table and determines the next hop for the packet. After this, it queues the packets to be transmitted on the output interface. It is at this point that the linux traffic control comes into play. Linux traffic control can be used to build a complex combination of queuing disciplines, classes and filters that control the packets that are sent on the output interface.

Figure 1: Linux Traffic Control
\begin{figure}
\centerline{\psfig{file=figures/linux_traffic.eps,width=4.0in}}\end{figure}

From an implementation standpoint, what this means is this. When queuing disciplines are created for a device, a pointer to the queue is maintained in the device structure (in include/netdevice.h). The IP layer, after adding the necessary header information to a packet (in net/ipv4/ip_output.c) , calls the function dev_queue_xmit (in net/core/dev.c). A portion of this code is shown below.

q = dev->qdisc;
if (q->enqueue) {
    q->enqueue(skb, q);
    qdisc_wakeup(dev);
    return 0;
}
.
.
.
.
if (dev->hard_start_xmit(skb, dev) == 0) 
.
.
.

This function shows that before actually sending the packet on the output interface (by doing a hard_start_xmit), the packet is enqueued in the queue maintained by the device, if one exists. Thus, an mentioned before, traffic control is implemented just before the packet is sent to the device driver.

As already mentioned, the linux traffic control mechanism provides the basic framework for the development of integrated services [1] and differentiated services [2] support in linux. This is shown in Figure 2.

Figure 2: Framework for developing "intserv" and "diffserv"
\begin{figure}
\centerline{\psfig{file=figures/framework.eps,width=4.0in}}\end{figure}

As shown in Figure 2, the QoS support in linux consists of the following three basic building blocks, namely:

Let us now discuss these basic blocks in detail.


next up previous
Next: Queuing Disciplines Up: Implementation Previous: Implementation
Saravanan Radhakrishnan
1999-09-30