# Cake traffic shaper



## chrcol (Nov 1, 2020)

Does anyone know if cake is coming to FreeBSD any time soon?

Thanks


----------



## Beastie7 (Nov 1, 2020)

FreeBSD has its own traffic shaper. See dummynet(4).


----------



## chrcol (Nov 1, 2020)

I am aware of dummynet which includes various shapers.  I am asking if cake is coming to dummynet, I hope that clarifies the question more.  I probably used the wrong terminology to describe cake which I apologise for.


----------



## Beastie7 (Nov 1, 2020)

From what I’ve read CAKE is heavily linux centric, and connects to many network interfaces in the Linux kernel. What features do you need (or that’s missing) that would necessitate CAKE coming to FreeBSD? I think that’s the question you should ask yourself first.


----------



## Donald Baud (Nov 6, 2020)

Just for the curious who is wondering what's Cake: 
it's a queuing algorithm used for QOS (quality of service) to manage overloaded connections. It works better than FIFO (First In First Out) scheduling with less packet drops.
More details about the implementation is:
https://www.bufferbloat.net/projects/codel/wiki/Cake/

You are right to ask about Cake,
Cake is an improvement over fq_codel wich is currently what's available with Dummynet.
I've compared Codel vs Cake and can confirm that Cake provides sane defaults and works extremely well at least on Debian.
Unfortunately it isn't implemented yet on Dummynet.

I've used Codel a year ago and it is a definite improvement over "red" a "gred".
Unfortunately it had a tendency on crashing the kernel on some mysterious edge cases.
I couldn't spend the time to troubleshoot it because there were all kinds of other known issues that were being worked on, namely the iflib transition and the vmx mysterious locking and stalling.
I had to move the project to Debian but was very sad about it because Dummynet/ipfw is a pure delight to work with.

Anyway, if you do manage to reach a developer to implement Cake on FreeBSD, you'll deserve a medal in by book.

====
Now for the reader who wants to experiment with QOS on dummynet, here is a typical example:

```
# CASE: share One PIPE for all IPs
/sbin/ipfw                                              pipe 2000 config bw 101Mbit/s
/sbin/ipfw                            sched 2000 config pipe 2000 type qfq
/sbin/ipfw          queue 2000 config sched 2000 mask dst-ip 0xffffffff codel
/sbin/ipfw add 2000 queue 2000 ip from any to "table(1000)" in recv em0
/sbin/ipfw table 1000 add 192.168.3.111
```


----------



## chrcol (Nov 10, 2020)

Beastie7 said:


> From what I’ve read CAKE is heavily linux centric, and connects to many network interfaces in the Linux kernel. What features do you need (or that’s missing) that would necessitate CAKE coming to FreeBSD? I think that’s the question you should ask yourself first.


Easy to answer when you read the documentation, I want the improvements from it of course.  But sounds like it would be very difficult to port over


----------



## Beastie7 (Nov 11, 2020)

chrcol said:


> Easy to answer when you read the documentation, I want the improvements from it of course.  But sounds like it would be very difficult to port over



You could probably review how the code works, and try to write a clean room implementation of it on FreeBSD.


----------

