| 1 |
.TH CAKE 8 "19 July 2018" "iproute2" "Linux" |
| 2 |
.SH NAME |
| 3 |
CAKE \- Common Applications Kept Enhanced (CAKE) |
| 4 |
.SH SYNOPSIS |
| 5 |
.B tc qdisc ... { cake | cake_mq } |
| 6 |
.br |
| 7 |
[ |
| 8 |
.BR bandwidth |
| 9 |
RATE | |
| 10 |
.BR unlimited* |
| 11 |
| |
| 12 |
.BR autorate-ingress |
| 13 |
] |
| 14 |
.br |
| 15 |
[ |
| 16 |
.BR rtt |
| 17 |
TIME | |
| 18 |
.BR datacentre |
| 19 |
| |
| 20 |
.BR lan |
| 21 |
| |
| 22 |
.BR metro |
| 23 |
| |
| 24 |
.BR regional |
| 25 |
| |
| 26 |
.BR internet* |
| 27 |
| |
| 28 |
.BR oceanic |
| 29 |
| |
| 30 |
.BR satellite |
| 31 |
| |
| 32 |
.BR interplanetary |
| 33 |
] |
| 34 |
.br |
| 35 |
[ |
| 36 |
.BR besteffort |
| 37 |
| |
| 38 |
.BR diffserv8 |
| 39 |
| |
| 40 |
.BR diffserv4 |
| 41 |
| |
| 42 |
.BR diffserv3* |
| 43 |
] |
| 44 |
.br |
| 45 |
[ |
| 46 |
.BR flowblind |
| 47 |
| |
| 48 |
.BR srchost |
| 49 |
| |
| 50 |
.BR dsthost |
| 51 |
| |
| 52 |
.BR hosts |
| 53 |
| |
| 54 |
.BR flows |
| 55 |
| |
| 56 |
.BR dual-srchost |
| 57 |
| |
| 58 |
.BR dual-dsthost |
| 59 |
| |
| 60 |
.BR triple-isolate* |
| 61 |
] |
| 62 |
.br |
| 63 |
[ |
| 64 |
.BR nat |
| 65 |
| |
| 66 |
.BR nonat* |
| 67 |
] |
| 68 |
.br |
| 69 |
[ |
| 70 |
.BR wash |
| 71 |
| |
| 72 |
.BR nowash* |
| 73 |
] |
| 74 |
.br |
| 75 |
[ |
| 76 |
.BR split-gso* |
| 77 |
| |
| 78 |
.BR no-split-gso |
| 79 |
] |
| 80 |
.br |
| 81 |
[ |
| 82 |
.BR ack-filter |
| 83 |
| |
| 84 |
.BR ack-filter-aggressive |
| 85 |
| |
| 86 |
.BR no-ack-filter* |
| 87 |
] |
| 88 |
.br |
| 89 |
[ |
| 90 |
.BR memlimit |
| 91 |
LIMIT ] |
| 92 |
.br |
| 93 |
[ |
| 94 |
.BR fwmark |
| 95 |
MASK ] |
| 96 |
.br |
| 97 |
[ |
| 98 |
.BR ptm |
| 99 |
| |
| 100 |
.BR atm |
| 101 |
| |
| 102 |
.BR noatm* |
| 103 |
] |
| 104 |
.br |
| 105 |
[ |
| 106 |
.BR overhead |
| 107 |
N | |
| 108 |
.BR conservative |
| 109 |
| |
| 110 |
.BR raw* |
| 111 |
] |
| 112 |
.br |
| 113 |
[ |
| 114 |
.BR mpu |
| 115 |
N ] |
| 116 |
.br |
| 117 |
[ |
| 118 |
.BR ingress |
| 119 |
| |
| 120 |
.BR egress* |
| 121 |
] |
| 122 |
.br |
| 123 |
(* marks defaults) |
| 124 |
|
| 125 |
|
| 126 |
.SH DESCRIPTION |
| 127 |
CAKE (Common Applications Kept Enhanced) is a shaping-capable queue discipline |
| 128 |
which uses both AQM and FQ. It combines COBALT, which is an AQM algorithm |
| 129 |
combining Codel and BLUE, a shaper which operates in deficit mode, and a variant |
| 130 |
of DRR++ for flow isolation. 8-way set-associative hashing is used to virtually |
| 131 |
eliminate hash collisions. Priority queuing is available through a simplified |
| 132 |
diffserv implementation. Overhead compensation for various encapsulation |
| 133 |
schemes is tightly integrated. |
| 134 |
|
| 135 |
A multi-queue aware version of CAKE is available as a separate qdisc called |
| 136 |
\fBcake_mq\fR. This variant allows the CAKE shaper to scale across multiple CPUs |
| 137 |
on hardware that has multiple transmit queues. It is mostly a drop-in |
| 138 |
replacement for CAKE (and takes the same parameters), but has a few differences |
| 139 |
in how it treats traffic. See the section below for more details on these |
| 140 |
differences. |
| 141 |
|
| 142 |
All settings are optional; the default settings are chosen to be sensible in |
| 143 |
most common deployments. Most people will only need to set the |
| 144 |
.B bandwidth |
| 145 |
parameter to get useful results, but reading the |
| 146 |
.B Overhead Compensation |
| 147 |
and |
| 148 |
.B Round Trip Time |
| 149 |
sections is strongly encouraged. |
| 150 |
|
| 151 |
.SH SHAPER PARAMETERS |
| 152 |
CAKE uses a deficit-mode shaper, which does not exhibit the initial burst |
| 153 |
typical of token-bucket shapers. It will automatically burst precisely as much |
| 154 |
as required to maintain the configured throughput. As such, it is very |
| 155 |
straightforward to configure. |
| 156 |
|
| 157 |
.TP |
| 158 |
\fBunlimited\fR (default) |
| 159 |
.br |
| 160 |
No limit on the bandwidth. |
| 161 |
|
| 162 |
.TP |
| 163 |
\fBbandwidth\fR RATE |
| 164 |
.br |
| 165 |
Set the shaper bandwidth. See |
| 166 |
.BR tc(8) |
| 167 |
or examples below for details of the RATE value. |
| 168 |
|
| 169 |
.TP |
| 170 |
.B autorate-ingress |
| 171 |
.br |
| 172 |
Automatic capacity estimation based on traffic arriving at this qdisc. |
| 173 |
This is most likely to be useful with cellular links, which tend to change |
| 174 |
quality randomly. A |
| 175 |
.B bandwidth |
| 176 |
parameter can be used in conjunction to specify an initial estimate. The shaper |
| 177 |
will periodically be set to a bandwidth slightly below the estimated rate. This |
| 178 |
estimator cannot estimate the bandwidth of links downstream of itself. |
| 179 |
|
| 180 |
This parameter cannot be used with the \fBcake_mq\fR variant. |
| 181 |
|
| 182 |
.SH OVERHEAD COMPENSATION PARAMETERS |
| 183 |
The size of each packet on the wire may differ from that seen by Linux. The |
| 184 |
following parameters allow CAKE to compensate for this difference by internally |
| 185 |
considering each packet to be bigger than Linux informs it. To assist users who |
| 186 |
are not expert network engineers, keywords have been provided to represent a |
| 187 |
number of common link technologies. |
| 188 |
|
| 189 |
.SS Manual Overhead Specification |
| 190 |
.TP |
| 191 |
\fBoverhead\fR BYTES |
| 192 |
.br |
| 193 |
Adds BYTES to the size of each packet. BYTES may be negative; values |
| 194 |
between -64 and 256 (inclusive) are accepted. |
| 195 |
|
| 196 |
.TP |
| 197 |
\fBmpu\fR BYTES |
| 198 |
.br |
| 199 |
Rounds each packet (including overhead) up to a minimum length |
| 200 |
BYTES. BYTES may not be negative; values between 0 and 256 (inclusive) |
| 201 |
are accepted. |
| 202 |
|
| 203 |
.TP |
| 204 |
.B atm |
| 205 |
.br |
| 206 |
Compensates for ATM cell framing, which is normally found on ADSL links. |
| 207 |
This is performed after the |
| 208 |
.B overhead |
| 209 |
parameter above. ATM uses fixed 53-byte cells, each of which can carry 48 bytes |
| 210 |
payload. |
| 211 |
|
| 212 |
.TP |
| 213 |
.B ptm |
| 214 |
.br |
| 215 |
Compensates for PTM encoding, which is normally found on VDSL2 links and |
| 216 |
uses a 64b/65b encoding scheme. It is even more efficient to simply |
| 217 |
derate the specified shaper bandwidth by a factor of 64/65 or 0.984. See |
| 218 |
ITU G.992.3 Annex N and IEEE 802.3 Section 61.3 for details. |
| 219 |
|
| 220 |
.TP |
| 221 |
.B noatm |
| 222 |
.br |
| 223 |
Disables ATM and PTM compensation. |
| 224 |
|
| 225 |
.SS Failsafe Overhead Keywords |
| 226 |
These two keywords are provided for quick-and-dirty setup. Use them if you |
| 227 |
can't be bothered to read the rest of this section. |
| 228 |
|
| 229 |
.TP |
| 230 |
\fBraw\fR (default) |
| 231 |
.br |
| 232 |
Turns off all overhead compensation in CAKE. The packet size reported |
| 233 |
by Linux will be used directly. |
| 234 |
|
| 235 |
Other overhead keywords may be added after "raw". The effect of this is |
| 236 |
to make the overhead compensation operate relative to the reported packet size, |
| 237 |
not the underlying IP packet size. |
| 238 |
|
| 239 |
.TP |
| 240 |
.B conservative |
| 241 |
.br |
| 242 |
Compensates for more overhead than is likely to occur on any |
| 243 |
widely-deployed link technology. |
| 244 |
Equivalent to |
| 245 |
.B overhead 48 atm. |
| 246 |
|
| 247 |
.SS ADSL Overhead Keywords |
| 248 |
Most ADSL modems have a way to check which framing scheme is in use. Often this |
| 249 |
is also specified in the settings document provided by the ISP. The keywords in |
| 250 |
this section are intended to correspond with these sources of information. All |
| 251 |
of them implicitly set the |
| 252 |
.B atm |
| 253 |
flag. |
| 254 |
|
| 255 |
.TP |
| 256 |
.B pppoa-vcmux |
| 257 |
.br |
| 258 |
Equivalent to |
| 259 |
.B overhead 10 atm |
| 260 |
|
| 261 |
.TP |
| 262 |
.B pppoa-llc |
| 263 |
.br |
| 264 |
Equivalent to |
| 265 |
.B overhead 14 atm |
| 266 |
|
| 267 |
.TP |
| 268 |
.B pppoe-vcmux |
| 269 |
.br |
| 270 |
Equivalent to |
| 271 |
.B overhead 32 atm |
| 272 |
|
| 273 |
.TP |
| 274 |
.B pppoe-llcsnap |
| 275 |
.br |
| 276 |
Equivalent to |
| 277 |
.B overhead 40 atm |
| 278 |
|
| 279 |
.TP |
| 280 |
.B bridged-vcmux |
| 281 |
.br |
| 282 |
Equivalent to |
| 283 |
.B overhead 24 atm |
| 284 |
|
| 285 |
.TP |
| 286 |
.B bridged-llcsnap |
| 287 |
.br |
| 288 |
Equivalent to |
| 289 |
.B overhead 32 atm |
| 290 |
|
| 291 |
.TP |
| 292 |
.B ipoa-vcmux |
| 293 |
.br |
| 294 |
Equivalent to |
| 295 |
.B overhead 8 atm |
| 296 |
|
| 297 |
.TP |
| 298 |
.B ipoa-llcsnap |
| 299 |
.br |
| 300 |
Equivalent to |
| 301 |
.B overhead 16 atm |
| 302 |
|
| 303 |
.P |
| 304 |
See also the Ethernet Correction Factors section below. |
| 305 |
|
| 306 |
.SS VDSL2 Overhead Keywords |
| 307 |
ATM was dropped from VDSL2 in favour of PTM, which is a much more |
| 308 |
straightforward framing scheme. Some ISPs retained PPPoE for compatibility with |
| 309 |
their existing back-end systems. |
| 310 |
|
| 311 |
.TP |
| 312 |
.B pppoe-ptm |
| 313 |
.br |
| 314 |
Equivalent to |
| 315 |
.B overhead 30 ptm |
| 316 |
|
| 317 |
PPPoE: 2B PPP + 6B PPPoE + |
| 318 |
.br |
| 319 |
ETHERNET: 6B dest MAC + 6B src MAC + 2B ethertype + 4B Frame Check Sequence + |
| 320 |
.br |
| 321 |
PTM: 1B Start of Frame (S) + 1B End of Frame (Ck) + 2B TC-CRC (PTM-FCS) |
| 322 |
|
| 323 |
.TP |
| 324 |
.B bridged-ptm |
| 325 |
.br |
| 326 |
Equivalent to |
| 327 |
.B overhead 22 ptm |
| 328 |
|
| 329 |
ETHERNET: 6B dest MAC + 6B src MAC + 2B ethertype + 4B Frame Check Sequence + |
| 330 |
.br |
| 331 |
PTM: 1B Start of Frame (S) + 1B End of Frame (Ck) + 2B TC-CRC (PTM-FCS) |
| 332 |
|
| 333 |
.P |
| 334 |
See also the Ethernet Correction Factors section below. |
| 335 |
|
| 336 |
.SS DOCSIS Cable Overhead Keyword |
| 337 |
DOCSIS is the universal standard for providing Internet service over cable-TV |
| 338 |
infrastructure. |
| 339 |
|
| 340 |
In this case, the actual on-wire overhead is less important than the packet size |
| 341 |
the head-end equipment uses for shaping and metering. This is specified to be |
| 342 |
an Ethernet frame including the CRC (aka FCS). |
| 343 |
|
| 344 |
.TP |
| 345 |
.B docsis |
| 346 |
.br |
| 347 |
Equivalent to |
| 348 |
.B overhead 18 mpu 64 noatm |
| 349 |
|
| 350 |
.SS Ethernet Overhead Keywords |
| 351 |
|
| 352 |
.TP |
| 353 |
.B ethernet |
| 354 |
.br |
| 355 |
Accounts for Ethernet's preamble, inter-frame gap, and Frame Check |
| 356 |
Sequence. Use this keyword when the bottleneck being shaped for is an |
| 357 |
actual Ethernet cable. |
| 358 |
Equivalent to |
| 359 |
.B overhead 38 mpu 84 noatm |
| 360 |
|
| 361 |
.TP |
| 362 |
.B ether-vlan |
| 363 |
.br |
| 364 |
Adds 4 bytes to the overhead compensation, accounting for an IEEE 802.1Q |
| 365 |
VLAN header appended to the Ethernet frame header. NB: Some ISPs use one or |
| 366 |
even two of these within PPPoE; this keyword may be repeated as necessary to |
| 367 |
express this. |
| 368 |
|
| 369 |
.SH ROUND TRIP TIME PARAMETERS |
| 370 |
Active Queue Management (AQM) consists of embedding congestion signals in the |
| 371 |
packet flow, which receivers use to instruct senders to slow down when the queue |
| 372 |
is persistently occupied. CAKE uses ECN signalling when available, and packet |
| 373 |
drops otherwise, according to a combination of the Codel and BLUE AQM algorithms |
| 374 |
called COBALT. |
| 375 |
|
| 376 |
Very short latencies require a very rapid AQM response to adequately control |
| 377 |
latency. However, such a rapid response tends to impair throughput when the |
| 378 |
actual RTT is relatively long. CAKE allows specifying the RTT it assumes for |
| 379 |
tuning various parameters. Actual RTTs within an order of magnitude of this |
| 380 |
will generally work well for both throughput and latency management. |
| 381 |
|
| 382 |
At the 'lan' setting and below, the time constants are similar in magnitude to |
| 383 |
the jitter in the Linux kernel itself, so congestion might be signalled |
| 384 |
prematurely. The flows will then become sparse and total throughput reduced, |
| 385 |
leaving little or no back-pressure for the fairness logic to work against. Use |
| 386 |
the "metro" setting for local lans unless you have a custom kernel. |
| 387 |
|
| 388 |
.TP |
| 389 |
\fBrtt\fR TIME |
| 390 |
.br |
| 391 |
Manually specify an RTT. |
| 392 |
|
| 393 |
.TP |
| 394 |
.B datacentre |
| 395 |
.br |
| 396 |
For extremely high-performance 10GigE+ networks only. |
| 397 |
.br |
| 398 |
Equivalent to |
| 399 |
.B rtt 100us. |
| 400 |
|
| 401 |
.TP |
| 402 |
.B lan |
| 403 |
.br |
| 404 |
For pure Ethernet (not Wi-Fi) networks, at home or in the office. Don't |
| 405 |
use this when shaping for an Internet access link. |
| 406 |
.br |
| 407 |
Equivalent to |
| 408 |
.B rtt 1ms. |
| 409 |
|
| 410 |
.TP |
| 411 |
.B metro |
| 412 |
.br |
| 413 |
For traffic mostly within a single city. |
| 414 |
.br |
| 415 |
Equivalent to |
| 416 |
.B rtt 10ms. |
| 417 |
|
| 418 |
.TP |
| 419 |
.B regional |
| 420 |
.br |
| 421 |
For traffic mostly within a European-sized country. |
| 422 |
.br |
| 423 |
Equivalent to |
| 424 |
.B rtt 30ms. |
| 425 |
|
| 426 |
.TP |
| 427 |
\fBinternet\fR (default) |
| 428 |
.br |
| 429 |
This is suitable for most Internet traffic. |
| 430 |
.br |
| 431 |
Equivalent to |
| 432 |
.B rtt 100ms. |
| 433 |
|
| 434 |
.TP |
| 435 |
.B oceanic |
| 436 |
.br |
| 437 |
For Internet traffic with generally above-average latency, such as that |
| 438 |
suffered by Australasian residents. |
| 439 |
.br |
| 440 |
Equivalent to |
| 441 |
.B rtt 300ms. |
| 442 |
|
| 443 |
.TP |
| 444 |
.B satellite |
| 445 |
.br |
| 446 |
For traffic via geostationary satellites. |
| 447 |
.br |
| 448 |
Equivalent to |
| 449 |
.B rtt 1000ms. |
| 450 |
|
| 451 |
.TP |
| 452 |
.B interplanetary |
| 453 |
.br |
| 454 |
So named because Jupiter is about 1 light-hour from Earth. Use this to |
| 455 |
(almost) completely disable AQM actions. |
| 456 |
.br |
| 457 |
Equivalent to |
| 458 |
.B rtt 3600s. |
| 459 |
|
| 460 |
.SH FLOW ISOLATION PARAMETERS |
| 461 |
With flow isolation enabled, CAKE places packets from different flows into |
| 462 |
different queues, each of which carries its own AQM state. Packets from each |
| 463 |
queue are then delivered fairly, according to a DRR++ algorithm which minimizes |
| 464 |
latency for "sparse" flows. CAKE uses a set-associative hashing algorithm to |
| 465 |
minimize flow collisions. |
| 466 |
|
| 467 |
These keywords specify whether fairness based on source address, destination |
| 468 |
address, individual flows, or any combination of those is desired. |
| 469 |
|
| 470 |
.TP |
| 471 |
.B flowblind |
| 472 |
.br |
| 473 |
Disables flow isolation; all traffic passes through a single queue for |
| 474 |
each tin. |
| 475 |
|
| 476 |
.TP |
| 477 |
.B srchost |
| 478 |
.br |
| 479 |
Flows are defined only by source address. Could be useful on the egress |
| 480 |
path of an ISP backhaul. |
| 481 |
|
| 482 |
.TP |
| 483 |
.B dsthost |
| 484 |
.br |
| 485 |
Flows are defined only by destination address. Could be useful on the |
| 486 |
ingress path of an ISP backhaul. |
| 487 |
|
| 488 |
.TP |
| 489 |
.B hosts |
| 490 |
.br |
| 491 |
Flows are defined by source-destination host pairs. This is host |
| 492 |
isolation, rather than flow isolation. |
| 493 |
|
| 494 |
.TP |
| 495 |
.B flows |
| 496 |
.br |
| 497 |
Flows are defined by the entire 5-tuple of source address, destination |
| 498 |
address, transport protocol, source port and destination port. This is the type |
| 499 |
of flow isolation performed by SFQ and fq_codel. |
| 500 |
|
| 501 |
.TP |
| 502 |
.B dual-srchost |
| 503 |
.br |
| 504 |
Flows are defined by the 5-tuple, and fairness is applied first over |
| 505 |
source addresses, then over individual flows. Good for use on egress traffic |
| 506 |
from a LAN to the internet, where it'll prevent any one LAN host from |
| 507 |
monopolising the uplink, regardless of the number of flows they use. |
| 508 |
|
| 509 |
.TP |
| 510 |
.B dual-dsthost |
| 511 |
.br |
| 512 |
Flows are defined by the 5-tuple, and fairness is applied first over |
| 513 |
destination addresses, then over individual flows. Good for use on ingress |
| 514 |
traffic to a LAN from the internet, where it'll prevent any one LAN host from |
| 515 |
monopolising the downlink, regardless of the number of flows they use. |
| 516 |
|
| 517 |
.TP |
| 518 |
\fBtriple-isolate\fR (default) |
| 519 |
.br |
| 520 |
Flows are defined by the 5-tuple, and fairness is applied over source |
| 521 |
*and* destination addresses intelligently (ie. not merely by host-pairs), and |
| 522 |
also over individual flows. Use this if you're not certain whether to use |
| 523 |
dual-srchost or dual-dsthost; it'll do both jobs at once, preventing any one |
| 524 |
host on *either* side of the link from monopolising it with a large number of |
| 525 |
flows. |
| 526 |
|
| 527 |
.TP |
| 528 |
.B nat |
| 529 |
.br |
| 530 |
Instructs Cake to perform a NAT lookup before applying flow-isolation |
| 531 |
rules, to determine the true addresses and port numbers of the packet, to |
| 532 |
improve fairness between hosts "inside" the NAT. This has no practical effect |
| 533 |
in "flowblind" or "flows" modes, or if NAT is performed on a different host. |
| 534 |
|
| 535 |
.TP |
| 536 |
\fBnonat\fR (default) |
| 537 |
.br |
| 538 |
Cake will not perform a NAT lookup. Flow isolation will be performed |
| 539 |
using the addresses and port numbers directly visible to the interface Cake is |
| 540 |
attached to. |
| 541 |
|
| 542 |
.SH PRIORITY QUEUE PARAMETERS |
| 543 |
CAKE can divide traffic into "tins" based on the Diffserv field. Each tin has |
| 544 |
its own independent set of flow-isolation queues, and is serviced based on a WRR |
| 545 |
algorithm. To avoid perverse Diffserv marking incentives, tin weights have a |
| 546 |
"priority sharing" value when bandwidth used by that tin is below a threshold, |
| 547 |
and a lower "bandwidth sharing" value when above. Bandwidth is compared against |
| 548 |
the threshold using the same algorithm as the deficit-mode shaper. |
| 549 |
|
| 550 |
Detailed customisation of tin parameters is not provided. The following presets |
| 551 |
perform all necessary tuning, relative to the current shaper bandwidth and RTT |
| 552 |
settings. |
| 553 |
|
| 554 |
.TP |
| 555 |
.B besteffort |
| 556 |
.br |
| 557 |
Disables priority queuing by placing all traffic in one tin. |
| 558 |
|
| 559 |
.TP |
| 560 |
.B precedence |
| 561 |
.br |
| 562 |
Enables legacy interpretation of TOS "Precedence" field. Use of this |
| 563 |
preset on the modern Internet is firmly discouraged. |
| 564 |
|
| 565 |
.TP |
| 566 |
.B diffserv4 |
| 567 |
.br |
| 568 |
Provides a general-purpose Diffserv implementation with four tins: |
| 569 |
|
| 570 |
\(bu Bulk (CS1, LE in kernel v5.9+), 6.25% threshold, generally low priority. |
| 571 |
.br |
| 572 |
\(bu Best Effort (general), 100% threshold. |
| 573 |
.br |
| 574 |
\(bu Video (AF4x, AF3x, CS3, AF2x, CS2, TOS4, TOS1), 50% threshold. |
| 575 |
.br |
| 576 |
\(bu Voice (CS7, CS6, EF, VA, CS5, CS4), 25% threshold. |
| 577 |
|
| 578 |
.TP |
| 579 |
\fBdiffserv3\fR (default) |
| 580 |
.br |
| 581 |
Provides a simple, general-purpose Diffserv implementation with three tins: |
| 582 |
|
| 583 |
\(bu Bulk (CS1, LE in kernel v5.9+), 6.25% threshold, generally low priority. |
| 584 |
.br |
| 585 |
\(bu Best Effort (general), 100% threshold. |
| 586 |
.br |
| 587 |
\(bu Voice (CS7, CS6, EF, VA, TOS4), 25% threshold, reduced Codel interval. |
| 588 |
|
| 589 |
.TP |
| 590 |
\fBfwmark\fR MASK |
| 591 |
.br |
| 592 |
This options turns on fwmark-based overriding of CAKE's tin selection. |
| 593 |
If set, the option specifies a bitmask that will be applied to the fwmark |
| 594 |
associated with each packet. If the result of this masking is non-zero, the |
| 595 |
result will be right-shifted by the number of least-significant unset bits in |
| 596 |
the mask value, and the result will be used as a the tin number for that packet. |
| 597 |
This can be used to set policies in a firewall script that will override CAKE's |
| 598 |
built-in tin selection. |
| 599 |
|
| 600 |
.SH OTHER PARAMETERS |
| 601 |
|
| 602 |
.TP |
| 603 |
.B ingress |
| 604 |
.br |
| 605 |
Indicates that CAKE is running in ingress mode (i.e. running on the downlink of |
| 606 |
a connection). This changes the shaper to also count dropped packets as data |
| 607 |
transferred, as these will have already traversed the link before CAKE can |
| 608 |
choose what to do with them. |
| 609 |
|
| 610 |
In addition, the AQM will be tuned to always keep at least two packets |
| 611 |
queued per flow. The reason for this is that retransmits are more expensive in |
| 612 |
ingress mode, since dropped packets have to traverse the link again; thus, |
| 613 |
keeping a minimum number of packets queued will improve throughput in cases |
| 614 |
where the number of active flows are so large that they saturate the link even |
| 615 |
at their minimum window size. |
| 616 |
|
| 617 |
.TP |
| 618 |
\fBmemlimit\fR LIMIT |
| 619 |
.br |
| 620 |
Limit the memory consumed by Cake to LIMIT bytes. Note that this does |
| 621 |
not translate directly to queue size (so do not size this based on bandwidth |
| 622 |
delay product considerations, but rather on worst case acceptable memory |
| 623 |
consumption), as there is some overhead in the data structures containing the |
| 624 |
packets, especially for small packets. |
| 625 |
|
| 626 |
By default, the limit is calculated based on the bandwidth and RTT |
| 627 |
settings. |
| 628 |
|
| 629 |
.TP |
| 630 |
.B wash |
| 631 |
.br |
| 632 |
Traffic entering your diffserv domain is frequently mis-marked in |
| 633 |
transit from the perspective of your network, and traffic exiting yours may be |
| 634 |
mis-marked from the perspective of the transiting provider. |
| 635 |
|
| 636 |
Apply the wash option to clear all extra diffserv (but not ECN bits), after |
| 637 |
priority queuing has taken place. |
| 638 |
|
| 639 |
If you are shaping inbound, and cannot trust the diffserv markings (as is the |
| 640 |
case for Comcast Cable, among others), it is best to use a single queue |
| 641 |
"besteffort" mode with wash. |
| 642 |
|
| 643 |
.TP |
| 644 |
.B split-gso |
| 645 |
.br |
| 646 |
This option controls whether CAKE will split General Segmentation |
| 647 |
Offload (GSO) super-packets into their on-the-wire components and |
| 648 |
dequeue them individually. |
| 649 |
|
| 650 |
Super-packets are created by the networking stack to improve efficiency. |
| 651 |
However, because they are larger they take longer to dequeue, which |
| 652 |
translates to higher latency for competing flows, especially at lower |
| 653 |
bandwidths. CAKE defaults to splitting GSO packets to achieve the lowest |
| 654 |
possible latency. At link speeds higher than 10 Gbps, setting the |
| 655 |
no-split-gso parameter can increase the maximum achievable throughput by |
| 656 |
retaining the full GSO packets. |
| 657 |
|
| 658 |
.SH OVERRIDING CLASSIFICATION WITH TC FILTERS |
| 659 |
|
| 660 |
CAKE supports overriding of its internal classification of packets through the |
| 661 |
tc filter mechanism. Packets can be assigned to different priority tins by |
| 662 |
setting the |
| 663 |
.B priority |
| 664 |
field on the skb, and the flow hashing can be overridden by setting the |
| 665 |
.B classid |
| 666 |
parameter. |
| 667 |
|
| 668 |
.SS Tin override |
| 669 |
To assign a priority tin, the major number of the priority field needs |
| 670 |
to match the qdisc handle of the cake instance; if it does, the minor number |
| 671 |
will be interpreted as the tin index. For example, to classify all ICMP packets |
| 672 |
as 'bulk', the following filter can be used: |
| 673 |
|
| 674 |
.RS |
| 675 |
.EX |
| 676 |
# tc qdisc replace dev eth0 handle 1: root cake diffserv3 |
| 677 |
# tc filter add dev eth0 parent 1: protocol ip prio 1 \\ |
| 678 |
u32 match icmp type 0 0 action skbedit priority 1:1 |
| 679 |
.EE |
| 680 |
.RE |
| 681 |
|
| 682 |
.SS Flow hash override |
| 683 |
To override flow hashing, the classid can be set. CAKE will interpret |
| 684 |
the major number of the classid as the host hash used in host isolation mode, |
| 685 |
and the minor number as the flow hash used for flow-based queueing. One or both |
| 686 |
of those can be set, and will be used if the relevant flow isolation parameter |
| 687 |
is set (i.e., the major number will be ignored if CAKE is not configured in |
| 688 |
hosts mode, and the minor number will be ignored if CAKE is not configured in |
| 689 |
flows mode). |
| 690 |
|
| 691 |
This example will assign all ICMP packets to the first queue: |
| 692 |
|
| 693 |
.RS |
| 694 |
.EX |
| 695 |
# tc qdisc replace dev eth0 handle 1: root cake |
| 696 |
# tc filter add dev eth0 parent 1: protocol ip prio 1 \\ |
| 697 |
u32 match icmp type 0 0 classid 0:1 |
| 698 |
.EE |
| 699 |
.RE |
| 700 |
|
| 701 |
If only one of the host and flow overrides is set, CAKE will compute the other |
| 702 |
hash from the packet as normal. Note, however, that the host isolation mode |
| 703 |
works by assigning a host ID to the flow queue; so if overriding both host and |
| 704 |
flow, the same flow cannot have more than one host assigned. In addition, it is |
| 705 |
not possible to assign different source and destination host IDs through the |
| 706 |
override mechanism; if a host ID is assigned, it will be used as both source and |
| 707 |
destination host. |
| 708 |
|
| 709 |
|
| 710 |
.SH DIFFERENCES BETWEEN SINGLE-QUEUE CAKE AND THE CAKE_MQ MULTI-QUEUE VARIANT |
| 711 |
|
| 712 |
The regular CAKE qdisc is, like most other qdiscs, subject to the global qdisc |
| 713 |
lock, which means that it does not scale across multiple CPUs. This limits the |
| 714 |
maximum bandwidth the shaper can handle to that achievable on a single CPU. |
| 715 |
|
| 716 |
To avoid this central locking, the \fBcake_mq\fR qdisc can be used as a drop-in |
| 717 |
replacement for \fBcake\fR on devices that have more than one TX queue, as |
| 718 |
follows: |
| 719 |
|
| 720 |
.RS |
| 721 |
.EX |
| 722 |
# tc qdisc replace dev eth0 handle 1: root cake_mq bandwidth 1Gbit |
| 723 |
# tc qdisc show dev eth0 |
| 724 |
qdisc cake_mq 8001: root bandwidth 1Gbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms raw overhead 0 |
| 725 |
qdisc cake 0: parent 8001:2 bandwidth 1Gbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms raw overhead 0 |
| 726 |
qdisc cake 0: parent 8001:1 bandwidth 1Gbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms raw overhead 0 |
| 727 |
.EE |
| 728 |
.RE |
| 729 |
|
| 730 |
As the example output shows, this will install separate \fBcake\fR instances on |
| 731 |
each hardware queue. These instances will share configuration, and can only be |
| 732 |
configured through the root \fBcake_mq\fR instance. They will also share the |
| 733 |
bandwidth shaper state, but will otherwise run independently of one another, |
| 734 |
allowing the CAKE shaper to scale across multiple CPUs. |
| 735 |
|
| 736 |
While the \fBcake_mq\fR qdisc is designed to serve as a drop-in replacement for |
| 737 |
single-queue CAKE, it does have some differences in how it treats traffic, |
| 738 |
caused by the independent execution of each sub-qdisc. In particular, the flow |
| 739 |
classification and fairness enforcement between flows (including the |
| 740 |
prioritisation between tins) only happens within each qdisc instance. This means |
| 741 |
that global flow and host fairness cannot be enforced by \fBcake_mq\fR. |
| 742 |
Approximate fairness should still be achievable assuming flows are evenly |
| 743 |
distributed between queues, but this is ultimately outside the control of CAKE |
| 744 |
itself. Users requiring exact fairness between flows are encouraged to stick to |
| 745 |
the regular \fBcake\fR qdisc. |
| 746 |
|
| 747 |
For details on how the shaper state sharing algorithm works, and its scaling |
| 748 |
properties, see the publication: Köppeler et al, 2025: "Have your CAKE and eat |
| 749 |
it too: Scaling software rate limiting across CPU cores", published in the IEEE |
| 750 |
LANMAN 2025 conference proceedings, and also available at |
| 751 |
https://schmiste.github.io/lanman25.pdf. |
| 752 |
|
| 753 |
.SH EXAMPLES |
| 754 |
.EX |
| 755 |
# tc qdisc delete root dev eth0 |
| 756 |
# tc qdisc add root dev eth0 cake bandwidth 100Mbit ethernet |
| 757 |
# tc -s qdisc show dev eth0 |
| 758 |
|
| 759 |
qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84 |
| 760 |
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) |
| 761 |
backlog 0b 0p requeues 0 |
| 762 |
memory used: 0b of 5000000b |
| 763 |
capacity estimate: 100Mbit |
| 764 |
min/max network layer size: 65535 / 0 |
| 765 |
min/max overhead-adjusted size: 65535 / 0 |
| 766 |
average network hdr offset: 0 |
| 767 |
|
| 768 |
Bulk Best Effort Voice |
| 769 |
thresh 6250Kbit 100Mbit 25Mbit |
| 770 |
target 5.0ms 5.0ms 5.0ms |
| 771 |
interval 100.0ms 100.0ms 100.0ms |
| 772 |
pk_delay 0us 0us 0us |
| 773 |
av_delay 0us 0us 0us |
| 774 |
sp_delay 0us 0us 0us |
| 775 |
pkts 0 0 0 |
| 776 |
bytes 0 0 0 |
| 777 |
way_inds 0 0 0 |
| 778 |
way_miss 0 0 0 |
| 779 |
way_cols 0 0 0 |
| 780 |
drops 0 0 0 |
| 781 |
marks 0 0 0 |
| 782 |
ack_drop 0 0 0 |
| 783 |
sp_flows 0 0 0 |
| 784 |
bk_flows 0 0 0 |
| 785 |
un_flows 0 0 0 |
| 786 |
max_len 0 0 0 |
| 787 |
quantum 300 1514 762 |
| 788 |
.EE |
| 789 |
|
| 790 |
.SS After some use: |
| 791 |
.EX |
| 792 |
# tc -s qdisc show dev eth0 |
| 793 |
|
| 794 |
qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84 |
| 795 |
Sent 44709231 bytes 31931 pkt (dropped 45, overlimits 93782 requeues 0) |
| 796 |
backlog 33308b 22p requeues 0 |
| 797 |
memory used: 292352b of 5000000b |
| 798 |
capacity estimate: 100Mbit |
| 799 |
min/max network layer size: 28 / 1500 |
| 800 |
min/max overhead-adjusted size: 84 / 1538 |
| 801 |
average network hdr offset: 14 |
| 802 |
|
| 803 |
Bulk Best Effort Voice |
| 804 |
thresh 6250Kbit 100Mbit 25Mbit |
| 805 |
target 5.0ms 5.0ms 5.0ms |
| 806 |
interval 100.0ms 100.0ms 100.0ms |
| 807 |
pk_delay 8.7ms 6.9ms 5.0ms |
| 808 |
av_delay 4.9ms 5.3ms 3.8ms |
| 809 |
sp_delay 727us 1.4ms 511us |
| 810 |
pkts 2590 21271 8137 |
| 811 |
bytes 3081804 30302659 11426206 |
| 812 |
way_inds 0 46 0 |
| 813 |
way_miss 3 17 4 |
| 814 |
way_cols 0 0 0 |
| 815 |
drops 20 15 10 |
| 816 |
marks 0 0 0 |
| 817 |
ack_drop 0 0 0 |
| 818 |
sp_flows 2 4 1 |
| 819 |
bk_flows 1 2 1 |
| 820 |
un_flows 0 0 0 |
| 821 |
max_len 1514 1514 1514 |
| 822 |
quantum 300 1514 762 |
| 823 |
.EE |
| 824 |
|
| 825 |
.SH SEE ALSO |
| 826 |
.BR tc (8), |
| 827 |
.BR tc-codel (8), |
| 828 |
.BR tc-fq_codel (8), |
| 829 |
.BR tc-htb (8) |
| 830 |
|
| 831 |
.SH AUTHORS |
| 832 |
Cake's principal author is Jonathan Morton, with contributions from |
| 833 |
Tony Ambardar, Kevin Darbyshire-Bryant, Toke Høiland-Jørgensen, |
| 834 |
Sebastian Moeller, Ryan Mounce, Dean Scarff, Nils Andreas Svee, and Dave Täht. |
| 835 |
The cake_mq shared shaper state algorithm was implemented by Jonas Köppeler. |
| 836 |
|
| 837 |
This manual page was written by Loganaden Velvindron. Please report corrections |
| 838 |
to the Linux Networking mailing list <[email protected]>. |