The flow key should be the same regardless of whether a live bucket is
found or not, as it would be confusing that the flow key would be
different (different mask bits) after the last group bucket goes dead.

In general, the megaflow algorithm expects the mask bits be set as
soon as we read the header bits, regardless of what happens
afterwards.

Also, use flow_mask_hash_fields() instead of individually setting mask
fields. This immediately brings in IPv6 support, and helps keeping
masks in sync with potential algorithm changes to flow hashing
functions.

Found by inspection.

Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
---
 ofproto/ofproto-dpif-xlate.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 8ca35a7..c1aedd2 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3133,18 +3133,9 @@ xlate_select_group(struct xlate_ctx *ctx, struct 
group_dpif *group)
     uint32_t basis;
 
     basis = flow_hash_symmetric_l4(&ctx->xin->flow, 0);
+    flow_mask_hash_fields(&ctx->xin->flow, wc, NX_HASH_FIELDS_SYMMETRIC_L4);
     bucket = group_best_live_bucket(ctx, group, basis);
     if (bucket) {
-        memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
-        memset(&wc->masks.dl_src, 0xff, sizeof wc->masks.dl_src);
-        memset(&wc->masks.dl_type, 0xff, sizeof wc->masks.dl_type);
-        memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
-        memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
-        memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src);
-        memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
-        memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
-        memset(&wc->masks.vlan_tci, 0xff, sizeof wc->masks.vlan_tci);
-
         xlate_group_bucket(ctx, bucket);
         xlate_group_stats(ctx, group, bucket);
     }
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to