summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan Scheurich <jan.scheurich@ericsson.com>2018-05-24 17:28:00 +0200
committerBen Pfaff <blp@ovn.org>2018-05-25 14:58:42 -0700
commit2e3fd24c7c440f87d7a24fbfce1474237de7e1cf (patch)
tree192caa8df2f8460f037867068d7f660b9df14fa8 /lib
parent6a0b0d3be8573c42d750eb22e3445a3c759c8e8f (diff)
downloadopenvswitch-2e3fd24c7c440f87d7a24fbfce1474237de7e1cf.tar.gz
ofproto-dpif: Improve dp_hash selection method for select groups
The current implementation of the "dp_hash" selection method suffers from two deficiences: 1. The hash mask and hence the number of dp_hash values is just large enough to cover the number of group buckets, but does not consider the case that buckets have different weights. 2. The xlate-time selection of best bucket from the masked dp_hash value often results in bucket load distributions that are quite different from the bucket weights because the number of available masked dp_hash values is too small (2-6 bits compared to 32 bits of a full hash in the default hash selection method). This commit provides a more accurate implementation of the dp_hash select group by applying the well known Webster method for distributing a small number of "seats" fairly over the weighted "parties" (see https://en.wikipedia.org/wiki/Webster/Sainte-Lagu%C3%AB_method). The dp_hash mask is autmatically chosen large enough to provide good enough accuracy even with widely differing weights. This distribution happens at group modification time and the resulting table is stored with the group-dpif struct. At xlation time, we use the masked dp_hash values as index to look up the assigned bucket. If the bucket should not be live, we do a circular search over the mapping table until we find the first live bucket. As the buckets in the table are by construction in pseudo-random order with a frequency according to their weight, this method maintains correct distribution even if one or more buckets are non-live. Xlation is further simplified by storing some derived select group state at group construction in struct group-dpif in a form better suited for xlation purposes. Adapted the unit test case for dp_hash select group accordingly. Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com> Co-authored-by: Nitin Katiyar <nitin.katiyar@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/odp-util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 5e858f0f9..cf62550bf 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -595,7 +595,9 @@ format_odp_hash_action(struct ds *ds, const struct ovs_action_hash *hash_act)
ds_put_format(ds, "hash(");
if (hash_act->hash_alg == OVS_HASH_ALG_L4) {
- ds_put_format(ds, "hash_l4(%"PRIu32")", hash_act->hash_basis);
+ ds_put_format(ds, "l4(%"PRIu32")", hash_act->hash_basis);
+ } else if (hash_act->hash_alg == OVS_HASH_ALG_SYM_L4) {
+ ds_put_format(ds, "sym_l4(%"PRIu32")", hash_act->hash_basis);
} else {
ds_put_format(ds, "Unknown hash algorithm(%"PRIu32")",
hash_act->hash_alg);