tc: fq: add horizon attributes
Commit 39d010504e6b ("net_sched: sch_fq: add horizon attribute")
added kernel support for horizon attributes in linux-5.8
$ tc -s -d qd sh dev wlp2s0
qdisc fq 8006: root refcnt 2 limit 10000p flow_limit 100p buckets 1024 orphan_mask 1023 quantum 3028b initial_quantum 15140b low_rate_threshold 550Kbit refill_delay 40ms timer_slack 10us horizon 10s horizon_drop
Sent 690924 bytes 3234 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
flows 112 (inactive 104 throttled 0)
gc 0 highprio 0 throttled 2 latency 8.25us
$ tc qd change dev wlp2s0 root fq horizon 500ms horizon_cap
$ tc -s -d qd sh dev wlp2s0
qdisc fq 8006: root refcnt 2 limit 10000p flow_limit 100p buckets 1024 orphan_mask 1023 quantum 3028b initial_quantum 15140b low_rate_threshold 550Kbit refill_delay 40ms timer_slack 10us horizon 500ms horizon_cap
Sent 831220 bytes 3844 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
flows 122 (inactive 120 throttled 0)
gc 0 highprio 0 throttled 2 latency 8.25us
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
parent
7ae2585b86
commit
52f136f640
66
tc/q_fq.c
66
tc/q_fq.c
|
|
@ -58,7 +58,9 @@ static void explain(void)
|
|||
" [ low_rate_threshold RATE ]\n"
|
||||
" [ orphan_mask MASK]\n"
|
||||
" [ timer_slack TIME]\n"
|
||||
" [ ce_threshold TIME ]\n");
|
||||
" [ ce_threshold TIME ]\n"
|
||||
" [ horizon TIME ]\n"
|
||||
" [ horizon_{cap|drop} ]\n");
|
||||
}
|
||||
|
||||
static unsigned int ilog2(unsigned int val)
|
||||
|
|
@ -88,6 +90,8 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
unsigned int orphan_mask;
|
||||
unsigned int ce_threshold;
|
||||
unsigned int timer_slack;
|
||||
unsigned int horizon;
|
||||
__u8 horizon_drop = 255;
|
||||
bool set_plimit = false;
|
||||
bool set_flow_plimit = false;
|
||||
bool set_quantum = false;
|
||||
|
|
@ -99,6 +103,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
bool set_low_rate_threshold = false;
|
||||
bool set_ce_threshold = false;
|
||||
bool set_timer_slack = false;
|
||||
bool set_horizon = false;
|
||||
int pacing = -1;
|
||||
struct rtattr *tail;
|
||||
|
||||
|
|
@ -163,6 +168,17 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
return -1;
|
||||
}
|
||||
set_timer_slack = true;
|
||||
} else if (strcmp(*argv, "horizon_drop") == 0) {
|
||||
horizon_drop = 1;
|
||||
} else if (strcmp(*argv, "horizon_cap") == 0) {
|
||||
horizon_drop = 0;
|
||||
} else if (strcmp(*argv, "horizon") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_time(&horizon, *argv)) {
|
||||
fprintf(stderr, "Illegal \"horizon\"\n");
|
||||
return -1;
|
||||
}
|
||||
set_horizon = true;
|
||||
} else if (strcmp(*argv, "defrate") == 0) {
|
||||
NEXT_ARG();
|
||||
if (strchr(*argv, '%')) {
|
||||
|
|
@ -260,6 +276,12 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
if (set_timer_slack)
|
||||
addattr_l(n, 1024, TCA_FQ_TIMER_SLACK,
|
||||
&timer_slack, sizeof(timer_slack));
|
||||
if (set_horizon)
|
||||
addattr_l(n, 1024, TCA_FQ_HORIZON,
|
||||
&horizon, sizeof(horizon));
|
||||
if (horizon_drop != 255)
|
||||
addattr_l(n, 1024, TCA_FQ_HORIZON_DROP,
|
||||
&horizon_drop, sizeof(horizon_drop));
|
||||
addattr_nest_end(n, tail);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -275,6 +297,8 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
|||
unsigned int orphan_mask;
|
||||
unsigned int ce_threshold;
|
||||
unsigned int timer_slack;
|
||||
unsigned int horizon;
|
||||
__u8 horizon_drop;
|
||||
|
||||
SPRINT_BUF(b1);
|
||||
|
||||
|
|
@ -374,6 +398,23 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
|||
sprint_time64(timer_slack, b1));
|
||||
}
|
||||
|
||||
if (tb[TCA_FQ_HORIZON] &&
|
||||
RTA_PAYLOAD(tb[TCA_FQ_HORIZON]) >= sizeof(__u32)) {
|
||||
horizon = rta_getattr_u32(tb[TCA_FQ_HORIZON]);
|
||||
print_uint(PRINT_JSON, "horizon", NULL, horizon);
|
||||
print_string(PRINT_FP, NULL, "horizon %s ",
|
||||
sprint_time(horizon, b1));
|
||||
}
|
||||
|
||||
if (tb[TCA_FQ_HORIZON_DROP] &&
|
||||
RTA_PAYLOAD(tb[TCA_FQ_HORIZON_DROP]) >= sizeof(__u8)) {
|
||||
horizon_drop = rta_getattr_u8(tb[TCA_FQ_HORIZON_DROP]);
|
||||
if (!horizon_drop)
|
||||
print_null(PRINT_ANY, "horizon_cap", "horizon_cap ", NULL);
|
||||
else
|
||||
print_null(PRINT_ANY, "horizon_drop", "horizon_drop ", NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -430,12 +471,25 @@ static int fq_print_xstats(struct qdisc_util *qu, FILE *f,
|
|||
print_lluint(PRINT_ANY, "flows_plimit", " flows_plimit %llu",
|
||||
st->flows_plimit);
|
||||
|
||||
if (st->pkts_too_long || st->allocation_errors) {
|
||||
if (st->pkts_too_long || st->allocation_errors ||
|
||||
st->horizon_drops || st->horizon_caps) {
|
||||
print_nl();
|
||||
print_lluint(PRINT_ANY, "pkts_too_long",
|
||||
" pkts_too_long %llu", st->pkts_too_long);
|
||||
print_lluint(PRINT_ANY, "alloc_errors", " alloc_errors %llu",
|
||||
st->allocation_errors);
|
||||
if (st->pkts_too_long)
|
||||
print_lluint(PRINT_ANY, "pkts_too_long",
|
||||
" pkts_too_long %llu",
|
||||
st->pkts_too_long);
|
||||
if (st->allocation_errors)
|
||||
print_lluint(PRINT_ANY, "alloc_errors",
|
||||
" alloc_errors %llu",
|
||||
st->allocation_errors);
|
||||
if (st->horizon_drops)
|
||||
print_lluint(PRINT_ANY, "horizon_drops",
|
||||
" horizon_drops %llu",
|
||||
st->horizon_drops);
|
||||
if (st->horizon_caps)
|
||||
print_lluint(PRINT_ANY, "horizon_caps",
|
||||
" horizon_caps %llu",
|
||||
st->horizon_caps);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue