]>
Commit | Line | Data |
---|---|---|
bc113e46 ED |
1 | /* |
2 | * Fair Queue | |
3 | * | |
8d5bd8c3 | 4 | * Copyright (C) 2013-2015 Eric Dumazet <edumazet@google.com> |
bc113e46 ED |
5 | * |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions, and the following disclaimer, | |
11 | * without modification. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3. The names of the authors may not be used to endorse or promote products | |
16 | * derived from this software without specific prior written permission. | |
17 | * | |
18 | * Alternatively, provided that this notice is retained in full, this | |
19 | * software may be distributed under the terms of the GNU General | |
20 | * Public License ("GPL") version 2, in which case the provisions of the | |
21 | * GPL apply INSTEAD OF those given above. | |
22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | |
34 | * DAMAGE. | |
35 | * | |
36 | */ | |
37 | ||
38 | #include <stdio.h> | |
39 | #include <stdlib.h> | |
40 | #include <unistd.h> | |
bc113e46 ED |
41 | #include <fcntl.h> |
42 | #include <sys/socket.h> | |
43 | #include <netinet/in.h> | |
44 | #include <arpa/inet.h> | |
45 | #include <string.h> | |
aeb199d5 | 46 | #include <stdbool.h> |
bc113e46 ED |
47 | |
48 | #include "utils.h" | |
49 | #include "tc_util.h" | |
50 | ||
51 | static void explain(void) | |
52 | { | |
8589eb4e MC |
53 | fprintf(stderr, |
54 | "Usage: ... fq [ limit PACKETS ] [ flow_limit PACKETS ]\n" | |
55 | " [ quantum BYTES ] [ initial_quantum BYTES ]\n" | |
56 | " [ maxrate RATE ] [ buckets NUMBER ]\n" | |
57 | " [ [no]pacing ] [ refill_delay TIME ]\n" | |
58 | " [ low_rate_threshold RATE ]\n" | |
59 | " [ orphan_mask MASK]\n" | |
be9ca9d5 | 60 | " [ timer_slack TIME]\n" |
8589eb4e | 61 | " [ ce_threshold TIME ]\n"); |
bc113e46 ED |
62 | } |
63 | ||
64 | static unsigned int ilog2(unsigned int val) | |
65 | { | |
66 | unsigned int res = 0; | |
67 | ||
68 | val--; | |
69 | while (val) { | |
70 | res++; | |
71 | val >>= 1; | |
72 | } | |
73 | return res; | |
74 | } | |
75 | ||
76 | static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, | |
927e3cfb | 77 | struct nlmsghdr *n, const char *dev) |
bc113e46 | 78 | { |
aeb199d5 YY |
79 | unsigned int plimit; |
80 | unsigned int flow_plimit; | |
81 | unsigned int quantum; | |
82 | unsigned int initial_quantum; | |
bc113e46 | 83 | unsigned int buckets = 0; |
aeb199d5 | 84 | unsigned int maxrate; |
ff28b751 | 85 | unsigned int low_rate_threshold; |
aeb199d5 | 86 | unsigned int defrate; |
565af7b8 | 87 | unsigned int refill_delay; |
8d5bd8c3 | 88 | unsigned int orphan_mask; |
55e106c4 | 89 | unsigned int ce_threshold; |
be9ca9d5 | 90 | unsigned int timer_slack; |
aeb199d5 YY |
91 | bool set_plimit = false; |
92 | bool set_flow_plimit = false; | |
93 | bool set_quantum = false; | |
94 | bool set_initial_quantum = false; | |
95 | bool set_maxrate = false; | |
96 | bool set_defrate = false; | |
565af7b8 | 97 | bool set_refill_delay = false; |
8d5bd8c3 | 98 | bool set_orphan_mask = false; |
ff28b751 | 99 | bool set_low_rate_threshold = false; |
55e106c4 | 100 | bool set_ce_threshold = false; |
be9ca9d5 | 101 | bool set_timer_slack = false; |
bc113e46 ED |
102 | int pacing = -1; |
103 | struct rtattr *tail; | |
104 | ||
105 | while (argc > 0) { | |
106 | if (strcmp(*argv, "limit") == 0) { | |
107 | NEXT_ARG(); | |
108 | if (get_unsigned(&plimit, *argv, 0)) { | |
109 | fprintf(stderr, "Illegal \"limit\"\n"); | |
110 | return -1; | |
111 | } | |
aeb199d5 | 112 | set_plimit = true; |
bc113e46 ED |
113 | } else if (strcmp(*argv, "flow_limit") == 0) { |
114 | NEXT_ARG(); | |
115 | if (get_unsigned(&flow_plimit, *argv, 0)) { | |
116 | fprintf(stderr, "Illegal \"flow_limit\"\n"); | |
117 | return -1; | |
118 | } | |
aeb199d5 | 119 | set_flow_plimit = true; |
bc113e46 ED |
120 | } else if (strcmp(*argv, "buckets") == 0) { |
121 | NEXT_ARG(); | |
122 | if (get_unsigned(&buckets, *argv, 0)) { | |
123 | fprintf(stderr, "Illegal \"buckets\"\n"); | |
124 | return -1; | |
125 | } | |
126 | } else if (strcmp(*argv, "maxrate") == 0) { | |
127 | NEXT_ARG(); | |
927e3cfb ND |
128 | if (strchr(*argv, '%')) { |
129 | if (get_percent_rate(&maxrate, *argv, dev)) { | |
130 | fprintf(stderr, "Illegal \"maxrate\"\n"); | |
131 | return -1; | |
132 | } | |
133 | } else if (get_rate(&maxrate, *argv)) { | |
bc113e46 ED |
134 | fprintf(stderr, "Illegal \"maxrate\"\n"); |
135 | return -1; | |
136 | } | |
aeb199d5 | 137 | set_maxrate = true; |
ff28b751 ED |
138 | } else if (strcmp(*argv, "low_rate_threshold") == 0) { |
139 | NEXT_ARG(); | |
140 | if (get_rate(&low_rate_threshold, *argv)) { | |
141 | fprintf(stderr, "Illegal \"low_rate_threshold\"\n"); | |
142 | return -1; | |
143 | } | |
144 | set_low_rate_threshold = true; | |
55e106c4 ED |
145 | } else if (strcmp(*argv, "ce_threshold") == 0) { |
146 | NEXT_ARG(); | |
147 | if (get_time(&ce_threshold, *argv)) { | |
148 | fprintf(stderr, "Illegal \"ce_threshold\"\n"); | |
149 | return -1; | |
150 | } | |
151 | set_ce_threshold = true; | |
be9ca9d5 ED |
152 | } else if (strcmp(*argv, "timer_slack") == 0) { |
153 | __s64 t64; | |
154 | ||
155 | NEXT_ARG(); | |
156 | if (get_time64(&t64, *argv)) { | |
157 | fprintf(stderr, "Illegal \"timer_slack\"\n"); | |
158 | return -1; | |
159 | } | |
160 | timer_slack = t64; | |
161 | if (timer_slack != t64) { | |
162 | fprintf(stderr, "Illegal (out of range) \"timer_slack\"\n"); | |
163 | return -1; | |
164 | } | |
165 | set_timer_slack = true; | |
bc113e46 ED |
166 | } else if (strcmp(*argv, "defrate") == 0) { |
167 | NEXT_ARG(); | |
927e3cfb ND |
168 | if (strchr(*argv, '%')) { |
169 | if (get_percent_rate(&defrate, *argv, dev)) { | |
170 | fprintf(stderr, "Illegal \"defrate\"\n"); | |
171 | return -1; | |
172 | } | |
173 | } else if (get_rate(&defrate, *argv)) { | |
bc113e46 ED |
174 | fprintf(stderr, "Illegal \"defrate\"\n"); |
175 | return -1; | |
176 | } | |
aeb199d5 | 177 | set_defrate = true; |
bc113e46 ED |
178 | } else if (strcmp(*argv, "quantum") == 0) { |
179 | NEXT_ARG(); | |
180 | if (get_unsigned(&quantum, *argv, 0)) { | |
181 | fprintf(stderr, "Illegal \"quantum\"\n"); | |
182 | return -1; | |
183 | } | |
aeb199d5 | 184 | set_quantum = true; |
bc113e46 ED |
185 | } else if (strcmp(*argv, "initial_quantum") == 0) { |
186 | NEXT_ARG(); | |
187 | if (get_unsigned(&initial_quantum, *argv, 0)) { | |
188 | fprintf(stderr, "Illegal \"initial_quantum\"\n"); | |
189 | return -1; | |
190 | } | |
aeb199d5 | 191 | set_initial_quantum = true; |
8d5bd8c3 ED |
192 | } else if (strcmp(*argv, "orphan_mask") == 0) { |
193 | NEXT_ARG(); | |
194 | if (get_unsigned(&orphan_mask, *argv, 0)) { | |
195 | fprintf(stderr, "Illegal \"initial_quantum\"\n"); | |
196 | return -1; | |
197 | } | |
198 | set_orphan_mask = true; | |
565af7b8 PS |
199 | } else if (strcmp(*argv, "refill_delay") == 0) { |
200 | NEXT_ARG(); | |
201 | if (get_time(&refill_delay, *argv)) { | |
202 | fprintf(stderr, "Illegal \"refill_delay\"\n"); | |
203 | return -1; | |
204 | } | |
205 | set_refill_delay = true; | |
bc113e46 ED |
206 | } else if (strcmp(*argv, "pacing") == 0) { |
207 | pacing = 1; | |
208 | } else if (strcmp(*argv, "nopacing") == 0) { | |
209 | pacing = 0; | |
210 | } else if (strcmp(*argv, "help") == 0) { | |
211 | explain(); | |
212 | return -1; | |
213 | } else { | |
214 | fprintf(stderr, "What is \"%s\"?\n", *argv); | |
215 | explain(); | |
216 | return -1; | |
217 | } | |
218 | argc--; argv++; | |
219 | } | |
220 | ||
c14f9d92 | 221 | tail = addattr_nest(n, 1024, TCA_OPTIONS); |
bc113e46 ED |
222 | if (buckets) { |
223 | unsigned int log = ilog2(buckets); | |
224 | ||
225 | addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG, | |
226 | &log, sizeof(log)); | |
227 | } | |
aeb199d5 | 228 | if (set_plimit) |
bc113e46 ED |
229 | addattr_l(n, 1024, TCA_FQ_PLIMIT, |
230 | &plimit, sizeof(plimit)); | |
aeb199d5 | 231 | if (set_flow_plimit) |
bc113e46 ED |
232 | addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT, |
233 | &flow_plimit, sizeof(flow_plimit)); | |
aeb199d5 | 234 | if (set_quantum) |
bc113e46 | 235 | addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum)); |
aeb199d5 | 236 | if (set_initial_quantum) |
bc113e46 ED |
237 | addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM, |
238 | &initial_quantum, sizeof(initial_quantum)); | |
239 | if (pacing != -1) | |
240 | addattr_l(n, 1024, TCA_FQ_RATE_ENABLE, | |
241 | &pacing, sizeof(pacing)); | |
aeb199d5 | 242 | if (set_maxrate) |
bc113e46 ED |
243 | addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE, |
244 | &maxrate, sizeof(maxrate)); | |
ff28b751 ED |
245 | if (set_low_rate_threshold) |
246 | addattr_l(n, 1024, TCA_FQ_LOW_RATE_THRESHOLD, | |
247 | &low_rate_threshold, sizeof(low_rate_threshold)); | |
aeb199d5 | 248 | if (set_defrate) |
bc113e46 ED |
249 | addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE, |
250 | &defrate, sizeof(defrate)); | |
565af7b8 PS |
251 | if (set_refill_delay) |
252 | addattr_l(n, 1024, TCA_FQ_FLOW_REFILL_DELAY, | |
8fe98398 | 253 | &refill_delay, sizeof(refill_delay)); |
8d5bd8c3 ED |
254 | if (set_orphan_mask) |
255 | addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK, | |
78ace1c2 | 256 | &orphan_mask, sizeof(orphan_mask)); |
55e106c4 ED |
257 | if (set_ce_threshold) |
258 | addattr_l(n, 1024, TCA_FQ_CE_THRESHOLD, | |
259 | &ce_threshold, sizeof(ce_threshold)); | |
be9ca9d5 ED |
260 | if (set_timer_slack) |
261 | addattr_l(n, 1024, TCA_FQ_TIMER_SLACK, | |
262 | &timer_slack, sizeof(timer_slack)); | |
c14f9d92 | 263 | addattr_nest_end(n, tail); |
bc113e46 ED |
264 | return 0; |
265 | } | |
266 | ||
267 | static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) | |
268 | { | |
269 | struct rtattr *tb[TCA_FQ_MAX + 1]; | |
270 | unsigned int plimit, flow_plimit; | |
271 | unsigned int buckets_log; | |
272 | int pacing; | |
273 | unsigned int rate, quantum; | |
565af7b8 | 274 | unsigned int refill_delay; |
8d5bd8c3 | 275 | unsigned int orphan_mask; |
55e106c4 | 276 | unsigned int ce_threshold; |
be9ca9d5 | 277 | unsigned int timer_slack; |
32a121cb | 278 | |
bc113e46 ED |
279 | SPRINT_BUF(b1); |
280 | ||
281 | if (opt == NULL) | |
282 | return 0; | |
283 | ||
284 | parse_rtattr_nested(tb, TCA_FQ_MAX, opt); | |
285 | ||
286 | if (tb[TCA_FQ_PLIMIT] && | |
287 | RTA_PAYLOAD(tb[TCA_FQ_PLIMIT]) >= sizeof(__u32)) { | |
288 | plimit = rta_getattr_u32(tb[TCA_FQ_PLIMIT]); | |
d15e2bfc | 289 | print_uint(PRINT_ANY, "limit", "limit %up ", plimit); |
bc113e46 ED |
290 | } |
291 | if (tb[TCA_FQ_FLOW_PLIMIT] && | |
292 | RTA_PAYLOAD(tb[TCA_FQ_FLOW_PLIMIT]) >= sizeof(__u32)) { | |
293 | flow_plimit = rta_getattr_u32(tb[TCA_FQ_FLOW_PLIMIT]); | |
d15e2bfc LM |
294 | print_uint(PRINT_ANY, "flow_limit", "flow_limit %up ", |
295 | flow_plimit); | |
bc113e46 ED |
296 | } |
297 | if (tb[TCA_FQ_BUCKETS_LOG] && | |
298 | RTA_PAYLOAD(tb[TCA_FQ_BUCKETS_LOG]) >= sizeof(__u32)) { | |
299 | buckets_log = rta_getattr_u32(tb[TCA_FQ_BUCKETS_LOG]); | |
d15e2bfc LM |
300 | print_uint(PRINT_ANY, "buckets", "buckets %u ", |
301 | 1U << buckets_log); | |
bc113e46 | 302 | } |
8d5bd8c3 ED |
303 | if (tb[TCA_FQ_ORPHAN_MASK] && |
304 | RTA_PAYLOAD(tb[TCA_FQ_ORPHAN_MASK]) >= sizeof(__u32)) { | |
305 | orphan_mask = rta_getattr_u32(tb[TCA_FQ_ORPHAN_MASK]); | |
d15e2bfc LM |
306 | print_uint(PRINT_ANY, "orphan_mask", "orphan_mask %u ", |
307 | orphan_mask); | |
8d5bd8c3 | 308 | } |
bc113e46 ED |
309 | if (tb[TCA_FQ_RATE_ENABLE] && |
310 | RTA_PAYLOAD(tb[TCA_FQ_RATE_ENABLE]) >= sizeof(int)) { | |
311 | pacing = rta_getattr_u32(tb[TCA_FQ_RATE_ENABLE]); | |
312 | if (pacing == 0) | |
d15e2bfc | 313 | print_bool(PRINT_ANY, "pacing", "nopacing ", false); |
bc113e46 ED |
314 | } |
315 | if (tb[TCA_FQ_QUANTUM] && | |
316 | RTA_PAYLOAD(tb[TCA_FQ_QUANTUM]) >= sizeof(__u32)) { | |
317 | quantum = rta_getattr_u32(tb[TCA_FQ_QUANTUM]); | |
adbe5de9 | 318 | print_size(PRINT_ANY, "quantum", "quantum %s ", quantum); |
bc113e46 ED |
319 | } |
320 | if (tb[TCA_FQ_INITIAL_QUANTUM] && | |
321 | RTA_PAYLOAD(tb[TCA_FQ_INITIAL_QUANTUM]) >= sizeof(__u32)) { | |
322 | quantum = rta_getattr_u32(tb[TCA_FQ_INITIAL_QUANTUM]); | |
adbe5de9 PM |
323 | print_size(PRINT_ANY, "initial_quantum", "initial_quantum %s ", |
324 | quantum); | |
bc113e46 ED |
325 | } |
326 | if (tb[TCA_FQ_FLOW_MAX_RATE] && | |
327 | RTA_PAYLOAD(tb[TCA_FQ_FLOW_MAX_RATE]) >= sizeof(__u32)) { | |
328 | rate = rta_getattr_u32(tb[TCA_FQ_FLOW_MAX_RATE]); | |
329 | ||
60265cc2 PM |
330 | if (rate != ~0U) |
331 | tc_print_rate(PRINT_ANY, | |
332 | "maxrate", "maxrate %s ", rate); | |
bc113e46 ED |
333 | } |
334 | if (tb[TCA_FQ_FLOW_DEFAULT_RATE] && | |
335 | RTA_PAYLOAD(tb[TCA_FQ_FLOW_DEFAULT_RATE]) >= sizeof(__u32)) { | |
336 | rate = rta_getattr_u32(tb[TCA_FQ_FLOW_DEFAULT_RATE]); | |
337 | ||
60265cc2 PM |
338 | if (rate != 0) |
339 | tc_print_rate(PRINT_ANY, | |
340 | "defrate", "defrate %s ", rate); | |
bc113e46 | 341 | } |
ff28b751 ED |
342 | if (tb[TCA_FQ_LOW_RATE_THRESHOLD] && |
343 | RTA_PAYLOAD(tb[TCA_FQ_LOW_RATE_THRESHOLD]) >= sizeof(__u32)) { | |
344 | rate = rta_getattr_u32(tb[TCA_FQ_LOW_RATE_THRESHOLD]); | |
345 | ||
60265cc2 PM |
346 | if (rate != 0) |
347 | tc_print_rate(PRINT_ANY, "low_rate_threshold", | |
348 | "low_rate_threshold %s ", rate); | |
ff28b751 | 349 | } |
565af7b8 PS |
350 | if (tb[TCA_FQ_FLOW_REFILL_DELAY] && |
351 | RTA_PAYLOAD(tb[TCA_FQ_FLOW_REFILL_DELAY]) >= sizeof(__u32)) { | |
352 | refill_delay = rta_getattr_u32(tb[TCA_FQ_FLOW_REFILL_DELAY]); | |
d15e2bfc LM |
353 | print_uint(PRINT_JSON, "refill_delay", NULL, refill_delay); |
354 | print_string(PRINT_FP, NULL, "refill_delay %s ", | |
355 | sprint_time(refill_delay, b1)); | |
565af7b8 | 356 | } |
bc113e46 | 357 | |
55e106c4 ED |
358 | if (tb[TCA_FQ_CE_THRESHOLD] && |
359 | RTA_PAYLOAD(tb[TCA_FQ_CE_THRESHOLD]) >= sizeof(__u32)) { | |
360 | ce_threshold = rta_getattr_u32(tb[TCA_FQ_CE_THRESHOLD]); | |
d15e2bfc LM |
361 | if (ce_threshold != ~0U) { |
362 | print_uint(PRINT_JSON, "ce_threshold", NULL, | |
363 | ce_threshold); | |
364 | print_string(PRINT_FP, NULL, "ce_threshold %s ", | |
365 | sprint_time(ce_threshold, b1)); | |
366 | } | |
55e106c4 ED |
367 | } |
368 | ||
be9ca9d5 ED |
369 | if (tb[TCA_FQ_TIMER_SLACK] && |
370 | RTA_PAYLOAD(tb[TCA_FQ_TIMER_SLACK]) >= sizeof(__u32)) { | |
371 | timer_slack = rta_getattr_u32(tb[TCA_FQ_TIMER_SLACK]); | |
0ecb90b3 ED |
372 | print_uint(PRINT_JSON, "timer_slack", NULL, timer_slack); |
373 | print_string(PRINT_FP, NULL, "timer_slack %s ", | |
374 | sprint_time64(timer_slack, b1)); | |
be9ca9d5 ED |
375 | } |
376 | ||
bc113e46 ED |
377 | return 0; |
378 | } | |
379 | ||
380 | static int fq_print_xstats(struct qdisc_util *qu, FILE *f, | |
381 | struct rtattr *xstats) | |
382 | { | |
55e106c4 | 383 | struct tc_fq_qd_stats *st, _st; |
bc113e46 | 384 | |
d15e2bfc LM |
385 | SPRINT_BUF(b1); |
386 | ||
bc113e46 ED |
387 | if (xstats == NULL) |
388 | return 0; | |
389 | ||
55e106c4 ED |
390 | memset(&_st, 0, sizeof(_st)); |
391 | memcpy(&_st, RTA_DATA(xstats), min(RTA_PAYLOAD(xstats), sizeof(*st))); | |
bc113e46 | 392 | |
55e106c4 | 393 | st = &_st; |
bc113e46 | 394 | |
d15e2bfc LM |
395 | print_uint(PRINT_ANY, "flows", " flows %u", st->flows); |
396 | print_uint(PRINT_ANY, "inactive", " (inactive %u", st->inactive_flows); | |
397 | print_uint(PRINT_ANY, "throttled", " throttled %u)", | |
398 | st->throttled_flows); | |
bc113e46 | 399 | |
d15e2bfc LM |
400 | if (st->time_next_delayed_flow > 0) { |
401 | print_lluint(PRINT_JSON, "next_packet_delay", NULL, | |
402 | st->time_next_delayed_flow); | |
403 | print_string(PRINT_FP, NULL, " next_packet_delay %s", | |
404 | sprint_time64(st->time_next_delayed_flow, b1)); | |
405 | } | |
bc113e46 | 406 | |
d15e2bfc LM |
407 | print_nl(); |
408 | print_lluint(PRINT_ANY, "gc", " gc %llu", st->gc_flows); | |
409 | print_lluint(PRINT_ANY, "highprio", " highprio %llu", | |
410 | st->highprio_packets); | |
bc113e46 ED |
411 | |
412 | if (st->tcp_retrans) | |
d15e2bfc LM |
413 | print_lluint(PRINT_ANY, "retrans", " retrans %llu", |
414 | st->tcp_retrans); | |
bc113e46 | 415 | |
d15e2bfc | 416 | print_lluint(PRINT_ANY, "throttled", " throttled %llu", st->throttled); |
bc113e46 | 417 | |
d15e2bfc LM |
418 | if (st->unthrottle_latency_ns) { |
419 | print_uint(PRINT_JSON, "latency", NULL, | |
420 | st->unthrottle_latency_ns); | |
421 | print_string(PRINT_FP, NULL, " latency %s", | |
422 | sprint_time64(st->unthrottle_latency_ns, b1)); | |
423 | } | |
39f8caeb | 424 | |
55e106c4 | 425 | if (st->ce_mark) |
d15e2bfc LM |
426 | print_lluint(PRINT_ANY, "ce_mark", " ce_mark %llu", |
427 | st->ce_mark); | |
55e106c4 | 428 | |
bc113e46 | 429 | if (st->flows_plimit) |
d15e2bfc LM |
430 | print_lluint(PRINT_ANY, "flows_plimit", " flows_plimit %llu", |
431 | st->flows_plimit); | |
432 | ||
433 | if (st->pkts_too_long || st->allocation_errors) { | |
434 | print_nl(); | |
435 | print_lluint(PRINT_ANY, "pkts_too_long", | |
436 | " pkts_too_long %llu", st->pkts_too_long); | |
0ecb90b3 | 437 | print_lluint(PRINT_ANY, "alloc_errors", " alloc_errors %llu", |
d15e2bfc LM |
438 | st->allocation_errors); |
439 | } | |
bc113e46 ED |
440 | |
441 | return 0; | |
442 | } | |
443 | ||
444 | struct qdisc_util fq_qdisc_util = { | |
445 | .id = "fq", | |
446 | .parse_qopt = fq_parse_opt, | |
447 | .print_qopt = fq_print_opt, | |
448 | .print_xstats = fq_print_xstats, | |
449 | }; |