info > CAKE

πŸ“– NAME

CAKE - Common Applications Kept Enhanced (CAKE)

πŸš€ Quick Reference

Use CaseCommandDescription
Basic shapingtc qdisc add dev eth0 cake bandwidth 100MbitSet a simple bandwidth limit
With Ethernet overheadtc qdisc add dev eth0 cake bandwidth 100Mbit ethernetCompensates for Ethernet preamble, inter-frame gap, and FCS
With RTT settingtc qdisc add dev eth0 cake bandwidth 100Mbit rtt 10msOptimize AQM for a specific round-trip time
Auto-rate ingresstc qdisc add dev eth0 cake autorate-ingressAutomatic capacity estimation (useful for cellular links)
Diffserv prioritytc qdisc add dev eth0 cake diffserv4Enable 4‑tin Diffserv priority queuing
Flow isolationtc qdisc add dev eth0 cake triple-isolateFairness over source and destination addresses and flows
Override classificationtc filter add dev eth0 parent 1: ...Use tc filters to assign packets to specific tins or queues

πŸ› οΈ SYNOPSIS

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)

πŸ“ DESCRIPTION

CAKE (Common Applications Kept Enhanced) is a shaping-capable queue discipline which uses both AQM and FQ. It combines COBALT, which is an AQM algorithm combining Codel and BLUE, a shaper which operates in deficit mode, and a variant of DRR++ for flow isolation. 8-way set-associative hashing is used to virtually eliminate hash collisions. Priority queuing is available through a simplified diffserv implementation. Overhead compensation for various encapsulation schemes is tightly integrated.

All settings are optional; the default settings are chosen to be sensible in most common deployments. Most people will only need to set the bandwidth parameter to get useful results, but reading the Overhead Compensation and Round Trip Time sections is strongly encouraged.

βš™οΈ SHAPER PARAMETERS

CAKE uses a deficit-mode shaper, which does not exhibit the initial burst typical of token-bucket shapers. It will automatically burst precisely as much as required to maintain the configured throughput. As such, it is very straightforward to configure.

πŸ“ OVERHEAD COMPENSATION PARAMETERS

The size of each packet on the wire may differ from that seen by Linux. The following parameters allow CAKE to compensate for this difference by internally considering each packet to be bigger than Linux informs it. To assist users who are not expert network engineers, keywords have been provided to represent a number of common link technologies.

πŸ“¦ Manual Overhead Specification

πŸ›‘οΈ Failsafe Overhead Keywords

These two keywords are provided for quick-and-dirty setup. Use them if you can't be bothered to read the rest of this section.

πŸ”Œ ADSL Overhead Keywords

Most ADSL modems have a way to check which framing scheme is in use. Often this is also specified in the settings document provided by the ISP. The keywords in this section are intended to correspond with these sources of information. All of them implicitly set the atm flag.

See also the Ethernet Correction Factors section below.

πŸ“‘ VDSL2 Overhead Keywords

ATM was dropped from VDSL2 in favour of PTM, which is a much more straightforward framing scheme. Some ISPs retained PPPoE for compatibility with their existing back-end systems.

See also the Ethernet Correction Factors section below.

πŸ“‘ DOCSIS Cable Overhead Keyword

DOCSIS is the universal standard for providing Internet service over cable-TV infrastructure. In this case, the actual on-wire overhead is less important than the packet size the head-end equipment uses for shaping and metering. This is specified to be an Ethernet frame including the CRC (aka FCS).

πŸ”— Ethernet Overhead Keywords

⏱️ ROUND TRIP TIME PARAMETERS

Active Queue Management (AQM) consists of embedding congestion signals in the packet flow, which receivers use to instruct senders to slow down when the queue is persistently occupied. CAKE uses ECN signalling when available, and packet drops otherwise, according to a combination of the Codel and BLUE AQM algorithms called COBALT.

Very short latencies require a very rapid AQM response to adequately control latency. However, such a rapid response tends to impair throughput when the actual RTT is relatively long. CAKE allows specifying the RTT it assumes for tuning various parameters. Actual RTTs within an order of magnitude of this will generally work well for both throughput and latency management.

At the 'lan' setting and below, the time constants are similar in magnitude to the jitter in the Linux kernel itself, so congestion might be signalled prematurely. The flows will then become sparse and total throughput reduced, leaving little or no back-pressure for the fairness logic to work against. Use the "metro" setting for local lans unless you have a custom kernel.

