From ab27b3f74d840429c8d994162d7db9c5c4aba381 Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 2 Aug 2012 13:39:50 +0000 Subject: [bufferbloat] Codel: avoid a nul rec_inv_sqrt One condition before codel_Newton_step() was not good if we never left the dropping state for a flow. As a result rec_inv_sqrt was 0, instead of the ~0 initial value. codel control law was then set to a very aggressive mode, dropping many packets before reaching 'target' and recovering from this problem. Brought over from 3.5-stable Signed-off-by: Dave Taht git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32950 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...one-condition-to-avoid-a-nul-rec_inv_sqrt.patch | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 target/linux/generic/patches-3.3/049-codel-refine-one-condition-to-avoid-a-nul-rec_inv_sqrt.patch (limited to 'target/linux/generic') diff --git a/target/linux/generic/patches-3.3/049-codel-refine-one-condition-to-avoid-a-nul-rec_inv_sqrt.patch b/target/linux/generic/patches-3.3/049-codel-refine-one-condition-to-avoid-a-nul-rec_inv_sqrt.patch new file mode 100644 index 0000000000..210a58c6a7 --- /dev/null +++ b/target/linux/generic/patches-3.3/049-codel-refine-one-condition-to-avoid-a-nul-rec_inv_sqrt.patch @@ -0,0 +1,68 @@ +From patchwork Mon Jul 30 06:52:21 2012 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: codel: refine one condition to avoid a nul rec_inv_sqrt +Date: Sun, 29 Jul 2012 20:52:21 -0000 +From: Eric Dumazet +X-Patchwork-Id: 173968 +Message-Id: <1343631141.2626.13293.camel@edumazet-glaptop> +To: David Miller +Cc: netdev , Anton Mich + +From: Eric Dumazet + +One condition before codel_Newton_step() was not good if +we never left the dropping state for a flow. As a result +rec_inv_sqrt was 0, instead of the ~0 initial value. + +codel control law was then set to a very aggressive mode, dropping +many packets before reaching 'target' and recovering from this problem. + +To keep codel_vars_init() as efficient as possible, refine +the condition to make sure rec_inv_sqrt initial value is correct + +Many thanks to Anton Mich for discovering the issue and suggesting +a fix. + +Reported-by: Anton Mich +Signed-off-by: Eric Dumazet + +--- +include/net/codel.h | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + + + +-- +To unsubscribe from this list: send the line "unsubscribe netdev" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +diff --git a/include/net/codel.h b/include/net/codel.h +index 550debf..389cf62 100644 +--- a/include/net/codel.h ++++ b/include/net/codel.h +@@ -305,6 +305,8 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch, + } + } + } else if (drop) { ++ u32 delta; ++ + if (params->ecn && INET_ECN_set_ce(skb)) { + stats->ecn_mark++; + } else { +@@ -320,9 +322,11 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch, + * assume that the drop rate that controlled the queue on the + * last cycle is a good starting point to control it now. + */ +- if (codel_time_before(now - vars->drop_next, ++ delta = vars->count - vars->lastcount; ++ if (delta > 1 && ++ codel_time_before(now - vars->drop_next, + 16 * params->interval)) { +- vars->count = (vars->count - vars->lastcount) | 1; ++ vars->count = delta; + /* we dont care if rec_inv_sqrt approximation + * is not very precise : + * Next Newton steps will correct it quadratically. -- cgit v1.2.3