Source
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/* COMMON Applications Kept Enhanced (CAKE) discipline
*
* Copyright (C) 2014-2018 Jonathan Morton <chromatix99@gmail.com>
* Copyright (C) 2015-2018 Toke Høiland-Jørgensen <toke@toke.dk>
* Copyright (C) 2014-2018 Dave Täht <dave.taht@gmail.com>
* Copyright (C) 2015-2018 Sebastian Moeller <moeller0@gmx.de>
* (C) 2015-2018 Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
* Copyright (C) 2017-2018 Ryan Mounce <ryan@mounce.com.au>
*
* The CAKE Principles:
* (or, how to have your cake and eat it too)
*
* This is a combination of several shaping, AQM and FQ techniques into one
* easy-to-use package:
*
* - An overall bandwidth shaper, to move the bottleneck away from dumb CPE
* equipment and bloated MACs. This operates in deficit mode (as in sch_fq),
* eliminating the need for any sort of burst parameter (eg. token bucket
* depth). Burst support is limited to that necessary to overcome scheduling
* latency.
*
* - A Diffserv-aware priority queue, giving more priority to certain classes,
* up to a specified fraction of bandwidth. Above that bandwidth threshold,
* the priority is reduced to avoid starving other tins.
*
* - Each priority tin has a separate Flow Queue system, to isolate traffic
* flows from each other. This prevents a burst on one flow from increasing
* the delay to another. Flows are distributed to queues using a
* set-associative hash function.
*
* - Each queue is actively managed by Cobalt, which is a combination of the
* Codel and Blue AQM algorithms. This serves flows fairly, and signals
* congestion early via ECN (if available) and/or packet drops, to keep
* latency low. The codel parameters are auto-tuned based on the bandwidth
* setting, as is necessary at low bandwidths.
*
* The configuration parameters are kept deliberately simple for ease of use.
* Everything has sane defaults. Complete generality of configuration is *not*
* a goal.
*
* The priority queue operates according to a weighted DRR scheme, combined with
* a bandwidth tracker which reuses the shaper logic to detect which side of the
* bandwidth sharing threshold the tin is operating. This determines whether a
* priority-based weight (high) or a bandwidth-based weight (low) is used for
* that tin in the current pass.
*
* This qdisc was inspired by Eric Dumazet's fq_codel code, which he kindly
* granted us permission to leverage.
*/