datapath: Use currect rcu API in exact match flow lookup function.
authorPravin B Shelar <pshelar@nicira.com>
Sat, 26 Jul 2014 03:34:48 +0000 (20:34 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Mon, 28 Jul 2014 22:59:14 +0000 (15:59 -0700)
exact match cache lookup is always done under ovs lock. So
use ovsl_dereference() API for rcu access.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
datapath/flow_table.c

index 21f67bf..cfd5a84 100644 (file)
@@ -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;
 }