diff mbox series

[ovs-dev,ovs,v2,2/4] dpif-netdev: Add burst size to buckets

Message ID 20200513133135.48474-3-xiangxia.m.yue@gmail.com
State Changes Requested
Headers show
Series expand the meter table and fix bug | expand

Commit Message

Tonghao Zhang May 13, 2020, 1:31 p.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

For now, the meter of the userspace datapath, don't include
the bucket burst size to buckets. This patch includes it now.

$ ovs-ofctl -O OpenFlow13 add-meter br0 \
        'meter=1 pktps burst stats bands=type=drop rate=10000 burst_size=2000'

Cc: Ilya Maximets <i.maximets@ovn.org>
Cc: William Tu <u9012063@gmail.com>
Cc: Jarno Rajahalme <jarno@ovn.org>
Cc: Ben Pfaff <blp@ovn.org>
Cc: Andy Zhou <azhou@ovn.org>
Cc: Pravin Shelar <pshelar@ovn.org>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
v2:
* burst size unit is kilobits. should x1000.
---
 lib/dpif-netdev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index b5deaab31eb0..36ecbfc728a9 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -6093,15 +6093,11 @@  dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id meter_id,
     for (i = 0; i < config->n_bands; ++i) {
         uint32_t band_max_delta_t;
 
-        /* Set burst size to a workable value if none specified. */
-        if (config->bands[i].burst_size == 0) {
-            config->bands[i].burst_size = config->bands[i].rate;
-        }
-
         meter->bands[i].up = config->bands[i];
         /* Convert burst size to the bucket units: */
         /* pkts => 1/1000 packets, kilobits => bits. */
-        meter->bands[i].up.burst_size *= 1000;
+        meter->bands[i].up.burst_size += config->bands[i].rate;
+        meter->bands[i].up.burst_size *= 1000ULL;
         /* Initialize bucket to empty. */
         meter->bands[i].bucket = 0;