aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2020-04-27 11:05:43 -0700
committerStephen Hemminger <stephen@networkplumber.org>2020-04-27 14:56:42 -0700
commitbe9ca9d541232112ed3a878ddfe0a5829bf0e887 (patch)
treeabf4686609b5e509b9cafa6cd15a48533a85b8ae
parent7868f802e2d93a9f6e2d64a6fc608445a33c8a8d (diff)
downloadiproute2-be9ca9d541232112ed3a878ddfe0a5829bf0e887.tar.gz
tc: fq: add timer_slack parameter
Commit 583396f4ca4d ("net_sched: sch_fq: enable use of hrtimer slack") added TCA_FQ_TIMER_SLACK parameter, with a default value of 10 usec. Add the corresponding tc support to get/set this tunable. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--tc/q_fq.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tc/q_fq.c b/tc/q_fq.c
index 44d8a7e03..ffae0523b 100644
--- a/tc/q_fq.c
+++ b/tc/q_fq.c
@@ -57,6 +57,7 @@ static void explain(void)
" [ [no]pacing ] [ refill_delay TIME ]\n"
" [ low_rate_threshold RATE ]\n"
" [ orphan_mask MASK]\n"
+ " [ timer_slack TIME]\n"
" [ ce_threshold TIME ]\n");
}
@@ -86,6 +87,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
unsigned int refill_delay;
unsigned int orphan_mask;
unsigned int ce_threshold;
+ unsigned int timer_slack;
bool set_plimit = false;
bool set_flow_plimit = false;
bool set_quantum = false;
@@ -96,6 +98,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
bool set_orphan_mask = false;
bool set_low_rate_threshold = false;
bool set_ce_threshold = false;
+ bool set_timer_slack = false;
int pacing = -1;
struct rtattr *tail;
@@ -146,6 +149,20 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
return -1;
}
set_ce_threshold = true;
+ } else if (strcmp(*argv, "timer_slack") == 0) {
+ __s64 t64;
+
+ NEXT_ARG();
+ if (get_time64(&t64, *argv)) {
+ fprintf(stderr, "Illegal \"timer_slack\"\n");
+ return -1;
+ }
+ timer_slack = t64;
+ if (timer_slack != t64) {
+ fprintf(stderr, "Illegal (out of range) \"timer_slack\"\n");
+ return -1;
+ }
+ set_timer_slack = true;
} else if (strcmp(*argv, "defrate") == 0) {
NEXT_ARG();
if (strchr(*argv, '%')) {
@@ -240,6 +257,9 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
if (set_ce_threshold)
addattr_l(n, 1024, TCA_FQ_CE_THRESHOLD,
&ce_threshold, sizeof(ce_threshold));
+ if (set_timer_slack)
+ addattr_l(n, 1024, TCA_FQ_TIMER_SLACK,
+ &timer_slack, sizeof(timer_slack));
addattr_nest_end(n, tail);
return 0;
}
@@ -254,6 +274,7 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
unsigned int refill_delay;
unsigned int orphan_mask;
unsigned int ce_threshold;
+ unsigned int timer_slack;
SPRINT_BUF(b1);
@@ -355,6 +376,12 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
}
}
+ if (tb[TCA_FQ_TIMER_SLACK] &&
+ RTA_PAYLOAD(tb[TCA_FQ_TIMER_SLACK]) >= sizeof(__u32)) {
+ timer_slack = rta_getattr_u32(tb[TCA_FQ_TIMER_SLACK]);
+ fprintf(f, "timer_slack %s ", sprint_time64(timer_slack, b1));
+ }
+
return 0;
}