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 <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Jakub Kicinski 2018-01-16 15:08:50 -08:00 committed by David Ahern
parent c0788a09d4
commit e0850bdedc
1 changed files with 3 additions and 1 deletions

View File

@ -30,7 +30,9 @@ int tc_red_eval_P(unsigned int qmin, unsigned int qmax, double prob)
{ {
int i = qmax - qmin; int i = qmax - qmin;
if (i <= 0) if (!i)
return 0;
if (i < 0)
return -1; return -1;
prob /= i; prob /= i;