1 --- a/include/uapi/linux/pkt_sched.h
2 +++ b/include/uapi/linux/pkt_sched.h
3 @@ -934,4 +934,110 @@ enum {
5 #define TCA_CBS_MAX (__TCA_CBS_MAX - 1)
11 + TCA_CAKE_DIFFSERV_MODE,
20 + TCA_CAKE_RAW, // was _ETHERNET
24 + TCA_CAKE_ACK_FILTER,
28 +#define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1)
31 + __TCA_CAKE_STATS_INVALID,
32 + TCA_CAKE_STATS_CAPACITY_ESTIMATE,
33 + TCA_CAKE_STATS_MEMORY_LIMIT,
34 + TCA_CAKE_STATS_MEMORY_USED,
35 + TCA_CAKE_STATS_AVG_NETOFF,
36 + TCA_CAKE_STATS_MIN_NETLEN,
37 + TCA_CAKE_STATS_MAX_NETLEN,
38 + TCA_CAKE_STATS_MIN_ADJLEN,
39 + TCA_CAKE_STATS_MAX_ADJLEN,
40 + TCA_CAKE_STATS_TIN_STATS,
41 + __TCA_CAKE_STATS_MAX
43 +#define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1)
46 + __TCA_CAKE_TIN_STATS_INVALID,
47 + TCA_CAKE_TIN_STATS_PAD,
48 + TCA_CAKE_TIN_STATS_SENT_PACKETS,
49 + TCA_CAKE_TIN_STATS_SENT_BYTES64,
50 + TCA_CAKE_TIN_STATS_DROPPED_PACKETS,
51 + TCA_CAKE_TIN_STATS_DROPPED_BYTES64,
52 + TCA_CAKE_TIN_STATS_ACKS_DROPPED_PACKETS,
53 + TCA_CAKE_TIN_STATS_ACKS_DROPPED_BYTES64,
54 + TCA_CAKE_TIN_STATS_ECN_MARKED_PACKETS,
55 + TCA_CAKE_TIN_STATS_ECN_MARKED_BYTES64,
56 + TCA_CAKE_TIN_STATS_BACKLOG_PACKETS,
57 + TCA_CAKE_TIN_STATS_BACKLOG_BYTES64,
58 + TCA_CAKE_TIN_STATS_THRESHOLD_RATE,
59 + TCA_CAKE_TIN_STATS_TARGET_US,
60 + TCA_CAKE_TIN_STATS_INTERVAL_US,
61 + TCA_CAKE_TIN_STATS_WAY_INDIRECT_HITS,
62 + TCA_CAKE_TIN_STATS_WAY_MISSES,
63 + TCA_CAKE_TIN_STATS_WAY_COLLISIONS,
64 + TCA_CAKE_TIN_STATS_PEAK_DELAY_US,
65 + TCA_CAKE_TIN_STATS_AVG_DELAY_US,
66 + TCA_CAKE_TIN_STATS_BASE_DELAY_US,
67 + TCA_CAKE_TIN_STATS_SPARSE_FLOWS,
68 + TCA_CAKE_TIN_STATS_BULK_FLOWS,
69 + TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS,
70 + TCA_CAKE_TIN_STATS_MAX_SKBLEN,
71 + TCA_CAKE_TIN_STATS_FLOW_QUANTUM,
72 + __TCA_CAKE_TIN_STATS_MAX
74 +#define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1)
75 +#define TC_CAKE_MAX_TINS (8)
81 + CAKE_FLOW_HOSTS, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_DST_IP */
83 + CAKE_FLOW_DUAL_SRC, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_FLOWS */
84 + CAKE_FLOW_DUAL_DST, /* = CAKE_FLOW_DST_IP | CAKE_FLOW_FLOWS */
85 + CAKE_FLOW_TRIPLE, /* = CAKE_FLOW_HOSTS | CAKE_FLOW_FLOWS */
90 + CAKE_DIFFSERV_DIFFSERV3 = 0,
91 + CAKE_DIFFSERV_DIFFSERV4,
92 + CAKE_DIFFSERV_DIFFSERV8,
93 + CAKE_DIFFSERV_BESTEFFORT,
94 + CAKE_DIFFSERV_PRECEDENCE,
101 + CAKE_ACK_AGGRESSIVE,
115 +++ b/man/man8/tc-cake.8
117 +.TH CAKE 8 "23 November 2017" "iproute2" "Linux"
119 +CAKE \- Common Applications Kept Enhanced (CAKE)
121 +.B tc qdisc ... cake
128 +.BR autorate_ingress
194 +.BR ack-filter-aggressive
233 +CAKE (Common Applications Kept Enhanced) is a shaping-capable queue discipline
234 +which uses both AQM and FQ. It combines COBALT, which is an AQM algorithm
235 +combining Codel and BLUE, a shaper which operates in deficit mode, and a variant
236 +of DRR++ for flow isolation. 8-way set-associative hashing is used to virtually
237 +eliminate hash collisions. Priority queuing is available through a simplified
238 +diffserv implementation. Overhead compensation for various encapsulation
239 +schemes is tightly integrated.
241 +All settings are optional; the default settings are chosen to be sensible in
242 +most common deployments. Most people will only need to set the
244 +parameter to get useful results, but reading the
245 +.B Overhead Compensation
248 +sections is strongly encouraged.
250 +.SH SHAPER PARAMETERS
251 +CAKE uses a deficit-mode shaper, which does not exhibit the initial burst
252 +typical of token-bucket shapers. It will automatically burst precisely as much
253 +as required to maintain the configured throughput. As such, it is very
254 +straightforward to configure.
259 + No limit on the bandwidth.
264 + Set the shaper bandwidth. See
266 +or examples below for details of the RATE value.
270 + Automatic capacity estimation based on traffic arriving at this qdisc.
271 +This is most likely to be useful with cellular links, which tend to change
274 +parameter can be used in conjunction to specify an initial estimate. The shaper
275 +will periodically be set to a bandwidth slightly below the estimated rate. This
276 +estimator cannot estimate the bandwidth of links downstream of itself.
278 +.SH OVERHEAD COMPENSATION PARAMETERS
279 +The size of each packet on the wire may differ from that seen by Linux. The
280 +following parameters allow CAKE to compensate for this difference by internally
281 +considering each packet to be bigger than Linux informs it. To assist users who
282 +are not expert network engineers, keywords have been provided to represent a
283 +number of common link technologies.
285 +.SS Manual Overhead Specification
289 + Adds BYTES to the size of each packet. BYTES may be negative; values
290 +between -64 and 256 (inclusive) are accepted.
295 + Rounds each packet (including overhead) up to a minimum length
296 +BYTES. BYTES may not be negative; values between 0 and 256 (inclusive)
301 + Compensates for ATM cell framing, which is normally found on ADSL links.
302 +This is performed after the
304 +parameter above. ATM uses fixed 53-byte cells, each of which can carry 48 bytes
309 + Compensates for PTM encoding, which is normally found on VDSL2 links and
310 +uses a 64b/65b encoding scheme. It is even more efficient to simply
311 +derate the specified shaper bandwidth by a factor of 64/65 or 0.984. See
312 +ITU G.992.3 Annex N and IEEE 802.3 Section 61.3 for details.
316 + Disables ATM and PTM compensation.
318 +.SS Failsafe Overhead Keywords
319 +These two keywords are provided for quick-and-dirty setup. Use them if you
320 +can't be bothered to read the rest of this section.
325 + Turns off all overhead compensation in CAKE. The packet size reported
326 +by Linux will be used directly.
328 + Other overhead keywords may be added after "raw". The effect of this is
329 +to make the overhead compensation operate relative to the reported packet size,
330 +not the underlying IP packet size.
334 + Compensates for more overhead than is likely to occur on any
335 +widely-deployed link technology.
340 +.SS ADSL Overhead Keywords
341 +Most ADSL modems have a way to check which framing scheme is in use. Often this
342 +is also specified in the settings document provided by the ISP. The keywords in
343 +this section are intended to correspond with these sources of information. All
344 +of them implicitly set the
388 +See also the Ethernet Correction Factors section below.
390 +.SS VDSL2 Overhead Keywords
391 +ATM was dropped from VDSL2 in favour of PTM, which is a much more
392 +straightforward framing scheme. Some ISPs retained PPPoE for compatibility with
393 +their existing back-end systems.
401 + PPPoE: 2B PPP + 6B PPPoE +
403 + ETHERNET: 6B dest MAC + 6B src MAC + 2B ethertype + 4B Frame Check Sequence +
405 + PTM: 1B Start of Frame (S) + 1B End of Frame (Ck) + 2B TC-CRC (PTM-FCS)
413 + ETHERNET: 6B dest MAC + 6B src MAC + 2B ethertype + 4B Frame Check Sequence +
415 + PTM: 1B Start of Frame (S) + 1B End of Frame (Ck) + 2B TC-CRC (PTM-FCS)
418 +See also the Ethernet Correction Factors section below.
420 +.SS DOCSIS Cable Overhead Keyword
421 +DOCSIS is the universal standard for providing Internet service over cable-TV
424 +In this case, the actual on-wire overhead is less important than the packet size
425 +the head-end equipment uses for shaping and metering. This is specified to be
426 +an Ethernet frame including the CRC (aka FCS).
431 +.B overhead 18 mpu 64 noatm
433 +.SS Ethernet Overhead Keywords
437 + Accounts for Ethernet's preamble, inter-frame gap, and Frame Check
438 +Sequence. Use this keyword when the bottleneck being shaped for is an
439 +actual Ethernet cable.
442 +.B overhead 38 mpu 84 noatm
446 + Adds 4 bytes to the overhead compensation, accounting for an IEEE 802.1Q
447 +VLAN header appended to the Ethernet frame header. NB: Some ISPs use one or
448 +even two of these within PPPoE; this keyword may be repeated as necessary to
451 +.SH ROUND TRIP TIME PARAMETERS
452 +Active Queue Management (AQM) consists of embedding congestion signals in the
453 +packet flow, which receivers use to instruct senders to slow down when the queue
454 +is persistently occupied. CAKE uses ECN signalling when available, and packet
455 +drops otherwise, according to a combination of the Codel and BLUE AQM algorithms
458 +Very short latencies require a very rapid AQM response to adequately control
459 +latency. However, such a rapid response tends to impair throughput when the
460 +actual RTT is relatively long. CAKE allows specifying the RTT it assumes for
461 +tuning various parameters. Actual RTTs within an order of magnitude of this
462 +will generally work well for both throughput and latency management.
464 +At the 'lan' setting and below, the time constants are similar in magnitude to
465 +the jitter in the Linux kernel itself, so congestion might be signalled
466 +prematurely. The flows will then become sparse and total throughput reduced,
467 +leaving little or no back-pressure for the fairness logic to work against. Use
468 +the "metro" setting for local lans unless you have a custom kernel.
473 + Manually specify an RTT.
477 + For extremely high-performance 10GigE+ networks only. Equivalent to
482 + For pure Ethernet (not Wi-Fi) networks, at home or in the office. Don't
483 +use this when shaping for an Internet access link. Equivalent to
488 + For traffic mostly within a single city. Equivalent to
493 + For traffic mostly within a European-sized country. Equivalent to
499 + This is suitable for most Internet traffic. Equivalent to
504 + For Internet traffic with generally above-average latency, such as that
505 +suffered by Australasian residents. Equivalent to
510 + For traffic via geostationary satellites. Equivalent to
515 + So named because Jupiter is about 1 light-hour from Earth. Use this to
516 +(almost) completely disable AQM actions. Equivalent to
519 +.SH FLOW ISOLATION PARAMETERS
520 +With flow isolation enabled, CAKE places packets from different flows into
521 +different queues, each of which carries its own AQM state. Packets from each
522 +queue are then delivered fairly, according to a DRR++ algorithm which minimises
523 +latency for "sparse" flows. CAKE uses a set-associative hashing algorithm to
524 +minimise flow collisions.
526 +These keywords specify whether fairness based on source address, destination
527 +address, individual flows, or any combination of those is desired.
531 + Disables flow isolation; all traffic passes through a single queue for
536 + Flows are defined only by source address. Could be useful on the egress
537 +path of an ISP backhaul.
541 + Flows are defined only by destination address. Could be useful on the
542 +ingress path of an ISP backhaul.
546 + Flows are defined by source-destination host pairs. This is host
547 +isolation, rather than flow isolation.
551 + Flows are defined by the entire 5-tuple of source address, destination
552 +address, transport protocol, source port and destination port. This is the type
553 +of flow isolation performed by SFQ and fq_codel.
557 + Flows are defined by the 5-tuple, and fairness is applied first over
558 +source addresses, then over individual flows. Good for use on egress traffic
559 +from a LAN to the internet, where it'll prevent any one LAN host from
560 +monopolising the uplink, regardless of the number of flows they use.
564 + Flows are defined by the 5-tuple, and fairness is applied first over
565 +destination addresses, then over individual flows. Good for use on ingress
566 +traffic to a LAN from the internet, where it'll prevent any one LAN host from
567 +monopolising the downlink, regardless of the number of flows they use.
572 + Flows are defined by the 5-tuple, and fairness is applied over source
573 +*and* destination addresses intelligently (ie. not merely by host-pairs), and
574 +also over individual flows. Use this if you're not certain whether to use
575 +dual-srchost or dual-dsthost; it'll do both jobs at once, preventing any one
576 +host on *either* side of the link from monopolising it with a large number of
581 + Instructs Cake to perform a NAT lookup before applying flow-isolation
582 +rules, to determine the true addresses and port numbers of the packet, to
583 +improve fairness between hosts "inside" the NAT. This has no practical effect
584 +in "flowblind" or "flows" modes, or if NAT is performed on a different host.
589 + Cake will not perform a NAT lookup. Flow isolation will be performed
590 +using the addresses and port numbers directly visible to the interface Cake is
593 +.SH PRIORITY QUEUE PARAMETERS
594 +CAKE can divide traffic into "tins" based on the Diffserv field. Each tin has
595 +its own independent set of flow-isolation queues, and is serviced based on a WRR
596 +algorithm. To avoid perverse Diffserv marking incentives, tin weights have a
597 +"priority sharing" value when bandwidth used by that tin is below a threshold,
598 +and a lower "bandwidth sharing" value when above. Bandwidth is compared against
599 +the threshold using the same algorithm as the deficit-mode shaper.
601 +Detailed customisation of tin parameters is not provided. The following presets
602 +perform all necessary tuning, relative to the current shaper bandwidth and RTT
607 + Disables priority queuing by placing all traffic in one tin.
611 + Enables legacy interpretation of TOS "Precedence" field. Use of this
612 +preset on the modern Internet is firmly discouraged.
616 + Provides a general-purpose Diffserv implementation with four tins:
618 + Bulk (CS1), 6.25% threshold, generally low priority.
620 + Best Effort (general), 100% threshold.
622 + Video (AF4x, AF3x, CS3, AF2x, CS2, TOS4, TOS1), 50% threshold.
624 + Voice (CS7, CS6, EF, VA, CS5, CS4), 25% threshold.
629 + Provides a simple, general-purpose Diffserv implementation with three tins:
631 + Bulk (CS1), 6.25% threshold, generally low priority.
633 + Best Effort (general), 100% threshold.
635 + Voice (CS7, CS6, EF, VA, TOS4), 25% threshold, reduced Codel interval.
637 +.SH OTHER PARAMETERS
641 + Limit the memory consumed by Cake to LIMIT bytes. Note that this does
642 +not translate directly to queue size (so do not size this based on bandwidth
643 +delay product considerations, but rather on worst case acceptable memory
644 +consumption), as there is some overhead in the data structures containing the
645 +packets, especially for small packets.
647 + By default, the limit is calculated based on the bandwidth and RTT
654 + Traffic entering your diffserv domain is frequently mis-marked in
655 +transit from the perspective of your network, and traffic exiting yours may be
656 +mis-marked from the perspective of the transiting provider.
658 +Apply the wash option to clear all extra diffserv (but not ECN bits), after
659 +priority queuing has taken place.
661 +If you are shaping inbound, and cannot trust the diffserv markings (as is the
662 +case for Comcast Cable, among others), it is best to use a single queue
663 +"besteffort" mode with wash.
666 +# tc qdisc delete root dev eth0
668 +# tc qdisc add root dev eth0 cake bandwidth 100Mbit ethernet
670 +# tc -s qdisc show dev eth0
672 +qdisc cake 1: dev eth0 root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84
673 + Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
674 + backlog 0b 0p requeues 0
675 + memory used: 0b of 5000000b
676 + capacity estimate: 100Mbit
677 + min/max network layer size: 65535 / 0
678 + min/max overhead-adjusted size: 65535 / 0
679 + average network hdr offset: 0
681 + Bulk Best Effort Voice
682 + thresh 6250Kbit 100Mbit 25Mbit
683 + target 5.0ms 5.0ms 5.0ms
684 + interval 100.0ms 100.0ms 100.0ms
685 + pk_delay 0us 0us 0us
686 + av_delay 0us 0us 0us
687 + sp_delay 0us 0us 0us
700 + quantum 300 1514 762
704 +# tc -s qdisc show dev eth0
706 +qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84
707 + Sent 44709231 bytes 31931 pkt (dropped 45, overlimits 93782 requeues 0)
708 + backlog 33308b 22p requeues 0
709 + memory used: 292352b of 5000000b
710 + capacity estimate: 100Mbit
711 + min/max network layer size: 28 / 1500
712 + min/max overhead-adjusted size: 84 / 1538
713 + average network hdr offset: 14
715 + Bulk Best Effort Voice
716 + thresh 6250Kbit 100Mbit 25Mbit
717 + target 5.0ms 5.0ms 5.0ms
718 + interval 100.0ms 100.0ms 100.0ms
719 + pk_delay 8.7ms 6.9ms 5.0ms
720 + av_delay 4.9ms 5.3ms 3.8ms
721 + sp_delay 727us 1.4ms 511us
722 + pkts 2590 21271 8137
723 + bytes 3081804 30302659 11426206
733 + max_len 1514 1514 1514
734 + quantum 300 1514 762
739 +.BR tc-fq_codel (8),
743 +Cake's principal author is Jonathan Morton, with contributions from
744 +Tony Ambardar, Kevin Darbyshire-Bryant, Toke Høiland-Jørgensen,
745 +Sebastian Moeller, Ryan Mounce, Dean Scarff, Nils Andreas Svee, and Dave Täht.
747 +This manual page was written by Loganaden Velvindron. Please report corrections
748 +to the Linux Networking mailing list <netdev@vger.kernel.org>.
751 @@ -64,6 +64,7 @@ TCMODULES += em_meta.o
752 TCMODULES += q_mqprio.o
753 TCMODULES += q_codel.o
754 TCMODULES += q_fq_codel.o
755 +TCMODULES += q_cake.o
762 +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
764 + * Common Applications Kept Enhanced -- CAKE
766 + * Copyright (C) 2014-2018 Jonathan Morton <chromatix99@gmail.com>
767 + * Copyright (C) 2017-2018 Toke Høiland-Jørgensen <toke@toke.dk>
776 +#include <sys/socket.h>
777 +#include <netinet/in.h>
778 +#include <arpa/inet.h>
782 +#include "tc_util.h"
784 +struct cake_preset {
786 + unsigned int target;
787 + unsigned int interval;
790 +static struct cake_preset presets[] = {
791 + {"datacentre", 5, 100},
793 + {"metro", 500, 10000},
794 + {"regional", 1500, 30000},
795 + {"internet", 5000, 100000},
796 + {"oceanic", 15000, 300000},
797 + {"satellite", 50000, 1000000},
798 + {"interplanetary", 50000000, 1000000000},
802 +static struct cake_preset *find_preset(char *argv)
806 + for (i = 0; i < ARRAY_SIZE(presets); i++)
807 + if (!strcmp(argv, presets[i].name))
808 + return &presets[i];
812 +static void explain(void)
815 +"Usage: ... cake [ bandwidth RATE | unlimited* | autorate_ingress ]\n"
816 +" [ rtt TIME | datacentre | lan | metro | regional |\n"
817 +" internet* | oceanic | satellite | interplanetary ]\n"
818 +" [ besteffort | diffserv8 | diffserv4 | diffserv3* ]\n"
819 +" [ flowblind | srchost | dsthost | hosts | flows |\n"
820 +" dual-srchost | dual-dsthost | triple-isolate* ]\n"
821 +" [ nat | nonat* ]\n"
822 +" [ wash | nowash* ]\n"
823 +" [ ack-filter | ack-filter-aggressive | no-ack-filter* ]\n"
824 +" [ memlimit LIMIT ]\n"
825 +" [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n"
826 +" [ mpu N ] [ ingress | egress* ]\n"
827 +" (* marks defaults)\n");
830 +static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
831 + struct nlmsghdr *n, const char *dev)
834 + unsigned bandwidth = 0;
835 + unsigned interval = 0;
836 + unsigned target = 0;
837 + unsigned diffserv = 0;
838 + unsigned memlimit = 0;
840 + bool overhead_set = false;
841 + bool overhead_override = false;
849 + int ack_filter = -1;
850 + struct rtattr *tail;
851 + struct cake_preset *preset, *preset_set = NULL;
854 + if (strcmp(*argv, "bandwidth") == 0) {
856 + if (get_rate(&bandwidth, *argv)) {
857 + fprintf(stderr, "Illegal \"bandwidth\"\n");
862 + } else if (strcmp(*argv, "unlimited") == 0) {
866 + } else if (strcmp(*argv, "autorate_ingress") == 0) {
869 + } else if (strcmp(*argv, "rtt") == 0) {
871 + if (get_time(&interval, *argv)) {
872 + fprintf(stderr, "Illegal \"rtt\"\n");
875 + target = interval / 20;
878 + } else if ((preset = find_preset(*argv))) {
880 + duparg(*argv, preset_set->name);
881 + preset_set = preset;
882 + target = preset->target;
883 + interval = preset->interval;
885 + } else if (strcmp(*argv, "besteffort") == 0) {
886 + diffserv = CAKE_DIFFSERV_BESTEFFORT;
887 + } else if (strcmp(*argv, "precedence") == 0) {
888 + diffserv = CAKE_DIFFSERV_PRECEDENCE;
889 + } else if (strcmp(*argv, "diffserv8") == 0) {
890 + diffserv = CAKE_DIFFSERV_DIFFSERV8;
891 + } else if (strcmp(*argv, "diffserv4") == 0) {
892 + diffserv = CAKE_DIFFSERV_DIFFSERV4;
893 + } else if (strcmp(*argv, "diffserv") == 0) {
894 + diffserv = CAKE_DIFFSERV_DIFFSERV4;
895 + } else if (strcmp(*argv, "diffserv3") == 0) {
896 + diffserv = CAKE_DIFFSERV_DIFFSERV3;
898 + } else if (strcmp(*argv, "nowash") == 0) {
900 + } else if (strcmp(*argv, "wash") == 0) {
903 + } else if (strcmp(*argv, "flowblind") == 0) {
904 + flowmode = CAKE_FLOW_NONE;
905 + } else if (strcmp(*argv, "srchost") == 0) {
906 + flowmode = CAKE_FLOW_SRC_IP;
907 + } else if (strcmp(*argv, "dsthost") == 0) {
908 + flowmode = CAKE_FLOW_DST_IP;
909 + } else if (strcmp(*argv, "hosts") == 0) {
910 + flowmode = CAKE_FLOW_HOSTS;
911 + } else if (strcmp(*argv, "flows") == 0) {
912 + flowmode = CAKE_FLOW_FLOWS;
913 + } else if (strcmp(*argv, "dual-srchost") == 0) {
914 + flowmode = CAKE_FLOW_DUAL_SRC;
915 + } else if (strcmp(*argv, "dual-dsthost") == 0) {
916 + flowmode = CAKE_FLOW_DUAL_DST;
917 + } else if (strcmp(*argv, "triple-isolate") == 0) {
918 + flowmode = CAKE_FLOW_TRIPLE;
920 + } else if (strcmp(*argv, "nat") == 0) {
922 + } else if (strcmp(*argv, "nonat") == 0) {
925 + } else if (strcmp(*argv, "ptm") == 0) {
926 + atm = CAKE_ATM_PTM;
927 + } else if (strcmp(*argv, "atm") == 0) {
928 + atm = CAKE_ATM_ATM;
929 + } else if (strcmp(*argv, "noatm") == 0) {
930 + atm = CAKE_ATM_NONE;
932 + } else if (strcmp(*argv, "raw") == 0) {
933 + atm = CAKE_ATM_NONE;
935 + overhead_set = true;
936 + overhead_override = true;
937 + } else if (strcmp(*argv, "conservative") == 0) {
939 + * Deliberately over-estimate overhead:
940 + * one whole ATM cell plus ATM framing.
941 + * A safe choice if the actual overhead is unknown.
943 + atm = CAKE_ATM_ATM;
945 + overhead_set = true;
947 + /* Various ADSL framing schemes, all over ATM cells */
948 + } else if (strcmp(*argv, "ipoa-vcmux") == 0) {
949 + atm = CAKE_ATM_ATM;
951 + overhead_set = true;
952 + } else if (strcmp(*argv, "ipoa-llcsnap") == 0) {
953 + atm = CAKE_ATM_ATM;
955 + overhead_set = true;
956 + } else if (strcmp(*argv, "bridged-vcmux") == 0) {
957 + atm = CAKE_ATM_ATM;
959 + overhead_set = true;
960 + } else if (strcmp(*argv, "bridged-llcsnap") == 0) {
961 + atm = CAKE_ATM_ATM;
963 + overhead_set = true;
964 + } else if (strcmp(*argv, "pppoa-vcmux") == 0) {
965 + atm = CAKE_ATM_ATM;
967 + overhead_set = true;
968 + } else if (strcmp(*argv, "pppoa-llc") == 0) {
969 + atm = CAKE_ATM_ATM;
971 + overhead_set = true;
972 + } else if (strcmp(*argv, "pppoe-vcmux") == 0) {
973 + atm = CAKE_ATM_ATM;
975 + overhead_set = true;
976 + } else if (strcmp(*argv, "pppoe-llcsnap") == 0) {
977 + atm = CAKE_ATM_ATM;
979 + overhead_set = true;
981 + /* Typical VDSL2 framing schemes, both over PTM */
982 + /* PTM has 64b/65b coding which absorbs some bandwidth */
983 + } else if (strcmp(*argv, "pppoe-ptm") == 0) {
984 + /* 2B PPP + 6B PPPoE + 6B dest MAC + 6B src MAC
985 + * + 2B ethertype + 4B Frame Check Sequence
986 + * + 1B Start of Frame (S) + 1B End of Frame (Ck)
987 + * + 2B TC-CRC (PTM-FCS) = 30B
989 + atm = CAKE_ATM_PTM;
991 + overhead_set = true;
992 + } else if (strcmp(*argv, "bridged-ptm") == 0) {
993 + /* 6B dest MAC + 6B src MAC + 2B ethertype
994 + * + 4B Frame Check Sequence
995 + * + 1B Start of Frame (S) + 1B End of Frame (Ck)
996 + * + 2B TC-CRC (PTM-FCS) = 22B
998 + atm = CAKE_ATM_PTM;
1000 + overhead_set = true;
1002 + } else if (strcmp(*argv, "via-ethernet") == 0) {
1004 + * We used to use this flag to manually compensate for
1005 + * Linux including the Ethernet header on Ethernet-type
1006 + * interfaces, but not on IP-type interfaces.
1008 + * It is no longer needed, because Cake now adjusts for
1009 + * that automatically, and is thus ignored.
1011 + * It would be deleted entirely, but it appears in the
1012 + * stats output when the automatic compensation is
1016 + } else if (strcmp(*argv, "ethernet") == 0) {
1017 + /* ethernet pre-amble & interframe gap & FCS
1018 + * you may need to add vlan tag */
1020 + overhead_set = true;
1023 + /* Additional Ethernet-related overhead used by some ISPs */
1024 + } else if (strcmp(*argv, "ether-vlan") == 0) {
1025 + /* 802.1q VLAN tag - may be repeated */
1027 + overhead_set = true;
1030 + * DOCSIS cable shapers account for Ethernet frame with FCS,
1031 + * but not interframe gap or preamble.
1033 + } else if (strcmp(*argv, "docsis") == 0) {
1034 + atm = CAKE_ATM_NONE;
1036 + overhead_set = true;
1039 + } else if (strcmp(*argv, "overhead") == 0) {
1042 + overhead = strtol(*argv, &p, 10);
1043 + if(!p || *p || !*argv || overhead < -64 || overhead > 256) {
1044 + fprintf(stderr, "Illegal \"overhead\", valid range is -64 to 256\\n");
1047 + overhead_set = true;
1049 + } else if (strcmp(*argv, "mpu") == 0) {
1052 + mpu = strtol(*argv, &p, 10);
1053 + if(!p || *p || !*argv || mpu < 0 || mpu > 256) {
1054 + fprintf(stderr, "Illegal \"mpu\", valid range is 0 to 256\\n");
1058 + } else if (strcmp(*argv, "ingress") == 0) {
1060 + } else if (strcmp(*argv, "egress") == 0) {
1063 + } else if (strcmp(*argv, "no-ack-filter") == 0) {
1064 + ack_filter = CAKE_ACK_NONE;
1065 + } else if (strcmp(*argv, "ack-filter") == 0) {
1066 + ack_filter = CAKE_ACK_FILTER;
1067 + } else if (strcmp(*argv, "ack-filter-aggressive") == 0) {
1068 + ack_filter = CAKE_ACK_AGGRESSIVE;
1070 + } else if (strcmp(*argv, "memlimit") == 0) {
1072 + if(get_size(&memlimit, *argv)) {
1073 + fprintf(stderr, "Illegal value for \"memlimit\": \"%s\"\n", *argv);
1077 + } else if (strcmp(*argv, "help") == 0) {
1081 + fprintf(stderr, "What is \"%s\"?\n", *argv);
1088 + tail = NLMSG_TAIL(n);
1089 + addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
1090 + if (bandwidth || unlimited)
1091 + addattr_l(n, 1024, TCA_CAKE_BASE_RATE, &bandwidth, sizeof(bandwidth));
1093 + addattr_l(n, 1024, TCA_CAKE_DIFFSERV_MODE, &diffserv, sizeof(diffserv));
1095 + addattr_l(n, 1024, TCA_CAKE_ATM, &atm, sizeof(atm));
1096 + if (flowmode != -1)
1097 + addattr_l(n, 1024, TCA_CAKE_FLOW_MODE, &flowmode, sizeof(flowmode));
1099 + addattr_l(n, 1024, TCA_CAKE_OVERHEAD, &overhead, sizeof(overhead));
1100 + if (overhead_override) {
1101 + unsigned zero = 0;
1102 + addattr_l(n, 1024, TCA_CAKE_RAW, &zero, sizeof(zero));
1105 + addattr_l(n, 1024, TCA_CAKE_MPU, &mpu, sizeof(mpu));
1107 + addattr_l(n, 1024, TCA_CAKE_RTT, &interval, sizeof(interval));
1109 + addattr_l(n, 1024, TCA_CAKE_TARGET, &target, sizeof(target));
1110 + if (autorate != -1)
1111 + addattr_l(n, 1024, TCA_CAKE_AUTORATE, &autorate, sizeof(autorate));
1113 + addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit, sizeof(memlimit));
1115 + addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat));
1117 + addattr_l(n, 1024, TCA_CAKE_WASH, &wash, sizeof(wash));
1118 + if (ingress != -1)
1119 + addattr_l(n, 1024, TCA_CAKE_INGRESS, &ingress, sizeof(ingress));
1120 + if (ack_filter != -1)
1121 + addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter, sizeof(ack_filter));
1123 + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
1128 +static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
1130 + struct rtattr *tb[TCA_CAKE_MAX + 1];
1131 + unsigned bandwidth = 0;
1132 + unsigned diffserv = 0;
1133 + unsigned flowmode = 0;
1134 + unsigned interval = 0;
1135 + unsigned memlimit = 0;
1144 + int ack_filter = 0;
1145 + int split_gso = 0;
1152 + parse_rtattr_nested(tb, TCA_CAKE_MAX, opt);
1154 + if (tb[TCA_CAKE_BASE_RATE] &&
1155 + RTA_PAYLOAD(tb[TCA_CAKE_BASE_RATE]) >= sizeof(__u32)) {
1156 + bandwidth = rta_getattr_u32(tb[TCA_CAKE_BASE_RATE]);
1158 + print_uint(PRINT_JSON, "bandwidth", NULL, bandwidth);
1159 + print_string(PRINT_FP, NULL, "bandwidth %s ", sprint_rate(bandwidth, b1));
1161 + print_string(PRINT_ANY, "bandwidth", "bandwidth %s ", "unlimited");
1163 + if (tb[TCA_CAKE_AUTORATE] &&
1164 + RTA_PAYLOAD(tb[TCA_CAKE_AUTORATE]) >= sizeof(__u32)) {
1165 + autorate = rta_getattr_u32(tb[TCA_CAKE_AUTORATE]);
1167 + print_string(PRINT_ANY, "autorate", "autorate_%s ", "ingress");
1169 + print_string(PRINT_ANY, "autorate", "(?autorate?) ", "unknown");
1171 + if (tb[TCA_CAKE_DIFFSERV_MODE] &&
1172 + RTA_PAYLOAD(tb[TCA_CAKE_DIFFSERV_MODE]) >= sizeof(__u32)) {
1173 + diffserv = rta_getattr_u32(tb[TCA_CAKE_DIFFSERV_MODE]);
1174 + switch(diffserv) {
1175 + case CAKE_DIFFSERV_DIFFSERV3:
1176 + print_string(PRINT_ANY, "diffserv", "%s ", "diffserv3");
1178 + case CAKE_DIFFSERV_DIFFSERV4:
1179 + print_string(PRINT_ANY, "diffserv", "%s ", "diffserv4");
1181 + case CAKE_DIFFSERV_DIFFSERV8:
1182 + print_string(PRINT_ANY, "diffserv", "%s ", "diffserv8");
1184 + case CAKE_DIFFSERV_BESTEFFORT:
1185 + print_string(PRINT_ANY, "diffserv", "%s ", "besteffort");
1187 + case CAKE_DIFFSERV_PRECEDENCE:
1188 + print_string(PRINT_ANY, "diffserv", "%s ", "precedence");
1191 + print_string(PRINT_ANY, "diffserv", "(?diffserv?) ", "unknown");
1195 + if (tb[TCA_CAKE_FLOW_MODE] &&
1196 + RTA_PAYLOAD(tb[TCA_CAKE_FLOW_MODE]) >= sizeof(__u32)) {
1197 + flowmode = rta_getattr_u32(tb[TCA_CAKE_FLOW_MODE]);
1198 + switch(flowmode) {
1199 + case CAKE_FLOW_NONE:
1200 + print_string(PRINT_ANY, "flowmode", "%s ", "flowblind");
1202 + case CAKE_FLOW_SRC_IP:
1203 + print_string(PRINT_ANY, "flowmode", "%s ", "srchost");
1205 + case CAKE_FLOW_DST_IP:
1206 + print_string(PRINT_ANY, "flowmode", "%s ", "dsthost");
1208 + case CAKE_FLOW_HOSTS:
1209 + print_string(PRINT_ANY, "flowmode", "%s ", "hosts");
1211 + case CAKE_FLOW_FLOWS:
1212 + print_string(PRINT_ANY, "flowmode", "%s ", "flows");
1214 + case CAKE_FLOW_DUAL_SRC:
1215 + print_string(PRINT_ANY, "flowmode", "%s ", "dual-srchost");
1217 + case CAKE_FLOW_DUAL_DST:
1218 + print_string(PRINT_ANY, "flowmode", "%s ", "dual-dsthost");
1220 + case CAKE_FLOW_TRIPLE:
1221 + print_string(PRINT_ANY, "flowmode", "%s ", "triple-isolate");
1224 + print_string(PRINT_ANY, "flowmode", "(?flowmode?) ", "unknown");
1230 + if (tb[TCA_CAKE_NAT] &&
1231 + RTA_PAYLOAD(tb[TCA_CAKE_NAT]) >= sizeof(__u32)) {
1232 + nat = rta_getattr_u32(tb[TCA_CAKE_NAT]);
1236 + print_string(PRINT_FP, NULL, "nat ", NULL);
1237 + print_bool(PRINT_JSON, "nat", NULL, nat);
1239 + if (tb[TCA_CAKE_WASH] &&
1240 + RTA_PAYLOAD(tb[TCA_CAKE_WASH]) >= sizeof(__u32)) {
1241 + wash = rta_getattr_u32(tb[TCA_CAKE_WASH]);
1243 + if (tb[TCA_CAKE_ATM] &&
1244 + RTA_PAYLOAD(tb[TCA_CAKE_ATM]) >= sizeof(__u32)) {
1245 + atm = rta_getattr_u32(tb[TCA_CAKE_ATM]);
1247 + if (tb[TCA_CAKE_OVERHEAD] &&
1248 + RTA_PAYLOAD(tb[TCA_CAKE_OVERHEAD]) >= sizeof(__s32)) {
1249 + overhead = *(__s32 *) RTA_DATA(tb[TCA_CAKE_OVERHEAD]);
1251 + if (tb[TCA_CAKE_MPU] &&
1252 + RTA_PAYLOAD(tb[TCA_CAKE_MPU]) >= sizeof(__u32)) {
1253 + mpu = rta_getattr_u32(tb[TCA_CAKE_MPU]);
1255 + if (tb[TCA_CAKE_INGRESS] &&
1256 + RTA_PAYLOAD(tb[TCA_CAKE_INGRESS]) >= sizeof(__u32)) {
1257 + ingress = rta_getattr_u32(tb[TCA_CAKE_INGRESS]);
1259 + if (tb[TCA_CAKE_ACK_FILTER] &&
1260 + RTA_PAYLOAD(tb[TCA_CAKE_ACK_FILTER]) >= sizeof(__u32)) {
1261 + ack_filter = rta_getattr_u32(tb[TCA_CAKE_ACK_FILTER]);
1263 + if (tb[TCA_CAKE_SPLIT_GSO] &&
1264 + RTA_PAYLOAD(tb[TCA_CAKE_SPLIT_GSO]) >= sizeof(__u32)) {
1265 + split_gso = rta_getattr_u32(tb[TCA_CAKE_SPLIT_GSO]);
1267 + if (tb[TCA_CAKE_RAW]) {
1270 + if (tb[TCA_CAKE_RTT] &&
1271 + RTA_PAYLOAD(tb[TCA_CAKE_RTT]) >= sizeof(__u32)) {
1272 + interval = rta_getattr_u32(tb[TCA_CAKE_RTT]);
1276 + print_string(PRINT_FP, NULL, "wash ", NULL);
1277 + print_bool(PRINT_JSON, "wash", NULL, wash);
1280 + print_string(PRINT_FP, NULL, "ingress ", NULL);
1281 + print_bool(PRINT_JSON, "ingress", NULL, ingress);
1283 + if (ack_filter == CAKE_ACK_AGGRESSIVE)
1284 + print_string(PRINT_ANY, "ack-filter", "ack-filter-%s ", "aggressive");
1285 + else if (ack_filter == CAKE_ACK_FILTER)
1286 + print_string(PRINT_ANY, "ack-filter", "ack-filter ", "enabled");
1288 + print_string(PRINT_JSON, "ack-filter", NULL, "disabled");
1291 + print_string(PRINT_FP, NULL, "split-gso ", NULL);
1292 + print_bool(PRINT_JSON, "split_gso", NULL, split_gso);
1295 + print_string(PRINT_FP, NULL, "rtt %s ", sprint_time(interval, b2));
1296 + print_uint(PRINT_JSON, "rtt", NULL, interval);
1299 + print_string(PRINT_FP, NULL, "raw ", NULL);
1300 + print_bool(PRINT_JSON, "raw", NULL, raw);
1302 + if (atm == CAKE_ATM_ATM)
1303 + print_string(PRINT_ANY, "atm", "%s ", "atm");
1304 + else if (atm == CAKE_ATM_PTM)
1305 + print_string(PRINT_ANY, "atm", "%s ", "ptm");
1307 + print_string(PRINT_ANY, "atm", "%s ", "noatm");
1309 + print_uint(PRINT_ANY, "overhead", "overhead %d ", overhead);
1312 + print_uint(PRINT_ANY, "mpu", "mpu %u ", mpu);
1315 + print_uint(PRINT_JSON, "memlimit", NULL, memlimit);
1316 + print_string(PRINT_FP, NULL, "memlimit %s", sprint_size(memlimit, b1));
1322 +static void cake_print_json_tin(struct rtattr **tstat)
1324 +#define PRINT_TSTAT_JSON(type, name, attr) if (tstat[TCA_CAKE_TIN_STATS_ ## attr]) \
1325 + print_uint(PRINT_JSON, name, NULL, \
1326 + rta_getattr_ ## type((struct rtattr *)tstat[TCA_CAKE_TIN_STATS_ ## attr]))
1328 + open_json_object(NULL);
1329 + PRINT_TSTAT_JSON(u32, "threshold_rate", THRESHOLD_RATE);
1330 + PRINT_TSTAT_JSON(u32, "target_us", TARGET_US);
1331 + PRINT_TSTAT_JSON(u32, "interval_us", INTERVAL_US);
1332 + PRINT_TSTAT_JSON(u32, "peak_delay_us", PEAK_DELAY_US);
1333 + PRINT_TSTAT_JSON(u32, "avg_delay_us", AVG_DELAY_US);
1334 + PRINT_TSTAT_JSON(u32, "base_delay_us", BASE_DELAY_US);
1335 + PRINT_TSTAT_JSON(u32, "sent_packets", SENT_PACKETS);
1336 + PRINT_TSTAT_JSON(u64, "sent_bytes", SENT_BYTES64);
1337 + PRINT_TSTAT_JSON(u32, "way_indirect_hits", WAY_INDIRECT_HITS);
1338 + PRINT_TSTAT_JSON(u32, "way_misses", WAY_MISSES);
1339 + PRINT_TSTAT_JSON(u32, "way_collisions", WAY_COLLISIONS);
1340 + PRINT_TSTAT_JSON(u32, "drops", DROPPED_PACKETS);
1341 + PRINT_TSTAT_JSON(u32, "ecn_mark", ECN_MARKED_PACKETS);
1342 + PRINT_TSTAT_JSON(u32, "ack_drops", ACKS_DROPPED_PACKETS);
1343 + PRINT_TSTAT_JSON(u32, "sparse_flows", SPARSE_FLOWS);
1344 + PRINT_TSTAT_JSON(u32, "bulk_flows", BULK_FLOWS);
1345 + PRINT_TSTAT_JSON(u32, "unresponsive_flows", UNRESPONSIVE_FLOWS);
1346 + PRINT_TSTAT_JSON(u32, "max_pkt_len", MAX_SKBLEN);
1347 + PRINT_TSTAT_JSON(u32, "flow_quantum", FLOW_QUANTUM);
1348 + close_json_object();
1350 +#undef PRINT_TSTAT_JSON
1353 +static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
1354 + struct rtattr *xstats)
1357 + struct rtattr *st[TCA_CAKE_STATS_MAX + 1];
1360 + if (xstats == NULL)
1363 +#define GET_STAT_U32(attr) rta_getattr_u32(st[TCA_CAKE_STATS_ ## attr])
1365 + parse_rtattr_nested(st, TCA_CAKE_STATS_MAX, xstats);
1367 + if (st[TCA_CAKE_STATS_MEMORY_USED] &&
1368 + st[TCA_CAKE_STATS_MEMORY_LIMIT]) {
1369 + print_string(PRINT_FP, NULL, " memory used: %s",
1370 + sprint_size(GET_STAT_U32(MEMORY_USED), b1));
1372 + print_string(PRINT_FP, NULL, " of %s\n",
1373 + sprint_size(GET_STAT_U32(MEMORY_LIMIT), b1));
1375 + print_uint(PRINT_JSON, "memory_used", NULL,
1376 + GET_STAT_U32(MEMORY_USED));
1377 + print_uint(PRINT_JSON, "memory_limit", NULL,
1378 + GET_STAT_U32(MEMORY_LIMIT));
1381 + if (st[TCA_CAKE_STATS_CAPACITY_ESTIMATE]) {
1382 + print_string(PRINT_FP, NULL, " capacity estimate: %s\n",
1383 + sprint_rate(GET_STAT_U32(CAPACITY_ESTIMATE), b1));
1384 + print_uint(PRINT_JSON, "capacity_estimate", NULL,
1385 + GET_STAT_U32(CAPACITY_ESTIMATE));
1388 + if (st[TCA_CAKE_STATS_MIN_NETLEN] &&
1389 + st[TCA_CAKE_STATS_MAX_NETLEN]) {
1390 + print_uint(PRINT_ANY, "min_network_size",
1391 + " min/max network layer size: %8u",
1392 + GET_STAT_U32(MIN_NETLEN));
1393 + print_uint(PRINT_ANY, "max_network_size",
1394 + " /%8u\n", GET_STAT_U32(MAX_NETLEN));
1397 + if (st[TCA_CAKE_STATS_MIN_ADJLEN] &&
1398 + st[TCA_CAKE_STATS_MAX_ADJLEN]) {
1399 + print_uint(PRINT_ANY, "min_adj_size",
1400 + " min/max overhead-adjusted size: %8u",
1401 + GET_STAT_U32(MIN_ADJLEN));
1402 + print_uint(PRINT_ANY, "max_adj_size",
1403 + " /%8u\n", GET_STAT_U32(MAX_ADJLEN));
1406 + if (st[TCA_CAKE_STATS_AVG_NETOFF])
1407 + print_uint(PRINT_ANY, "avg_hdr_offset",
1408 + " average network hdr offset: %8u\n\n",
1409 + GET_STAT_U32(AVG_NETOFF));
1411 +#undef GET_STAT_U32
1413 + if (st[TCA_CAKE_STATS_TIN_STATS]) {
1414 + struct rtattr *tins[TC_CAKE_MAX_TINS + 1];
1415 + struct rtattr *tstat[TC_CAKE_MAX_TINS][TCA_CAKE_TIN_STATS_MAX + 1];
1418 + parse_rtattr_nested(tins, TC_CAKE_MAX_TINS, st[TCA_CAKE_STATS_TIN_STATS]);
1420 + for (i = 1; i <= TC_CAKE_MAX_TINS && tins[i]; i++) {
1421 + parse_rtattr_nested(tstat[i-1], TCA_CAKE_TIN_STATS_MAX, tins[i]);
1428 + if (is_json_context()) {
1429 + open_json_array(PRINT_JSON, "tins");
1430 + for (i = 0; i < num_tins; i++)
1431 + cake_print_json_tin(tstat[i]);
1432 + close_json_array(PRINT_JSON, NULL);
1438 + switch(num_tins) {
1440 + fprintf(f, " Bulk Best Effort Voice\n");
1444 + fprintf(f, " Bulk Best Effort Video Voice\n");
1449 + for(i=0; i < num_tins; i++)
1450 + fprintf(f, " Tin %u", i);
1454 +#define GET_TSTAT(i, attr) (tstat[i][TCA_CAKE_TIN_STATS_ ## attr])
1455 +#define PRINT_TSTAT(name, attr, fmts, val) do { \
1456 + if (GET_TSTAT(0, attr)) { \
1457 + fprintf(f, name); \
1458 + for (i = 0; i < num_tins; i++) \
1459 + fprintf(f, " %12" fmts, val); \
1460 + fprintf(f, "\n"); \
1464 +#define SPRINT_TSTAT(pfunc, name, attr) PRINT_TSTAT( \
1465 + name, attr, "s", sprint_ ## pfunc( \
1466 + rta_getattr_u32(GET_TSTAT(i, attr)), b1))
1468 +#define PRINT_TSTAT_U32(name, attr) PRINT_TSTAT( \
1469 + name, attr, "u", rta_getattr_u32(GET_TSTAT(i, attr)))
1471 +#define PRINT_TSTAT_U64(name, attr) PRINT_TSTAT( \
1472 + name, attr, "llu", rta_getattr_u64(GET_TSTAT(i, attr)))
1474 + SPRINT_TSTAT(rate, " thresh ", THRESHOLD_RATE);
1475 + SPRINT_TSTAT(time, " target ", TARGET_US);
1476 + SPRINT_TSTAT(time, " interval", INTERVAL_US);
1477 + SPRINT_TSTAT(time, " pk_delay", PEAK_DELAY_US);
1478 + SPRINT_TSTAT(time, " av_delay", AVG_DELAY_US);
1479 + SPRINT_TSTAT(time, " sp_delay", BASE_DELAY_US);
1481 + PRINT_TSTAT_U32(" pkts ", SENT_PACKETS);
1482 + PRINT_TSTAT_U64(" bytes ", SENT_BYTES64);
1484 + PRINT_TSTAT_U32(" way_inds", WAY_INDIRECT_HITS);
1485 + PRINT_TSTAT_U32(" way_miss", WAY_MISSES);
1486 + PRINT_TSTAT_U32(" way_cols", WAY_COLLISIONS);
1487 + PRINT_TSTAT_U32(" drops ", DROPPED_PACKETS);
1488 + PRINT_TSTAT_U32(" marks ", ECN_MARKED_PACKETS);
1489 + PRINT_TSTAT_U32(" ack_drop", ACKS_DROPPED_PACKETS);
1490 + PRINT_TSTAT_U32(" sp_flows", SPARSE_FLOWS);
1491 + PRINT_TSTAT_U32(" bk_flows", BULK_FLOWS);
1492 + PRINT_TSTAT_U32(" un_flows", UNRESPONSIVE_FLOWS);
1493 + PRINT_TSTAT_U32(" max_len ", MAX_SKBLEN);
1494 + PRINT_TSTAT_U32(" quantum ", FLOW_QUANTUM);
1498 +#undef SPRINT_TSTAT
1499 +#undef PRINT_TSTAT_U32
1500 +#undef PRINT_TSTAT_U64
1505 +struct qdisc_util cake_qdisc_util = {
1507 + .parse_qopt = cake_parse_opt,
1508 + .print_qopt = cake_print_opt,
1509 + .print_xstats = cake_print_xstats,
1511 --- a/tc/q_ingress.c
1512 +++ b/tc/q_ingress.c
1513 @@ -40,7 +40,7 @@ static int ingress_parse_opt(struct qdis
1514 static int ingress_print_opt(struct qdisc_util *qu, FILE *f,
1517 - fprintf(f, "---------------- ");
1518 + print_string(PRINT_FP, NULL, "---------------- ", NULL);