diff mbox series

[ovs-dev] dpif-netdev: Avoid meter not working while burst is small

Message ID 20210924105527.23482-1-taoyunxiang@cmss.chinamobile.com
State Superseded
Headers show
Series [ovs-dev] dpif-netdev: Avoid meter not working while burst is small | expand

Checks

Context Check Description
ovsrobot/apply-robot fail apply and check: fail

Commit Message

taoyunxiang Sept. 24, 2021, 10:55 a.m. UTC
While busrt is smaller than rate/1000, the band_max_delta_t will be set to 0.
And than, it will cause the buckt in dp_netdev_run_meter being 0, eventually
it will make the packets be dropped.
This fix will set the band_max_delta_t to 1, if busrt is too small, to avoid
meter not working.


Signed-off-by: Tao YunXiang <taoyunxiang@cmss.chinamobile.com>
---
 lib/dpif-netdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

0-day Robot Sept. 27, 2021, 7:15 p.m. UTC | #1
Bleep bloop.  Greetings taoyunxiang, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 dpif-netdev: Avoid meter not working while burst is small
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Patch skipped due to previous failure.

Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 0b846cf0d..61f55639a 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -5735,8 +5735,11 @@  dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id meter_id,
         meter->bands[i].bucket = 0;
 
         /* Figure out max delta_t that is enough to fill any bucket. */
+        /* If burst_size is too small, set band_max_delta_t to 1 */
+        /* to avoid the packet being dropped in dp_netdev_run_meter. */
         band_max_delta_t
-            = meter->bands[i].up.burst_size / meter->bands[i].up.rate;
+            = (meter->bands[i].up.burst_size >= meter->bands[i].up.rate)
+              ? (meter->bands[i].up.burst_size / meter->bands[i].up.rate) : 1;
         if (band_max_delta_t > meter->max_delta_t) {
             meter->max_delta_t = band_max_delta_t;
         }