CoDel AQM discussions
 help / color / mirror / Atom feed
From: Dave Taht <dave.taht@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: codel@lists.bufferbloat.net, "Dave Täht" <dave.taht@bufferbloat.net>
Subject: Re: [Codel] [RFCv2 PATCH] codel: add ecn_target for when to drop rather than mark ecn packets
Date: Mon, 25 Jun 2012 07:50:32 -0700	[thread overview]
Message-ID: <CAA93jw711o_2jr_5f6zN2qpKVkD_fa5V2NUuOZA5KYHZSqpm1Q@mail.gmail.com> (raw)
In-Reply-To: <1340601724.23933.16.camel@edumazet-glaptop>

On Sun, Jun 24, 2012 at 10:22 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Sun, 2012-06-24 at 22:00 -0700, Dave Täht wrote:
>> From: Dave Taht <dave.taht@bufferbloat.net>
>>
>> ECN can be gamed, and it is generally faster under overload
>> to drop rather than mark packets, to get back to a target.
>>
>> This patch adds support for ecn_target which controls when
>> codel and fq_codel will start dropping rather than marking
>> ecn tagged packets.
>>
>> The default is 15ms.
>> ---
>>  include/linux/pkt_sched.h |    2 ++
>>  include/net/codel.h       |   11 +++++++++--
>>  net/sched/sch_codel.c     |   13 ++++++++++++-
>>  net/sched/sch_fq_codel.c  |   12 +++++++++++-
>>  4 files changed, 34 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
>> index 32aef0a..f0dcf8c 100644
>> --- a/include/linux/pkt_sched.h
>> +++ b/include/linux/pkt_sched.h
>> @@ -663,6 +663,7 @@ enum {
>>       TCA_CODEL_LIMIT,
>>       TCA_CODEL_INTERVAL,
>>       TCA_CODEL_ECN,
>> +     TCA_CODEL_ECN_TARGET,
>>       __TCA_CODEL_MAX
>>  };
>>
>> @@ -691,6 +692,7 @@ enum {
>>       TCA_FQ_CODEL_ECN,
>>       TCA_FQ_CODEL_FLOWS,
>>       TCA_FQ_CODEL_QUANTUM,
>> +     TCA_FQ_CODEL_ECN_TARGET,
>>       __TCA_FQ_CODEL_MAX
>>  };
>>
>> diff --git a/include/net/codel.h b/include/net/codel.h
>> index 550debf..8a6a2b0 100644
>> --- a/include/net/codel.h
>> +++ b/include/net/codel.h
>> @@ -111,11 +111,13 @@ static inline u32 codel_time_to_us(codel_time_t val)
>>   * @target:  target queue size (in time units)
>>   * @interval:        width of moving time window
>>   * @ecn:     is Explicit Congestion Notification enabled
>> + * @ecn_target:      ecn target for queue drop anyway (in time units)
>>   */
>>  struct codel_params {
>>       codel_time_t    target;
>>       codel_time_t    interval;
>>       bool            ecn;
>> +     codel_time_t    ecn_target;
>>  };
>>
>>  /**
>> @@ -161,6 +163,7 @@ static void codel_params_init(struct codel_params *params)
>>       params->interval = MS2TIME(100);
>>       params->target = MS2TIME(5);
>>       params->ecn = false;
>> +     params->ecn_target = MS2TIME(15);
>>  }
>>
>>  static void codel_vars_init(struct codel_vars *vars)
>> @@ -280,7 +283,9 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
>>                                               * since there is no more divide
>>                                               */
>>                               codel_Newton_step(vars);
>> -                             if (params->ecn && INET_ECN_set_ce(skb)) {
>> +                             if (params->ecn &&
>> +                                 params->ecn_target > vars->ldelay &&
>
> Wrong test ?
>
> We want ECN if delay < ecn_target, not if delay > ecn_target
>
> (unresponsive flows will make delay being above ecn_target, while
> responsive ones should make delay more like target ( < en_target)
>
> if (params->ecn &&
>    vars->ldelay <= params->ecn_target &&
>    INET_ECN_set_ce(skb)) {

The orig is the same test, as params->ecn_target > vars->ldelay
is equivalent to vars->ldelay <= params->ecn_target

My own mental debate was whether to switch ecn from a bool to being a
codel_time_t,
and use a value of 0 for noecn and whatever for the ecn target value.

>
>> +                                     INET_ECN_set_ce(skb)) {
>>                                       stats->ecn_mark++;
>>                                       vars->drop_next =
>>                                               codel_control_law(vars->drop_next,
>> @@ -305,7 +310,9 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
>>                       }
>>               }
>>       } else if (drop) {
>> -             if (params->ecn && INET_ECN_set_ce(skb)) {
>> +             if (params->ecn &&
>> +                 params->ecn_target > vars->ldelay &&
>> +                 INET_ECN_set_ce(skb)) {
>>                       stats->ecn_mark++;
>>               } else {
>>                       qdisc_drop(skb, sch);
>> diff --git a/net/sched/sch_codel.c b/net/sched/sch_codel.c
>> index 2f9ab17..b008a35 100644
>> --- a/net/sched/sch_codel.c
>> +++ b/net/sched/sch_codel.c
>> @@ -109,6 +109,7 @@ static const struct nla_policy codel_policy[TCA_CODEL_MAX + 1] = {
>>       [TCA_CODEL_LIMIT]       = { .type = NLA_U32 },
>>       [TCA_CODEL_INTERVAL]    = { .type = NLA_U32 },
>>       [TCA_CODEL_ECN]         = { .type = NLA_U32 },
>> +     [TCA_CODEL_ECN_TARGET]  = { .type = NLA_U32 },
>>  };
>>
>>  static int codel_change(struct Qdisc *sch, struct nlattr *opt)
>> @@ -133,6 +134,13 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt)
>>               q->params.target = ((u64)target * NSEC_PER_USEC) >> CODEL_SHIFT;
>>       }
>>
>> +     if (tb[TCA_CODEL_ECN_TARGET]) {
>> +             u32 target = nla_get_u32(tb[TCA_CODEL_TARGET]);
>> +
>> +             q->params.ecn_target = ((u64)target * NSEC_PER_USEC) >>
>> +                                     CODEL_SHIFT;
>> +     }
>> +
>>       if (tb[TCA_CODEL_INTERVAL]) {
>>               u32 interval = nla_get_u32(tb[TCA_CODEL_INTERVAL]);
>>
>> @@ -145,6 +153,7 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt)
>>       if (tb[TCA_CODEL_ECN])
>>               q->params.ecn = !!nla_get_u32(tb[TCA_CODEL_ECN]);
>>
>> +
>
> extra new line ?
>
>>       qlen = sch->q.qlen;
>>       while (sch->q.qlen > sch->limit) {
>>               struct sk_buff *skb = __skb_dequeue(&sch->q);
>> @@ -199,7 +208,9 @@ static int codel_dump(struct Qdisc *sch, struct sk_buff *skb)
>>           nla_put_u32(skb, TCA_CODEL_INTERVAL,
>>                       codel_time_to_us(q->params.interval)) ||
>>           nla_put_u32(skb, TCA_CODEL_ECN,
>> -                     q->params.ecn))
>> +                     q->params.ecn) ||
>> +         nla_put_u32(skb, TCA_CODEL_ECN_TARGET,
>> +                     codel_time_to_us(q->params.ecn_target)))
>>               goto nla_put_failure;
>>
>>       return nla_nest_end(skb, opts);
>> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
>> index 9fc1c62..d974e07 100644
>> --- a/net/sched/sch_fq_codel.c
>> +++ b/net/sched/sch_fq_codel.c
>> @@ -297,6 +297,7 @@ static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {
>>       [TCA_FQ_CODEL_ECN]      = { .type = NLA_U32 },
>>       [TCA_FQ_CODEL_FLOWS]    = { .type = NLA_U32 },
>>       [TCA_FQ_CODEL_QUANTUM]  = { .type = NLA_U32 },
>> +     [TCA_FQ_CODEL_ECN_TARGET]       = { .type = NLA_U32 },
>>  };
>>
>>  static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt)
>> @@ -327,6 +328,13 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt)
>>               q->cparams.target = (target * NSEC_PER_USEC) >> CODEL_SHIFT;
>>       }
>>
>> +     if (tb[TCA_FQ_CODEL_ECN_TARGET]) {
>> +             u64 target = nla_get_u32(tb[TCA_FQ_CODEL_TARGET]);
>> +
>> +             q->cparams.ecn_target = (target * NSEC_PER_USEC) >>
>> +                                     CODEL_SHIFT;
>> +     }
>> +
>>       if (tb[TCA_FQ_CODEL_INTERVAL]) {
>>               u64 interval = nla_get_u32(tb[TCA_FQ_CODEL_INTERVAL]);
>>
>> @@ -447,7 +455,9 @@ static int fq_codel_dump(struct Qdisc *sch, struct sk_buff *skb)
>>           nla_put_u32(skb, TCA_FQ_CODEL_QUANTUM,
>>                       q->quantum) ||
>>           nla_put_u32(skb, TCA_FQ_CODEL_FLOWS,
>> -                     q->flows_cnt))
>> +                     q->flows_cnt) ||
>> +         nla_put_u32(skb, TCA_FQ_CODEL_ECN_TARGET,
>> +                     codel_time_to_us(q->cparams.ecn_target)))
>>               goto nla_put_failure;
>>
>>       nla_nest_end(skb, opts);
>
>
> _______________________________________________
> Codel mailing list
> Codel@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/codel



