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

From: Ilya Maximets
Date: Wed Apr 28 2021 - 14:59:16 EST


On 4/28/21 6:31 PM, Jean Tourrilhes wrote:
> 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.

Makes sense. Thanks for the clarification!

> 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 see. Unfortunately, due to the fact that act_police.c uses time
instead of bytes as a measure for tokens, we will still see a difference
in behavior. Probably, not so big, but it will be there and it will
depend on a line rate.

> 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
>