In order for auto load balance to be enabled, there are
minimum requirements of more than one PMD and more than
one Rxq on at least one PMD.

If these conditions are not met a rebalance would be pointless,
so auto load balance is not enabled.

Currently the state is logged but in the case where the criteria
for enabling is not met, there is no reason given.

It would be useful for the user to see the reason, so they
can understand why auto load balance has not been enabled
when they have requested it.

For example, if a user has one PMD and sets pmd-auto-lb=true,
previously:
|INFO|PMD auto load balance is disabled

With patch:
|INFO|PMD auto load balance not enough PMDs or Rx Queues to enable
|INFO|PMD auto load balance is disabled

Signed-off-by: Kevin Traynor <[email protected]>
---
 lib/dpif-netdev.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 4381c618f..833f45616 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4213,4 +4213,5 @@ set_pmd_auto_lb(struct dp_netdev *dp, bool always_log)
     bool enable_alb = false;
     bool multi_rxq = false;
+    bool minreq = false;
     bool pmd_rxq_assign_cyc = dp->pmd_rxq_assign_cyc;
 
@@ -4226,6 +4227,6 @@ set_pmd_auto_lb(struct dp_netdev *dp, bool always_log)
         }
         if (cnt && multi_rxq) {
-                enable_alb = true;
-                break;
+            minreq = true;
+            break;
         }
         cnt++;
@@ -4233,6 +4234,5 @@ set_pmd_auto_lb(struct dp_netdev *dp, bool always_log)
 
     /* Enable auto LB if it is requested and cycle based assignment is true. */
-    enable_alb = enable_alb && pmd_rxq_assign_cyc &&
-                    pmd_alb->auto_lb_requested;
+    enable_alb = minreq && pmd_rxq_assign_cyc && pmd_alb->auto_lb_requested;
 
     if (pmd_alb->is_enabled != enable_alb || always_log) {
@@ -4251,4 +4251,15 @@ set_pmd_auto_lb(struct dp_netdev *dp, bool always_log)
         } else {
             pmd_alb->rebalance_poll_timer = 0;
+            if (pmd_alb->auto_lb_requested) {
+                if (!minreq) {
+                    VLOG_INFO("PMD auto load balance not enough "
+                              "PMDs or Rx Queues to enable");
+                }
+                if (!pmd_rxq_assign_cyc) {
+                    VLOG_INFO("PMD auto load balance needs "
+                              "'other_config:pmd-rxq-assign=cycles' "
+                              "to enable");
+                }
+            }
             VLOG_INFO("PMD auto load balance is disabled");
         }
-- 
2.26.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to