2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

linux: Increase accuracy of ingress_policing_rate at low rates

The current method of calculating the ingress policer rate
can lead to inaccuracy if ingress_policing_rate is set to
a smallish values because the rate is divided by 8 first
which causes rounding errors.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Thomas Graf
2013-01-25 20:13:55 +01:00
committed by Ben Pfaff
parent 8d675c5aee
commit e5c0801582

View File

@@ -3730,7 +3730,7 @@ tc_add_policer(struct netdev *netdev, int kbits_rate, int kbits_burst)
memset(&tc_police, 0, sizeof tc_police);
tc_police.action = TC_POLICE_SHOT;
tc_police.mtu = mtu;
tc_fill_rate(&tc_police.rate, kbits_rate/8 * 1000, mtu);
tc_fill_rate(&tc_police.rate, (kbits_rate * 1000)/8, mtu);
tc_police.burst = tc_bytes_to_ticks(tc_police.rate.rate,
kbits_burst * 1024);