[Cake] Query regarding COBALT implementation in CAKE
Jonathan Morton
chromatix99 at gmail.com
Tue Jan 22 04:04:50 EST 2019
> On 22 Jan, 2019, at 10:29 am, Shefali Gupta <shefaligups11 at gmail.com> wrote:
>
> We are unable to understand how over_target variable is being used to change the dropping state, on the line number 535 of CAKE code.
A little earlier in the code, you can see how over_target is calculated. It's simply a boolean decision:
over_target = sojourn > p->target &&
sojourn > p->mtu_time * bulk_flows * 2 &&
sojourn > p->mtu_time * 4;
There are three decision terms, all of which compare the sojourn time of the current packet to some threshold, and all of which must be true for over_target to be true, and thus for the Codel logic to enter dropping state. In principle, it could be replaced by "sojourn > min(p->target, p_mtu_time * min(4, bulk_flows * 2))", but that would be harder to lay out readably in the Linux kernel's 80-column style.
The middle term is not relevant for your implementation, because you have a single-queue version of COBALT; you could consider bulk_flows as being fixed at 1, so that term is always true when the last term is true.
The last term depends on p->mtu_time which is initialised whenever Cake's shaper is reconfigured. It refers to the time required to stuff an MTU-sized packet down the pipe. Since your implementation is not closely integrated with a shaper and therefore you don't have an easy way to calculate mtu_time, you may eliminate this term, and instead manually configure the target to satisfy the same criterion.
You can therefore simplify if(over_target) to if(sojourn > p->target) for your purposes.
- Jonathan Morton
More information about the Cake
mailing list