tc-prio
Configure traffic control packet prioritization
SYNOPSIS
tc qdisc add dev dev parent parentid handle handleid prio
[ bands number ] [ priomap prio_map ]
PARAMETERS
dev dev
Specifies the network interface the qdisc is attached to. dev is the name of the network interface (e.g., eth0, enp0s3).
parent parentid
Specifies the parent of this qdisc. Can be root (to attach directly to the interface) or another qdisc's handle. For example, parent 1: or parent root.
handle handleid
Assigns a handle to the qdisc, which is used to refer to it later. Handles are typically represented as a major:minor pair (e.g., 1: or 10:).
prio
Indicates that the prio queuing discipline is being used.
bands number
Specifies the number of bands or priority levels. Defaults to 3.
The maximum is limited by the priomap setting, but it is good practice to make it a power of 2.
priomap prio_map
Defines the mapping between the packet priority and the bands. The prio_map is a comma separated list of up to 16 numbers that specifies which band each priority maps to. By default is 0,1,2,2,1,0,2,2 mapping.
DESCRIPTION
The tc-prio
command is part of the tc (traffic control) suite in Linux. It's used to configure the prio (priority) queuing discipline (qdisc). The prio qdisc allows you to create multiple bands or traffic classes (typically three or more) with differing priorities. Packets are then enqueued into the appropriate band based on rules you define, and the scheduler always tries to dequeue from the highest priority band first. This allows you to prioritize certain types of traffic, such as interactive applications or VoIP, over less sensitive traffic like bulk data transfers. Using tc-prio
enables Quality of Service (QoS) by ensuring critical data receives preferential treatment during periods of network congestion.
CAVEATS
Incorrectly configured prio qdiscs can lead to starvation of lower-priority traffic. Care must be taken when mapping traffic priorities to bands.
BAND CONFIGURATION
Each band under the prio
qdisc requires a child qdisc. Typically, these child qdiscs are simple leaf qdiscs like pfifo_fast
or more complex shaping qdiscs. These child qdiscs are attached using tc filter
rules that classify traffic into the appropriate band based on various criteria like IP address, port number, or protocol.
TRAFFIC CLASSIFICATION
tc filter
rules are essential to assign packets to the correct priority band. These filters examine packet headers and use criteria like protocol, source/destination IP addresses and ports, or TOS/DSCP values to determine the appropriate band. Without effective traffic classification, the prio
qdisc cannot properly prioritize traffic.
HISTORY
The tc
command and the associated queuing disciplines, including prio
, have been part of the Linux kernel for many years as the primary mechanism for traffic control. Development has been ongoing to improve QoS capabilities and adapt to evolving network requirements. The prio
qdisc has been a fundamental building block for creating prioritized traffic shaping configurations.
SEE ALSO
tc(8), tc-fq_codel(8), tc-htb(8)