From 56a55081199ed9ee36de8a2806a7c51d5a83a078 Mon Sep 17 00:00:00 2001 From: Dave Taht Date: Tue, 5 Dec 2017 11:22:08 -0800 Subject: [PATCH] RHODIUM: disable blue algorithm for testing This patch disables the blue algorithm so the aqm becomes more pure codel. --- cobalt.h | 2 ++ sch_cake.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cobalt.h b/cobalt.h index f10f9db..c1d9dff 100644 --- a/cobalt.h +++ b/cobalt.h @@ -126,8 +126,10 @@ struct cobalt_vars { u32 count; u32 rec_inv_sqrt; cobalt_time_t drop_next; +#ifndef RHODIUM cobalt_time_t blue_timer; u32 p_drop; +#endif bool dropping; bool ecn_marked; }; diff --git a/sch_cake.c b/sch_cake.c index 4010388..134c6ca 100644 --- a/sch_cake.c +++ b/sch_cake.c @@ -62,6 +62,7 @@ #else #include #endif +#define RHODIUM 1 #include "cobalt.h" #if IS_ENABLED(CONFIG_NF_CONNTRACK) @@ -443,6 +444,7 @@ static bool cobalt_queue_full(struct cobalt_vars *vars, { bool up = false; +#ifndef RHODIUM if ((now - vars->blue_timer) > p->target) { up = !vars->p_drop; vars->p_drop += p->p_inc; @@ -450,6 +452,7 @@ static bool cobalt_queue_full(struct cobalt_vars *vars, vars->p_drop = ~0; vars->blue_timer = now; } +#endif vars->dropping = true; vars->drop_next = now; if (!vars->count) @@ -467,6 +470,7 @@ static bool cobalt_queue_empty(struct cobalt_vars *vars, { bool down = false; +#ifndef RHODIUM if (vars->p_drop && (now - vars->blue_timer) > p->target) { if (vars->p_drop < p->p_dec) vars->p_drop = 0; @@ -475,6 +479,7 @@ static bool cobalt_queue_empty(struct cobalt_vars *vars, vars->blue_timer = now; down = !vars->p_drop; } +#endif vars->dropping = false; if (vars->count && (now - vars->drop_next) >= 0) { @@ -559,10 +564,11 @@ static bool cobalt_should_drop(struct cobalt_vars *vars, } } +#ifndef RHODIUM /* Simple BLUE implementation. Lack of ECN is deliberate. */ if (vars->p_drop) drop |= (prandom_u32() < vars->p_drop); - +#endif /* Overload the drop_next field as an activity timeout */ if (!vars->count) vars->drop_next = now + p->interval; @@ -1818,8 +1824,13 @@ retry: if (cobalt_queue_empty(&flow->cvars, &b->cparams, now)) b->unresponsive_flow_count--; +#ifndef RHODIUM if (flow->cvars.p_drop || flow->cvars.count || (now - flow->cvars.drop_next) < 0) { +#else + if (flow->cvars.count || + (now - flow->cvars.drop_next) < 0) { +#endif /* keep in the flowchain until the state has * decayed to rest */ -- 2.7.4