提交 046f6fd5 编写于 作者: T Toke Høiland-Jørgensen 提交者: David S. Miller

sched: Add Common Applications Kept Enhanced (cake) qdisc

sch_cake targets the home router use case and is intended to squeeze the
most bandwidth and latency out of even the slowest ISP links and routers,
while presenting an API simple enough that even an ISP can configure it.

Example of use on a cable ISP uplink:

tc qdisc add dev eth0 cake bandwidth 20Mbit nat docsis ack-filter

To shape a cable download link (ifb and tc-mirred setup elided)

tc qdisc add dev ifb0 cake bandwidth 200mbit nat docsis ingress wash

CAKE is filled with:

* A hybrid Codel/Blue AQM algorithm, "Cobalt", tied to an FQ_Codel
  derived Flow Queuing system, which autoconfigures based on the bandwidth.
* A novel "triple-isolate" mode (the default) which balances per-host
  and per-flow FQ even through NAT.
* An deficit based shaper, that can also be used in an unlimited mode.
* 8 way set associative hashing to reduce flow collisions to a minimum.
* A reasonable interpretation of various diffserv latency/loss tradeoffs.
* Support for zeroing diffserv markings for entering and exiting traffic.
* Support for interacting well with Docsis 3.0 shaper framing.
* Extensive support for DSL framing types.
* Support for ack filtering.
* Extensive statistics for measuring, loss, ecn markings, latency
  variation.

A paper describing the design of CAKE is available at
https://arxiv.org/abs/1804.07617, and will be published at the 2018 IEEE
International Symposium on Local and Metropolitan Area Networks (LANMAN).

This patch adds the base shaper and packet scheduler, while subsequent
commits add the optional (configurable) features. The full userspace API
and most data structures are included in this commit, but options not
understood in the base version will be ignored.

Various versions baking have been available as an out of tree build for
kernel versions going back to 3.10, as the embedded router world has been
running a few years behind mainline Linux. A stable version has been
generally available on lede-17.01 and later.

sch_cake replaces a combination of iptables, tc filter, htb and fq_codel
in the sqm-scripts, with sane defaults and vastly simpler configuration.

CAKE's principal author is Jonathan Morton, with contributions from
Kevin Darbyshire-Bryant, Toke Høiland-Jørgensen, Sebastian Moeller,
Ryan Mounce, Tony Ambardar, Dean Scarff, Nils Andreas Svee, Dave Täht,
and Loganaden Velvindron.

Testing from Pete Heist, Georgios Amanakis, and the many other members of
the cake@lists.bufferbloat.net mailing list.

tc -s qdisc show dev eth2
 qdisc cake 8017: root refcnt 2 bandwidth 1Gbit diffserv3 triple-isolate split-gso rtt 100.0ms noatm overhead 38 mpu 84
 Sent 51504294511 bytes 37724591 pkt (dropped 6, overlimits 64958695 requeues 12)
  backlog 0b 0p requeues 12
  memory used: 1053008b of 15140Kb
  capacity estimate: 970Mbit
  min/max network layer size:           28 /    1500
  min/max overhead-adjusted size:       84 /    1538
  average network hdr offset:           14
                    Bulk  Best Effort        Voice
   thresh      62500Kbit        1Gbit      250Mbit
   target          5.0ms        5.0ms        5.0ms
   interval      100.0ms      100.0ms      100.0ms
   pk_delay          5us          5us          6us
   av_delay          3us          2us          2us
   sp_delay          2us          1us          1us
   backlog            0b           0b           0b
   pkts          3164050     25030267      9530280
   bytes      3227519915  35396974782  12879808898
   way_inds            0            8            0
   way_miss           21          366           25
   way_cols            0            0            0
   drops               5            0            1
   marks               0            0            0
   ack_drop            0            0            0
   sp_flows            1            3            0
   bk_flows            0            1            1
   un_flows            0            0            0
   max_len         68130        68130        68130
