From: Ethan Jackson Date: Mon, 23 May 2011 18:39:17 +0000 (-0700) Subject: flow: flow_hash_symmetric_l4() don't hash UDP ports. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e3eda957144b07379c8376b42cfcd1b634e1a48;p=openvswitch flow: flow_hash_symmetric_l4() don't hash UDP ports. There is no reason to believe that the source and destination ports will be symmetric in a bidirectional UDP stream. This patch no longer uses them for symmetric hashing. --- diff --git a/lib/flow.c b/lib/flow.c index 0a0e9f56..534a3997 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -750,10 +750,13 @@ flow_hash_symmetric_l4(const struct flow *flow, uint32_t basis) } fields.vlan_tci = flow->vlan_tci & htons(VLAN_VID_MASK); fields.eth_type = flow->dl_type; + + /* UDP source and destination port are not taken into account because they + * will not necessarily be symmetric in a bidirectional flow. */ if (fields.eth_type == htons(ETH_TYPE_IP)) { fields.ipv4_addr = flow->nw_src ^ flow->nw_dst; fields.ip_proto = flow->nw_proto; - if (fields.ip_proto == IPPROTO_TCP || fields.ip_proto == IPPROTO_UDP) { + if (fields.ip_proto == IPPROTO_TCP) { fields.tp_addr = flow->tp_src ^ flow->tp_dst; } } else if (fields.eth_type == htons(ETH_TYPE_IPV6)) { @@ -765,7 +768,7 @@ flow_hash_symmetric_l4(const struct flow *flow, uint32_t basis) ipv6_addr[i] = a[i] ^ b[i]; } fields.ip_proto = flow->nw_proto; - if (fields.ip_proto == IPPROTO_TCP || fields.ip_proto == IPPROTO_UDP) { + if (fields.ip_proto == IPPROTO_TCP) { fields.tp_addr = flow->tp_src ^ flow->tp_dst; } }