[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1587575340-6790-6-git-send-email-xiangxia.m.yue@gmail.com>
Date: Thu, 23 Apr 2020 01:09:00 +0800
From: xiangxia.m.yue@...il.com
To: pshelar@....org, azhou@....org, blp@....org, u9012063@...il.com
Cc: netdev@...r.kernel.org, dev@...nvswitch.org,
Tonghao Zhang <xiangxia.m.yue@...il.com>
Subject: [PATCH net-next v3 5/5] net: openvswitch: use u64 for meter bucket
From: Tonghao Zhang <xiangxia.m.yue@...il.com>
When setting the meter rate to 4+Gbps, there is an
overflow, the meters don't work as expected.
Cc: Pravin B Shelar <pshelar@....org>
Cc: Andy Zhou <azhou@....org>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
---
net/openvswitch/meter.c | 2 +-
net/openvswitch/meter.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index e36b464b32a5..915f31123f23 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -392,7 +392,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;
diff --git a/net/openvswitch/meter.h b/net/openvswitch/meter.h
index fcde5ee647da..9ca50bfd1142 100644
--- a/net/openvswitch/meter.h
+++ b/net/openvswitch/meter.h
@@ -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;
};
--
2.23.0
Powered by blists - more mailing lists