Commit 6043d611 authored by Tonghao Zhang's avatar Tonghao Zhang Committed by Greg Kroah-Hartman

net: openvswitch: use u64 for meter bucket

[ Upstream commit e5735887 ]

When setting the meter rate to 4+Gbps, there is an
overflow, the meters don't work as expected.

Cc: Pravin B Shelar <pshelar@ovn.org>
Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: default avatarTonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7c451f58
......@@ -255,7 +255,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
*
* Start with a full bucket.
*/
band->bucket = (band->burst_size + band->rate) * 1000;
band->bucket = (band->burst_size + band->rate) * 1000ULL;
band_max_delta_t = band->bucket / band->rate;
if (band_max_delta_t > meter->max_delta_t)
meter->max_delta_t = band_max_delta_t;
......
......@@ -26,7 +26,7 @@ struct dp_meter_band {
u32 type;
u32 rate;
u32 burst_size;
u32 bucket; /* 1/1000 packets, or in bits */
u64 bucket; /* 1/1000 packets, or in bits */
struct ovs_flow_stats stats;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment