[ovs-dev] [PATCH v2] datapath: Use currect rcu API in exact match flow lookup function.

Pravin B Shelar pshelar at nicira.com
Sun Jul 27 18:55:48 UTC 2014


Exact match flow lookup is always done under ovs lock. So use
ovsl_dereference() API for rcu access.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
 datapath/flow_table.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/datapath/flow_table.c b/datapath/flow_table.c
index 21f67bf..cfd5a84 100644
--- a/datapath/flow_table.c
+++ b/datapath/flow_table.c
@@ -666,23 +666,20 @@ struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl,
 struct sw_flow *ovs_flow_tbl_lookup_exact(struct flow_table *tbl,
 					  struct sw_flow_match *match)
 {
-	struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
-	struct mask_array *ma = rcu_dereference_ovsl(tbl->mask_array);
-	struct sw_flow *flow;
-	u32 __always_unused n_mask_hit;
+	struct mask_array *ma = ovsl_dereference(tbl->mask_array);
 	int i;
 
 	/* Always called under ovs-mutex. */
 	for (i = 0; i < ma->count; i++) {
+		struct table_instance *ti = ovsl_dereference(tbl->ti);
+		u32 __always_unused n_mask_hit;
 		struct sw_flow_mask *mask;
+		struct sw_flow *flow;
 
 		mask = ovsl_dereference(ma->masks[i]);
-		if (mask) {
-			flow = masked_flow_lookup(ti, match->key, mask, &n_mask_hit);
-			if (flow && ovs_flow_cmp_unmasked_key(flow, match)) { /* Found */
-				return flow;
-			}
-		}
+		flow = masked_flow_lookup(ti, match->key, mask, &n_mask_hit);
+		if (flow && ovs_flow_cmp_unmasked_key(flow, match))
+			return flow;
 	}
 	return NULL;
 }
-- 
1.9.3




More information about the dev mailing list