-- 
Dave Täht
http://www.bufferbloat.net/projects/cerowrt/wiki - "3.3.8-6 is out
with fq_codel!"

  reply	other threads:[~2012-06-25 14:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25  5:00 [Codel] [RFCv2 PATCH] iproute2: Add ecn_target option to codel and fq_codel Dave Täht
2012-06-25  5:00 ` [Codel] [RFCv2 PATCH] codel: add ecn_target for when to drop rather than mark ecn packets Dave Täht
2012-06-25  5:22   ` Eric Dumazet
2012-06-25 14:50     ` Dave Taht [this message]
2012-06-25 15:20       ` Eric Dumazet
2012-06-25 15:30         ` Dave Taht
2012-06-25 15:45           ` Eric Dumazet
2012-06-25 17:48             ` Jonathan Morton
2012-06-25 18:25               ` Dave Taht
2012-06-25 18:51                 ` Eric Dumazet
2012-06-25  5:24 ` [Codel] [RFCv2 PATCH] iproute2: Add ecn_target option to codel and fq_codel Eric Dumazet
2012-06-25  5:29 ` Eric Dumazet
2012-06-25 14:54   ` Dave Taht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/codel.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA93jw711o_2jr_5f6zN2qpKVkD_fa5V2NUuOZA5KYHZSqpm1Q@mail.gmail.com \
    --to=dave.taht@gmail.com \
    --cc=codel@lists.bufferbloat.net \
    --cc=dave.taht@bufferbloat.net \
    --cc=eric.dumazet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox