From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.toke.dk (mail.toke.dk [52.28.52.200]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 9A2923BA8E for ; Sat, 5 Jan 2019 05:07:06 -0500 (EST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1546682824; bh=BWNTEnSrq3b0Ev+izgmjW5VN2j9OJepw4QlenKD1YbE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=arZ6FliE7fS0CwBf7xOs2Dg0sLzvGk2q+13KX0uZWjCMEUaaB0uSnyexSvqDz9g7F D4NBP3Uwc8UtSkw+2b4Kpl2hbOsg5odaob4NsN1b1Ad6YGdxb4JJT5B8BOHL8j+qUF n4IQv1FRk8jtqYbUGsIfOfb7GiaG4PAFq7h98IthPhY3So7OtsTXfJSj0dRu9B6SZ/ Cbxman/qzRP292B7JpXx1aXW3mJ9pRt7MvfzqXhhohJ2ebRboJGwlXBKBhYK6zeJsB gXJ3goAhMyE8P3ySWP40dQuuLEWCFOtSUt1PX/6t8dYjuf9I2SDPjcQ5o5au+OBS5G fplmj9Ng4IG4A== To: Pete Heist Cc: Cake List In-Reply-To: References: <5482A3CA-9C36-4DDE-A858-24D8467F70C7@heistp.net> <8736q8yumt.fsf@toke.dk> <4C422792-7E51-4DBA-A229-FA7D3F987FB6@heistp.net> <87zhsgxdao.fsf@toke.dk> Date: Sat, 05 Jan 2019 11:06:59 +0100 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87wonjxvss.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Cake] cake infinite loop(?) with hfsc on one-armed router X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jan 2019 10:07:06 -0000 Pete Heist writes: >> On Jan 4, 2019, at 11:34 PM, Toke H=C3=B8iland-J=C3=B8rgensen wrote: >>=20 >> Pete Heist writes: >>=20 >> This basically means that we can't use CAKE as a leaf qdisc with GSO >> splitting as it stands currently. I *think* the solution is for CAKE to >> notify its parents; could you try the patch below and see if it helps? > > Aha, good news. :) > > I=E2=80=99m probably not currently in a position to try it on my old kern= els with the out of tree build: > > On 3.16.7: Hmm, try this version for 3.16 - probably doesn't work on later kernels. I'll look into a proper backport once you've confirmed that it works :) -Toke diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index b910cd5c56f7..ef3acdbb8429 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -1617,6 +1617,44 @@ static u32 cake_classify(struct Qdisc *sch, struct c= ake_tin_data **t, =20 static void cake_reconfigure(struct Qdisc *sch); =20 + +static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle) +{ + struct Qdisc *q; + + if (!(root->flags & TCQ_F_BUILTIN) && + root->handle =3D=3D handle) + return root; + + list_for_each_entry(q, &root->list, list) { + if (q->handle =3D=3D handle) + return q; + } + return NULL; +} + +void adjust_parent_qlen(struct Qdisc *sch, unsigned int n, + unsigned int len) +{ + u32 parentid; + if (n =3D=3D 0 && len =3D=3D 0) + return; + rcu_read_lock(); + while ((parentid =3D sch->parent)) { + if (TC_H_MAJ(parentid) =3D=3D TC_H_MAJ(TC_H_INGRESS)) + break; + + sch =3D qdisc_match_from_root(qdisc_dev(sch), TC_H_MAJ(parentid)); + if (sch =3D=3D NULL) { + WARN_ON_ONCE(parentid !=3D TC_H_ROOT); + break; + } + sch->q.qlen +=3D n; + sch->qstats.backlog +=3D len; + } + rcu_read_unlock(); +} + static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) { @@ -1667,7 +1705,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Q= disc *sch, if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) { struct sk_buff *segs, *nskb; netdev_features_t features =3D netif_skb_features(skb); - unsigned int slen =3D 0; + unsigned int slen =3D 0, numsegs =3D 0; =20 segs =3D skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); if (IS_ERR_OR_NULL(segs)) @@ -1684,6 +1722,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Q= disc *sch, =20 sch->q.qlen++; slen +=3D segs->len; + numsegs++; q->buffer_used +=3D segs->truesize; b->packets++; segs =3D nskb; @@ -1696,7 +1735,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Q= disc *sch, sch->qstats.backlog +=3D slen; q->avg_window_bytes +=3D slen; =20 - qdisc_tree_reduce_backlog(sch, 1, len); + adjust_parent_qlen(sch, numsegs - 1, slen - len); consume_skb(skb); } else { /* not splitting */