]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/patches/compat-wireless_codel-avoid-a-nul-rec_inv_sqrt.patch
tor: Bump package version to 6 and fix backup.
[people/teissler/ipfire-2.x.git] / src / patches / compat-wireless_codel-avoid-a-nul-rec_inv_sqrt.patch
CommitLineData
38bb1dd6
AF
1From patchwork Mon Jul 30 06:52:21 2012
2Content-Type: text/plain; charset="utf-8"
3MIME-Version: 1.0
4Content-Transfer-Encoding: 7bit
5Subject: codel: refine one condition to avoid a nul rec_inv_sqrt
6Date: Sun, 29 Jul 2012 20:52:21 -0000
7From: Eric Dumazet <eric.dumazet@gmail.com>
8X-Patchwork-Id: 173968
9Message-Id: <1343631141.2626.13293.camel@edumazet-glaptop>
10To: David Miller <davem@davemloft.net>
11Cc: netdev <netdev@vger.kernel.org>, Anton Mich <lp2s1h@gmail.com>
12
13From: Eric Dumazet <edumazet@google.com>
14
15One condition before codel_Newton_step() was not good if
16we never left the dropping state for a flow. As a result
17rec_inv_sqrt was 0, instead of the ~0 initial value.
18
19codel control law was then set to a very aggressive mode, dropping
20many packets before reaching 'target' and recovering from this problem.
21
22To keep codel_vars_init() as efficient as possible, refine
23the condition to make sure rec_inv_sqrt initial value is correct
24
25Many thanks to Anton Mich for discovering the issue and suggesting
26a fix.
27
28Reported-by: Anton Mich <lp2s1h@gmail.com>
29Signed-off-by: Eric Dumazet <edumazet@google.com>
30
31---
32include/net/codel.h | 8 ++++++--
33 1 file changed, 6 insertions(+), 2 deletions(-)
34
35
36
37--
38To unsubscribe from this list: send the line "unsubscribe netdev" in
39the body of a message to majordomo@vger.kernel.org
40More majordomo info at http://vger.kernel.org/majordomo-info.html
41
42diff --git a/include/net/codel.h b/include/net/codel.h
43index 550debf..389cf62 100644
44--- a/include/net/codel.h
45+++ b/include/net/codel.h
46@@ -305,6 +305,8 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
47 }
48 }
49 } else if (drop) {
50+ u32 delta;
51+
52 if (params->ecn && INET_ECN_set_ce(skb)) {
53 stats->ecn_mark++;
54 } else {
55@@ -320,9 +322,11 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
56 * assume that the drop rate that controlled the queue on the
57 * last cycle is a good starting point to control it now.
58 */
59- if (codel_time_before(now - vars->drop_next,
60+ delta = vars->count - vars->lastcount;
61+ if (delta > 1 &&
62+ codel_time_before(now - vars->drop_next,
63 16 * params->interval)) {
64- vars->count = (vars->count - vars->lastcount) | 1;
65+ vars->count = delta;
66 /* we dont care if rec_inv_sqrt approximation
67 * is not very precise :
68 * Next Newton steps will correct it quadratically.