Re: [PATCH net] openvswitch: meter: remove rate from the bucket size calculation

From: Jean Tourrilhes
Date: Wed Apr 28 2021 - 13:18:45 EST


On Wed, Apr 28, 2021 at 01:22:12PM +0200, Ilya Maximets wrote:
>
> I didn't test it, but I looked at the implementation in
> net/sched/act_police.c and net/sched/sch_tbf.c, and they should work
> in a same way as this patch, i.e. it's a classic token bucket where
> burst is a burst and nothing else.

Actually, act_police.c and sch_tbf.c will behave completely
differently, even if they are both based on the token bucket
algorithm.
The reason is that sch_tbf.c is applied to a queue, and the
queue will smooth out traffic and avoid drops. The token bucket is
used to dequeue the queue, this is sometime called leaky bucket. I've
personally used sch_tbf.c with burst size barely bigger than the MTU,
and it works fine.
This is why I was suggesting to compare to act_police.c, which
does not have a queue to smooth out traffic and can only drop
packets.
I believe OVS meters are similar to policers, so that's why
they are suprising for people used to queues such as TBF and HTB.

Regards,

Jean