2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

flow: New function flow_unwildcard_tp_ports().

This patch adds a new function flow_unildcard_tp_ports() which doesn't
unwildcard the upper half of tp_src and tp_dst with ICMP packets.
Unfortunately, this matters in future patches when we compare masks
carefully to determine if flows should be evicted from the datapath.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ethan Jackson
2013-12-06 18:53:12 -08:00
parent bca43eff7d
commit d8d9c698b8
3 changed files with 15 additions and 4 deletions

View File

@@ -519,6 +519,18 @@ flow_zero_wildcards(struct flow *flow, const struct flow_wildcards *wildcards)
}
}
void
flow_unwildcard_tp_ports(const struct flow *flow, struct flow_wildcards *wc)
{
if (flow->nw_proto != IPPROTO_ICMP) {
memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
} else {
wc->masks.tp_src = htons(0xff);
wc->masks.tp_dst = htons(0xff);
}
}
/* Initializes 'fmd' with the metadata found in 'flow'. */
void
flow_get_metadata(const struct flow *flow, struct flow_metadata *fmd)
@@ -922,8 +934,7 @@ flow_mask_hash_fields(const struct flow *flow, struct flow_wildcards *wc,
}
if (is_ip_any(flow)) {
memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
flow_unwildcard_tp_ports(flow, wc);
}
wc->masks.vlan_tci |= htons(VLAN_VID_MASK | VLAN_CFI);
break;