diff mbox series

[ovs-dev,v1] dpif-netdev : Fix ALB rebalance interval zero value.

Message ID MEYP282MB33026BCFF51ECFAB0BE7D042CDF99@MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM
State Superseded
Headers show
Series [ovs-dev,v1] dpif-netdev : Fix ALB rebalance interval zero value. | expand

Checks

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

Commit Message

lin huang April 24, 2022, 10:07 a.m. UTC
When we set a special value "-0" to pmd-auto-lb-rebal-interval, its
value is 0 not 1.

e.g.
ovs-vsctl set open_vswitch .
other_config:pmd-auto-lb-rebal-interval="-0"

2022-04-20T11:31:44.987Z|00526|dpif_netdev|INFO|PMD auto load balance
interval set to 0 mins

So, fix pmd-auto-lb-rebal-interval's value to 1.

Fixes: 5bf84282482a ("Adding support for PMD auto load balancing")
Signed-off-by: Lin Huang <linhuang@ruijie.com.cn>
---
lib/dpif-netdev.c |  6 ++++--
tests/alb.at      | 10 ++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)

从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 676434308..445742186 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4883,8 +4883,10 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
                                    ALB_REBALANCE_INTERVAL);
     /* Input is in min, convert it to msec. */
-    rebalance_intvl =
-        rebalance_intvl ? rebalance_intvl * MIN_TO_MSEC : MIN_TO_MSEC;
+    if (rebalance_intvl < ALB_REBALANCE_INTERVAL) {
+        rebalance_intvl = ALB_REBALANCE_INTERVAL;
+    }
+    rebalance_intvl *= MIN_TO_MSEC;
     if (pmd_alb->rebalance_intvl != rebalance_intvl) {
         pmd_alb->rebalance_intvl = rebalance_intvl;
diff --git a/tests/alb.at b/tests/alb.at
index 0036bd1f2..7fd2d7530 100644
--- a/tests/alb.at
+++ b/tests/alb.at
@@ -243,6 +243,16 @@  get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebal-interval="0"])
CHECK_ALB_PARAM([interval], [1 mins], [+$LINENUM])
+# Set new value
+get_log_next_line_num
+AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebal-interval="100"])
+CHECK_ALB_PARAM([interval], [100 mins], [+$LINENUM])
+
+# Set below min value
+get_log_next_line_num
+AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebal-interval="-0"])
+CHECK_ALB_PARAM([interval], [1 mins], [+$LINENUM])
+
# No check for above max as it is only a documented max value and not a hard limit
 OVS_VSWITCHD_STOP
--
2.34.1