Debian Codegraph @

tc/q_fq.c

raw
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /*
3 * Fair Queue
4 *
5 * Copyright (C) 2013-2015 Eric Dumazet <[email protected]>
6 */
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <fcntl.h>
12 #include <sys/socket.h>
13 #include <netinet/in.h>
14 #include <arpa/inet.h>
15 #include <string.h>
16 #include <stdbool.h>
17
18 #include "utils.h"
19 #include "tc_util.h"
20
21 static void explain(void)
22 {
23 fprintf(stderr,
24 "Usage: ... fq [ limit PACKETS ] [ flow_limit PACKETS ]\n"
25 " [ quantum BYTES ] [ initial_quantum BYTES ]\n"
26 " [ maxrate RATE ] [ buckets NUMBER ]\n"
27 " [ [no]pacing ] [ refill_delay TIME ]\n"
28 " [ bands 3 priomap P0 P1 ... P14 P15 ]\n"
29 " [ weights W1 W2 W3 ]\n"
30 " [ low_rate_threshold RATE ]\n"
31 " [ orphan_mask MASK]\n"
32 " [ timer_slack TIME]\n"
33 " [ ce_threshold TIME ]\n"
34 " [ horizon TIME ]\n"
35 " [ horizon_{cap|drop} ]\n"
36 " [ offload_horizon TIME ]\n");
37 }
38
39 static unsigned int ilog2(unsigned int val)
40 {
41 unsigned int res = 0;
42
43 val--;
44 while (val) {
45 res++;
46 val >>= 1;
47 }
48 return res;
49 }
50
51 static int fq_parse_opt(const struct qdisc_util *qu, int argc, char **argv,
52 struct nlmsghdr *n, const char *dev)
53 {
54 struct tc_prio_qopt prio2band;
55 unsigned int plimit;
56 unsigned int flow_plimit;
57 unsigned int quantum;
58 unsigned int initial_quantum;
59 unsigned int buckets = 0;
60 unsigned int maxrate;
61 unsigned int low_rate_threshold;
62 unsigned int defrate;
63 unsigned int refill_delay;
64 unsigned int orphan_mask;
65 unsigned int ce_threshold;
66 unsigned int timer_slack;
67 unsigned int horizon;
68 unsigned int offload_horizon;
69 __u8 horizon_drop = 255;
70 bool set_plimit = false;
71 bool set_flow_plimit = false;
72 bool set_quantum = false;
73 bool set_initial_quantum = false;
74 bool set_maxrate = false;
75 bool set_defrate = false;
76 bool set_refill_delay = false;
77 bool set_orphan_mask = false;
78 bool set_low_rate_threshold = false;
79 bool set_ce_threshold = false;
80 bool set_timer_slack = false;
81 bool set_horizon = false;
82 bool set_priomap = false;
83 bool set_weights = false;
84 bool set_offload_horizon = false;
85 int weights[FQ_BANDS];
86 int pacing = -1;
87 struct rtattr *tail;
88
89 while (argc > 0) {
90 if (strcmp(*argv, "limit") == 0) {
91 NEXT_ARG();
92 if (get_unsigned(&plimit, *argv, 0)) {
93 fprintf(stderr, "Illegal \"limit\"\n");
94 return -1;
95 }
96 set_plimit = true;
97 } else if (strcmp(*argv, "flow_limit") == 0) {
98 NEXT_ARG();
99 if (get_unsigned(&flow_plimit, *argv, 0)) {
100 fprintf(stderr, "Illegal \"flow_limit\"\n");
101 return -1;
102 }
103 set_flow_plimit = true;
104 } else if (strcmp(*argv, "buckets") == 0) {
105 NEXT_ARG();
106 if (get_unsigned(&buckets, *argv, 0)) {
107 fprintf(stderr, "Illegal \"buckets\"\n");
108 return -1;
109 }
110 } else if (strcmp(*argv, "maxrate") == 0) {
111 NEXT_ARG();
112 if (strchr(*argv, '%')) {
113 if (get_percent_rate(&maxrate, *argv, dev)) {
114 fprintf(stderr, "Illegal \"maxrate\"\n");
115 return -1;
116 }
117 } else if (get_rate(&maxrate, *argv)) {
118 fprintf(stderr, "Illegal \"maxrate\"\n");
119 return -1;
120 }
121 set_maxrate = true;
122 } else if (strcmp(*argv, "low_rate_threshold") == 0) {
123 NEXT_ARG();
124 if (get_rate(&low_rate_threshold, *argv)) {
125 fprintf(stderr, "Illegal \"low_rate_threshold\"\n");
126 return -1;
127 }
128 set_low_rate_threshold = true;
129 } else if (strcmp(*argv, "ce_threshold") == 0) {
130 NEXT_ARG();
131 if (get_time(&ce_threshold, *argv)) {
132 fprintf(stderr, "Illegal \"ce_threshold\"\n");
133 return -1;
134 }
135 set_ce_threshold = true;
136 } else if (strcmp(*argv, "timer_slack") == 0) {
137 __s64 t64;
138
139 NEXT_ARG();
140 if (get_time64(&t64, *argv)) {
141 fprintf(stderr, "Illegal \"timer_slack\"\n");
142 return -1;
143 }
144 timer_slack = t64;
145 if (timer_slack != t64) {
146 fprintf(stderr, "Illegal (out of range) \"timer_slack\"\n");
147 return -1;
148 }
149 set_timer_slack = true;
150 } else if (strcmp(*argv, "horizon_drop") == 0) {
151 horizon_drop = 1;
152 } else if (strcmp(*argv, "horizon_cap") == 0) {
153 horizon_drop = 0;
154 } else if (strcmp(*argv, "horizon") == 0) {
155 NEXT_ARG();
156 if (get_time(&horizon, *argv)) {
157 fprintf(stderr, "Illegal \"horizon\"\n");
158 return -1;
159 }
160 set_horizon = true;
161 } else if (strcmp(*argv, "offload_horizon") == 0) {
162 NEXT_ARG();
163 if (get_time(&offload_horizon, *argv)) {
164 fprintf(stderr, "Illegal \"offload_horizon\"\n");
165 return -1;
166 }
167 set_offload_horizon = true;
168 } else if (strcmp(*argv, "defrate") == 0) {
169 NEXT_ARG();
170 if (strchr(*argv, '%')) {
171 if (get_percent_rate(&defrate, *argv, dev)) {
172 fprintf(stderr, "Illegal \"defrate\"\n");
173 return -1;
174 }
175 } else if (get_rate(&defrate, *argv)) {
176 fprintf(stderr, "Illegal \"defrate\"\n");
177 return -1;
178 }
179 set_defrate = true;
180 } else if (strcmp(*argv, "quantum") == 0) {
181 NEXT_ARG();
182 if (get_unsigned(&quantum, *argv, 0)) {
183 fprintf(stderr, "Illegal \"quantum\"\n");
184 return -1;
185 }
186 set_quantum = true;
187 } else if (strcmp(*argv, "initial_quantum") == 0) {
188 NEXT_ARG();
189 if (get_unsigned(&initial_quantum, *argv, 0)) {
190 fprintf(stderr, "Illegal \"initial_quantum\"\n");
191 return -1;
192 }
193 set_initial_quantum = true;
194 } else if (strcmp(*argv, "orphan_mask") == 0) {
195 NEXT_ARG();
196 if (get_unsigned(&orphan_mask, *argv, 0)) {
197 fprintf(stderr, "Illegal \"initial_quantum\"\n");
198 return -1;
199 }
200 set_orphan_mask = true;
201 } else if (strcmp(*argv, "refill_delay") == 0) {
202 NEXT_ARG();
203 if (get_time(&refill_delay, *argv)) {
204 fprintf(stderr, "Illegal \"refill_delay\"\n");
205 return -1;
206 }
207 set_refill_delay = true;
208 } else if (strcmp(*argv, "pacing") == 0) {
209 pacing = 1;
210 } else if (strcmp(*argv, "nopacing") == 0) {
211 pacing = 0;
212 } else if (strcmp(*argv, "bands") == 0) {
213 int idx;
214
215 if (set_priomap) {
216 fprintf(stderr, "Duplicate \"bands\"\n");
217 return -1;
218 }
219 memset(&prio2band, 0, sizeof(prio2band));
220 NEXT_ARG();
221 if (get_integer(&prio2band.bands, *argv, 10)) {
222 fprintf(stderr, "Illegal \"bands\"\n");
223 return -1;
224 }
225 if (prio2band.bands != 3) {
226 fprintf(stderr, "\"bands\" must be 3\n");
227 return -1;
228 }
229 NEXT_ARG();
230 if (strcmp(*argv, "priomap") != 0) {
231 fprintf(stderr, "\"priomap\" expected\n");
232 return -1;
233 }
234 for (idx = 0; idx <= TC_PRIO_MAX; ++idx) {
235 unsigned band;
236
237 if (!NEXT_ARG_OK()) {
238 fprintf(stderr, "Not enough elements in priomap\n");
239 return -1;
240 }
241 NEXT_ARG();
242 if (get_unsigned(&band, *argv, 10)) {
243 fprintf(stderr, "Illegal \"priomap\" element, number in [0..%u] expected\n",
244 prio2band.bands - 1);
245 return -1;
246 }
247 if (band >= prio2band.bands) {
248 fprintf(stderr, "\"priomap\" element %u too big\n", band);
249 return -1;
250 }
251 prio2band.priomap[idx] = band;
252 }
253 set_priomap = true;
254 } else if (strcmp(*argv, "weights") == 0) {
255 int idx;
256
257 if (set_weights) {
258 fprintf(stderr, "Duplicate \"weights\"\n");
259 return -1;
260 }
261 for (idx = 0; idx < FQ_BANDS; ++idx) {
262 int val;
263
264 if (!NEXT_ARG_OK()) {
265 fprintf(stderr, "Not enough elements in weights\n");
266 return -1;
267 }
268 NEXT_ARG();
269 if (get_integer(&val, *argv, 10)) {
270 fprintf(stderr, "Illegal \"weights\" element, positive number expected\n");
271 return -1;
272 }
273 if (val < FQ_MIN_WEIGHT) {
274 fprintf(stderr, "\"weight\" element %d too small\n", val);
275 return -1;
276 }
277 weights[idx] = val;
278 }
279 set_weights = true;
280 } else if (strcmp(*argv, "help") == 0) {
281 explain();
282 return -1;
283 } else {
284 fprintf(stderr, "What is \"%s\"?\n", *argv);
285 explain();
286 return -1;
287 }
288 argc--; argv++;
289 }
290
291 tail = addattr_nest(n, 1024, TCA_OPTIONS);
292 if (buckets) {
293 unsigned int log = ilog2(buckets);
294
295 addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG,
296 &log, sizeof(log));
297 }
298 if (set_plimit)
299 addattr_l(n, 1024, TCA_FQ_PLIMIT,
300 &plimit, sizeof(plimit));
301 if (set_flow_plimit)
302 addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT,
303 &flow_plimit, sizeof(flow_plimit));
304 if (set_quantum)
305 addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum));
306 if (set_initial_quantum)
307 addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM,
308 &initial_quantum, sizeof(initial_quantum));
309 if (pacing != -1)
310 addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
311 &pacing, sizeof(pacing));
312 if (set_maxrate)
313 addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
314 &maxrate, sizeof(maxrate));
315 if (set_low_rate_threshold)
316 addattr_l(n, 1024, TCA_FQ_LOW_RATE_THRESHOLD,
317 &low_rate_threshold, sizeof(low_rate_threshold));
318 if (set_defrate)
319 addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE,
320 &defrate, sizeof(defrate));
321 if (set_refill_delay)
322 addattr_l(n, 1024, TCA_FQ_FLOW_REFILL_DELAY,
323 &refill_delay, sizeof(refill_delay));
324 if (set_orphan_mask)
325 addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK,
326 &orphan_mask, sizeof(orphan_mask));
327 if (set_ce_threshold)
328 addattr_l(n, 1024, TCA_FQ_CE_THRESHOLD,
329 &ce_threshold, sizeof(ce_threshold));
330 if (set_timer_slack)
331 addattr_l(n, 1024, TCA_FQ_TIMER_SLACK,
332 &timer_slack, sizeof(timer_slack));
333 if (set_horizon)
334 addattr_l(n, 1024, TCA_FQ_HORIZON,
335 &horizon, sizeof(horizon));
336 if (horizon_drop != 255)
337 addattr_l(n, 1024, TCA_FQ_HORIZON_DROP,
338 &horizon_drop, sizeof(horizon_drop));
339 if (set_priomap)
340 addattr_l(n, 1024, TCA_FQ_PRIOMAP,
341 &prio2band, sizeof(prio2band));
342 if (set_weights)
343 addattr_l(n, 1024, TCA_FQ_WEIGHTS,
344 weights, sizeof(weights));
345 if (set_offload_horizon)
346 addattr_l(n, 1024, TCA_FQ_OFFLOAD_HORIZON,
347 &offload_horizon, sizeof(offload_horizon));
348 addattr_nest_end(n, tail);
349 return 0;
350 }
351
352 static int fq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
353 {
354 struct rtattr *tb[TCA_FQ_MAX + 1];
355 unsigned int plimit, flow_plimit;
356 unsigned int buckets_log;
357 int pacing;
358 unsigned int rate, quantum;
359 unsigned int refill_delay;
360 unsigned int orphan_mask;
361 unsigned int ce_threshold;
362 unsigned int timer_slack;
363 __u32 offload_horizon;
364 unsigned int horizon;
365 __u8 horizon_drop;
366
367 SPRINT_BUF(b1);
368
369 if (opt == NULL)
370 return 0;
371
372 parse_rtattr_nested(tb, TCA_FQ_MAX, opt);
373
374 if (tb[TCA_FQ_PLIMIT] &&
375 RTA_PAYLOAD(tb[TCA_FQ_PLIMIT]) >= sizeof(__u32)) {
376 plimit = rta_getattr_u32(tb[TCA_FQ_PLIMIT]);
377 print_uint(PRINT_ANY, "limit", "limit %up ", plimit);
378 }
379 if (tb[TCA_FQ_FLOW_PLIMIT] &&
380 RTA_PAYLOAD(tb[TCA_FQ_FLOW_PLIMIT]) >= sizeof(__u32)) {
381 flow_plimit = rta_getattr_u32(tb[TCA_FQ_FLOW_PLIMIT]);
382 print_uint(PRINT_ANY, "flow_limit", "flow_limit %up ",
383 flow_plimit);
384 }
385 if (tb[TCA_FQ_BUCKETS_LOG] &&
386 RTA_PAYLOAD(tb[TCA_FQ_BUCKETS_LOG]) >= sizeof(__u32)) {
387 buckets_log = rta_getattr_u32(tb[TCA_FQ_BUCKETS_LOG]);
388 print_uint(PRINT_ANY, "buckets", "buckets %u ",
389 1U << buckets_log);
390 }
391 if (tb[TCA_FQ_ORPHAN_MASK] &&
392 RTA_PAYLOAD(tb[TCA_FQ_ORPHAN_MASK]) >= sizeof(__u32)) {
393 orphan_mask = rta_getattr_u32(tb[TCA_FQ_ORPHAN_MASK]);
394 print_uint(PRINT_ANY, "orphan_mask", "orphan_mask %u ",
395 orphan_mask);
396 }
397 if (tb[TCA_FQ_RATE_ENABLE] &&
398 RTA_PAYLOAD(tb[TCA_FQ_RATE_ENABLE]) >= sizeof(int)) {
399 pacing = rta_getattr_u32(tb[TCA_FQ_RATE_ENABLE]);
400 if (pacing == 0)
401 print_bool(PRINT_ANY, "pacing", "nopacing ", false);
402 }
403 if (tb[TCA_FQ_PRIOMAP] &&
404 RTA_PAYLOAD(tb[TCA_FQ_PRIOMAP]) >= sizeof(struct tc_prio_qopt)) {
405 struct tc_prio_qopt *prio2band = RTA_DATA(tb[TCA_FQ_PRIOMAP]);
406 int i;
407
408 print_uint(PRINT_ANY, "bands", "bands %u ", prio2band->bands);
409 open_json_array(PRINT_ANY, "priomap ");
410 for (i = 0; i <= TC_PRIO_MAX; i++)
411 print_uint(PRINT_ANY, NULL, "%d ", prio2band->priomap[i]);
412 close_json_array(PRINT_ANY, "");
413 }
414 if (tb[TCA_FQ_WEIGHTS] &&
415 RTA_PAYLOAD(tb[TCA_FQ_WEIGHTS]) >= FQ_BANDS * sizeof(int)) {
416 const int *weights = RTA_DATA(tb[TCA_FQ_WEIGHTS]);
417 int i;
418
419 open_json_array(PRINT_ANY, "weights ");
420 for (i = 0; i < FQ_BANDS; ++i)
421 print_uint(PRINT_ANY, NULL, "%d ", weights[i]);
422 close_json_array(PRINT_ANY, "");
423 }
424 if (tb[TCA_FQ_QUANTUM] &&
425 RTA_PAYLOAD(tb[TCA_FQ_QUANTUM]) >= sizeof(__u32)) {
426 quantum = rta_getattr_u32(tb[TCA_FQ_QUANTUM]);
427 print_size(PRINT_ANY, "quantum", "quantum %s ", quantum);
428 }
429 if (tb[TCA_FQ_INITIAL_QUANTUM] &&
430 RTA_PAYLOAD(tb[TCA_FQ_INITIAL_QUANTUM]) >= sizeof(__u32)) {
431 quantum = rta_getattr_u32(tb[TCA_FQ_INITIAL_QUANTUM]);
432 print_size(PRINT_ANY, "initial_quantum", "initial_quantum %s ",
433 quantum);
434 }
435 if (tb[TCA_FQ_FLOW_MAX_RATE] &&
436 RTA_PAYLOAD(tb[TCA_FQ_FLOW_MAX_RATE]) >= sizeof(__u32)) {
437 rate = rta_getattr_u32(tb[TCA_FQ_FLOW_MAX_RATE]);
438
439 if (rate != ~0U)
440 tc_print_rate(PRINT_ANY,
441 "maxrate", "maxrate %s ", rate);
442 }
443 if (tb[TCA_FQ_FLOW_DEFAULT_RATE] &&
444 RTA_PAYLOAD(tb[TCA_FQ_FLOW_DEFAULT_RATE]) >= sizeof(__u32)) {
445 rate = rta_getattr_u32(tb[TCA_FQ_FLOW_DEFAULT_RATE]);
446
447 if (rate != 0)
448 tc_print_rate(PRINT_ANY,
449 "defrate", "defrate %s ", rate);
450 }
451 if (tb[TCA_FQ_LOW_RATE_THRESHOLD] &&
452 RTA_PAYLOAD(tb[TCA_FQ_LOW_RATE_THRESHOLD]) >= sizeof(__u32)) {
453 rate = rta_getattr_u32(tb[TCA_FQ_LOW_RATE_THRESHOLD]);
454
455 if (rate != 0)
456 tc_print_rate(PRINT_ANY, "low_rate_threshold",
457 "low_rate_threshold %s ", rate);
458 }
459 if (tb[TCA_FQ_FLOW_REFILL_DELAY] &&
460 RTA_PAYLOAD(tb[TCA_FQ_FLOW_REFILL_DELAY]) >= sizeof(__u32)) {
461 refill_delay = rta_getattr_u32(tb[TCA_FQ_FLOW_REFILL_DELAY]);
462 print_uint(PRINT_JSON, "refill_delay", NULL, refill_delay);
463 print_string(PRINT_FP, NULL, "refill_delay %s ",
464 sprint_time(refill_delay, b1));
465 }
466
467 if (tb[TCA_FQ_CE_THRESHOLD] &&
468 RTA_PAYLOAD(tb[TCA_FQ_CE_THRESHOLD]) >= sizeof(__u32)) {
469 ce_threshold = rta_getattr_u32(tb[TCA_FQ_CE_THRESHOLD]);
470 if (ce_threshold != ~0U) {
471 print_uint(PRINT_JSON, "ce_threshold", NULL,
472 ce_threshold);
473 print_string(PRINT_FP, NULL, "ce_threshold %s ",
474 sprint_time(ce_threshold, b1));
475 }
476 }
477
478 if (tb[TCA_FQ_TIMER_SLACK] &&
479 RTA_PAYLOAD(tb[TCA_FQ_TIMER_SLACK]) >= sizeof(__u32)) {
480 timer_slack = rta_getattr_u32(tb[TCA_FQ_TIMER_SLACK]);
481 print_uint(PRINT_JSON, "timer_slack", NULL, timer_slack);
482 print_string(PRINT_FP, NULL, "timer_slack %s ",
483 sprint_time64(timer_slack, b1));
484 }
485
486 if (tb[TCA_FQ_HORIZON] &&
487 RTA_PAYLOAD(tb[TCA_FQ_HORIZON]) >= sizeof(__u32)) {
488 horizon = rta_getattr_u32(tb[TCA_FQ_HORIZON]);
489 print_uint(PRINT_JSON, "horizon", NULL, horizon);
490 print_string(PRINT_FP, NULL, "horizon %s ",
491 sprint_time(horizon, b1));
492 }
493
494 if (tb[TCA_FQ_HORIZON_DROP] &&
495 RTA_PAYLOAD(tb[TCA_FQ_HORIZON_DROP]) >= sizeof(__u8)) {
496 horizon_drop = rta_getattr_u8(tb[TCA_FQ_HORIZON_DROP]);
497 if (!horizon_drop)
498 print_null(PRINT_ANY, "horizon_cap", "horizon_cap ", NULL);
499 else
500 print_null(PRINT_ANY, "horizon_drop", "horizon_drop ", NULL);
501 }
502
503 if (tb[TCA_FQ_OFFLOAD_HORIZON] &&
504 RTA_PAYLOAD(tb[TCA_FQ_OFFLOAD_HORIZON]) >= sizeof(__u32)) {
505 offload_horizon = rta_getattr_u32(tb[TCA_FQ_OFFLOAD_HORIZON]);
506 print_uint(PRINT_JSON, "offload_horizon", NULL, offload_horizon);
507 print_string(PRINT_FP, NULL, "offload_horizon %s ",
508 sprint_time(offload_horizon, b1));
509 }
510
511 return 0;
512 }
513
514 static int fq_print_xstats(const struct qdisc_util *qu, FILE *f,
515 struct rtattr *xstats)
516 {
517 struct tc_fq_qd_stats *st, _st;
518
519 SPRINT_BUF(b1);
520
521 if (xstats == NULL)
522 return 0;
523
524 memset(&_st, 0, sizeof(_st));
525 memcpy(&_st, RTA_DATA(xstats), min(RTA_PAYLOAD(xstats), sizeof(*st)));
526
527 st = &_st;
528
529 print_uint(PRINT_ANY, "flows", " flows %u", st->flows);
530 print_uint(PRINT_ANY, "inactive", " (inactive %u", st->inactive_flows);
531 print_uint(PRINT_ANY, "throttled", " throttled %u)",
532 st->throttled_flows);
533
534 print_uint(PRINT_ANY, "band0_pkts", " band0_pkts %u", st->band_pkt_count[0]);
535 print_uint(PRINT_ANY, "band1_pkts", " band1_pkts %u", st->band_pkt_count[1]);
536 print_uint(PRINT_ANY, "band2_pkts", " band2_pkts %u", st->band_pkt_count[2]);
537
538 if (st->time_next_delayed_flow > 0) {
539 print_lluint(PRINT_JSON, "next_packet_delay", NULL,
540 st->time_next_delayed_flow);
541 print_string(PRINT_FP, NULL, " next_packet_delay %s",
542 sprint_time64(st->time_next_delayed_flow, b1));
543 }
544
545 print_nl();
546 print_lluint(PRINT_ANY, "gc", " gc %llu", st->gc_flows);
547 print_lluint(PRINT_ANY, "highprio", " highprio %llu",
548 st->highprio_packets);
549
550 if (st->fastpath_packets)
551 print_lluint(PRINT_ANY, "fastpath", " fastpath %llu",
552 st->fastpath_packets);
553
554 if (st->tcp_retrans)
555 print_lluint(PRINT_ANY, "retrans", " retrans %llu",
556 st->tcp_retrans);
557
558 print_lluint(PRINT_ANY, "throttled", " throttled %llu", st->throttled);
559
560 if (st->unthrottle_latency_ns) {
561 print_uint(PRINT_JSON, "latency", NULL,
562 st->unthrottle_latency_ns);
563 print_string(PRINT_FP, NULL, " latency %s",
564 sprint_time64(st->unthrottle_latency_ns, b1));
565 }
566
567 if (st->ce_mark)
568 print_lluint(PRINT_ANY, "ce_mark", " ce_mark %llu",
569 st->ce_mark);
570
571 if (st->flows_plimit)
572 print_lluint(PRINT_ANY, "flows_plimit", " flows_plimit %llu",
573 st->flows_plimit);
574
575 if (st->pkts_too_long || st->allocation_errors ||
576 st->horizon_drops || st->horizon_caps ||
577 st->band_drops[0] ||
578 st->band_drops[1] ||
579 st->band_drops[2]) {
580 print_nl();
581 if (st->pkts_too_long)
582 print_lluint(PRINT_ANY, "pkts_too_long",
583 " pkts_too_long %llu",
584 st->pkts_too_long);
585 if (st->allocation_errors)
586 print_lluint(PRINT_ANY, "alloc_errors",
587 " alloc_errors %llu",
588 st->allocation_errors);
589 if (st->horizon_drops)
590 print_lluint(PRINT_ANY, "horizon_drops",
591 " horizon_drops %llu",
592 st->horizon_drops);
593 if (st->horizon_caps)
594 print_lluint(PRINT_ANY, "horizon_caps",
595 " horizon_caps %llu",
596 st->horizon_caps);
597 if (st->band_drops[0])
598 print_lluint(PRINT_ANY, "band0_drops",
599 " band0_drops %llu",
600 st->band_drops[0]);
601 if (st->band_drops[1])
602 print_lluint(PRINT_ANY, "band1_drops",
603 " band1_drops %llu",
604 st->band_drops[1]);
605 if (st->band_drops[2])
606 print_lluint(PRINT_ANY, "band2_drops",
607 " band2_drops %llu",
608 st->band_drops[2]);
609 }
610
611 return 0;
612 }
613
614 struct qdisc_util fq_qdisc_util = {
615 .id = "fq",
616 .parse_qopt = fq_parse_opt,
617 .print_qopt = fq_print_opt,
618 .print_xstats = fq_print_xstats,
619 };