From: Jakub Kicinski Date: Tue, 16 Jan 2018 23:08:50 +0000 (-0800) Subject: tc: red: allow setting th_min and th_max to the same value X-Git-Tag: v4.16.0~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0850bdedc22ccc536039b1cb832cf383cafc6f8;p=thirdparty%2Fiproute2.git tc: red: allow setting th_min and th_max to the same value Setting th_min and th_max to the same value may be useful for DCTCP deployments. The original DCTCP paper describes it as a simplest way of achieving simple ECN threshold marking. Indeed, there doesn't seem to be any simpler qdisc in Linux which would allow such a setup today. Signed-off-by: Jakub Kicinski Reviewed-by: Dirk van der Merwe Signed-off-by: David Ahern --- diff --git a/tc/tc_red.c b/tc/tc_red.c index 1f82ef1ae..178fe088f 100644 --- a/tc/tc_red.c +++ b/tc/tc_red.c @@ -30,7 +30,9 @@ int tc_red_eval_P(unsigned int qmin, unsigned int qmax, double prob) { int i = qmax - qmin; - if (i <= 0) + if (!i) + return 0; + if (i < 0) return -1; prob /= i;