Table of Contents

Quality of Service (qos-scripts) configuration

This is the documentation for the UCI configuration file /etc/config/qos. It is used by the package qos-scripts only.

Do NOT install multiple QoS-packages simultaneously! Uninstall the old package before installing a new one.
There are at least two other QoS/ToS packages in the OpenWrt repositories regarding: sqm-scripts and wshaper. They do NOT use this file.

You can browse the scripts here: qos-scripts
There is direct LuCI-support for qos-scripts called: luci-app-qos.
NOTE: luci-app-qos won't start until you enable the qos Initscript within the System–>Startup tab as well as enable qos under Network–>QoS

As of r31759qos-scripts replaced sfq/red with fq_codel to massively improve latency under load.

Sections

A minimal QoS configuration usually consists of:

one interface section

some rules allocating packets to at least two buckets

configuration of the buckets.

Interface

Each Interface can have its own buffer. The interface section declares global characteristics of the connection on which the specified interface is communicating. The following options are defined within this section:

… Any interface with only a single qdisc line printed, showing the same settings as this line (this one is for dev eth0), indicates no QoS on that interface.

Network interfaces with QoS enabled will have multiple qdisc lines printed, each corresponding to a QoS class, etc.

If the printed qdisc settings don't seem to be correct, you can preview the tc commands generated from the OpenWRT /etc/config/qos by running:

/usr/lib/qos/generate.sh interface wan

(Replace 'wan' with the OpenWRT interface name you're debugging, as given in the /etc/config/qos file.)

This should print a series of insmod and tc commands used to set up the QoS subsystem. You can debug any errors caused by running these commands by running:

/usr/lib/qos/generate.sh interface wan | sh -x

(Note -x option which tells sh to print each line as it is executed.)

The output of /usr/lib/qos/generate.sh is normally executed automatically as part of /etc/hotplug.d/iface/10-qos.

txqueuelen

Recent versions of trunk uses CoDel (pronounced: Coddle), so this should not be needed. bufferbloat.net

( Note: after i know about bufferbloat - websearchd and many misguided users are asking about raising txqueuelen, or how to set it, and this was a recommended read posted for them -, and that just enabling QoS and setting up the rules i wanted didnt produce results, i thought of reduce txqueuelen from the default size of 1000 packets. On most SOHO applications the upload speed is much-much lower than the interface speed (100M or 1G), and it's written that the def buffer is tailored for enterprise size usage. I used values of 90 where[only] it was 1000 and it is wonderfully responsive and effective now, on a 256k connection. I also raised lenghts of 3 and 5 to 20 as i imagined it might be hard to do any queuing/shaping on such ultra short buffers. Leave the 0-s as 0. Btw, the 90 came by, that with 1500byte packet size and 256kbit speed, it takes just half a sec to empty it. Well, i mistakenly took mtu as bits so it's 4 second really but i didnt have the courage for a drastically smaller than default value, 90 already seem so smallish, and it works nicely anyway, awesome lack of latency, jitter and packetloss on the other machine, according to http://pingtest.net, before of this there was no difference between mine and that. Note that this time doesnt correspond to ping values. The point is to allow built-in TCP congestion control to work to reduce "spamming", set speeds as it was envisioned, and keep things leveled out rather than fluctuating widely. While this doesnt directly effects QoS-ing itself, it is extremely beneficial, even essential, to the results usually expected from employing it. It sets a foundation, a healthy network environment over which QoS to function.

First we list the stuff with

ifconfig

.
Then apply for example

ifconfig eth0 txqueuelen 90

and

ifconfig pppoe-wan txqueuelen 20

etc accordingly. Finally an

uci commit
/etc/init.d/network reload

might be needed, i did a network restart too after this.)

Types and Groups

The qos-scripts package didn't come with documentation and there has been some confusion about its features, among users. The information in this section comes straight from nbd (the developer), so it should come a long way to clearing some confusion on two major issues.

The biggest item of contention was which group setting gives better performance, Priority or Express. As it turns out, it depends on the application. Priority boosts low-bandwidth small frames, such as TCP-ACKs and DNS more than Express. Express is for prioritizing bigger frames, which would include stuff like VoIP (port 5060).

Another biggie was the exact meaning of each type. Types are necessary for connection tracking. By default, Classify is not run on a connection that had already been assigned a traffic class, so it is the initial connection-tracked classification. Reclassify can override the traffic class per packet, without altering the connection tracking mark. Default is a fall-back for everything that has not been marked by Classify/Reclassify. Rules get processed by type first (Classify gets processed first, then Reclassify and finally Default) and then based on the order in the configuration file (top to bottom).