Skip to content

Commit cd6f892

Browse files
hao022gregkh
authored andcommitted
net: openvswitch: use u64 for meter bucket
[ Upstream commit e573588 ] 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: Tonghao Zhang <xiangxia.m.yue@gmail.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 545c261 commit cd6f892

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/openvswitch/meter.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
251251
*
252252
* Start with a full bucket.
253253
*/
254-
band->bucket = (band->burst_size + band->rate) * 1000;
254+
band->bucket = (band->burst_size + band->rate) * 1000ULL;
255255
band_max_delta_t = band->bucket / band->rate;
256256
if (band_max_delta_t > meter->max_delta_t)
257257
meter->max_delta_t = band_max_delta_t;

‎net/openvswitch/meter.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct dp_meter_band {
2323
u32 type;
2424
u32 rate;
2525
u32 burst_size;
26-
u32 bucket; /* 1/1000 packets, or in bits */
26+
u64 bucket; /* 1/1000 packets, or in bits */
2727
struct ovs_flow_stats stats;
2828
};
2929

0 commit comments

Comments
 (0)