From: Rick Jones <rick.jones2@hp.com>
To: Dave Taht <dave.taht@gmail.com>
Cc: codel@lists.bufferbloat.net, "Dave Täht" <dave.taht@bufferbloat.net>
Subject: Re: [Codel] [PATCH] Preliminary codel implementation
Date: Thu, 03 May 2012 11:17:52 -0700 [thread overview]
Message-ID: <4FA2CBD0.4050307@hp.com> (raw)
In-Reply-To: <CAA93jw74ApHzegvuXQ_SOUDR6Da7U1XDc=LS4am5d_uNw-NY7Q@mail.gmail.com>
Some nits, may not be substantive.
>> +
>> +struct tc_codel_qopt {
>> + __u32 flags; /* flags (e.g. ecn) */
>> + __u32 target; /* max delay, in us */
>> + __u32 depth; /* queue depth in packets */
>> + __u32 minbytes; /* MTU (usually) */
>> + __u32 interval; /* Sliding min time window width (us) */
>> +};
Perhaps include the units in target and interval - eg target_usec? Or
go full-CS101 with target_delay_usec and action_delay_usec (interval)?
>> +
>> +#define MS2TIME(a) (ns_to_ktime( (u64) a*1000000))
>> +#define DEFAULT_CODEL_DEPTH 1000
>> +
>> +/* Per-queue state (codel_queue_t instance variables) */
>> +
>> +struct codel_sched_data {
>> + u32 flags;
>> + u32 minbytes;
>> + u32 count; /* packets dropped since we went into drop state */
>> + bool dropping; /* 1 if in drop state, might just add to flags */
>> + ktime_t target;
>> + ktime_t interval;
>> + /* time to declare above q->target (0 if below)*/
>> + ktime_t first_above_time;
>> + ktime_t drop_next; /* time to drop next packet */
>> +};
Similar sort of thing here, though I suspect ktime_t implies units
already. Also is drop_next the time to arbitrarily drop the next packet
or just consider it again - eg consider_drop_next?
>> +bool should_drop(struct sk_buff *skb, struct Qdisc *sch, ktime_t now)
>> +{
>> + struct codel_sched_data *q = qdisc_priv(sch);
>> + bool drop = 0;
>> + if (skb == NULL) {
>> + q->first_above_time.tv64 = 0;
>> + } else {
>> + ktime_t sojourn_time = ktime_sub(now, get_enqueue_time(skb));
>> + if (sojourn_time.tv64<
>> + q->target.tv64 || sch->qstats.backlog< q->minbytes) {
>> +/* went below so we’ll stay below for at least q->interval */
>> + q->first_above_time.tv64 = 0;
>> + } else {
>> + if (q->first_above_time.tv64 == 0) {
>> +
>> +/* just went above from below. If we stay above
>> + * for at least q->interval we’ll say it’s ok to drop
>> + */
Indentation on the comment?
>> + q->first_above_time =
>> + ktime_add(now,q->interval);
>> + } else if (now.tv64>= q->first_above_time.tv64) {
>> + drop = 1;
>> + }
>> + }
>> + }
>> + return drop;
>> +}
>> +
>> +static struct sk_buff *codel_dequeue(struct Qdisc *sch)
>> +{
>> + struct codel_sched_data *q = qdisc_priv(sch);
>> + struct sk_buff *skb = codel_dequeue_head(sch);
>> + ktime_t now;
>> + bool drop;
>> + if (skb == NULL) {
>> + q->dropping = 0;
>> + q->first_above_time.tv64 = 0;
>> + return skb;
>> + }
>> + now = ktime_get();
>> + drop = should_drop(skb, sch, now);
>> + if (q->dropping) {
>> + if (drop) {
>> +/* sojourn time below target - leave dropping state */
>> + q->dropping = 0;
>> + } else if (now.tv64>= q->drop_next.tv64) {
>> +/*
>> + * It’s time for the next drop. Drop the current packet and dequeue the next.
>> + * The dequeue might take us out of dropping state. If not, schedule the
>> + * next drop. A large backlog might result in drop rates so high that the next
>> + * drop should happen now, hence the ‘while’ loop.
>> + */
Comment indentation?
rick
next prev parent reply other threads:[~2012-05-03 18:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 17:52 [Codel] [PATCH] iproute2: added preliminary codel support Dave Täht
2012-05-03 17:52 ` [Codel] [PATCH] Preliminary codel implementation Dave Täht
2012-05-03 18:01 ` Dave Taht
2012-05-03 18:17 ` Rick Jones [this message]
2012-05-03 18:19 ` Eric Dumazet
2012-05-03 18:17 ` Eric Dumazet
2012-05-03 22:38 ` Dave Taht
2012-05-03 20:47 ` Jim Gettys
2012-05-03 21:35 ` Dave Taht
2012-05-03 23:12 ` Jim Gettys
2012-05-03 17:59 ` [Codel] [PATCH] iproute2: added preliminary codel support 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=4FA2CBD0.4050307@hp.com \
--to=rick.jones2@hp.com \
--cc=codel@lists.bufferbloat.net \
--cc=dave.taht@bufferbloat.net \
--cc=dave.taht@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