diff options
author | Thomas Graf <tgraf@redhat.com> | 2013-01-25 20:13:55 +0100 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-01-25 15:25:21 -0800 |
commit | e5c08015823bd055ce64f12bc271c46f0551923b (patch) | |
tree | 823725e6d3999cb303bd808c997a03a8eb3cbd0a /lib/netdev-linux.c | |
parent | 8d675c5aee6430ee7c7ff41261d0686bccfc66cd (diff) |
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>
Diffstat (limited to 'lib/netdev-linux.c')
-rw-r--r-- | lib/netdev-linux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 433d1687..f0f1dc27 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -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); |