Skip to content

Commit

Permalink
ofproto-dpif-xlate: More robust wildcarding for select group.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
Jarno Rajahalme committed Mar 24, 2015
1 parent 5b09e56 commit 80e3509
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions ofproto/ofproto-dpif-xlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3133,18 +3133,9 @@ xlate_default_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);
}
Expand Down

0 comments on commit 80e3509

Please sign in to comment.