[Cake] Using cake to shape 1000’s of users.

Toke Høiland-Jørgensen toke at toke.dk
Sun Jul 29 15:14:47 EDT 2018


Pete Heist <pete at heistp.net> writes:

>> On Jul 28, 2018, at 8:12 PM, Toke Høiland-Jørgensen <toke at toke.dk> wrote:
>> 
>> Priority field sets tin, class sets flow. Both need the qdisc is as its major number, iirc. And both can be set from the same bpf filter which can be run in direct action mode...
>
> This works for me. :)
>
> I only tested so far by setting classid with u32 to map 3 macs to two members IDs, then verified fairness:
>
> # IFACE is cake’s interface
> # MAJOR_ID is from cake
> while read mac id; do
>         tc filter add dev $IFACE parent $MAJOR_ID: \
>                 u32 match ether src $mac classid $MAJOR_ID:$id
> done << EOF
> aa:bb:cc:11:22:33 1
> bb:cc:dd:22:33:44 1
> cc:dd:ee:33:44:55 2
> EOF
>
> This should use eBPF and a map lookup for performance, so I’ll see if I can make that work.
>
> Caveats that I know of:
> - Limited to 1024 members
> - No fairness between flows

You could assign more than one queue per customer and hash traffic
between them in BPF...

> - Non-member traffic would have to be dealt with somehow, maybe put in
> its own queue or split among multiple queues, otherwise there can be
> hash collisions with member queues

Yeah, an "overflow queue" is definitely needed in this kind of
deployment :)

I actually wrote an eBPF classifier a few months back, that can lookup
subnets in a BPF map and map them into different classes:
https://github.com/tohojo/tc-classifier

-Toke


More information about the Cake mailing list