2013-08-30 10:30:36 +08:00
|
|
|
/*
|
|
|
|
* Fair Queue
|
|
|
|
*
|
2015-09-24 19:43:26 +08:00
|
|
|
* Copyright (C) 2013-2015 Eric Dumazet <edumazet@google.com>
|
2013-08-30 10:30:36 +08:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The names of the authors may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, provided that this notice is retained in full, this
|
|
|
|
* software may be distributed under the terms of the GNU General
|
|
|
|
* Public License ("GPL") version 2, in which case the provisions of the
|
|
|
|
* GPL apply INSTEAD OF those given above.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
|
|
* DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <string.h>
|
2014-05-29 12:04:34 +08:00
|
|
|
#include <stdbool.h>
|
2013-08-30 10:30:36 +08:00
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
#include "tc_util.h"
|
|
|
|
|
|
|
|
static void explain(void)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Usage: ... fq [ limit PACKETS ] [ flow_limit PACKETS ]\n");
|
|
|
|
fprintf(stderr, " [ quantum BYTES ] [ initial_quantum BYTES ]\n");
|
|
|
|
fprintf(stderr, " [ maxrate RATE ] [ buckets NUMBER ]\n");
|
2015-09-10 22:25:47 +08:00
|
|
|
fprintf(stderr, " [ [no]pacing ] [ refill_delay TIME ]\n");
|
2017-09-09 05:12:59 +08:00
|
|
|
fprintf(stderr, " [ low_rate_threshold RATE ]\n");
|
2015-09-24 19:43:26 +08:00
|
|
|
fprintf(stderr, " [ orphan_mask MASK]\n");
|
2018-11-24 14:37:24 +08:00
|
|
|
fprintf(stderr, " [ ce_threshold TIME ]\n");
|
2013-08-30 10:30:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned int ilog2(unsigned int val)
|
|
|
|
{
|
|
|
|
unsigned int res = 0;
|
|
|
|
|
|
|
|
val--;
|
|
|
|
while (val) {
|
|
|
|
res++;
|
|
|
|
val >>= 1;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
2017-11-21 10:20:47 +08:00
|
|
|
struct nlmsghdr *n, const char *dev)
|
2013-08-30 10:30:36 +08:00
|
|
|
{
|
2014-05-29 12:04:34 +08:00
|
|
|
unsigned int plimit;
|
|
|
|
unsigned int flow_plimit;
|
|
|
|
unsigned int quantum;
|
|
|
|
unsigned int initial_quantum;
|
2013-08-30 10:30:36 +08:00
|
|
|
unsigned int buckets = 0;
|
2014-05-29 12:04:34 +08:00
|
|
|
unsigned int maxrate;
|
2017-09-09 05:12:59 +08:00
|
|
|
unsigned int low_rate_threshold;
|
2014-05-29 12:04:34 +08:00
|
|
|
unsigned int defrate;
|
2015-09-10 22:25:47 +08:00
|
|
|
unsigned int refill_delay;
|
2015-09-24 19:43:26 +08:00
|
|
|
unsigned int orphan_mask;
|
2018-11-24 14:37:24 +08:00
|
|
|
unsigned int ce_threshold;
|
2014-05-29 12:04:34 +08:00
|
|
|
bool set_plimit = false;
|
|
|
|
bool set_flow_plimit = false;
|
|
|
|
bool set_quantum = false;
|
|
|
|
bool set_initial_quantum = false;
|
|
|
|
bool set_maxrate = false;
|
|
|
|
bool set_defrate = false;
|
2015-09-10 22:25:47 +08:00
|
|
|
bool set_refill_delay = false;
|
2015-09-24 19:43:26 +08:00
|
|
|
bool set_orphan_mask = false;
|
2017-09-09 05:12:59 +08:00
|
|
|
bool set_low_rate_threshold = false;
|
2018-11-24 14:37:24 +08:00
|
|
|
bool set_ce_threshold = false;
|
2013-08-30 10:30:36 +08:00
|
|
|
int pacing = -1;
|
|
|
|
struct rtattr *tail;
|
|
|
|
|
|
|
|
while (argc > 0) {
|
|
|
|
if (strcmp(*argv, "limit") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_unsigned(&plimit, *argv, 0)) {
|
|
|
|
fprintf(stderr, "Illegal \"limit\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2014-05-29 12:04:34 +08:00
|
|
|
set_plimit = true;
|
2013-08-30 10:30:36 +08:00
|
|
|
} else if (strcmp(*argv, "flow_limit") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_unsigned(&flow_plimit, *argv, 0)) {
|
|
|
|
fprintf(stderr, "Illegal \"flow_limit\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2014-05-29 12:04:34 +08:00
|
|
|
set_flow_plimit = true;
|
2013-08-30 10:30:36 +08:00
|
|
|
} else if (strcmp(*argv, "buckets") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_unsigned(&buckets, *argv, 0)) {
|
|
|
|
fprintf(stderr, "Illegal \"buckets\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else if (strcmp(*argv, "maxrate") == 0) {
|
|
|
|
NEXT_ARG();
|
2017-11-21 10:20:47 +08:00
|
|
|
if (strchr(*argv, '%')) {
|
|
|
|
if (get_percent_rate(&maxrate, *argv, dev)) {
|
|
|
|
fprintf(stderr, "Illegal \"maxrate\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else if (get_rate(&maxrate, *argv)) {
|
2013-08-30 10:30:36 +08:00
|
|
|
fprintf(stderr, "Illegal \"maxrate\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2014-05-29 12:04:34 +08:00
|
|
|
set_maxrate = true;
|
2017-09-09 05:12:59 +08:00
|
|
|
} else if (strcmp(*argv, "low_rate_threshold") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_rate(&low_rate_threshold, *argv)) {
|
|
|
|
fprintf(stderr, "Illegal \"low_rate_threshold\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
set_low_rate_threshold = true;
|
2018-11-24 14:37:24 +08:00
|
|
|
} else if (strcmp(*argv, "ce_threshold") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_time(&ce_threshold, *argv)) {
|
|
|
|
fprintf(stderr, "Illegal \"ce_threshold\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
set_ce_threshold = true;
|
2013-08-30 10:30:36 +08:00
|
|
|
} else if (strcmp(*argv, "defrate") == 0) {
|
|
|
|
NEXT_ARG();
|
2017-11-21 10:20:47 +08:00
|
|
|
if (strchr(*argv, '%')) {
|
|
|
|
if (get_percent_rate(&defrate, *argv, dev)) {
|
|
|
|
fprintf(stderr, "Illegal \"defrate\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else if (get_rate(&defrate, *argv)) {
|
2013-08-30 10:30:36 +08:00
|
|
|
fprintf(stderr, "Illegal \"defrate\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2014-05-29 12:04:34 +08:00
|
|
|
set_defrate = true;
|
2013-08-30 10:30:36 +08:00
|
|
|
} else if (strcmp(*argv, "quantum") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_unsigned(&quantum, *argv, 0)) {
|
|
|
|
fprintf(stderr, "Illegal \"quantum\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2014-05-29 12:04:34 +08:00
|
|
|
set_quantum = true;
|
2013-08-30 10:30:36 +08:00
|
|
|
} else if (strcmp(*argv, "initial_quantum") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_unsigned(&initial_quantum, *argv, 0)) {
|
|
|
|
fprintf(stderr, "Illegal \"initial_quantum\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2014-05-29 12:04:34 +08:00
|
|
|
set_initial_quantum = true;
|
2015-09-24 19:43:26 +08:00
|
|
|
} else if (strcmp(*argv, "orphan_mask") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_unsigned(&orphan_mask, *argv, 0)) {
|
|
|
|
fprintf(stderr, "Illegal \"initial_quantum\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
set_orphan_mask = true;
|
2015-09-10 22:25:47 +08:00
|
|
|
} else if (strcmp(*argv, "refill_delay") == 0) {
|
|
|
|
NEXT_ARG();
|
|
|
|
if (get_time(&refill_delay, *argv)) {
|
|
|
|
fprintf(stderr, "Illegal \"refill_delay\"\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
set_refill_delay = true;
|
2013-08-30 10:30:36 +08:00
|
|
|
} else if (strcmp(*argv, "pacing") == 0) {
|
|
|
|
pacing = 1;
|
|
|
|
} else if (strcmp(*argv, "nopacing") == 0) {
|
|
|
|
pacing = 0;
|
|
|
|
} else if (strcmp(*argv, "help") == 0) {
|
|
|
|
explain();
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "What is \"%s\"?\n", *argv);
|
|
|
|
explain();
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
argc--; argv++;
|
|
|
|
}
|
|
|
|
|
2018-01-31 16:15:08 +08:00
|
|
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
2013-08-30 10:30:36 +08:00
|
|
|
if (buckets) {
|
|
|
|
unsigned int log = ilog2(buckets);
|
|
|
|
|
|
|
|
addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG,
|
|
|
|
&log, sizeof(log));
|
|
|
|
}
|
2014-05-29 12:04:34 +08:00
|
|
|
if (set_plimit)
|
2013-08-30 10:30:36 +08:00
|
|
|
addattr_l(n, 1024, TCA_FQ_PLIMIT,
|
|
|
|
&plimit, sizeof(plimit));
|
2014-05-29 12:04:34 +08:00
|
|
|
if (set_flow_plimit)
|
2013-08-30 10:30:36 +08:00
|
|
|
addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT,
|
|
|
|
&flow_plimit, sizeof(flow_plimit));
|
2014-05-29 12:04:34 +08:00
|
|
|
if (set_quantum)
|
2013-08-30 10:30:36 +08:00
|
|
|
addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum));
|
2014-05-29 12:04:34 +08:00
|
|
|
if (set_initial_quantum)
|
2013-08-30 10:30:36 +08:00
|
|
|
addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM,
|
|
|
|
&initial_quantum, sizeof(initial_quantum));
|
|
|
|
if (pacing != -1)
|
|
|
|
addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
|
|
|
|
&pacing, sizeof(pacing));
|
2014-05-29 12:04:34 +08:00
|
|
|
if (set_maxrate)
|
2013-08-30 10:30:36 +08:00
|
|
|
addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
|
|
|
|
&maxrate, sizeof(maxrate));
|
2017-09-09 05:12:59 +08:00
|
|
|
if (set_low_rate_threshold)
|
|
|
|
addattr_l(n, 1024, TCA_FQ_LOW_RATE_THRESHOLD,
|
|
|
|
&low_rate_threshold, sizeof(low_rate_threshold));
|
2014-05-29 12:04:34 +08:00
|
|
|
if (set_defrate)
|
2013-08-30 10:30:36 +08:00
|
|
|
addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE,
|
|
|
|
&defrate, sizeof(defrate));
|
2015-09-10 22:25:47 +08:00
|
|
|
if (set_refill_delay)
|
|
|
|
addattr_l(n, 1024, TCA_FQ_FLOW_REFILL_DELAY,
|
2015-09-26 03:40:00 +08:00
|
|
|
&refill_delay, sizeof(refill_delay));
|
2015-09-24 19:43:26 +08:00
|
|
|
if (set_orphan_mask)
|
|
|
|
addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK,
|
2015-09-26 03:40:00 +08:00
|
|
|
&orphan_mask, sizeof(refill_delay));
|
2018-11-24 14:37:24 +08:00
|
|
|
if (set_ce_threshold)
|
|
|
|
addattr_l(n, 1024, TCA_FQ_CE_THRESHOLD,
|
|
|
|
&ce_threshold, sizeof(ce_threshold));
|
2018-01-31 16:15:08 +08:00
|
|
|
addattr_nest_end(n, tail);
|
2013-08-30 10:30:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
|
|
|
{
|
|
|
|
struct rtattr *tb[TCA_FQ_MAX + 1];
|
|
|
|
unsigned int plimit, flow_plimit;
|
|
|
|
unsigned int buckets_log;
|
|
|
|
int pacing;
|
|
|
|
unsigned int rate, quantum;
|
2015-09-10 22:25:47 +08:00
|
|
|
unsigned int refill_delay;
|
2015-09-24 19:43:26 +08:00
|
|
|
unsigned int orphan_mask;
|
2018-11-24 14:37:24 +08:00
|
|
|
unsigned int ce_threshold;
|
2016-03-22 02:48:36 +08:00
|
|
|
|
2013-08-30 10:30:36 +08:00
|
|
|
SPRINT_BUF(b1);
|
|
|
|
|
|
|
|
if (opt == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
parse_rtattr_nested(tb, TCA_FQ_MAX, opt);
|
|
|
|
|
|
|
|
if (tb[TCA_FQ_PLIMIT] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_PLIMIT]) >= sizeof(__u32)) {
|
|
|
|
plimit = rta_getattr_u32(tb[TCA_FQ_PLIMIT]);
|
|
|
|
fprintf(f, "limit %up ", plimit);
|
|
|
|
}
|
|
|
|
if (tb[TCA_FQ_FLOW_PLIMIT] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_FLOW_PLIMIT]) >= sizeof(__u32)) {
|
|
|
|
flow_plimit = rta_getattr_u32(tb[TCA_FQ_FLOW_PLIMIT]);
|
|
|
|
fprintf(f, "flow_limit %up ", flow_plimit);
|
|
|
|
}
|
|
|
|
if (tb[TCA_FQ_BUCKETS_LOG] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_BUCKETS_LOG]) >= sizeof(__u32)) {
|
|
|
|
buckets_log = rta_getattr_u32(tb[TCA_FQ_BUCKETS_LOG]);
|
|
|
|
fprintf(f, "buckets %u ", 1U << buckets_log);
|
|
|
|
}
|
2015-09-24 19:43:26 +08:00
|
|
|
if (tb[TCA_FQ_ORPHAN_MASK] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_ORPHAN_MASK]) >= sizeof(__u32)) {
|
|
|
|
orphan_mask = rta_getattr_u32(tb[TCA_FQ_ORPHAN_MASK]);
|
|
|
|
fprintf(f, "orphan_mask %u ", orphan_mask);
|
|
|
|
}
|
2013-08-30 10:30:36 +08:00
|
|
|
if (tb[TCA_FQ_RATE_ENABLE] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_RATE_ENABLE]) >= sizeof(int)) {
|
|
|
|
pacing = rta_getattr_u32(tb[TCA_FQ_RATE_ENABLE]);
|
|
|
|
if (pacing == 0)
|
|
|
|
fprintf(f, "nopacing ");
|
|
|
|
}
|
|
|
|
if (tb[TCA_FQ_QUANTUM] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_QUANTUM]) >= sizeof(__u32)) {
|
|
|
|
quantum = rta_getattr_u32(tb[TCA_FQ_QUANTUM]);
|
|
|
|
fprintf(f, "quantum %u ", quantum);
|
|
|
|
}
|
|
|
|
if (tb[TCA_FQ_INITIAL_QUANTUM] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_INITIAL_QUANTUM]) >= sizeof(__u32)) {
|
|
|
|
quantum = rta_getattr_u32(tb[TCA_FQ_INITIAL_QUANTUM]);
|
|
|
|
fprintf(f, "initial_quantum %u ", quantum);
|
|
|
|
}
|
|
|
|
if (tb[TCA_FQ_FLOW_MAX_RATE] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_FLOW_MAX_RATE]) >= sizeof(__u32)) {
|
|
|
|
rate = rta_getattr_u32(tb[TCA_FQ_FLOW_MAX_RATE]);
|
|
|
|
|
|
|
|
if (rate != ~0U)
|
|
|
|
fprintf(f, "maxrate %s ", sprint_rate(rate, b1));
|
|
|
|
}
|
|
|
|
if (tb[TCA_FQ_FLOW_DEFAULT_RATE] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_FLOW_DEFAULT_RATE]) >= sizeof(__u32)) {
|
|
|
|
rate = rta_getattr_u32(tb[TCA_FQ_FLOW_DEFAULT_RATE]);
|
|
|
|
|
|
|
|
if (rate != 0)
|
|
|
|
fprintf(f, "defrate %s ", sprint_rate(rate, b1));
|
|
|
|
}
|
2017-09-09 05:12:59 +08:00
|
|
|
if (tb[TCA_FQ_LOW_RATE_THRESHOLD] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_LOW_RATE_THRESHOLD]) >= sizeof(__u32)) {
|
|
|
|
rate = rta_getattr_u32(tb[TCA_FQ_LOW_RATE_THRESHOLD]);
|
|
|
|
|
|
|
|
if (rate != 0)
|
|
|
|
fprintf(f, "low_rate_threshold %s ", sprint_rate(rate, b1));
|
|
|
|
}
|
2015-09-10 22:25:47 +08:00
|
|
|
if (tb[TCA_FQ_FLOW_REFILL_DELAY] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_FLOW_REFILL_DELAY]) >= sizeof(__u32)) {
|
|
|
|
refill_delay = rta_getattr_u32(tb[TCA_FQ_FLOW_REFILL_DELAY]);
|
|
|
|
fprintf(f, "refill_delay %s ", sprint_time(refill_delay, b1));
|
|
|
|
}
|
2013-08-30 10:30:36 +08:00
|
|
|
|
2018-11-24 14:37:24 +08:00
|
|
|
if (tb[TCA_FQ_CE_THRESHOLD] &&
|
|
|
|
RTA_PAYLOAD(tb[TCA_FQ_CE_THRESHOLD]) >= sizeof(__u32)) {
|
|
|
|
ce_threshold = rta_getattr_u32(tb[TCA_FQ_CE_THRESHOLD]);
|
|
|
|
if (ce_threshold != ~0U)
|
|
|
|
fprintf(f, "ce_threshold %s ", sprint_time(ce_threshold, b1));
|
|
|
|
}
|
|
|
|
|
2013-08-30 10:30:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int fq_print_xstats(struct qdisc_util *qu, FILE *f,
|
|
|
|
struct rtattr *xstats)
|
|
|
|
{
|
2018-11-24 14:37:24 +08:00
|
|
|
struct tc_fq_qd_stats *st, _st;
|
2013-08-30 10:30:36 +08:00
|
|
|
|
|
|
|
if (xstats == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2018-11-24 14:37:24 +08:00
|
|
|
memset(&_st, 0, sizeof(_st));
|
|
|
|
memcpy(&_st, RTA_DATA(xstats), min(RTA_PAYLOAD(xstats), sizeof(*st)));
|
2013-08-30 10:30:36 +08:00
|
|
|
|
2018-11-24 14:37:24 +08:00
|
|
|
st = &_st;
|
2013-08-30 10:30:36 +08:00
|
|
|
|
|
|
|
fprintf(f, " %u flows (%u inactive, %u throttled)",
|
|
|
|
st->flows, st->inactive_flows, st->throttled_flows);
|
|
|
|
|
|
|
|
if (st->time_next_delayed_flow > 0)
|
|
|
|
fprintf(f, ", next packet delay %llu ns", st->time_next_delayed_flow);
|
|
|
|
|
|
|
|
fprintf(f, "\n %llu gc, %llu highprio",
|
|
|
|
st->gc_flows, st->highprio_packets);
|
|
|
|
|
|
|
|
if (st->tcp_retrans)
|
|
|
|
fprintf(f, ", %llu retrans", st->tcp_retrans);
|
|
|
|
|
|
|
|
fprintf(f, ", %llu throttled", st->throttled);
|
|
|
|
|
2016-09-28 21:23:15 +08:00
|
|
|
if (st->unthrottle_latency_ns)
|
|
|
|
fprintf(f, ", %u ns latency", st->unthrottle_latency_ns);
|
|
|
|
|
2018-11-24 14:37:24 +08:00
|
|
|
if (st->ce_mark)
|
|
|
|
fprintf(f, ", %llu ce_mark", st->ce_mark);
|
|
|
|
|
2013-08-30 10:30:36 +08:00
|
|
|
if (st->flows_plimit)
|
|
|
|
fprintf(f, ", %llu flows_plimit", st->flows_plimit);
|
|
|
|
|
|
|
|
if (st->pkts_too_long || st->allocation_errors)
|
|
|
|
fprintf(f, "\n %llu too long pkts, %llu alloc errors\n",
|
|
|
|
st->pkts_too_long, st->allocation_errors);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct qdisc_util fq_qdisc_util = {
|
|
|
|
.id = "fq",
|
|
|
|
.parse_qopt = fq_parse_opt,
|
|
|
|
.print_qopt = fq_print_opt,
|
|
|
|
.print_xstats = fq_print_xstats,
|
|
|
|
};
|