[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20180308111809.42640-1-zhanglkk1990@163.com>
Date: Thu, 8 Mar 2018 19:18:09 +0800
From: zhangliping <zhanglkk1990@....com>
To: pshelar@....org, davem@...emloft.net, netdev@...r.kernel.org
Cc: zhangliping <zhangliping02@...du.com>, Andy Zhou <azhou@....org>
Subject: [PATCH net] openvswitch: meter: fix the incorrect calculation of max delta_t
From: zhangliping <zhangliping02@...du.com>
Max delat_t should be the full_bucket/rate instead of the full_bucket.
Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
Cc: Andy Zhou <azhou@....org>
Signed-off-by: zhangliping <zhangliping02@...du.com>
---
net/openvswitch/meter.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 04b94281a30b..c30323aac603 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -246,10 +246,11 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
/* Figure out max delta_t that is enough to fill any bucket.
* Keep max_delta_t size to the bucket units:
* pkts => 1/1000 packets, kilobits => bits.
+ *
+ * Start with a full bucket.
*/
- band_max_delta_t = (band->burst_size + band->rate) * 1000;
- /* Start with a full bucket. */
- band->bucket = band_max_delta_t;
+ band->bucket = (band->burst_size + band->rate) * 1000;
+ 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;
band++;
--
2.13.4
Powered by blists - more mailing lists