Home / Alt manpages / tc-pfifo_fast(8)

  • tc-pfifo_fast(8)
  • Admin command
  • linux

Use pfifo_fast When You Need a Simple Priority Queue

You will finish with a safe way to inspect an interface queue, understand what pfifo_fast does with ordinary packet priority, and restore it after a test. The installed reference here is iproute2 6.1.0-1ubuntu6.4. Allow about ten minutes for inspection, or longer if you are changing a production interface.

This guide assumes a Linux shell and the iproute2 package. Reading queue settings is normally unprivileged. Replacing or deleting a qdisc changes packet handling and normally requires elevated privileges. Choose an interface placeholder such as IFACE=enp0s31f6 only after checking its name.

1. Identify the interface and current queue

Start with read-only commands. They do not alter networking:

$ ip -details link show
$ IFACE='enp0s31f6'
$ ip -details link show dev "$IFACE"
$ tc qdisc show dev "$IFACE"

Look for the interface's qlen value in the ip output and for a named root qdisc in the tc output. Do not copy enp0s31f6 blindly: interface names differ between machines.

Checkpoint: you have the right interface name and have recorded its current qdisc. If it carries production traffic, stop here until you have a maintenance window and a rollback command.

2. Understand what pfifo_fast actually does

pfifo_fast is a three-band first-in, first-out queue. Packets are placed into one of the three bands from their Type of Service bits or assigned priority, using the same general mapping described for the classful tc-prio qdisc. It is not three queues drained in parallel.

The queue always services the highest-priority band that has traffic. A lower band can therefore wait while a higher band remains busy. That can keep interactive traffic responsive, but it can also starve lower-priority traffic under sustained load. Treat the priority mapping as a policy decision, not as a guarantee that every application gets a particular band.

Each band is sized from the interface's txqueuelen. When a band is full, additional packets are not queued and are dropped. Changing txqueuelen therefore changes the capacity of all three bands, not one separately:

$ ip link show dev "$IFACE"
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> ... qdisc ... qlen 1000

The exact flags, line number and qdisc depend on the host. The useful checkpoint is the interface's current queue length, not a particular numeric example.

3. Know when pfifo_fast is already present

The manpage describes pfifo_fast as the automatic default qdisc for a newly created interface. If another qdisc is attached, it pre-empts that default. When the configured qdisc is detached, the automatic pfifo_fast queue returns.

This default has an awkward diagnostic detail: the automatic qdisc does not maintain statistics and does not appear in tc qdisc ls. An empty or apparently unhelpful tc qdisc show result is not proof that the interface has no transmit queue. Compare it with ip -details link show dev "$IFACE", and remember that other devices may deliberately use fq_codel, noqueue or another qdisc.

4. Attach pfifo_fast explicitly for a controlled test

Only do this on an interface you are authorised to reconfigure. The command replaces the root qdisc, so it can change latency and packet handling immediately. It may disrupt traffic while the kernel applies the change:

$ sudo tc qdisc replace dev "$IFACE" root pfifo_fast

The command has no success output. Check its exit status and inspect the interface:

$ printf 'tc status: %s\n' "$?"
tc status: 0
$ tc qdisc show dev "$IFACE"
qdisc pfifo_fast 8001: root refcnt 2 bands 3 priomap ...

Output formatting and the handle can vary. The important result is a successful command and a root qdisc identified as pfifo_fast. If the command reports permission denied, use sudo only with an approved maintenance plan. If it reports an unknown qdisc, check the installed tc and kernel support before trying a different spelling.

5. Restore the automatic behaviour

Deleting the explicitly attached root qdisc is the undo operation described by the manpage's default behaviour. It is also a live network change, so run it only when the interface can tolerate the transition:

$ sudo tc qdisc del dev "$IFACE" root
$ printf 'tc status: %s\n' "$?"
tc status: 0
$ ip -details link show dev "$IFACE"
$ tc qdisc show dev "$IFACE"

After deletion, the interface's automatic default is allowed to return. Do not assume that this means the same queue policy as before: another service, network manager or container tool may attach a different qdisc again. Re-run both inspection commands and compare them with the record from step 1.

6. Avoid the common mistakes

  • Do not infer that pfifo_fast is active just because it is the documented default. An explicitly attached qdisc pre-empts it.
  • Do not expect tc qdisc ls to provide statistics for the automatic default. The manpage says it does not maintain them or show up there.
  • Do not describe the three bands as simultaneous queues. Higher-priority traffic is served first while lower bands have traffic waiting.
  • Do not tune txqueuelen casually on a busy host. It changes how many packets each band can hold and can alter drops and latency.
  • Do not use this queue as a substitute for measuring the traffic classification and the bottleneck. Its useful behaviour depends on packet priority and actual load.

Done means

  • You identified the real interface and recorded its qdisc and txqueuelen.
  • You can explain the three-band strict-priority behaviour and its starvation risk.
  • You know that each band's capacity follows txqueuelen.
  • You changed a live qdisc only with an approved rollback plan.
  • You verified the result with tc qdisc show and ip -details link show.
  • You can remove an explicit root qdisc and re-check whether the automatic default returned.