]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: openvswitch: use u64 for meter bucket
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Fri, 24 Apr 2020 00:08:06 +0000 (08:08 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Apr 2020 01:26:11 +0000 (18:26 -0700)
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>
net/openvswitch/meter.c
net/openvswitch/meter.h

index e36b464b32a56973514bde7e9aef55bfa0bdf7c8..915f31123f235c032ab67d41c30a8717477d8d4b 100644 (file)
@@ -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;
index 61a3ca43cd77020e19297157711f136e294566e4..0c33889a85156997f5dc5067de3625ec83e9b479 100644 (file)
@@ -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;
 };