Root/target/linux/generic/patches-3.3/049-codel-refine-one-condition-to-avoid-a-nul-rec_inv_sqrt.patch

1From b8fc328668a74e1314a19266755a54abd875e5a6 Mon Sep 17 00:00:00 2001
2From: Eric Dumazet <edumazet@google.com>
3Date: Sun, 29 Jul 2012 20:52:21 +0000
4Subject: [PATCH] codel: refine one condition to avoid a nul rec_inv_sqrt
5
6commit 2359a47671fc4fb0fe5e9945f76c2cb10792c0f8 upstream.
7
8One condition before codel_Newton_step() was not good if
9we never left the dropping state for a flow. As a result
10rec_inv_sqrt was 0, instead of the ~0 initial value.
11
12codel control law was then set to a very aggressive mode, dropping
13many packets before reaching 'target' and recovering from this problem.
14
15To keep codel_vars_init() as efficient as possible, refine
16the condition to make sure rec_inv_sqrt initial value is correct
17
18Many thanks to Anton Mich for discovering the issue and suggesting
19a fix.
20
21Reported-by: Anton Mich <lp2s1h@gmail.com>
22Signed-off-by: Eric Dumazet <edumazet@google.com>
23Signed-off-by: David S. Miller <davem@davemloft.net>
24---
25 include/net/codel.h | 8 ++++++--
26 1 file changed, 6 insertions(+), 2 deletions(-)
27
28--- a/include/net/codel.h
29+++ b/include/net/codel.h
30@@ -305,6 +305,8 @@ static struct sk_buff *codel_dequeue(str
31             }
32         }
33     } else if (drop) {
34+ u32 delta;
35+
36         if (params->ecn && INET_ECN_set_ce(skb)) {
37             stats->ecn_mark++;
38         } else {
39@@ -320,9 +322,11 @@ static struct sk_buff *codel_dequeue(str
40          * assume that the drop rate that controlled the queue on the
41          * last cycle is a good starting point to control it now.
42          */
43- if (codel_time_before(now - vars->drop_next,
44+ delta = vars->count - vars->lastcount;
45+ if (delta > 1 &&
46+ codel_time_before(now - vars->drop_next,
47                       16 * params->interval)) {
48- vars->count = (vars->count - vars->lastcount) | 1;
49+ vars->count = delta;
50             /* we dont care if rec_inv_sqrt approximation
51              * is not very precise :
52              * Next Newton steps will correct it quadratically.
53

Archive Download this file



interactive