[ovs-dev] [PATCH v2 2/3] ofproto-dpif: Improve dp_hash selection method for select groups

Jan Scheurich jan.scheurich at ericsson.com
Tue Apr 17 12:27:42 UTC 2018


Hi Ychen,

Thank you for finding yet another corner case. I will fix it in the next version with the following incremental:

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 8f71083..674b3b5 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -4762,6 +4762,11 @@ group_setup_dp_hash_table(struct group_dpif *group, size_t max_hash)
     VLOG_DBG("  Minimum weight: %d, total weight: %.0f",
              min_weight, total_weight);

+    if (total_weight == 0) {
+        VLOG_DBG("  Total weight is zero. No active buckets.");
+        return false;
+    }
+
     uint32_t min_slots = ceil(total_weight / min_weight);
     n_hash = MAX(16, 1L << log_2_ceil(min_slots));

I would like to mention your contribution with Tested-By: tag in the commit messages. Would that be ok? What is your real name I should put?

BR, Jan


From: ychen [mailto:ychen103103 at 163.com]
Sent: Tuesday, 17 April, 2018 13:22
To: Jan Scheurich <jan.scheurich at ericsson.com>
Cc: dev at openvswitch.org; Nitin Katiyar <nitin.katiyar at ericsson.com>; blp at ovn.org
Subject: Re:[PATCH v2 2/3] ofproto-dpif: Improve dp_hash selection method for select groups

Hi, Jan:
    I think the following code should also be modified
 + for (int hash = 0; hash < n_hash; hash++) {
+ double max_val = 0.0;
+ struct webster *winner;

+        for (i = 0; i < n_buckets; i++) {

+            if (webster[i].value > max_val) {  =======================> if bucket->weight=0, and there is only one bucket with weight equal to 0, then winner will be null

+                max_val = webster[i].value;

+                winner = &webster[i];

+            }

+        }



   Test like this command:

   ovs-ofctl add-group br-int -O openflow15 "group_id=2,type=select,selection_method=dp_hash,bucket=bucket_id=1,weight=0,actions=output:10"

  vswitchd crashed after command put.





More information about the dev mailing list