From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by huchra.bufferbloat.net (Postfix) with ESMTPS id 7B08A200CCC for ; Sat, 5 May 2012 12:47:43 -0700 (PDT) Received: by wibhn6 with SMTP id hn6so2128928wib.10 for ; Sat, 05 May 2012 12:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=0oZj3FgvktaMy7w5c32GEUPdECVNr0m8qde8oMyjSR4=; b=ywQgc+Rv2/c4bymgfsmQ+7CpYHMlsf6p0IYZf450T5CVqTxeKATMpxe5TgDHc00152 6hgQkbhaGHzyd6NI6A3WJbv+le72+1qzYXidWS5TwtwwAL6NrWY1OCBVbxF0TlT23epH SMeECVWj9sG+Okh/EXeRgQNDkPJRm23Uq4V73fUgCFVr+vQPlgHzRM1POYkbZK9QO7dN LSY4J0KLaNjKVjS0EUJ8CpzzHU6nyE47eH/k8+RWUbVBBuEl1POhMuJcQ1eoROHIRUx5 JbxdSPCAc0PcXzy9w+VuRFN16EZkshZKxtU1xxrameHztT6yGVmCgUXEn2r2/ddPruQ2 oVfQ== MIME-Version: 1.0 Received: by 10.216.141.134 with SMTP id g6mr4056804wej.12.1336247260527; Sat, 05 May 2012 12:47:40 -0700 (PDT) Received: by 10.223.112.66 with HTTP; Sat, 5 May 2012 12:47:40 -0700 (PDT) In-Reply-To: <1336246349-20228-1-git-send-email-dave.taht@bufferbloat.net> References: <1336246349-20228-1-git-send-email-dave.taht@bufferbloat.net> Date: Sat, 5 May 2012 12:47:40 -0700 Message-ID: From: Dave Taht To: Dave Taht Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Eric Dumazet , codel@lists.bufferbloat.net Subject: Re: [Codel] [PATCH 1/2] codel: Controlled Delay AQM X-BeenThere: codel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: CoDel AQM discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 May 2012 19:47:44 -0000 On Sat, May 5, 2012 at 12:32 PM, Dave Taht wrot= e: > From: Dave T=E4ht > > tc qdisc ... codel [ limit PACKETS ] [ target TIME] > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 [ interval TIME ] [ minbytes BYTES ] > > Signed-off-by: Eric Dumazet > Signed-off-by: Dave T=E4ht > --- > =A0include/linux/pkt_sched.h | =A0 14 +++++ > =A0tc/Makefile =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A01 + > =A0tc/q_codel.c =A0 =A0 =A0 =A0 =A0 =A0 =A0| =A0136 +++++++++++++++++++++= ++++++++++++++++++++++++ > =A03 files changed, 151 insertions(+) > =A0create mode 100644 tc/q_codel.c > > diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h > index 410b33d..62a73bf 100644 > --- a/include/linux/pkt_sched.h > +++ b/include/linux/pkt_sched.h > @@ -509,6 +509,7 @@ enum { > =A0 =A0 =A0 =A0TCA_NETEM_CORRUPT, > =A0 =A0 =A0 =A0TCA_NETEM_LOSS, > =A0 =A0 =A0 =A0TCA_NETEM_RATE, > + =A0 =A0 =A0 TCA_NETEM_ECN, > =A0 =A0 =A0 =A0__TCA_NETEM_MAX, > =A0}; > > @@ -654,4 +655,17 @@ struct tc_qfq_stats { > =A0 =A0 =A0 =A0__u32 lmax; > =A0}; > > +/* CODEL */ > + > +enum { > + =A0 =A0 =A0 TCA_CODEL_UNSPEC, > + =A0 =A0 =A0 TCA_CODEL_TARGET, > + =A0 =A0 =A0 TCA_CODEL_LIMIT, > + =A0 =A0 =A0 TCA_CODEL_MINBYTES, > + =A0 =A0 =A0 TCA_CODEL_INTERVAL, > + =A0 =A0 =A0 __TCA_CODEL_MAX > +}; > + > +#define TCA_CODEL_MAX =A0(__TCA_CODEL_MAX - 1) > + > =A0#endif > diff --git a/tc/Makefile b/tc/Makefile > index be8cd5a..8a7cc8d 100644 > --- a/tc/Makefile > +++ b/tc/Makefile > @@ -47,6 +47,7 @@ TCMODULES +=3D em_cmp.o > =A0TCMODULES +=3D em_u32.o > =A0TCMODULES +=3D em_meta.o > =A0TCMODULES +=3D q_mqprio.o > +TCMODULES +=3D q_codel.o > > =A0TCSO :=3D > =A0ifeq ($(TC_CONFIG_ATM),y) > diff --git a/tc/q_codel.c b/tc/q_codel.c > new file mode 100644 > index 0000000..0a7cf9f > --- /dev/null > +++ b/tc/q_codel.c > @@ -0,0 +1,136 @@ > +/* > + * q_codel.c =A0 =A0 =A0 =A0 =A0 Codel. > + * > + * =A0 =A0 =A0 =A0 =A0 =A0 This program is free software; you can redist= ribute it and/or > + * =A0 =A0 =A0 =A0 =A0 =A0 modify it under the terms of the GNU General = Public License > + * =A0 =A0 =A0 =A0 =A0 =A0 as published by the Free Software Foundation;= either version > + * =A0 =A0 =A0 =A0 =A0 =A0 2 of the License, or (at your option) any lat= er version. > + * > + * Authors: =A0 =A0Eric Dumazet > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "utils.h" > +#include "tc_util.h" > + > +static void explain(void) > +{ > + =A0 =A0 =A0 fprintf(stderr, "Usage: ... codel [ limit PACKETS ] [ targe= t TIME]\n"); > + =A0 =A0 =A0 fprintf(stderr, " =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 [ interva= l TIME ] [ minbytes BYTES ]\n"); > +} > + > +static int codel_parse_opt(struct qdisc_util *qu, int argc, char **argv, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct nlmsghdr *n) > +{ > + =A0 =A0 =A0 struct tc_red_qopt opt; > + =A0 =A0 =A0 unsigned limit =3D 0; > + =A0 =A0 =A0 unsigned target =3D 0; > + =A0 =A0 =A0 unsigned interval =3D 0; > + =A0 =A0 =A0 unsigned minbytes =3D 0; > + =A0 =A0 =A0 struct rtattr *tail; > + > + =A0 =A0 =A0 while (argc > 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (strcmp(*argv, "limit") =3D=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NEXT_ARG(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (get_unsigned(&limit, *a= rgv, 0)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(std= err, "Illegal \"limit\"\n"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strcmp(*argv, "minbytes") =3D=3D= 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NEXT_ARG(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (get_unsigned(&minbytes,= *argv, 0)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(std= err, "Illegal \"minbytes\"\n"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strcmp(*argv, "target") =3D=3D 0= ) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NEXT_ARG(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (get_time(&target, *argv= )) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(std= err, "Illegal \"target\"\n"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strcmp(*argv, "interval") =3D=3D= 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NEXT_ARG(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (get_time(&interval, *ar= gv)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(std= err, "Illegal \"interval\"\n"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strcmp(*argv, "help") =3D=3D 0) = { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 explain(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(stderr, "What is \"= %s\"?\n", *argv); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 explain(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 argc--; argv++; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 tail =3D NLMSG_TAIL(n); > + =A0 =A0 =A0 addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); > + > + =A0 =A0 =A0 if (limit) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 addattr_l(n, 1024, TCA_CODEL_LIMIT, &limit,= sizeof(limit)); > + =A0 =A0 =A0 if (minbytes) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 addattr_l(n, 1024, TCA_CODEL_MINBYTES, &min= bytes, sizeof(minbytes)); > + =A0 =A0 =A0 if (interval) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 addattr_l(n, 1024, TCA_CODEL_INTERVAL, &int= erval, sizeof(interval)); > + =A0 =A0 =A0 if (target) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 addattr_l(n, 1024, TCA_CODEL_TARGET, &targe= t, sizeof(target)); > + =A0 =A0 =A0 tail->rta_len =3D (void *) NLMSG_TAIL(n) - (void *) tail; > + =A0 =A0 =A0 return 0; > +} > + > +static int codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr= *opt) > +{ > + =A0 =A0 =A0 struct rtattr *tb[TCA_CODEL_MAX + 1]; > + =A0 =A0 =A0 unsigned limit; > + =A0 =A0 =A0 unsigned interval; > + =A0 =A0 =A0 unsigned target; > + =A0 =A0 =A0 unsigned minbytes; > + =A0 =A0 =A0 SPRINT_BUF(b1); > + > + =A0 =A0 =A0 if (opt =3D=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0; > + > + =A0 =A0 =A0 parse_rtattr_nested(tb, TCA_CODEL_MAX, opt); > + > + =A0 =A0 =A0 if (tb[TCA_CODEL_LIMIT] && > + =A0 =A0 =A0 =A0 =A0 RTA_PAYLOAD(tb[TCA_CODEL_LIMIT]) >=3D sizeof(__u32)= ) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 limit =3D rta_getattr_u32(tb[TCA_CODEL_LIMI= T]); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(f, "limit %up ", limit); > + =A0 =A0 =A0 } > + =A0 =A0 =A0 if (tb[TCA_CODEL_MINBYTES] && > + =A0 =A0 =A0 =A0 =A0 RTA_PAYLOAD(tb[TCA_CODEL_MINBYTES]) >=3D sizeof(__u= 32)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 minbytes =3D rta_getattr_u32(tb[TCA_CODEL_M= INBYTES]); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(f, "minbytes %u ", minbytes); > + =A0 =A0 =A0 } > + =A0 =A0 =A0 if (tb[TCA_CODEL_TARGET] && > + =A0 =A0 =A0 =A0 =A0 RTA_PAYLOAD(tb[TCA_CODEL_TARGET]) >=3D sizeof(__u32= )) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 target =3D rta_getattr_u32(tb[TCA_CODEL_TAR= GET]); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(f, "target %s ", sprint_time(target= , b1)); > + =A0 =A0 =A0 } > + =A0 =A0 =A0 if (tb[TCA_CODEL_INTERVAL] && > + =A0 =A0 =A0 =A0 =A0 RTA_PAYLOAD(tb[TCA_CODEL_INTERVAL]) >=3D sizeof(__u= 32)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 interval =3D rta_getattr_u32(tb[TCA_CODEL_I= NTERVAL]); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf(f, "interval %s ", sprint_time(inte= rval, b1)); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 return 0; > +} > + > + > +struct qdisc_util codel_qdisc_util =3D { > + =A0 =A0 =A0 .id =A0 =A0 =A0 =A0 =A0 =A0 =3D "codel", > + =A0 =A0 =A0 .parse_qopt =A0 =A0 =3D codel_parse_opt, > + =A0 =A0 =A0 .print_qopt =A0 =A0 =3D codel_print_opt, > +}; > -- > 1.7.9.5 I note that your recent work on ECN for netem crept in, and it should probably stay in whatever patches exist out of tree for it. Please feel free to rework these two patches into one, add my signed-off-by, and resubmit. --=20 Dave T=E4ht SKYPE: davetaht US Tel: 1-239-829-5608 http://www.bufferbloat.net