Skip to content

Commit 2359a47

Browse files
edumazetdavem330
authored andcommitted
codel: refine one condition to 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. 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 <lp2s1h@gmail.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 55461dd commit 2359a47

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎include/net/codel.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
305305
}
306306
}
307307
} else if (drop) {
308+
u32 delta;
309+
308310
if (params->ecn && INET_ECN_set_ce(skb)) {
309311
stats->ecn_mark++;
310312
} else {
@@ -320,9 +322,11 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
320322
* assume that the drop rate that controlled the queue on the
321323
* last cycle is a good starting point to control it now.
322324
*/
323-
if (codel_time_before(now - vars->drop_next,
325+
delta = vars->count - vars->lastcount;
326+
if (delta > 1 &&
327+
codel_time_before(now - vars->drop_next,
324328
16 * params->interval)) {
325-
vars->count = (vars->count - vars->lastcount) | 1;
329+
vars->count = delta;
326330
/* we dont care if rec_inv_sqrt approximation
327331
* is not very precise :
328332
* Next Newton steps will correct it quadratically.

0 commit comments

Comments
 (0)