[ovs-dev] [PATCH v3] ofproto-dpif: Increase dp_hash default max buckets.

Mike Pattrick mkp at redhat.com
Thu Nov 18 20:50:46 UTC 2021

Currently when a user creates an openflow group with with multiple
buckets without specifying a selection type, the efficient dp_hash is
only selected if the user is creating fewer than 64 buckets. But when
dp_hash is explicitly selected, up to 256 buckets are supported.

While up to 64 buckets seems like a lot, certain OVN/Open Stack
workloads could result in the user creating more than 64 buckets. For
example, when using OVN to load balance. This patch increases the
default maximum from 64 to 256.

This change to the default limit doesn't affect how many buckets are
actually created, that is specified by the user when the group is
created, just how traffic is distributed across buckets.

Changes in v2:
   - Clarified change in manpage

Changes in v3:
   - Updated NEWS file

Signed-off-by: Mike Pattrick <mkp at redhat.com>
 NEWS                     | 4 ++++
 ofproto/ofproto-dpif.c   | 4 ++--
 utilities/ovs-ofctl.8.in | 5 +++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 434ee570f..912e27c9e 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ Post-v2.16.0
    - ovs-dpctl and 'ovs-appctl dpctl/':
      * New commands 'cache-get-size' and 'cache-set-size' that allows to
        get or configure linux kernel datapath cache sizes.
+   - OpenFlow:
+     * Default selection method for select groups with up to 256 buckets is
+       now dp_hash. Previously this was limited to 64 buckets. This change is
+       mainly for the benefit of OVN load balancing configurations.
 v2.16.0 - 16 Aug 2021
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index cba49a99e..bc3df8ea1 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5152,9 +5152,9 @@ group_set_selection_method(struct group_dpif *group)
     if (selection_method[0] == '\0') {
         VLOG_DBG("No selection method specified. Trying dp_hash.");
         /* If the controller has not specified a selection method, check if
-         * the dp_hash selection method with max 64 hash values is appropriate
+         * the dp_hash selection method with max 256 hash values is appropriate
          * for the given bucket configuration. */
-        if (group_setup_dp_hash_table(group, 64)) {
+        if (group_setup_dp_hash_table(group, 256)) {
             /* Use dp_hash selection method with symmetric L4 hash. */
             group->selection_method = SEL_METHOD_DP_HASH;
             group->hash_alg = OVS_HASH_ALG_SYM_L4;
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index 2017c6eba..94a55dbc5 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -1083,8 +1083,9 @@ This field is optional for \fBadd\-group\fR, \fBadd\-groups\fR and
 otherwise.  If no selection method is specified, Open vSwitch up to
 release 2.9 applies the \fBhash\fR method with default fields. From
 2.10 onwards Open vSwitch defaults to the \fBdp_hash\fR method with symmetric
-L3/L4 hash algorithm, unless the weighted group buckets cannot be mapped to
-a maximum of 64 dp_hash values with sufficient accuracy.
+L3/L4 hash algorithm, as long as the weighted group buckets can be mapped to
+dp_hash values with sufficient accuracy. In 2.10 this was restricted to a
+maximum of 64 buckets, and in 2.17 the limit was raised to 256 buckets.
 In those rare cases Open vSwitch 2.10 and later fall back to the \fBhash\fR
 method with the default set of hash fields.

More information about the dev mailing list