🌊 FLOW ISOLATION PARAMETERS

With flow isolation enabled, CAKE places packets from different flows into different queues, each of which carries its own AQM state. Packets from each queue are then delivered fairly, according to a DRR++ algorithm which minimizes latency for "sparse" flows. CAKE uses a set-associative hashing algorithm to minimize flow collisions.

These keywords specify whether fairness based on source address, destination address, individual flows, or any combination of those is desired.

🎯 PRIORITY QUEUE PARAMETERS

CAKE can divide traffic into "tins" based on the Diffserv field. Each tin has its own independent set of flow-isolation queues, and is serviced based on a WRR algorithm. To avoid perverse Diffserv marking incentives, tin weights have a "priority sharing" value when bandwidth used by that tin is below a threshold, and a lower "bandwidth sharing" value when above. Bandwidth is compared against the threshold using the same algorithm as the deficit-mode shaper.

Detailed customisation of tin parameters is not provided. The following presets perform all necessary tuning, relative to the current shaper bandwidth and RTT settings.

πŸ”§ OTHER PARAMETERS

πŸ”€ OVERRIDING CLASSIFICATION WITH TC FILTERS

CAKE supports overriding of its internal classification of packets through the tc filter mechanism. Packets can be assigned to different priority tins by setting the priority field on the skb, and the flow hashing can be overridden by setting the classid parameter.

🎫 Tin override

To assign a priority tin, the major number of the priority field needs to match the qdisc handle of the cake instance; if it does, the minor number will be interpreted as the tin index. For example, to classify all ICMP packets as 'bulk', the following filter can be used:

# 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

πŸ”€ Flow hash override

To override flow hashing, the classid can be set. CAKE will interpret the major number of the classid as the host hash used in host isolation mode, and the minor number as the flow hash used for flow-based queueing. One or both of those can be set, and will be used if the relevant flow isolation parameter is set (i.e., the major number will be ignored if CAKE is not configured in hosts mode, and the minor number will be ignored if CAKE is not configured in flows mode).

This example will assign all ICMP packets to the first queue:

# 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

If only one of the host and flow overrides is set, CAKE will compute the other hash from the packet as normal. Note, however, that the host isolation mode works by assigning a host ID to the flow queue; so if overriding both host and flow, the same flow cannot have more than one host assigned. In addition, it is not possible to assign different source and destination host IDs through the override mechanism; if a host ID is assigned, it will be used as both source and destination host.

πŸ§ͺ EXAMPLES

# 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 use:

# 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

πŸ”— SEE ALSO

tc(8), tc-codel(8), tc-fq_codel(8), tc-htb(8)

πŸ‘€ AUTHORS

Cake's principal author is Jonathan Morton, with contributions from Tony Ambardar, Kevin Darbyshire-Bryant, Toke Hoiland-Jorgensen, Sebastian Moeller, Ryan Mounce, Dean Scarff, Nils Andreas Svee, and Dave Taht.

This manual page was written by Loganaden Velvindron. Please report corrections to the Linux Networking mailing list <netdev@vger.kernel.org>.

CAKE
πŸ“– NAME πŸš€ Quick Reference πŸ› οΈ SYNOPSIS πŸ“ DESCRIPTION βš™οΈ SHAPER PARAMETERS πŸ“ OVERHEAD COMPENSATION PARAMETERS
πŸ“¦ Manual Overhead Specification πŸ›‘οΈ Failsafe Overhead Keywords πŸ”Œ ADSL Overhead Keywords πŸ“‘ VDSL2 Overhead Keywords πŸ“‘ DOCSIS Cable Overhead Keyword πŸ”— Ethernet Overhead Keywords
⏱️ ROUND TRIP TIME PARAMETERS 🌊 FLOW ISOLATION PARAMETERS 🎯 PRIORITY QUEUE PARAMETERS πŸ”§ OTHER PARAMETERS πŸ”€ OVERRIDING CLASSIFICATION WITH TC FILTERS
🎫 Tin override πŸ”€ Flow hash override
πŸ§ͺ EXAMPLES πŸ”— SEE ALSO πŸ‘€ AUTHORS

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-09 09:26 @2600:1f28:365:80b0:50b3:453e:ff52:20f7
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^