summaryrefslogtreecommitdiff
path: root/tc/q_fq_codel.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-05-11 10:44:55 -0700
committerStephen Hemminger <shemming@brocade.com>2015-05-21 15:25:05 -0700
commitdf1c7d9138eafd5b96e81040b0c1475b6d73d158 (patch)
tree29369e0b43636c49c26b0fad20acab4780008af8 /tc/q_fq_codel.c
parent30eb304ecd1dd7e452847fabea779de0dbe3f1a5 (diff)
codel: add ce_threshold support to codel & fc_codel
codel & fq_codel packet schedulers are now able to have a threshold for CE marking packets, regardless of the drop/nodrop decision taken by CoDel. This is particularly useful for dctcp and variants, that do not use traditional ECN. Note that fq_codel users would have to specify noecn if ce_threshold is used, otherwise results would be not very interesting, as ecn is default on for fq_codel. $ tc -s qdisc show dev eth1 qdisc codel 8002: root refcnt 45 limit 1000p target 5.0ms ce_threshold 1.0ms interval 100.0ms Sent 4908469888317 bytes 3351813967 pkt (dropped 0, overlimits 0 requeues 21624365) rate 37671Mbit 3231836pps backlog 4904740b 250p requeues 21624365 count 0 lastcount 0 ldelay 1.1ms drop_next 0us maxpacket 68130 ecn_mark 0 drop_overlimit 0 ce_mark 410861803 Signed-off-by: Eric Dumazet <edumazet@google.com>
Diffstat (limited to 'tc/q_fq_codel.c')
-rw-r--r--tc/q_fq_codel.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/tc/q_fq_codel.c b/tc/q_fq_codel.c
index 1d3bfa2a..4f747ebd 100644
--- a/tc/q_fq_codel.c
+++ b/tc/q_fq_codel.c
@@ -1,7 +1,7 @@
/*
* Fair Queue Codel
*
- * Copyright (C) 2012 Eric Dumazet <edumazet@google.com>
+ * Copyright (C) 2012,2015 Eric Dumazet <edumazet@google.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -53,6 +53,7 @@ static void explain(void)
fprintf(stderr, "Usage: ... fq_codel [ limit PACKETS ] [ flows NUMBER ]\n");
fprintf(stderr, " [ target TIME] [ interval TIME ]\n");
fprintf(stderr, " [ quantum BYTES ] [ [no]ecn ]\n");
+ fprintf(stderr, " [ ce_threshold TIME ]\n");
}
static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
@@ -63,6 +64,7 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
unsigned target = 0;
unsigned interval = 0;
unsigned quantum = 0;
+ unsigned ce_threshold = ~0U;
int ecn = -1;
struct rtattr *tail;
@@ -91,6 +93,12 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"target\"\n");
return -1;
}
+ } else if (strcmp(*argv, "ce_threshold") == 0) {
+ NEXT_ARG();
+ if (get_time(&ce_threshold, *argv)) {
+ fprintf(stderr, "Illegal \"ce_threshold\"\n");
+ return -1;
+ }
} else if (strcmp(*argv, "interval") == 0) {
NEXT_ARG();
if (get_time(&interval, *argv)) {
@@ -126,6 +134,9 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
addattr_l(n, 1024, TCA_FQ_CODEL_TARGET, &target, sizeof(target));
if (ecn != -1)
addattr_l(n, 1024, TCA_FQ_CODEL_ECN, &ecn, sizeof(ecn));
+ if (ce_threshold != ~0U)
+ addattr_l(n, 1024, TCA_FQ_CODEL_CE_THRESHOLD,
+ &ce_threshold, sizeof(ce_threshold));
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
return 0;
}
@@ -139,6 +150,7 @@ static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt
unsigned target;
unsigned ecn;
unsigned quantum;
+ unsigned ce_threshold;
SPRINT_BUF(b1);
if (opt == NULL)
@@ -166,6 +178,11 @@ static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt
target = rta_getattr_u32(tb[TCA_FQ_CODEL_TARGET]);
fprintf(f, "target %s ", sprint_time(target, b1));
}
+ if (tb[TCA_FQ_CODEL_CE_THRESHOLD] &&
+ RTA_PAYLOAD(tb[TCA_FQ_CODEL_CE_THRESHOLD]) >= sizeof(__u32)) {
+ ce_threshold = rta_getattr_u32(tb[TCA_FQ_CODEL_CE_THRESHOLD]);
+ fprintf(f, "ce_threshold %s ", sprint_time(ce_threshold, b1));
+ }
if (tb[TCA_FQ_CODEL_INTERVAL] &&
RTA_PAYLOAD(tb[TCA_FQ_CODEL_INTERVAL]) >= sizeof(__u32)) {
interval = rta_getattr_u32(tb[TCA_FQ_CODEL_INTERVAL]);
@@ -184,22 +201,26 @@ static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt
static int fq_codel_print_xstats(struct qdisc_util *qu, FILE *f,
struct rtattr *xstats)
{
- struct tc_fq_codel_xstats *st;
+ struct tc_fq_codel_xstats _st, *st;
SPRINT_BUF(b1);
if (xstats == NULL)
return 0;
- if (RTA_PAYLOAD(xstats) < sizeof(*st))
- return -1;
-
st = RTA_DATA(xstats);
+ if (RTA_PAYLOAD(xstats) < sizeof(*st)) {
+ memset(&_st, 0, sizeof(_st));
+ memcpy(&_st, st, RTA_PAYLOAD(xstats));
+ st = &_st;
+ }
if (st->type == TCA_FQ_CODEL_XSTATS_QDISC) {
fprintf(f, " maxpacket %u drop_overlimit %u new_flow_count %u ecn_mark %u",
st->qdisc_stats.maxpacket,
st->qdisc_stats.drop_overlimit,
st->qdisc_stats.new_flow_count,
st->qdisc_stats.ecn_mark);
+ if (st->qdisc_stats.ce_mark)
+ fprintf(f, " ce_mark %u", st->qdisc_stats.ce_mark);
fprintf(f, "\n new_flows_len %u old_flows_len %u",
st->qdisc_stats.new_flows_len,
st->qdisc_stats.old_flows_len);