[Cake] cake, codel5.h, ecn marking & dropping. Confused

Kevin Darbyshire-Bryant kevin at darbyshire-bryant.me.uk
Wed May 4 05:57:52 EDT 2016


Hi All,

As a result of Eric's recent change to fq_codel which, to use an
analogy, when being subject to loads of sh*t, it's better to use a
shovel to get rid of it rather than a teaspoon, I started having a nose
deeper into cake than I've ever gone before.  I was also interested to
note that one of Dave's recent tests where cake was using lots of CPU
but apparently cake wasn't getting into its own 'buffer full, discard at
enqueue' mode.  That sort of suggests the dequeue process was the thing
using all the CPU, possibly starving the process generating packets so
the buffer never filled.

So, in the context of I'm an ignorant buffoon, I'm wondering what I'm
misunderstanding from the following extract of code: codel5.h, line 358

        if (!skb) {
                vars->dropping = false;
                return skb;
        }
        drop = codel_should_drop(skb, sch, vars, p, now, overloaded);
        if (vars->dropping) {
                if (!drop) {
                        /* sojourn time below target - leave dropping
state */
                        vars->dropping = false;
                } else if (now >= vars->drop_next) {
                        /* 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.
                         */

                        /* saturating increment */
                        vars->count++;
                        if (!vars->count)
                                vars->count--;

                        codel_Newton_step(vars);
                        vars->drop_next = codel_control_law(vars->drop_next,
                                                            p->interval,
                                                           
vars->rec_inv_sqrt);
                        do {
                                if (INET_ECN_set_ce(skb)) {
                                        vars->ecn_mark++;
                                        /* and schedule the next drop */
                                        vars->drop_next = codel_control_law(
                                                vars->drop_next,
p->interval,
                                                vars->rec_inv_sqrt);
                                        goto end;
                                }
                                qdisc_drop(skb, sch);
                                vars->drop_count++;
                                skb = custom_dequeue(vars, sch);
                                if (skb && !codel_should_drop(skb, sch,
vars,
                                                              p, now,
overloaded)) {
                                        /* leave dropping state */
                                        vars->dropping = false;
                                } else {
                                        /* schedule the next drop */
                                        vars->drop_next = codel_control_law(
                                                vars->drop_next,
p->interval,
                                                vars->rec_inv_sqrt);
                                }
                        } while (skb && vars->dropping && now >=
                                 vars->drop_next);

                        /* Mark the packet regardless */
                        if (skb && INET_ECN_set_ce(skb))
                                vars->ecn_mark++;
                }

In essence my (mis)understanding of this code is something like: We've
got here because we've been dropping and codel is telling is to continue
to drop.  With that decided we enter a do..while, the first thing to
happen is to ECN mark and let that marked packet escape to send the
signal.  Otherwise we appear to iterate around the loop.  So here's the
nub of my question: the INET_ECN_set_ce is done on every iteration of
that loop...with its potential early escape..do we escape on every
iteration?  Do we need to twiddle the ECN bits on every packet that
we're about to drop?  And we seem to mark the packet on exit of the loop
anyway.

I'm confused but almost certainly because I'm an idiot.

Kevin


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4816 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.bufferbloat.net/pipermail/cake/attachments/20160504/1bc59245/attachment.bin>


More information about the Cake mailing list