Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: Pete Heist <pete@heistp.net>
Cc: Cake List <cake@lists.bufferbloat.net>
Subject: Re: [Cake] cake infinite loop(?) with hfsc on one-armed router
Date: Sat, 05 Jan 2019 11:06:59 +0100	[thread overview]
Message-ID: <87wonjxvss.fsf@toke.dk> (raw)
In-Reply-To: <B1F84884-7150-41BB-9E39-640F560F99D5@heistp.net>

Pete Heist <pete@heistp.net> writes:

>> On Jan 4, 2019, at 11:34 PM, Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>> 
>> Pete Heist <pete@heistp.net> writes:
>> 
>> 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’m probably not currently in a position to try it on my old kernels 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 cake_tin_data **t,
 
 static void cake_reconfigure(struct Qdisc *sch);
 
+
+static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle)
+{
+	struct Qdisc *q;
+
+	if (!(root->flags & TCQ_F_BUILTIN) &&
+	    root->handle == handle)
+		return root;
+
+	list_for_each_entry(q, &root->list, list) {
+		if (q->handle == handle)
+			return q;
+	}
+	return NULL;
+}
+
+void adjust_parent_qlen(struct Qdisc *sch, unsigned int n,
+			       unsigned int len)
+{
+	u32 parentid;
+	if (n == 0 && len == 0)
+		return;
+	rcu_read_lock();
+	while ((parentid = sch->parent)) {
+		if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS))
+			break;
+
+		sch = qdisc_match_from_root(qdisc_dev(sch), TC_H_MAJ(parentid));
+		if (sch == NULL) {
+			WARN_ON_ONCE(parentid != TC_H_ROOT);
+			break;
+		}
+		sch->q.qlen += n;
+		sch->qstats.backlog += 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 Qdisc *sch,
 	if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) {
 		struct sk_buff *segs, *nskb;
 		netdev_features_t features = netif_skb_features(skb);
-		unsigned int slen = 0;
+		unsigned int slen = 0, numsegs = 0;
 
 		segs = 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 Qdisc *sch,
 
 			sch->q.qlen++;
 			slen += segs->len;
+			numsegs++;
 			q->buffer_used += segs->truesize;
 			b->packets++;
 			segs = nskb;
@@ -1696,7 +1735,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		sch->qstats.backlog += slen;
 		q->avg_window_bytes += slen;
 
-		qdisc_tree_reduce_backlog(sch, 1, len);
+		adjust_parent_qlen(sch, numsegs - 1, slen - len);
 		consume_skb(skb);
 	} else {
 		/* not splitting */

  reply	other threads:[~2019-01-05 10:07 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-27 23:30 Pete Heist
2018-12-28 12:58 ` Pete Heist
2018-12-28 21:22   ` Pete Heist
2018-12-28 22:07     ` Jonathan Morton
2018-12-28 22:42       ` Pete Heist
2019-01-04 21:34     ` Toke Høiland-Jørgensen
2019-01-04 22:10       ` Pete Heist
2019-01-04 22:12         ` Pete Heist
2019-01-04 22:34         ` Toke Høiland-Jørgensen
2019-01-05  5:58           ` Pete Heist
2019-01-05 10:06             ` Toke Høiland-Jørgensen [this message]
2019-01-05 10:59               ` Pete Heist
2019-01-05 11:06                 ` Pete Heist
2019-01-05 11:18                   ` Toke Høiland-Jørgensen
2019-01-05 11:26                     ` Pete Heist
2019-01-05 11:35                       ` Pete Heist
2019-01-05 12:38                   ` Toke Høiland-Jørgensen
2019-01-05 12:51                     ` Pete Heist
2019-01-05 13:10                       ` Toke Høiland-Jørgensen
2019-01-05 13:20                         ` Pete Heist
2019-01-05 13:35                           ` Toke Høiland-Jørgensen
2019-01-05 15:34                             ` Pete Heist
2019-01-05 15:52                               ` Jonathan Morton
2019-01-05 16:32                               ` Toke Høiland-Jørgensen
2019-01-05 19:27                                 ` Sebastian Moeller
2019-01-05 20:01                                   ` Pete Heist
2019-01-05 20:10                                     ` Toke Høiland-Jørgensen
2019-01-05 20:31                                       ` Pete Heist
2019-01-05 22:27                                         ` Toke Høiland-Jørgensen
2019-01-05 22:41                                           ` Pete Heist
2019-01-06  9:37                                             ` Pete Heist
2019-01-06 20:56                                               ` Toke Høiland-Jørgensen
2019-01-07  0:30                                                 ` Pete Heist
2019-01-07  2:11                                                   ` Dave Taht
2019-01-07 11:30                                                   ` Toke Høiland-Jørgensen
2019-01-07 15:07                                                     ` Pete Heist
2019-01-08 20:03                                                       ` Pete Heist
2019-01-08 20:44                                                         ` Dave Taht
2019-01-08 22:01                                                           ` Pete Heist
2019-01-08 22:33                                                             ` Dave Taht
2019-01-09  6:13                                                               ` Pete Heist
2019-01-08 22:27                                                         ` Toke Høiland-Jørgensen
2019-01-09  5:29                                                           ` Pete Heist
2019-01-09  8:36                                                             ` Toke Høiland-Jørgensen
2019-01-06 20:55                                             ` Toke Høiland-Jørgensen
2019-01-05 10:44           ` Jonathan Morton
2019-01-05 11:17             ` Toke Høiland-Jørgensen

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/cake.lists.bufferbloat.net/

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

  git send-email \
    --in-reply-to=87wonjxvss.fsf@toke.dk \
    --to=toke@toke.dk \
    --cc=cake@lists.bufferbloat.net \
    --cc=pete@heistp.net \
    /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