diff mbox series

[ovs-dev] bond:Fixinaccurateloginfoinbond_shift_load.

Message ID 202407021827034806094@chinatelecom.cn
State Superseded
Headers show
Series [ovs-dev] bond:Fixinaccurateloginfoinbond_shift_load. | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Han Ding July 2, 2024, 10:27 a.m. UTC
When the delta is less than 1024 in bond_shift_load, it print "shift 0kB of load".
Like this:
bond dpdkbond0: shift 0kB of load (with hash 71) from nic1 to nic2 (now carrying 20650165kB and 8311662kB load, respectively)

Signed-off-by: Han Ding <handing@chinatelecom.cn>
---
 ofproto/bond.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/ofproto/bond.c b/ofproto/bond.c
index c31869a..5b1975d 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -1192,13 +1192,23 @@  bond_shift_load(struct bond_entry *hash, struct bond_member *to)
     struct bond *bond = from->bond;
     uint64_t delta = hash->tx_bytes;
 
-    VLOG_INFO("bond %s: shift %"PRIu64"kB of load (with hash %"PRIdPTR") "
-              "from %s to %s (now carrying %"PRIu64"kB and "
-              "%"PRIu64"kB load, respectively)",
-              bond->name, delta / 1024, hash - bond->hash,
-              from->name, to->name,
-              (from->tx_bytes - delta) / 1024,
-              (to->tx_bytes + delta) / 1024);
+    if (delta >= 1024) {
+        VLOG_INFO("bond %s: shift %"PRIu64"kB of load (with hash %"PRIdPTR") "
+                "from %s to %s (now carrying %"PRIu64"kB and "
+                "%"PRIu64"kB load, respectively)",
+                bond->name, delta / 1024, hash - bond->hash,
+                from->name, to->name,
+                (from->tx_bytes - delta) / 1024,
+                (to->tx_bytes + delta) / 1024);
+    } else {
+        VLOG_INFO("bond %s: shift %"PRIu64"B of load (with hash %"PRIdPTR") "
+                "from %s to %s (now carrying %"PRIu64"kB and "
+                "%"PRIu64"kB load, respectively)",
+                bond->name, delta, hash - bond->hash,
+                from->name, to->name,
+                (from->tx_bytes - delta) / 1024,
+                (to->tx_bytes + delta) / 1024);
+    }
 
     /* Shift load away from 'from' to 'to'. */
     from->tx_bytes -= delta;