浏览代码

openvswitch: Use flow hash during flow lookup operation.

Flow->hash can be used to detect hash collisions and avoid flow key
compare in flow lookup.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Pravin B Shelar 12 年之前
父节点
当前提交
8ddd094675
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/openvswitch/flow_table.c

+ 1 - 1
net/openvswitch/flow_table.c

@@ -421,7 +421,7 @@ static struct sw_flow *masked_flow_lookup(struct table_instance *ti,
 	hash = flow_hash(&masked_key, key_start, key_end);
 	hash = flow_hash(&masked_key, key_start, key_end);
 	head = find_bucket(ti, hash);
 	head = find_bucket(ti, hash);
 	hlist_for_each_entry_rcu(flow, head, hash_node[ti->node_ver]) {
 	hlist_for_each_entry_rcu(flow, head, hash_node[ti->node_ver]) {
-		if (flow->mask == mask &&
+		if (flow->mask == mask && flow->hash == hash &&
 		    flow_cmp_masked_key(flow, &masked_key,
 		    flow_cmp_masked_key(flow, &masked_key,
 					  key_start, key_end))
 					  key_start, key_end))
 			return flow;
 			return flow;