lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 13 Sep 2012 09:43:40 -0400
From:	Cyril Chemparathy <cyril@...com>
To:	<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>
CC:	<davem@...emloft.net>, <david.ward@...mit.edu>,
	<eric.dumazet@...il.com>, <jdowdal@...com>,
	<paul.gortmaker@...driver.com>, Cyril Chemparathy <cyril@...com>
Subject: [PATCH] sch_red: fix weighted average calculation

This patch fixes an apparent bug in the running weighted average calculation
used in the RED algorithm.

Going by the described formula:
	   qavg = qavg*(1-W) + backlog*W
	=> qavg = qavg + (backlog - qavg) * W

... with W converted to a pre-calculated shift, this then becomes:
	qavg = qavg + (backlog - qavg) >> logW

... giving the modified expression introduced by this patch.

Signed-off-by: John Dowdal <jdowdal@...com>
---
 include/net/red.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/red.h b/include/net/red.h
index ef46058..05960a4 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -287,7 +287,7 @@ static inline unsigned long red_calc_qavg_no_idle_time(const struct red_parms *p
 	 *
 	 * --ANK (980924)
 	 */
-	return v->qavg + (backlog - (v->qavg >> p->Wlog));
+	return v->qavg + (backlog - v->qavg) >> p->Wlog;
 }
 
 static inline unsigned long red_calc_qavg(const struct red_parms *p,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