CAKE - Common Applications Kept Enhanced (CAKE)
| Use Case | Command | Description |
|---|---|---|
| Basic egress shaping with Ethernet overhead | tc qdisc add dev eth0 root cake bandwidth 100Mbit ethernet | Shape outbound to 100 Mbit/s, compensating for Ethernet framing |
| Ingress autorate (cellular) | tc qdisc add dev eth0 ingress cake autorate-ingress | Let CAKE estimate link capacity dynamically from incoming traffic |
| Set RTT for satellite | tc qdisc add dev eth0 root cake bandwidth 1Mbit satellite | Configure AQM for high-latency satellite link |
| Dual-srchost flow isolation (LAN egress) | tc qdisc add dev eth0 root cake bandwidth 10Mbit dual-srchost | Prevent one host from monopolising uplink regardless of flow count |
| Wash untrusted diffserv markings | tc qdisc add dev eth0 root cake bandwidth 100Mbit wash | Clear QoS bits (but not ECN) after priority queuing |
| Show real-time statistics | tc -s qdisc show dev eth0 | Display per-tin stats, drops, delays, and flow counts |
tc qdisc ... cake
[ bandwidth RATE | unlimited* | autorate-ingress ]
[ rtt TIME | datacentre | lan | metro | regional | internet* | oceanic
| satellite | interplanetary ]
[ besteffort | diffserv8 | diffserv4 | diffserv3* ]
[ flowblind | srchost | dsthost | hosts | flows | dual-srchost | dual-dsthost
| triple-isolate* ]
[ nat | nonat* ]
[ wash | nowash* ]
[ split-gso* | no-split-gso ]
[ ack-filter | ack-filter-aggressive | no-ack-filter* ]
[ memlimit LIMIT ]
[ fwmark MASK ]
[ ptm | atm | noatm* ]
[ overhead N | conservative | raw* ]
[ mpu N ]
[ ingress | egress* ]
(* marks defaults)
CAKE (Common Applications Kept Enhanced) is a shaping‑capable queue discipline which uses both AQM and FQ. It combines COBALT (Codel + BLUE), a deficit‑mode shaper, and a variant of DRR++ for flow isolation. 8‑way set‑associative hashing virtually eliminates collisions. Simplified diffserv priority queuing is available, and overhead compensation for encapsulation schemes is tightly integrated.
All settings are optional; defaults are sensible for most deployments. Most people only need to set the bandwidth parameter, but reading the Overhead Compensation and Round Trip Time sections is strongly encouraged.
CAKE uses a deficit‑mode shaper (no initial burst). It automatically bursts just enough to maintain the configured throughput.
The packet size Linux sees may differ from the wire size. These options make CAKE internally treat each packet as larger, accounting for encapsulation overheads. Keywords exist for common link technologies.
Quick‑and‑dirty settings if you don’t want to read further.
overhead 48 atm.All implicitly enable atm. Check your modem’s framing settings.
pppoa-vcmux – equivalent to overhead 10 atmpppoa-llc – equivalent to overhead 14 atmpppoe-vcmux – equivalent to overhead 32 atmpppoe-llcsnap – equivalent to overhead 40 atmbridged-vcmux – equivalent to overhead 24 atmbridged-llcsnap – equivalent to overhead 32 atmipoa-vcmux – equivalent to overhead 8 atmipoa-llcsnap – equivalent to overhead 16 atmpppoe-ptm – equivalent to overhead 30 ptm
bridged-ptm – equivalent to overhead 22 ptm
docsis – equivalent to overhead 18 mpu 64 noatm. Matches the head‑end’s Ethernet‑frame metering.ethernet – Accounts for preamble, inter‑frame gap, and FCS. Equivalent to overhead 38 mpu 84 noatm.ether-vlan – Adds 4 bytes for an IEEE 802.1Q VLAN header. Can be repeated for multiple VLAN tags.AQM in CAKE (COBALT) responds to queue occupancy, but response speed must match actual RTT. Very short RTT presets can starve throughput; use metro for local LANs unless you have a custom kernel.
Packets from different flows are isolated in separate queues, each with its own AQM state. Set‑associative hashing minimises collisions. Choose fairness based on source, destination, 5‑tuple, or layered isolation.
Traffic is divided into “tins” based on Diffserv field. Each tin has independent flow‑isolation queues and is serviced via WRR with priority‑sharing thresholds.
CAKE allows overriding its internal classification via standard tc filters. Tin assignment uses skb→priority, and flow hashing uses classid.
The major number of the priority must match the qdisc handle; the minor is the tin index. Example: classify ICMP as ‘bulk’ (tin 1).
# tc qdisc replace dev eth0 handle 1: root cake diffserv3
# tc filter add dev eth0 parent 1: protocol ip prio 1 \
u32 match icmp type 0 0 action skbedit priority 1:1
Set the classid to override flow hashing. The major number is the host hash (used in host‑isolation modes), the minor is the flow hash (used in flows mode). Both can be set; missing ones are computed normally. Host isolation assigns a host ID to flow queues – the same flow cannot have multiple host IDs. Overriden host ID is used as both source and destination host.
# tc qdisc replace dev eth0 handle 1: root cake
# tc filter add dev eth0 parent 1: protocol ip prio 1 \
u32 match icmp type 0 0 classid 0:1
Setup and initial statistics:
# tc qdisc delete root dev eth0
# tc qdisc add root dev eth0 cake bandwidth 100Mbit ethernet
# tc -s qdisc show dev eth0
qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple‑isolate rtt 100.0ms noatm overhead 38 mpu 84
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
memory used: 0b of 5000000b
capacity estimate: 100Mbit
min/max network layer size: 65535 / 0
min/max overhead‑adjusted size: 65535 / 0
average network hdr offset: 0
Bulk Best Effort Voice
thresh 6250Kbit 100Mbit 25Mbit
target 5.0ms 5.0ms 5.0ms
interval 100.0ms 100.0ms 100.0ms
pk_delay 0us 0us 0us
av_delay 0us 0us 0us
sp_delay 0us 0us 0us
pkts 0 0 0
bytes 0 0 0
way_inds 0 0 0
way_miss 0 0 0
way_cols 0 0 0
drops 0 0 0
marks 0 0 0
ack_drop 0 0 0
sp_flows 0 0 0
bk_flows 0 0 0
un_flows 0 0 0
max_len 0 0 0
quantum 300 1514 762
After some traffic:
# tc -s qdisc show dev eth0
qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple‑isolate rtt 100.0ms noatm overhead 38 mpu 84
Sent 44709231 bytes 31931 pkt (dropped 45, overlimits 93782 requeues 0)
backlog 33308b 22p requeues 0
memory used: 292352b of 5000000b
capacity estimate: 100Mbit
min/max network layer size: 28 / 1500
min/max overhead‑adjusted size: 84 / 1538
average network hdr offset: 14
Bulk Best Effort Voice
thresh 6250Kbit 100Mbit 25Mbit
target 5.0ms 5.0ms 5.0ms
interval 100.0ms 100.0ms 100.0ms
pk_delay 8.7ms 6.9ms 5.0ms
av_delay 4.9ms 5.3ms 3.8ms
sp_delay 727us 1.4ms 511us
pkts 2590 21271 8137
bytes 3081804 30302659 11426206
way_inds 0 46 0
way_miss 3 17 4
way_cols 0 0 0
drops 20 15 10
marks 0 0 0
ack_drop 0 0 0
sp_flows 2 4 1
bk_flows 1 2 1
un_flows 0 0 0
max_len 1514 1514 1514
quantum 300 1514 762
tc(8), tc‑codel(8), tc‑fq_codel(8), tc‑htb(8)
CAKE principal author: Jonathan Morton. Contributors: Tony Ambardar, Kevin Darbyshire‑Bryant, Toke Høiland‑Jørgensen, Sebastian Moeller, Ryan Mounce, Dean Scarff, Nils Andreas Svee, Dave Taht.
Manual page: Loganaden Velvindron. Corrections to: <netdev AT vger.ker‑nel.org>.
Generated by phpman v4.9.22-1-g1b0fcb4 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-05 06:01 @216.73.216.52
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-pro / taotoken.net / www.chedong.com - original format