Tested-by: NPete Heist <peteheist@gmail.com>
Tested-by: NGeorgios Amanakis <gamanakis@gmail.com>
Signed-off-by: NDave Taht <dave.taht@gmail.com>
Signed-off-by: NToke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 52b50921
......@@ -955,4 +955,118 @@ enum {
#define TCA_ETF_MAX (__TCA_ETF_MAX - 1)
/* CAKE */
enum {
TCA_CAKE_UNSPEC,
TCA_CAKE_PAD,
TCA_CAKE_BASE_RATE64,
TCA_CAKE_DIFFSERV_MODE,
TCA_CAKE_ATM,
TCA_CAKE_FLOW_MODE,
TCA_CAKE_OVERHEAD,
TCA_CAKE_RTT,
TCA_CAKE_TARGET,
TCA_CAKE_AUTORATE,
TCA_CAKE_MEMORY,
TCA_CAKE_NAT,
TCA_CAKE_RAW,
TCA_CAKE_WASH,
TCA_CAKE_MPU,
TCA_CAKE_INGRESS,
TCA_CAKE_ACK_FILTER,
TCA_CAKE_SPLIT_GSO,
__TCA_CAKE_MAX
};
#define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1)
enum {
__TCA_CAKE_STATS_INVALID,
TCA_CAKE_STATS_PAD,
TCA_CAKE_STATS_CAPACITY_ESTIMATE64,
TCA_CAKE_STATS_MEMORY_LIMIT,
TCA_CAKE_STATS_MEMORY_USED,
TCA_CAKE_STATS_AVG_NETOFF,
TCA_CAKE_STATS_MIN_NETLEN,
TCA_CAKE_STATS_MAX_NETLEN,
TCA_CAKE_STATS_MIN_ADJLEN,
TCA_CAKE_STATS_MAX_ADJLEN,
TCA_CAKE_STATS_TIN_STATS,
TCA_CAKE_STATS_DEFICIT,
TCA_CAKE_STATS_COBALT_COUNT,
TCA_CAKE_STATS_DROPPING,
TCA_CAKE_STATS_DROP_NEXT_US,
TCA_CAKE_STATS_P_DROP,
TCA_CAKE_STATS_BLUE_TIMER_US,
__TCA_CAKE_STATS_MAX
};
#define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1)
enum {
__TCA_CAKE_TIN_STATS_INVALID,
TCA_CAKE_TIN_STATS_PAD,
TCA_CAKE_TIN_STATS_SENT_PACKETS,
TCA_CAKE_TIN_STATS_SENT_BYTES64,
TCA_CAKE_TIN_STATS_DROPPED_PACKETS,
TCA_CAKE_TIN_STATS_DROPPED_BYTES64,
TCA_CAKE_TIN_STATS_ACKS_DROPPED_PACKETS,
TCA_CAKE_TIN_STATS_ACKS_DROPPED_BYTES64,
TCA_CAKE_TIN_STATS_ECN_MARKED_PACKETS,
TCA_CAKE_TIN_STATS_ECN_MARKED_BYTES64,
TCA_CAKE_TIN_STATS_BACKLOG_PACKETS,
TCA_CAKE_TIN_STATS_BACKLOG_BYTES,
TCA_CAKE_TIN_STATS_THRESHOLD_RATE64,
TCA_CAKE_TIN_STATS_TARGET_US,
TCA_CAKE_TIN_STATS_INTERVAL_US,
TCA_CAKE_TIN_STATS_WAY_INDIRECT_HITS,
TCA_CAKE_TIN_STATS_WAY_MISSES,
TCA_CAKE_TIN_STATS_WAY_COLLISIONS,
TCA_CAKE_TIN_STATS_PEAK_DELAY_US,
TCA_CAKE_TIN_STATS_AVG_DELAY_US,
TCA_CAKE_TIN_STATS_BASE_DELAY_US,
TCA_CAKE_TIN_STATS_SPARSE_FLOWS,
TCA_CAKE_TIN_STATS_BULK_FLOWS,
TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS,
TCA_CAKE_TIN_STATS_MAX_SKBLEN,
TCA_CAKE_TIN_STATS_FLOW_QUANTUM,
__TCA_CAKE_TIN_STATS_MAX
};
#define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1)
#define TC_CAKE_MAX_TINS (8)
enum {
CAKE_FLOW_NONE = 0,
CAKE_FLOW_SRC_IP,
CAKE_FLOW_DST_IP,
CAKE_FLOW_HOSTS, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_DST_IP */
CAKE_FLOW_FLOWS,
CAKE_FLOW_DUAL_SRC, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_FLOWS */
CAKE_FLOW_DUAL_DST, /* = CAKE_FLOW_DST_IP | CAKE_FLOW_FLOWS */
CAKE_FLOW_TRIPLE, /* = CAKE_FLOW_HOSTS | CAKE_FLOW_FLOWS */
CAKE_FLOW_MAX,
};
enum {
CAKE_DIFFSERV_DIFFSERV3 = 0,
CAKE_DIFFSERV_DIFFSERV4,
CAKE_DIFFSERV_DIFFSERV8,
CAKE_DIFFSERV_BESTEFFORT,
CAKE_DIFFSERV_PRECEDENCE,
CAKE_DIFFSERV_MAX
};
enum {
CAKE_ACK_NONE = 0,
CAKE_ACK_FILTER,
CAKE_ACK_AGGRESSIVE,
CAKE_ACK_MAX
};
enum {
CAKE_ATM_NONE = 0,
CAKE_ATM_ATM,
CAKE_ATM_PTM,
CAKE_ATM_MAX
};
#endif
......@@ -295,6 +295,17 @@ config NET_SCH_FQ_CODEL
If unsure, say N.
config NET_SCH_CAKE
tristate "Common Applications Kept Enhanced (CAKE)"
help
Say Y here if you want to use the Common Applications Kept Enhanced
(CAKE) queue management algorithm.
To compile this driver as a module, choose M here: the module
will be called sch_cake.
If unsure, say N.
config NET_SCH_FQ
tristate "Fair Queue"
help
......
......@@ -50,6 +50,7 @@ obj-$(CONFIG_NET_SCH_CHOKE) += sch_choke.o
obj-$(CONFIG_NET_SCH_QFQ) += sch_qfq.o
obj-$(CONFIG_NET_SCH_CODEL) += sch_codel.o
obj-$(CONFIG_NET_SCH_FQ_CODEL) += sch_fq_codel.o
obj-$(CONFIG_NET_SCH_CAKE) += sch_cake.o
obj-$(CONFIG_NET_SCH_FQ) += sch_fq.o
obj-$(CONFIG_NET_SCH_HHF) += sch_hhf.o
obj-$(CONFIG_NET_SCH_PIE) += sch_pie.o
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册